X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/49f7b879bda4e86690b0799abde08748f07359f3..e86fbab1bade4c76243ab6552d0823989295cad5:/wxPython/src/_graphics.i?ds=sidebyside diff --git a/wxPython/src/_graphics.i b/wxPython/src/_graphics.i index 07f7db2e23..1b261790a0 100644 --- a/wxPython/src/_graphics.i +++ b/wxPython/src/_graphics.i @@ -33,10 +33,14 @@ // C++ stub classes for platforms or build configurations that don't have // wxGraphicsContext yet. +class wxGraphicsRenderer; +class wxGraphicsMatrix; + class wxGraphicsObject : public wxObject { public : + wxGraphicsObject() {} wxGraphicsObject( wxGraphicsRenderer* ) { PyErr_SetString(PyExc_NotImplementedError, "wx.GraphicsObject is not available on this platform."); @@ -51,6 +55,7 @@ public : class wxGraphicsPen : public wxGraphicsObject { +public: wxGraphicsPen() {} virtual ~wxGraphicsPen() {} } ; @@ -81,6 +86,7 @@ wxGraphicsFont wxNullGraphicsFont; class wxGraphicsPath : public wxGraphicsObject { public : + wxGraphicsPath() { } wxGraphicsPath(wxGraphicsRenderer* ) { PyErr_SetString(PyExc_NotImplementedError, "wx.GraphicsPath is not available on this platform."); @@ -93,10 +99,10 @@ public : void AddLineToPoint( const wxPoint2DDouble& ) {} void AddCurveToPoint( wxDouble, wxDouble, wxDouble, wxDouble, wxDouble, wxDouble ) {} void AddCurveToPoint( const wxPoint2DDouble&, const wxPoint2DDouble&, const wxPoint2DDouble&) {} - void AddPath( const wxGraphicsPath* ) {} + void AddPath( const wxGraphicsPath& ) {} void CloseSubpath() {} - void GetCurrentPoint( wxDouble&, wxDouble&) {} - wxPoint2DDouble GetCurrentPoint() { reutrn wxPoint2D(0,0); } + void GetCurrentPoint( wxDouble&, wxDouble&) const {} + wxPoint2DDouble GetCurrentPoint() const { return wxPoint2D(0,0); } void AddArc( wxDouble, wxDouble, wxDouble, wxDouble, wxDouble, bool ) {} void AddArc( const wxPoint2DDouble& , wxDouble, wxDouble , wxDouble , bool ) {} @@ -108,13 +114,13 @@ public : void AddEllipse( wxDouble , wxDouble , wxDouble , wxDouble ) {} void AddRoundedRectangle( wxDouble , wxDouble , wxDouble , wxDouble , wxDouble ) {} void * GetNativePath() const { return NULL; } - void UnGetNativePath(void *) {} - void Transform( wxGraphicsMatrix* ) {} - void GetBox(wxDouble *, wxDouble *, wxDouble *, wxDouble *) {} - wxRect2D GetBox() { return wxRect2D(0,0,0,0); } + void UnGetNativePath(void *) const {} + void Transform( const wxGraphicsMatrix& ) {} + void GetBox(wxDouble *, wxDouble *, wxDouble *, wxDouble *) const {} + wxRect2D GetBox() const { return wxRect2D(0,0,0,0); } - bool Contains( wxDouble , wxDouble , int ) { return false; } - bool Contains( const wxPoint2DDouble& , int ) { return false; } + bool Contains( wxDouble , wxDouble , int ) const { return false; } + bool Contains( const wxPoint2DDouble& , int ) const { return false; } }; wxGraphicsPath wxNullGraphicsPath; @@ -122,23 +128,26 @@ wxGraphicsPath wxNullGraphicsPath; class wxGraphicsMatrix : public wxGraphicsObject { public : + wxGraphicsMatrix() { } wxGraphicsMatrix(wxGraphicsRenderer* ) { PyErr_SetString(PyExc_NotImplementedError, "wx.GraphicsMatrix is not available on this platform."); } virtual ~wxGraphicsMatrix() {} - virtual void Concat( const wxGraphicsMatrix * ) {} - virtual void Copy( const wxGraphicsMatrix * ) {} + virtual void Concat( const wxGraphicsMatrix & ) {} + virtual void Copy( const wxGraphicsMatrix & ) {} virtual void Set(wxDouble , wxDouble , wxDouble , wxDouble , wxDouble , wxDouble ) {} + virtual void Get(wxDouble*, wxDouble*, wxDouble*, + wxDouble*, wxDouble*, wxDouble*) {} virtual void Invert() {} - virtual bool IsEqual( const wxGraphicsMatrix* t) const {} - virtual bool IsIdentity() { return false; } + virtual bool IsEqual( const wxGraphicsMatrix& t) const { return false; } + virtual bool IsIdentity() const { return false; } virtual void Translate( wxDouble , wxDouble ) {} virtual void Scale( wxDouble , wxDouble ) {} virtual void Rotate( wxDouble ) {} - virtual void TransformPoint( wxDouble *, wxDouble * ) {} - virtual void TransformDistance( wxDouble *, wxDouble * ) {} + virtual void TransformPoint( wxDouble *, wxDouble * ) const {} + virtual void TransformDistance( wxDouble *, wxDouble * ) const {} virtual void * GetNativeMatrix() const { return NULL; } }; wxGraphicsMatrix wxNullGraphicsMatrix; @@ -155,43 +164,52 @@ public: virtual ~wxGraphicsContext() {} + static wxGraphicsContext* Create() { + PyErr_SetString(PyExc_NotImplementedError, + "wx.GraphicsContext is not available on this platform."); + return NULL; + } static wxGraphicsContext* Create( const wxWindowDC& ) { PyErr_SetString(PyExc_NotImplementedError, "wx.GraphicsContext is not available on this platform."); + return NULL; } static wxGraphicsContext* CreateFromNative( void * ) { PyErr_SetString(PyExc_NotImplementedError, "wx.GraphicsContext is not available on this platform."); + return NULL; } static wxGraphicsContext* CreateFromNativeWindow( void * ) { PyErr_SetString(PyExc_NotImplementedError, "wx.GraphicsContext is not available on this platform."); + return NULL; } static wxGraphicsContext* Create( wxWindow* ) { PyErr_SetString(PyExc_NotImplementedError, "wx.GraphicsContext is not available on this platform."); + return NULL; } - wxGraphicsPath * CreatePath() { return NULL; } + wxGraphicsPath CreatePath() { return wxNullGraphicsPath; } - virtual wxGraphicsPen CreatePen(const wxPen& ) { return NULL; } + virtual wxGraphicsPen CreatePen(const wxPen& ) { return wxNullGraphicsPen; } - virtual wxGraphicsBrush CreateBrush(const wxBrush& ) { return NULL; } + virtual wxGraphicsBrush CreateBrush(const wxBrush& ) { return wxNullGraphicsBrush; } virtual wxGraphicsBrush CreateLinearGradientBrush( wxDouble , wxDouble , wxDouble , wxDouble , - const wxColour&, const wxColour&) { return NULL; } + const wxColour&, const wxColour&) { return wxNullGraphicsBrush; } virtual wxGraphicsBrush CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, - const wxColour &oColor, const wxColour &cColor) { return NULL; } + const wxColour &oColor, const wxColour &cColor) { return wxNullGraphicsBrush; } - virtual wxGraphicsFont CreateFont( const wxFont &, const wxColour & ) { return NULL; } + virtual wxGraphicsFont CreateFont( const wxFont &, const wxColour & ) { return wxNullGraphicsFont; } - virtual wxGraphicsMatrix* CreateMatrix( wxDouble, wxDouble, wxDouble, wxDouble, - wxDouble, wxDouble) { return NULL; } + virtual wxGraphicsMatrix CreateMatrix( wxDouble, wxDouble, wxDouble, wxDouble, + wxDouble, wxDouble) { return wxNullGraphicsMatrix; } virtual void PushState() {} virtual void PopState() {} @@ -199,12 +217,14 @@ public: virtual void Clip( wxDouble , wxDouble , wxDouble , wxDouble ) {} virtual void ResetClip() {} virtual void * GetNativeContext() { return NULL; } + virtual int GetLogicalFunction() const { return 0; } + virtual bool SetLogicalFunction(int ) {} virtual void Translate( wxDouble , wxDouble ) {} virtual void Scale( wxDouble , wxDouble ) {} virtual void Rotate( wxDouble ) {} - virtual void ConcatTransform( const wxGraphicsMatrix* ) {} - virtual void SetTransform( const wxGraphicsMatrix* ) {} - virtual void GetTransform( wxGraphicsMatrix* ) {} + virtual void ConcatTransform( const wxGraphicsMatrix& ) {} + virtual void SetTransform( const wxGraphicsMatrix& ) {} + virtual wxGraphicsMatrix GetTransform() const { return wxNullGraphicsMatrix; } virtual void SetPen( const wxGraphicsPen& ) {} void SetPen( const wxPen& ) {} @@ -215,12 +235,14 @@ public: virtual void SetFont( const wxGraphicsFont& ) {} void SetFont( const wxFont&, const wxColour& ) {} - virtual void StrokePath( const wxGraphicsPath * ) {} - virtual void FillPath( const wxGraphicsPath *, int ) {} - virtual void DrawPath( const wxGraphicsPath *, int ) {} + virtual void StrokePath( const wxGraphicsPath & ) {} + virtual void FillPath( const wxGraphicsPath &, int ) {} + virtual void DrawPath( const wxGraphicsPath &, int ) {} virtual void DrawText( const wxString &, wxDouble , wxDouble ) {} virtual void DrawText( const wxString &, wxDouble , wxDouble , wxDouble ) {} + virtual void DrawText( const wxString &, wxDouble , wxDouble , wxGraphicsBrush ) {} + virtual void DrawText( const wxString &, wxDouble , wxDouble , wxDouble , wxGraphicsBrush ) {} virtual void GetTextExtent( const wxString &, wxDouble *, wxDouble *, wxDouble *, wxDouble * ) const {} virtual void GetPartialTextExtents(const wxString& , wxArrayDouble& ) const {} @@ -234,7 +256,7 @@ public: virtual void DrawLines( size_t , const wxPoint2DDouble *, int ) {} virtual void DrawRectangle( wxDouble , wxDouble , wxDouble , wxDouble ) {} virtual void DrawEllipse( wxDouble , wxDouble , wxDouble , wxDouble ) {} - virtual void DrawRoundedRectangle( wxDouble wxDouble , wxDouble , wxDouble , wxDouble ) {} + virtual void DrawRoundedRectangle( wxDouble , wxDouble , wxDouble , wxDouble , wxDouble ) {} virtual bool ShouldOffset() const { return false; } }; @@ -249,28 +271,30 @@ public : virtual ~wxGraphicsRenderer() {} - static wxGraphicsRenderer* GetDefaultRenderer( + static wxGraphicsRenderer* GetDefaultRenderer() { PyErr_SetString(PyExc_NotImplementedError, "wx.GraphicsRenderer is not available on this platform."); - ); + return NULL; + } virtual wxGraphicsContext * CreateContext( const wxWindowDC& ) { return NULL; } virtual wxGraphicsContext * CreateContextFromNativeContext( void * ) { return NULL; } virtual wxGraphicsContext * CreateContextFromNativeWindow( void * ) { return NULL; } virtual wxGraphicsContext * CreateContext( wxWindow* ) { return NULL; } + virtual wxGraphicsContext * CreateMeasuringContext() { return NULL; } - virtual wxGraphicsPath * CreatePath() { return NULL; } + virtual wxGraphicsPath CreatePath() { return wxNullGraphicsPath; } - virtual wxGraphicsMatrix * CreateMatrix( wxDouble , wxDouble , wxDouble , wxDouble , - wxDouble , wxDouble ) { return NULL; } + virtual wxGraphicsMatrix CreateMatrix( wxDouble , wxDouble , wxDouble , wxDouble , + wxDouble , wxDouble ) { return wxNullGraphicsMatrix; } - virtual wxGraphicsPen CreatePen(const wxPen& ) { return wxNullGaphicsPen; } - virtual wxGraphicsBrush CreateBrush(const wxBrush& ) { return wxNullGaphicsBrush; } - virtual wxGraphicsBrush CreateLinearGradientBrush(xDouble , wxDouble , wxDouble , wxDouble , - const wxColour&, const wxColour&) { return wxNullGaphicsBrush; } + virtual wxGraphicsPen CreatePen(const wxPen& ) { return wxNullGraphicsPen; } + virtual wxGraphicsBrush CreateBrush(const wxBrush& ) { return wxNullGraphicsBrush; } + virtual wxGraphicsBrush CreateLinearGradientBrush(wxDouble , wxDouble , wxDouble , wxDouble , + const wxColour&, const wxColour&) { return wxNullGraphicsBrush; } virtual wxGraphicsBrush CreateRadialGradientBrush(wxDouble , wxDouble , wxDouble , wxDouble , wxDouble , - const wxColour &, const wxColour &) { return wxNullGaphicsBrush; } - virtual wxGraphicsFont CreateFont( const wxFont & , const wxColour & ) { return wxNullGaphicsFont; } + const wxColour &, const wxColour &) { return wxNullGraphicsBrush; } + virtual wxGraphicsFont CreateFont( const wxFont & , const wxColour & ) { return wxNullGraphicsFont; } }; @@ -426,6 +450,13 @@ public : "Sets the matrix to the specified values (default values are the identity matrix.)", ""); + + DocDeclAStr( + virtual void , Get(wxDouble* OUTPUT, wxDouble* OUTPUT, wxDouble* OUTPUT, + wxDouble* OUTPUT, wxDouble* OUTPUT, wxDouble* OUTPUT), + "Get(self) --> (a, b, c, d, tx, ty)", + "Gets the component values of the matrix and returns them as a tuple.", ""); + DocDeclStr( virtual void , Invert(), @@ -434,7 +465,8 @@ identity matrix.)", ""); DocDeclStr( virtual bool , IsEqual( const wxGraphicsMatrix& t) const, - "Returns ``True`` if the elements of the transformation matrix are equal", ""); + "Returns ``True`` if the elements of the transformation matrix are +equal", ""); DocDeclStr( @@ -532,8 +564,8 @@ points and an end point", ""); "Adds an arc of a circle centering at (x,y) with radius (r) from startAngle to endAngle", ""); virtual void AddArc( wxDouble x, wxDouble y, wxDouble r, - wxDouble startAngle, wxDouble endAngle, bool clockwise ); - void AddArc( const wxPoint2D& c, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise); + wxDouble startAngle, wxDouble endAngle, bool clockwise=true ); + void AddArc( const wxPoint2D& c, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise=true); DocDeclStr( @@ -554,8 +586,8 @@ point and an end point", ""); DocDeclStr( virtual void , AddArcToPoint( wxDouble x1, wxDouble y1 , wxDouble x2, wxDouble y2, wxDouble r ) , - "Appends an arc to two tangents connecting (current) to (x1,y1) and (x1,y1) -to (x2,y2), also a straight line from (current) to (x1,y1)", ""); + "Appends an arc to two tangents connecting (current) to (x1,y1) and +(x1,y1) to (x2,y2), also a straight line from (current) to (x1,y1)", ""); DocDeclStr( @@ -588,15 +620,16 @@ returned by GetNativePath is newly allocated each time).", ""); DocDeclStr( - wxRect2DDouble , GetBox() const, - "Gets the bounding box enclosing all points (possibly including control points)", ""); + wxRect2D , GetBox() const, + "Gets the bounding box enclosing all points (possibly including control +points)", ""); %nokwargs Contains; DocStr(Contains, "Returns ``True`` if the point is within the path.", ""); virtual bool Contains( wxDouble x, wxDouble y, int fillStyle = wxODDEVEN_RULE) const; - bool Contains( const wxPoint2DDouble& c, int fillStyle = wxODDEVEN_RULE) const; + bool Contains( const wxPoint2D& c, int fillStyle = wxODDEVEN_RULE) const; }; @@ -643,9 +676,9 @@ public: %newobject CreateFromNative; DocDeclStr( static wxGraphicsContext* , CreateFromNative( void * context ) , - "Creates a wx.GraphicsContext from a native context. This native context -must be eg a CGContextRef for Core Graphics, a Graphics pointer for -GDIPlus or a cairo_t pointer for Cairo.", ""); + "Creates a wx.GraphicsContext from a native context. This native +context must be eg a CGContextRef for Core Graphics, a Graphics +pointer for GDIPlus or a cairo_t pointer for Cairo.", ""); %newobject CreateFromNative; @@ -682,8 +715,8 @@ with color c1 to (x2,y2) with color c2.", ""); virtual wxGraphicsBrush , CreateRadialGradientBrush( wxDouble xo, wxDouble yo, wxDouble xc, wxDouble yc, wxDouble radius, const wxColour &oColor, const wxColour &cColor), - "Creates a native brush, having a radial gradient originating at -point (xo,yc) with color oColour and ends on a circle around (xc,yc) with + "Creates a native brush, having a radial gradient originating at point +(xo,yc) with color oColour and ends on a circle around (xc,yc) with radius r and color cColour.", ""); @@ -703,12 +736,13 @@ values. The defaults result in an identity matrix.", ""); DocDeclStr( virtual void , PushState(), - "push the current state of the context, ie the transformation matrix on a stack", ""); + "Push the current state of the context, (ie the transformation matrix) +on a stack", ""); DocDeclStr( virtual void , PopState(), - "pops a stored state from the stack", ""); + "Pops a stored state from the stack", ""); DocDeclStrName( @@ -733,6 +767,16 @@ values. The defaults result in an identity matrix.", ""); pointer for GDIPlus and cairo_t pointer for cairo).", ""); + DocDeclStr( + virtual int , GetLogicalFunction() const, + "Returns the current logical function.", ""); + + + DocDeclStr( + virtual bool , SetLogicalFunction(int function) , + "Sets the current logical function, returns ``True`` if it supported", ""); + + DocDeclStr( virtual void , Translate( wxDouble dx , wxDouble dy ), "Translates the current transformation matrix.", "");