Canvas Class Referenceabstract

#include <Pt/Gfx/Canvas.h>

Backend that executes drawing commands. More...

Public Member Functions

virtual ~Canvas ()
 Destroys the canvas.
const PointF & origin () const
 Returns the logical origin of the current region.
const RectF & region () 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 created by a PaintSurface while a painter is active. Its constructor is protected. Ordinary application code does not construct a canvas; use a Painter.