PaintContext Class Reference

#include <Pt/Gfx/PaintContext.h>

Active painting session for a surface. More...

Inherits NonCopyable.

Inherited by PaintContext.

Public Member Functions

 PaintContext (PaintSurface &surface)
 Constructs a context using the paint surface.
 
 PaintContext (PaintSurface &surface, const RectF &clip)
 Constructs a context using the paint surface and an initial clip rect.
 
virtual ~PaintContext ()
 Destructor.
 
const Gfx::ImageFormatformat () const
 Returns the image format.
 
const Gfx::SizeFsize () const
 Returns the size in physical pixels.
 
const Scalingscaling () const
 Returns the scaling from logical to physical pixels.
 
const RectFclip () const
 Returns the default clip rect or null if clipping is disabled.
 
void setClip (const RectF &clip)
 Sets the default clip rect for painters on this context.
 
void resetClip ()
 Resets the default clip rect.
 
CanvasgetCanvas (Canvas *canvas)
 Returns a canvas for backend drawing.
 
void sync ()
 Synchronizes pending drawing operations.
 
void finish ()
 Finishes painting on the surface.
 

Protected Member Functions

virtual void onDetachSurface (PaintSurface &surface)
 Handles detachment from the surface.
 

Detailed Description

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.