The Pt::Gfx drawing API provides the abstractions needed to render 2D content on different paint surfaces. A Painter can be used to draw lines, rectangles, ellipses, paths, text, images and bitmaps on paint surfaces such as Bitmap. Pen, Brush, Font, Transform and CompositionMode control how shapes, images and text are rendered.
Painting always targets a PaintSurface via a PaintContext, which represents an active painting scope. The Canvas is used by Painter to translate the high-level drawing commands into paint surface operations. Bitmap is the standard in-memory target and makes rendered content available as an image when pixels need to be inspected, copied or reused later.
Paths, transforms and scaling describe geometry independently from the underlying backend. Text drawing uses Font together with FontMetrics and TextMetrics so that layout and rendering can share the same font request and measurement model.
The drawing API focuses on rendering operations and paint state. Image, view and pixel classes in Pt::Gfx focus on image storage, format handling and direct pixel access.
Painter is the entry point for issuing drawing commands against a PaintSurface or an existing PaintContext. It owns no rendering backend itself and instead binds PainterBase to the target supplied through begin or the corresponding constructor.
PaintSurface supplies the backend-specific resources needed for painting. It reports target format, size and scaling, creates a Canvas on demand and coordinates PainterBase and PaintContext while drawing is active.
PaintContext represents a prepared drawing session on a PaintSurface. It exposes target properties, provides access to a backend canvas and keeps painter and surface lifetime in sync while painting is active.
Paint bundles the composition mode, pen, brush and font that define how a painter renders geometry and text. It can be reused to apply the same drawing state to multiple painting operations.
Path stores a sequence of drawing commands such as moves, lines and curves. Painters can stroke or fill the current path directly, while helper functions make it easy to append rectangles, ellipses and arc segments.
Transform stores the matrix used to map logical drawing coordinates to the coordinate system of the target. It can be composed from translation, scaling, rotation and shear operations and is used by painters, paths and text drawing.
Font describes the family, size and style attributes that painters use to select a concrete typeface. The same description can be used both for text measurement and for actual rendering, which keeps layout and drawing in sync across paint targets.
FontMetrics contains values such as ascent, descent and underline geometry for the font selected by a painter. These metrics can be used to align text, compute line spacing and position decorative lines.
TextMetrics stores the horizontal advance and bounding-box information of a rendered text run. Painters return this structure when text needs to be aligned before it is drawn.