31#ifndef PT_GFX_PAINTERBASE_H
32#define PT_GFX_PAINTERBASE_H
34#include <Pt/Gfx/Api.h>
35#include <Pt/Gfx/Size.h>
36#include <Pt/Gfx/Point.h>
37#include <Pt/Gfx/Rect.h>
38#include <Pt/Gfx/Font.h>
39#include <Pt/Gfx/FontMetrics.h>
40#include <Pt/Gfx/TextMetrics.h>
41#include <Pt/Gfx/Pen.h>
42#include <Pt/Gfx/Brush.h>
43#include <Pt/Gfx/Scaling.h>
44#include <Pt/Gfx/Transform.h>
45#include <Pt/Gfx/Path.h>
46#include <Pt/Gfx/CompositionMode.h>
47#include <Pt/Gfx/Paint.h>
49#include <Pt/NonCopyable.h>
86 friend class PaintSurface;
87 friend class PaintContext;
171 void drawLine(
const PointF& from,
const PointF& to);
207 void drawArc(
const PointF& topLeft,
const SizeF& size,
208 float degBegin,
float degEnd);
212 void fillChord(
const PointF& topLeft,
const SizeF& size,
213 float degBegin,
float degEnd);
217 void fillPie(
const PointF& topLeft,
const SizeF& size,
218 float degBegin,
float degEnd);
269 void drawImage(
const PointF& to,
const Image& im,
const RectF& rect);
308 void onSetContextClip(
const RectF*
clip);
310 void updateClip(
const RectF* painterClip,
const RectF* contextClip);
313 PaintSurface* _surface;
314 PaintContext* _context;
Off-screen image that can be painted.
Definition Bitmap.h:71
Fill color, gradient or texture.
Definition Brush.h:151
Backend that executes drawing commands.
Definition Canvas.h:66
How new pixels combine with existing pixels.
Definition CompositionMode.h:49
Ascent, descent and line height of a font.
Definition FontMetrics.h:50
Font family, size and style.
Definition Font.h:63
Active painting session on a surface.
Definition PaintContext.h:61
Target for drawing operations.
Definition PaintSurface.h:66
Pen, brush, font and composition mode.
Definition Paint.h:53
const Paint & paint() const
Returns the current paint state.
void beginPaint(PaintSurface &surface)
Begins painting to a paint surface.
const Brush & brush() const
Returns the current brush.
void drawText(const PointF &to, const Pt::String &text)
Draws a line of text at the given position.
void setClip(const RectF &clip)
Sets the clipping rect.
const Transform & transform() const
Returns the user transform.
void drawPath(const Path &path)
Draws the given path.
const Pen & pen() const
Returns the current pen.
virtual void onDetachContext(PaintContext &context)
Called when the context is detached.
void setPath(const Path &path)
Sets the current path.
void drawBitmap(const PointF &to, const Bitmap &bm)
Draws a bitmap.
void drawEllipse(const PointF &topLeft, const SizeF &size)
Draws the outline of an ellipse.
const Font & font() const
Returns the current font.
void resetTransform()
Resets the user transform to identity.
const RectF * clip() const
Returns the current clip rectangle or null if clipping is disabled.
void drawBitmap(const PointF &to, const Bitmap &bm, const RectF &rect)
Draws a rectangular part of a bitmap.
void finish()
Ends the current painting operation.
PainterBase()
Default constructor.
const ImageFormat & format() const
Returns the pixel format of the current target.
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 setBrush(const Brush &brush)
Sets the brush used to fill areas.
void fillPie(const PointF &topLeft, const SizeF &size, float degBegin, float degEnd)
Fills a pie segment on an ellipse.
void drawImage(const PointF &to, const Image &im, const RectF &rect)
Draws a rectangular part of an image.
void fillChord(const PointF &topLeft, const SizeF &size, float degBegin, float degEnd)
Fills a chord on an ellipse.
void drawRect(const RectF &rect)
Draws the outline of a rectangle.
void setCompositionMode(const CompositionMode &mode)
Sets the composition mode.
void fillEllipse(const PointF &topLeft, const SizeF &size)
Fills an elliptical area.
const FontMetrics & fontMetrics() const
Returns the font metrics of the current font.
const Scaling & scaling() const
Returns the logical-to-physical scaling of the target.
void resetClip()
Resets the clipping rect.
const CompositionMode & compositionMode() const
Returns the current composition mode.
virtual void onDetachSurface(PaintSurface &surface)
Called when the surface is detached.
void fillPolygon(const PointF *points, const size_t pointCount)
Fills a polygon defined by the given points.
void drawImage(const PointF &to, const Image &im)
Draws an image.
void drawCircle(const PointF &topLeft, double diameter)
Draws the outline of a circle.
const Gfx::Path & path() const
Returns the current path.
void fillPath(const Path &path)
Fills the given path.
void drawText(const PointF &to, const Pt::String &text, const Transform &t)
Draws a line of text using an additional text transform.
Canvas * canvas() const
Returns the current canvas or null.
void setPen(const Pen &pen)
Sets the pen used to stroke lines.
void setTransform(const Transform &tx)
Sets the user transform.
void fillCircle(const PointF &topLeft, double diameter)
Fills a circular area.
void setFont(const Font &font)
Sets the font used to draw text.
void drawPath()
Draws the current path.
void beginPaint(PaintContext &context)
Begins painting to a paint context.
void drawArc(const PointF &topLeft, const SizeF &size, float degBegin, float degEnd)
Draws an arc on an ellipse.
TextMetrics textMetrics(const Pt::String &text) const
Measures a line of text using the current font.
virtual ~PainterBase()
Destructor.
void fillRect(const RectF &rect)
Fills a rectangular area.
void fillPath()
Fills the current path.
Sequence of lines and curves.
Definition Path.h:81
Outline color, width and style.
Definition Pen.h:59
Conversion between logical units and pixels.
Definition Scaling.h:52
Width and bounds of a text run.
Definition TextMetrics.h:49
NonCopyable()
Default constructor.
Definition NonCopyable.h:63
Unicode capable basic_string.
Definition Api-String.h:67
Graphics and imaging services.
Definition Api-Argb32Image.h:12
Core module.
Definition Allocator.h:33