X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cbd251acbaf0b1cc8ae5409ae08cc0469922fe82..ed8efd46d9c8fa3bf5d10b2a6efd295a6dd71bdb:/interface/wx/graphics.h diff --git a/interface/wx/graphics.h b/interface/wx/graphics.h index df59fbe9c8..10c2ea7485 100644 --- a/interface/wx/graphics.h +++ b/interface/wx/graphics.h @@ -22,18 +22,24 @@ class wxGraphicsPath : public wxGraphicsObject { public: /** - Adds an arc of a circle centering at (@a x,@a y) with radius (@a r) - from @a startAngle to @a endAngle. + Adds an arc of a circle. + + The circle is defined by the coordinates of its centre (@a x, @a y) or + @a c and its radius @a r. The arc goes from the starting angle @a + startAngle to @a endAngle either clockwise or counter-clockwise + depending on the value of @a clockwise argument. + + The angles are measured in radians but, contrary to the usual + mathematical convention, are always @e clockwise from the horizontal + axis. */ + //@{ virtual void AddArc(wxDouble x, wxDouble y, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise); - /** - Adds an arc of a circle centering at @a c with radius (@a r) - from @a startAngle to @a endAngle. - */ void AddArc(const wxPoint2DDouble& c, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise); + //@} /** Appends a an arc to two tangents connecting (current) to (@a x1,@a y1) @@ -194,6 +200,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 +423,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 +496,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 +558,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 +567,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 +592,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 +609,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 +706,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. */