#include <Pt/Forms/Painter.h>

Draws on a Forms paint surface or paint context. More...

Inherits PainterBase.

Public Member Functions

 Painter ()
 Creates an inactive painter.
 Painter (PaintSurface &surface)
 Constructs and begins painting on surface.
 Painter (PaintContext &context)
 Constructs and begins painting on context.
virtual ~Painter ()
 Destructor.
void begin (PaintSurface &surface)
 Begins painting on surface.
void begin (PaintContext &context)
 Begins painting on context.
void drawPixmap (const Gfx::PointF &to, const Pixmap &pixmap)
 Draws pixmap at to.
void drawPixmap (const Gfx::PointF &to, const Pixmap &pixmap, const Gfx::RectF &rect)
 Draws the rect region of pixmap at to.
void finish ()
 Ends the current painting operation.
const ImageFormat & format () const
 Returns the pixel format of the current target.
const Scaling & scaling () const
 Returns the logical-to-physical scaling of the target.
const CompositionMode & compositionMode () const
 Returns the current composition mode.
void setCompositionMode (const CompositionMode &mode)
 Sets the composition mode.
const Pen & pen () const
 Returns the current pen.
void setPen (const Pen &pen)
 Sets the pen used to stroke lines.
const Brush & brush () const
 Returns the current brush.
void setBrush (const Brush &brush)
 Sets the brush used to fill areas.
const Font & font () const
 Returns the current font.
void setFont (const Font &font)
 Sets the font used to draw text.
const Transform & transform () const
 Returns the user transform.
void setTransform (const Transform &tx)
 Sets the user transform.
void resetTransform ()
 Resets the user transform to identity.
const RectF * clip () const
 Returns the current clip rectangle or null if clipping is disabled.
void setClip (const RectF &clip)
 Sets the clipping rect.
void resetClip ()
 Resets the clipping rect.
void drawLine (const PointF &from, const PointF &to)
 Draws a line between two points.
void drawPolyline (const PointF *points, const size_t pointCount)
 Draws a connected sequence of line segments.
void fillPolygon (const PointF *points, const size_t pointCount)
 Fills a polygon defined by the given points.
void drawRect (const RectF &rect)
 Draws the outline of a rectangle.
void fillRect (const RectF &rect)
 Fills a rectangular area.
void drawCircle (const PointF &topLeft, double diameter)
 Draws the outline of a circle.
void fillCircle (const PointF &topLeft, double diameter)
 Fills a circular area.
void drawEllipse (const PointF &topLeft, const SizeF &size)
 Draws the outline of an ellipse.
void fillEllipse (const PointF &topLeft, const SizeF &size)
 Fills an elliptical area.
void drawArc (const PointF &topLeft, const SizeF &size, float degBegin, float degEnd)
 Draws an arc on an ellipse.
void fillChord (const PointF &topLeft, const SizeF &size, float degBegin, float degEnd)
 Fills a chord on an ellipse.
void fillPie (const PointF &topLeft, const SizeF &size, float degBegin, float degEnd)
 Fills a pie segment on an ellipse.
const Gfx::Pathpath () const
 Returns the current path.
void setPath (const Path &path)
 Sets the current path.
void drawPath ()
 Draws the current path.
void drawPath (const Path &path)
 Draws the given path.
void fillPath ()
 Fills the current path.
void fillPath (const Path &path)
 Fills the given path.
const FontMetrics & fontMetrics () const
 Returns the font metrics of the current font.
TextMetrics textMetrics (const Pt::String &text) const
 Measures a line of text using the current font.
void drawText (const PointF &to, const Pt::String &text)
 Draws a line of text at the given position.
void drawText (const PointF &to, const Pt::String &text, const Transform &t)
 Draws a line of text using an additional text transform.
void drawImage (const PointF &to, const Image &im)
 Draws an image.
void drawImage (const PointF &to, const Image &im, const RectF &rect)
 Draws a rectangular part of an image.
void drawBitmap (const PointF &to, const Bitmap &bm)
 Draws a bitmap.
void drawBitmap (const PointF &to, const Bitmap &bm, const RectF &rect)
 Draws a rectangular part of a bitmap.

Protected Member Functions

virtual void onDetachSurface (Gfx::PaintSurface &surface)
 Clears the Forms surface binding when the Gfx surface detaches.
void beginPaint (PaintSurface &surface)
 Begins painting to a paint surface.
void beginPaint (PaintContext &context)
 Begins painting to a paint context.
const Paint & paint () const
 Returns the current paint state.
Canvas * canvas () const
 Returns the current canvas or null.
virtual void onDetachContext (PaintContext &context)
 Called when the context is detached.

Detailed Description

Painter extends Gfx::PainterBase with pixmap drawing. Construct it or call begin() on a PaintSurface or PaintContext. It does not own the target. Cached paint state remains across begin() until it is changed.