Canvas Class Referenceabstract

#include <Pt/Gfx/Canvas.h>

Backend canvas for drawing commands. More...

Public Member Functions

virtual ~Canvas ()
 Destroys the canvas.
 
const PointForigin () const
 Returns the logical origin of the current region.
 
const RectFregion () const
 Returns the current paint region.
 
void setRegion (const RectF &r)
 Sets the paint region.
 
const Scalingscaling () const
 Returns the logical-to-physical scaling.
 
void setScaling (const Scaling &scaling)
 Sets the logical-to-physical scaling.
 
const Gfx::ImageFormatformat () const
 Returns the pixel format of the target.
 
const Gfx::Transformtransform () const
 Returns the current transform.
 
void setTransform (const Gfx::Transform &tx)
 Sets the current transform.
 
void resetTransform ()
 Resets the transform to the identity matrix.
 
void beginPaint (const Gfx::Paint &paint)
 Begins painting with the given paint state.
 
void finishPaint ()
 Ends the current painting operation.
 
bool isActive () const
 Returns true if painting is currently active.
 
void setCompositionMode (const Gfx::CompositionMode &mode)
 Sets the current composition mode.
 
void setPen (const Pen &pen)
 Sets the current pen.
 
void setBrush (const Brush &brush)
 Sets the current brush.
 
void setFont (const Gfx::Font &font)
 Sets the current font.
 
void setClip (const RectF &clip)
 Sets the clip rectangle.
 
void resetClip ()
 Clears the clip rectangle.
 
void drawLine (const PointF &from, const PointF &to)
 Draws a line between two points.
 
void drawPolyline (const Gfx::PointF *ps, const size_t n)
 Draws a connected sequence of line segments.
 
void fillPolygon (const Gfx::PointF *ps, const size_t n)
 Fills a polygon.
 
void drawRect (const Gfx::RectF &rectangle)
 Draws the outline of a rectangle.
 
void fillRect (const Gfx::RectF &rectangle)
 Fills a rectangle.
 
void drawEllipse (const Gfx::PointF &topLeft, const Gfx::SizeF &size)
 Draws the outline of an ellipse.
 
void fillEllipse (const Gfx::PointF &topLeft, const Gfx::SizeF &size)
 Fills an ellipse.
 
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 FontMetricsfontMetrics () const
 Returns metrics for the current font.
 
TextMetrics textMetrics (const Pt::String &text) const
 Measures a line of text.
 
void drawText (const PointF &to, const Pt::String &text, const Transform *tform=0)
 Draws a line of text.
 
void drawImage (const Gfx::PointF &to, const Gfx::Image &image, const Gfx::RectF *rect=0)
 Draws an image.
 
void drawBitmap (const Gfx::PointF &to, const Gfx::Bitmap &bitmap, const Gfx::RectF *rect=0)
 Draws a bitmap.
 

Detailed Description

Canvas is implemented by paint backends and executes the drawing commands emitted by PainterBase. It manages the active drawing state for a target, exposes target geometry and scaling, and translates high-level operations such as path, text and bitmap drawing into backend-specific primitives.