X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cbd251acbaf0b1cc8ae5409ae08cc0469922fe82..97d13342cc2ac77e21c38115cc6ebecac930f92a:/interface/wx/graphics.h diff --git a/interface/wx/graphics.h b/interface/wx/graphics.h index df59fbe9c8..6bea40c644 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. @@ -451,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 @@ -513,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. @@ -522,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 @@ -547,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. @@ -564,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; + }; @@ -629,6 +700,12 @@ public: */ 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. */