Drawing Graphics and Text

Detailed Description

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.

Classes

class  Bitmap
 Off-screen drawing surface backed by an image. More...
 
class  ColorStop
 Color stop for a gradient brush. More...
 
class  ColorStops
 Ordered collection of gradient color stops. More...
 
class  Brush
 Fill description for shapes and text. More...
 
class  Canvas
 Backend canvas for drawing commands. More...
 
class  CompositionMode
 Blend mode used for drawing operations. More...
 
class  Font
 Font request used for text drawing and measurement. More...
 
class  FontMetrics
 Metrics that describe a font face at a given size. More...
 
class  Paint
 Paint state used by drawing operations. More...
 
class  PaintContext
 Active painting session for a surface. More...
 
class  Painter
 Concrete painter for Pt::Gfx paint targets. More...
 
class  PainterBase
 Base class for drawing commands and paint state. More...
 
class  PaintSurface
 Abstract target for drawing operations. More...
 
class  Path
 Vector path for drawing outlines and filled shapes. More...
 
class  PathElement
 Read-only view of a path element. More...
 
class  PathIterator
 Forward iterator over path elements. More...
 
class  Pen
 Attributes for the drawing of outlines. More...
 
class  Scaling
 Logical-to-physical unit conversion. More...
 
class  TextMetrics
 Metrics for a measured line of text. More...
 
class  Transform
 Affine transform for drawing coordinates. More...
 

Enumerations

enum  FillRule {
  NonZero,
  EvenOdd
}
 Determines how overlapping subpaths of a filled shape are painted. More...
 

Enumeration Type Documentation

◆ FillRule

enum FillRule
strong

When a Path contains overlapping subpaths, FillRule controls which enclosed regions are considered inside and therefore filled.

Enumerator
NonZero 

Fills regions enclosed by a non-zero net winding count.

For each point, a horizontal ray is cast and the signed number of path crossings is counted. If the result is non-zero the point is inside. This is the SVG and PostScript default.

EvenOdd 

Fills regions enclosed by an odd number of path crossings.

For each point, a horizontal ray is cast and the total number of path crossings is counted. If the result is odd the point is inside. Also known as the alternating rule.