#include <Pt/Gfx/PainterBase.h>
Drawing commands and paint state. More...
Inherits NonCopyable.
Inherited by Painter, and Painter.
Public Member Functions | |
| virtual | ~PainterBase () |
| Destructor. | |
| 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::Path & | path () const |
| Returns the current path. | |
| void | setPath (const Path &path) |
| Sets the current path. | |
| void | drawPath () |
| Draws the current path. | |
| void | fillPath () |
| Fills the current path. | |
| void | drawPath (const Path &path) |
| Draws the given 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 | |
| PainterBase () | |
| Default constructor. | |
| 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 | onDetachSurface (PaintSurface &surface) |
| Called when the surface is detached. | |
| virtual void | onDetachContext (PaintContext &context) |
| Called when the context is detached. | |
PainterBase is the command API Painter inherits. It holds the current Pen, Brush, Font, CompositionMode, user Transform, and clip, and it forwards draw and fill operations to the Canvas of the bound surface or context.
Outline commands use the pen. Fill commands use the brush. drawPath() and fillPath() use the current path or a path passed as an argument. drawText() uses the current font. drawImage() and drawBitmap() composite existing pixels. Coordinates are logical; the target Scaling converts them to physical pixels.
This type is not constructed by application code. Construct a Painter. beginPaint() is protected so only a concrete painter starts a session.