bool IsNull() const;
};
+/**
+ Anti-aliasing modes used by wxGraphicsContext::SetAntialisingMode
+*/
+enum wxAntialiasMode
+{
+ /** No anti-aliasing */
+ wxANTIALIAS_NONE,
+
+ /** The default anti-aliasing */
+ wxANTIALIAS_DEFAULT,
+};
+
+/**
+ Compositing is done using Porter-Duff compositions
+ (see http://keithp.com/~keithp/porterduff/p253-porter.pdf) with
+ wxGraphicsContext::SetCompositionMode
+
+ The description give a short equation on how the values of a resulting
+ pixel are calculated.
+ @e R = Result, @e S = Source, @e D = Destination, colors premultiplied with alpha
+ @e Ra, @e Sa, @e Da their alpha components
+*/
+enum wxCompositionMode
+{
+ wxCOMPOSITION_CLEAR, /**< @e R = 0 */
+ wxCOMPOSITION_SOURCE, /**< @e R = S */
+ wxCOMPOSITION_OVER, /**< @e R = @e S + @e D*(1 - @e Sa) */
+ wxCOMPOSITION_IN, /**< @e R = @e S*@e Da */
+ wxCOMPOSITION_OUT, /**< @e R = @e S*(1 - @e Da) */
+ wxCOMPOSITION_ATOP, /**< @e R = @e S*@e Da + @e D*(1 - @e Sa) */
+
+ wxCOMPOSITION_DEST, /**< @e R = @e D, essentially a noop */
+ wxCOMPOSITION_DEST_OVER, /**< @e R = @e S*(1 - @e Da) + @e D */
+ wxCOMPOSITION_DEST_IN, /**< @e R = @e D*@e Sa */
+ wxCOMPOSITION_DEST_OUT, /**< @e R = @e D*(1 - @e Sa) */
+ wxCOMPOSITION_DEST_ATOP, /**< @e R = @e S*(1 - @e Da) + @e D*@e Sa */
+ wxCOMPOSITION_XOR, /**< @e R = @e S*(1 - @e Da) + @e D*(1 - @e Sa) */
+ wxCOMPOSITION_ADD, /**< @e R = @e S + @e D */
+};
/**
Draws a polygon.
*/
virtual void DrawLines(size_t n, const wxPoint2DDouble* points,
- int fillStyle = wxODDEVEN_RULE);
+ wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
/**
Draws the path by first filling and then stroking.
*/
virtual void DrawPath(const wxGraphicsPath& path,
- int fillStyle = wxODDEVEN_RULE);
+ wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
/**
Draws a rectangle.
Fills the path with the current brush.
*/
virtual void FillPath(const wxGraphicsPath& path,
- int fillStyle = wxODDEVEN_RULE) = 0;
+ wxPolygonFillMode fillStyle = wxODDEVEN_RULE) = 0;
/**
Returns the native context (CGContextRef for Core Graphics, Graphics
/**
Sets the brush for filling paths.
*/
- void SetBrush(const wxGraphicsBrush& brush);
+ virtual void SetBrush(const wxGraphicsBrush& brush);
/**
Sets the font for drawing text.
/**
Sets the font for drawing text.
*/
- void SetFont(const wxGraphicsFont& font);
+ virtual void SetFont(const wxGraphicsFont& font);
/**
Sets the pen used for stroking.
*/
- void SetPen(const wxGraphicsPen& pen);
+ void SetPen(const wxPen& pen);
/**
Sets the pen used for stroking.
*/
- void SetPen(const wxPen& pen);
+ virtual void SetPen(const wxGraphicsPen& pen);
/**
Sets the current transformation matrix of this context
Stroke disconnected lines from begin to end points, fastest method
available for this purpose.
*/
- void StrokeLines(size_t n, const wxPoint2DDouble* beginPoints,
- const wxPoint2DDouble* endPoints);
+ virtual void StrokeLines(size_t n, const wxPoint2DDouble* beginPoints,
+ const wxPoint2DDouble* endPoints);
/**
Stroke disconnected lines from begin to end points, fastest method
available for this purpose.
*/
- void StrokeLines(size_t n, const wxPoint2DDouble* points);
+ virtual void StrokeLines(size_t n, const wxPoint2DDouble* points);
/**
Strokes along a path with the current pen.
Translates the current transformation matrix.
*/
virtual void Translate(wxDouble dx, wxDouble dy) = 0;
+
+ /**
+ Redirects all rendering is done into a fully transparent temporary context
+ */
+ virtual void BeginLayer(wxDouble opacity) = 0;
+
+ /**
+ Composites back the drawings into the context with the opacity given at
+ the BeginLayer call
+ */
+ virtual void EndLayer() = 0;
+
+ /**
+ Sets the antialiasing mode, returns true if it supported
+ */
+ virtual bool SetAntialiasMode(wxAntialiasMode antialias) = 0;
+
+ /**
+ Returns the current shape antialiasing mode
+ */
+ virtual wxAntialiasMode GetAntialiasMode() const ;
+
+ /**
+ Sets the compositing operator, returns true if it supported
+ */
+ virtual bool SetCompositionMode(wxCompositionMode op) = 0;
+
+ /**
+ Returns the current compositing operator
+ */
+ virtual wxCompositionMode GetCompositionMode() const;
+
};
*/
virtual wxGraphicsContext* CreateContextFromNativeWindow(void* window) = 0;
+ /**
+ Creates a wxGraphicsContext that can be used for measuring texts only.
+ No drawing commands are allowed.
+ */
+ virtual wxGraphicsContext * CreateMeasuringContext() = 0;
+
/**
Creates a native graphics font from a wxFont and a text colour.
*/