X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ccf39540bb96a0e5d067451ad79c82397579aceb..ed8efd46d9c8fa3bf5d10b2a6efd295a6dd71bdb:/interface/wx/graphics.h diff --git a/interface/wx/graphics.h b/interface/wx/graphics.h index d463c3e630..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 @@ -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. */