A panel that can paint itself to fit an image.
Some components in this package, such as mosaics, tiles, and tile axes,
must be able to render themselves to images as well as on screen. For
various reasons, those images often have resolution that is higher
than that of a display screen. Simply scaling an on-screen rendering
does not exploit this higher resolution, because screen coordinates
are typically specified as integers. Rounding to the nearest integer
screen coordinates and then scaling to a high resolution image yields
visual artifacts, such as curves that appear jagged in the image.
Classes that extend this base class work differently. They paint
themselves to fit any specified rectangle of a specified graphics
context. When painting to a display screen, that graphics rectangle
is simply the panel's rectangle, in screen coordinates. However, when
painting to an image, the dimensions of that rectangle may be much
larger, corresponding to the higher resolution of the image. When
painting, these panels round coordinates to the nearest pixel of that
graphics rectangle, not the panel's on-screen rectangle. In this way,
panels can paint themselves with any desired resolution.
One complication is font size. Another is line width. Such properties
are typically specified in points, which are roughly equivalant to
on-screen pixels. Therefore, when drawing to a high-resolution image,
font sizes and line widths must be increased. This base class provides
methods that panels in this package use to properly scale font sizes,
line widths, and other resolution-dependent properties.