X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9cc4ab8522ec1978be193ae11b71e5623d78a14d..b5fe7ca67bf3121959a0b5a59afd00c1708f2f03:/interface/wx/graphics.h diff --git a/interface/wx/graphics.h b/interface/wx/graphics.h index f484162398..e5b1f4d58c 100644 --- a/interface/wx/graphics.h +++ b/interface/wx/graphics.h @@ -194,6 +194,45 @@ public: 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 */ +}; /** @@ -378,13 +417,13 @@ public: 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. @@ -404,6 +443,12 @@ public: /** Draws text at the defined position. + @param str + The text to draw. + @param x + The x coordinate position to draw the text at. + @param y + The y coordinate position to draw the text at. @param angle The angle relative to the (default) horizontal direction to draw the string. @@ -412,6 +457,12 @@ public: /** Draws text at the defined position. + @param str + The text to draw. + @param x + The x coordinate position to draw the text at. + @param y + The y coordinate position to draw the text at. @param backgroundBrush Brush to fill the text with. */ @@ -420,6 +471,12 @@ public: /** Draws text at the defined position. + @param str + The text to draw. + @param x + The x coordinate position to draw the text at. + @param y + The y coordinate position to draw the text at. @param angle The angle relative to the (default) horizontal direction to draw the string. @@ -433,7 +490,7 @@ public: 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 @@ -495,7 +552,7 @@ public: /** Sets the brush for filling paths. */ - void SetBrush(const wxGraphicsBrush& brush); + virtual void SetBrush(const wxGraphicsBrush& brush); /** Sets the font for drawing text. @@ -504,16 +561,16 @@ public: /** 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 @@ -529,13 +586,13 @@ public: 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. @@ -546,6 +603,38 @@ public: 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; + };