Hi Mattia,
Thanks for your tip it worked well. Here is the diff for implementing the
remaining useful functions in wxGraphicsContext, Path and Matrix. I have not
yet fully tested these, but everything I've tested so far has worked.
I had to add a few bits and pieces around the place for handling the static
function overloading and for constructing a wxPoint2DDouble from a SV*. I
have not implemented wxPoint2DDouble (it contains just an x,y co-ordinate).
There are three functions that require a wxPoint2DDouble (the rest have
overloaded alternatives) and these require an array of points. The perl
interface I have used here uses an array ref of points instead. These are of
the format [x1,y1,x2,y2,x3,y3]. Let me know what you think of this approach,
it is easy enough to change -- before anyone other than me starts using it!
Hopefully I've got the indentation and diff format correct this time!
Best wishes,
Klaas
Index: cpp/helpers.cpp
===================================================================
--- cpp/helpers.cpp (revision 2108)
+++ cpp/helpers.cpp (working copy)
@@ -676,6 +676,20 @@
PUTBACK;
}
+void wxPli_doublearray_push( pTHX_ const wxArrayDouble& doubles )
+{
+ dSP;
+
+ size_t mx = doubles.GetCount();
+ EXTEND( SP, int(mx) );
+ for( size_t i = 0; i < mx; ++i )
+ {
+ PUSHs( sv_2mortal( newSVnv( doubles[i] ) ) );
+ }
+
+ PUTBACK;
+}
+
AV* wxPli_objlist_2_av( pTHX_ const wxList& objs )
{
AV* av = newAV();
@@ -902,6 +916,42 @@
wxarray_thingy<wxArrayInt, int, 0>( array ) );
}
+//KH: takes an array reference with an even number of numbers and puts
+//the appropriate number of points in points
+int wxPli_av_2_wxPoint2DDouble( pTHX_ SV* avref, wxPoint2DDouble** points)
+{
+ AV* av;
+
+ if( !SvROK( avref ) ||
+ ( SvTYPE( (SV*) ( av = (AV*) SvRV( avref ) ) ) != SVt_PVAV ) )
+ {
+ croak( "the value is not an array reference" );
+ return 0;
+ }
+
+ int n = av_len( av ) + 1;
+
+ if (n % 2 != 0)
+ {
+ croak( "the array must contain an even number of points" );
+ }
+
+ n = n / 2;
+
+ *points = new wxPoint2DDouble[n];
+
+ for( int i = 0; i < n; i++ )
+ {
+ double x = SvNV(*av_fetch( av, 2*i, 0 ));
+ double y = SvNV(*av_fetch( av, 2*i+1, 0 ));
+ (*points)[i].m_x = x;
+ (*points)[i].m_y = y;
+
+ }
+
+ return n;
+}
+
const wxChar wxPliEmptyString[] = wxT("");
#if wxUSE_UNICODE
Index: cpp/overload.h
===================================================================
--- cpp/overload.h (revision 2108)
+++ cpp/overload.h (working copy)
@@ -29,6 +29,9 @@
#define REDISPATCH( NEW_METHOD_NAME ) \
count = call_method( #NEW_METHOD_NAME, GIMME_V ); SPAGAIN
+#define REDISPATCH_STATIC( NEW_METHOD_NAME ) \
+ count = call_pv( #NEW_METHOD_NAME, GIMME_V ); SPAGAIN
+
#define MATCH_VOIDM_REDISP( METHOD ) \
if( items == 1 ) \
{ REDISPATCH( METHOD ); } \
@@ -56,3 +59,23 @@
REQUIRED, true ) ) \
{ REDISPATCH( METHOD ); } \
else
+
+/* used for overloading static functions, see GraphicsContext.xs for an example */
+#define MATCH_REDISP_STATIC( PROTO, METHOD ) \
+ if( wxPli_match_arguments( aTHX_ PROTO, \
+ -1, false ) ) \
+ { REDISPATCH_STATIC( METHOD ); } \
+ else
+
+
+#define MATCH_REDISP_COUNT_STATIC( PROTO, METHOD, REQUIRED ) \
+ if( wxPli_match_arguments( aTHX_ PROTO, \
+ REQUIRED, false ) ) \
+ { REDISPATCH_STATIC( METHOD ); } \
+ else
+
+#define MATCH_REDISP_COUNT_ALLOWMORE_STATIC( PROTO, METHOD, REQUIRED ) \
+ if( wxPli_match_arguments( aTHX_ PROTO, \
+ REQUIRED, true ) ) \
+ { REDISPATCH_STATIC( METHOD ); } \
+ else
Index: cpp/helpers.h
===================================================================
--- cpp/helpers.h (revision 2108)
+++ cpp/helpers.h (working copy)
@@ -19,6 +19,7 @@
#include <wx/dynarray.h>
#include <wx/arrstr.h>
+#include <wx/graphics.h>
class wxPliUserDataCD;
class wxPliTreeItemData;
@@ -219,6 +220,7 @@
int wxPli_av_2_userdatacdarray( pTHX_ SV* avref, wxPliUserDataCD*** array );
int FUNCPTR( wxPli_av_2_arraystring )( pTHX_ SV* avref, wxArrayString* array );
int FUNCPTR( wxPli_av_2_arrayint )( pTHX_ SV* avref, wxArrayInt* array );
+int wxPli_av_2_wxPoint2DDouble( pTHX_ SV* avref, wxPoint2DDouble** points);
// pushes the elements of the array into the stack
// the caller _MUST_ call PUTBACK; before the function
@@ -241,6 +243,7 @@
void wxPli_stringarray_push( pTHX_ const wxArrayString& strings );
void FUNCPTR( wxPli_intarray_push )( pTHX_ const wxArrayInt& ints );
+void FUNCPTR( wxPli_doublearray_push )( pTHX_ const wxArrayDouble& doubles );
AV* wxPli_stringarray_2_av( pTHX_ const wxArrayString& strings );
AV* wxPli_uchararray_2_av( pTHX_ const unsigned char* array, int count );
AV* FUNCPTR( wxPli_objlist_2_av )( pTHX_ const wxList& objs );
Index: XS/GraphicsContext.xs
===================================================================
--- XS/GraphicsContext.xs (revision 2108)
+++ XS/GraphicsContext.xs (working copy)
@@ -19,45 +19,35 @@
MODULE=Wx PACKAGE=Wx::GraphicsContext
+void
+Create ( ... )
+ PPCODE:
+ BEGIN_OVERLOAD()
+ MATCH_REDISP_STATIC(wxPliOvl_wwin, Wx::GraphicsContext::createFromWindow)
+ MATCH_REDISP_STATIC(wxPliOvl_wdc, Wx::GraphicsContext::createFromDC)
+ END_OVERLOAD( "Wx::GraphicsContext::Create" )
wxGraphicsContext*
-Create ( window )
- wxWindow* window
+createFromWindow ( window )
+ wxWindow* window
CODE:
RETVAL = wxGraphicsContext::Create( window );
OUTPUT: RETVAL
-##void
-##Create ( ... )
-## PPCODE:
-## BEGIN_OVERLOAD()
-## MATCH_REDISP(wxPliOvl_wwin, CreateWindow)
-## MATCH_REDISP(wxPliOvl_wdc, CreateDC)
-## END_OVERLOAD( "Wx::GraphicsContext::Create" )
-##
-##wxGraphicsContext*
-##CreateWindow ( parent )
-## wxWindow* parent
-## CODE:
-## printf("A!\n");
-## RETVAL = wxGraphicsContext::Create( parent );
-## OUTPUT: RETVAL
-##
-##wxGraphicsContext*
-##CreateDC (dc )
-## wxWindowDC* dc
-## CODE:
-## printf("B!\n");
-## RETVAL = wxGraphicsContext::Create(*dc);
-## OUTPUT: RETVAL
-
+wxGraphicsContext*
+createFromDC (dc )
+ wxWindowDC* dc
+ CODE:
+ RETVAL = wxGraphicsContext::Create(*dc);
+ OUTPUT: RETVAL
+
wxGraphicsPen*
wxGraphicsContext::CreatePen ( pen )
wxPen* pen
CODE:
RETVAL = new wxGraphicsPen( THIS->CreatePen(*pen) );
OUTPUT: RETVAL
-
+
wxGraphicsBrush*
wxGraphicsContext::CreateBrush ( brush )
wxGraphicsBrush* brush
@@ -77,7 +67,7 @@
CODE:
RETVAL = new wxGraphicsBrush( THIS->CreateRadialGradientBrush(xo,yo,xc,yc,radius,*oColor,*cColor) );
OUTPUT: RETVAL
-
+
wxGraphicsBrush*
wxGraphicsContext::CreateLinearGradientBrush (x1,y1,x2,y2,c1,c2)
wxDouble x1
@@ -89,8 +79,7 @@
CODE:
RETVAL = new wxGraphicsBrush( THIS->CreateLinearGradientBrush(x1,y1,x2,y2,*c1,*c2) );
OUTPUT: RETVAL
-
-
+
wxGraphicsFont*
wxGraphicsContext::CreateFont (font, col = new wxColour(*wxBLACK) )
wxFont* font
@@ -98,7 +87,7 @@
CODE:
RETVAL = new wxGraphicsFont( THIS->CreateFont(*font, *col) );
OUTPUT: RETVAL
-
+
wxGraphicsMatrix*
wxGraphicsContext::CreateMatrix ( a = 1.0, b = 0.0, c = 0.0, d = 1.0, tx = 0.0, ty = 0.0)
wxDouble a
@@ -110,13 +99,13 @@
CODE:
RETVAL = new wxGraphicsMatrix( THIS->CreateMatrix(a,b,c,d,tx,ty) );
OUTPUT: RETVAL
-
+
wxGraphicsPath*
wxGraphicsContext::CreatePath ()
CODE:
RETVAL = new wxGraphicsPath( THIS->CreatePath() );
OUTPUT: RETVAL
-
+
void
wxGraphicsContext::Clip (x, y, w, h)
wxDouble x
@@ -136,14 +125,14 @@
wxDouble h
CODE:
THIS->DrawBitmap( *bitmap, x, y, w, h );
-
+
void
wxGraphicsContext::DrawEllipse(x, y, w, h)
wxDouble x
wxDouble y
wxDouble w
wxDouble h
-
+
void
wxGraphicsContext::DrawIcon(icon, x, y, w, h)
wxIcon* icon
@@ -154,16 +143,23 @@
CODE:
THIS->DrawIcon( *icon, x, y, w, h );
- # wxGraphicsContext::DrawLines
- # void DrawLines(size_t n, const wxPoint2DDouble* points, int fillStyle = wxODDEVEN_RULE)
-
+void
+wxGraphicsContext::DrawLines ( points, fillStyle = wxODDEVEN_RULE )
+ SV* points
+ int fillStyle
+ CODE:
+ wxPoint2DDouble* newPoints;
+ int n;
+ n = wxPli_av_2_wxPoint2DDouble(aTHX_ points, &newPoints);
+ THIS->DrawLines(n,newPoints);
+
void
wxGraphicsContext::DrawPath (path, fillStyle = wxODDEVEN_RULE)
wxGraphicsPath *path
int fillStyle
CODE:
THIS->DrawPath( *path, fillStyle );
-
+
void
wxGraphicsContext::DrawRectangle (x, y, w, h)
wxDouble x
@@ -178,7 +174,7 @@
wxDouble w
wxDouble h
wxDouble radius
-
+
void
wxGraphicsContext::DrawText ( ... )
PPCODE:
@@ -186,7 +182,7 @@
MATCH_REDISP(wxPliOvl_s_n_n_n, DrawTextAngle)
MATCH_REDISP(wxPliOvl_s_n_n, DrawTextNoAngle)
END_OVERLOAD( "Wx::GraphicsContext::DrawText" )
-
+
void
wxGraphicsContext::DrawTextAngle ( string, x, y, angle )
wxString string
@@ -210,49 +206,45 @@
int fillStyle
CODE:
THIS->FillPath ( *path, fillStyle );
-
+
void
wxGraphicsContext::StrokePath ( path )
wxGraphicsPath *path;
CODE:
THIS->StrokePath ( *path );
-
- # Not to be implemented
- # wxGraphicsContext::GetNativeContext
- # void * GetNativeContext()
-
- # Pinched from wxDC
- # void
- # wxGraphicsContext::GetTextExtent( string )
- # wxString string
- # PREINIT:
- # wxDouble x, y, descent, externalLeading;
- # PPCODE:
- # THIS->GetTextExtent( string, &x, &y, &descent, &externalLeading);
- # EXTEND( SP, 4 );
- # PUSHs( sv_2mortal( newSViv( x ) ) );
- # PUSHs( sv_2mortal( newSViv( y ) ) );
- # PUSHs( sv_2mortal( newSViv( descent ) ) );
- # PUSHs( sv_2mortal( newSViv( externalLeading ) ) );
+## Adapted from wxDC
- # Pinched from wxDC
+void
+wxGraphicsContext::GetTextExtent( string )
+ wxString string
+ PREINIT:
+ wxDouble x, y, descent, externalLeading;
+ PPCODE:
+ THIS->GetTextExtent( string, &x, &y, &descent, &externalLeading);
+ EXTEND( SP, 4 );
+ PUSHs( sv_2mortal( newSVnv( x ) ) );
+ PUSHs( sv_2mortal( newSVnv( y ) ) );
+ PUSHs( sv_2mortal( newSVnv( descent ) ) );
+ PUSHs( sv_2mortal( newSVnv( externalLeading ) ) );
- # void
- # wxGraphicsContext::GetPartialTextExtents( string )
- # wxString string
- # PREINIT:
- # wxArrayDouble widths;
- # PPCODE:
- # THIS->GetPartialTextExtents( string, widths );
- # PUTBACK;
- # wxPli_intarray_push( aTHX_ widths );
- # SPAGAIN;
+ # Adapted from wxDC
void
+wxGraphicsContext::GetPartialTextExtents( string )
+ wxString string
+ PREINIT:
+ wxArrayDouble widths;
+ PPCODE:
+ THIS->GetPartialTextExtents( string, widths );
+ PUTBACK;
+ wxPli_doublearray_push( aTHX_ widths );
+ SPAGAIN;
+
+void
wxGraphicsContext::Rotate ( angle )
wxDouble angle
-
+
void
wxGraphicsContext::Scale ( x, y )
wxDouble x
@@ -262,38 +254,38 @@
wxGraphicsContext::Translate ( x, y )
wxDouble x
wxDouble y
-
+
wxGraphicsMatrix*
wxGraphicsContext::GetTransform ()
CODE:
RETVAL = new wxGraphicsMatrix( THIS->GetTransform() );
OUTPUT: RETVAL
-
+
void
wxGraphicsContext::SetTransform (matrix)
wxGraphicsMatrix* matrix
CODE:
THIS->SetTransform(*matrix);
-
+
void
wxGraphicsContext::ConcatTransform (matrix)
wxGraphicsMatrix* matrix
CODE:
THIS->ConcatTransform(*matrix);
-
+
void
wxGraphicsContext::SetBrush (brush)
wxBrush* brush
CODE:
THIS->SetBrush( *brush );
-
+
void
wxGraphicsContext::SetFont (font, colour)
wxFont* font
wxColour* colour
CODE:
THIS->SetFont(*font, *colour);
-
+
void
wxGraphicsContext::SetPen (pen)
wxPen* pen
@@ -306,10 +298,40 @@
wxDouble y1
wxDouble x2
wxDouble y2
-
- # Todo!
- # wxGraphicsContext::StrokeLines
- # void StrokeLines(size_t n, const wxPoint2DDouble* beginPoints, const wxPoint2DDouble* endPoints)
- # void StrokeLines(size_t n, const wxPoint2DDouble* points)
-
+
+##Used wpoi's for overload checking as opposed to arr's
+##We want array references (which wpoi matches) but arr
+##causes some problems...
+
+void
+wxGraphicsContext::StrokeLines ( ... )
+ PPCODE:
+ BEGIN_OVERLOAD()
+ MATCH_REDISP(wxPliOvl_wpoi_wpoi, StrokeLinesTwo)
+ MATCH_REDISP(wxPliOvl_wpoi, StrokeLinesOne)
+ END_OVERLOAD( "Wx::GraphicsContext::StrokeLines" )
+
+
+void
+wxGraphicsContext::StrokeLinesOne ( points )
+ SV* points
+ CODE:
+ wxPoint2DDouble* points2d;
+ int n;
+ n = wxPli_av_2_wxPoint2DDouble(aTHX_ points, &points2d);
+ THIS->StrokeLines(n,points2d);
+
+
+void
+wxGraphicsContext::StrokeLinesTwo ( beginPoints, endPoints )
+ SV* beginPoints
+ SV* endPoints
+ CODE:
+ wxPoint2DDouble* endPoints2d;
+ wxPoint2DDouble* beginPoints2d;
+ int n;
+ n = wxPli_av_2_wxPoint2DDouble(aTHX_ beginPoints, &beginPoints2d);
+ n = MIN(n,wxPli_av_2_wxPoint2DDouble(aTHX_ endPoints, &endPoints2d));
+ THIS->StrokeLines(n, beginPoints2d, endPoints2d);
+
#endif
Index: XS/GraphicsPath.xs
===================================================================
--- XS/GraphicsPath.xs (revision 2108)
+++ XS/GraphicsPath.xs (working copy)
@@ -10,20 +10,28 @@
## modify it under the same terms as Perl itself
#############################################################################
-#if wxUSE_GRAPHICS_CONTEXT
+## There are several overloaded functions (see below) where one variant takes a
+## wxPoint2DDouble and the other takes x and y values individually. In these
+## cases the former variant has not been implemented. Feel free to do so!
+##
+## Unimplemented overloaded functions
+## void MoveToPoint(const wxPoint2DDouble& p)
+## void AddArc(const wxPoint2DDouble& c, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise)
+## void AddCurveToPoint(const wxPoint2DDouble& c1, const wxPoint2DDouble& c2, const wxPoint2DDouble& e)
+## void AddLineToPoint(const wxPoint2DDouble& p)
+## bool Contains(const wxPoint2DDouble& c, int fillStyle = wxODDEVEN_RULE) const
#include <wx/graphics.h>
+#if wxUSE_GRAPHICS_CONTEXT
+
MODULE=Wx PACKAGE=Wx::GraphicsPath
void
wxGraphicsPath::MoveToPoint (x, y)
wxDouble x
wxDouble y
-
- # To overload
- # void MoveToPoint(const wxPoint2DDouble& p)
-
+
void
wxGraphicsPath::AddArc(x,y,r,startAngle,endAngle,clockwise )
wxDouble x
@@ -33,9 +41,6 @@
wxDouble endAngle
bool clockwise
- # To overload
- # void AddArc(const wxPoint2DDouble& c, wxDouble r, wxDouble startAngle, wxDouble endAngle, bool clockwise)
-
void
wxGraphicsPath::AddArcToPoint ( x1, y1, x2, y2, r)
wxDouble x1
@@ -43,13 +48,13 @@
wxDouble x2
wxDouble y2
wxDouble r
-
+
void
wxGraphicsPath::AddCircle ( x, y, r)
wxDouble x
wxDouble y
wxDouble r
-
+
void
wxGraphicsPath::AddCurveToPoint (cx1, cy1, cx2, cy2, x, y)
wxDouble cx1
@@ -58,39 +63,33 @@
wxDouble cy2
wxDouble x
wxDouble y
-
- # To overload
- # void AddCurveToPoint(const wxPoint2DDouble& c1, const wxPoint2DDouble& c2, const wxPoint2DDouble& e)
-
+
void
wxGraphicsPath::AddEllipse ( x, y, w, h)
wxDouble x
wxDouble y
wxDouble w
wxDouble h
-
+
void
wxGraphicsPath::AddLineToPoint ( x, y)
wxDouble x
wxDouble y
-
- # To overload
- # void AddLineToPoint(const wxPoint2DDouble& p)
-
+
void
wxGraphicsPath::AddPath (path)
wxGraphicsPath* path
- CODE:
- THIS->AddPath(*path);
-
+ CODE:
+ THIS->AddPath(*path);
+
void
wxGraphicsPath::AddQuadCurveToPoint (cx, cy, x, y)
wxDouble cx
wxDouble cy
wxDouble x
wxDouble y
-
-void
+
+void
wxGraphicsPath::AddRectangle (x, y, w, h)
wxDouble x
wxDouble y
@@ -104,45 +103,42 @@
wxDouble w
wxDouble h
wxDouble radius
-
+
void
wxGraphicsPath::CloseSubpath ( )
-
+
bool
wxGraphicsPath::Contains (x, y, fillStyle = wxODDEVEN_RULE)
wxDouble x
wxDouble y
int fillStyle
-
- # To overload
- # bool Contains(const wxPoint2DDouble& c, int fillStyle = wxODDEVEN_RULE) const
- # bool Contains(wxDouble x, wxDouble y, int fillStyle = wxODDEVEN_RULE) const
-
- # To implement
- # wxGraphicsPath::GetBox
- # wxRect2DDouble GetBox() const
- # void GetBox(wxDouble* x, wxDouble* y, wxDouble* w, wxDouble* h) const
- # Gets the bounding box enclosing all points (possibly including control points).
-
- # To implement
- # wxGraphicsPath::GetCurrentPoint
- # void GetCurrentPoint(wxDouble* x, wxDouble* y) const
- # wxPoint2DDouble GetCurrentPoint() const
- # Gets the last point of the current path, (0,0) if not yet set.
-
- # To implement
- # wxGraphicsPath::Transform
- # void Transform(const wxGraphicsMatrix& matrix)
- # Transforms each point of this path by the matrix.
-
- # Omit?
- # wxGraphicsPath::GetNativePath
- # void * GetNativePath() const
- # Returns the native path (CGPathRef for Core Graphics, Path pointer for GDIPlus and a cairo_path_t pointer for cairo).
-
- # Omit?
- # wxGraphicsPath::UnGetNativePath
- # void UnGetNativePath(void* p) const
- # Gives back the native path returned by GetNativePath() because there might be some deallocations necessary (eg on cairo the native path returned by GetNativePath is newly allocated each time).
-#endif
+void
+wxGraphicsPath::GetBox ( )
+ PREINIT:
+ wxDouble x, y, w, h;
+ PPCODE:
+ THIS->GetBox( &x, &y, &w, &h );
+ EXTEND( SP, 4 );
+ PUSHs( sv_2mortal( newSVnv( x ) ) );
+ PUSHs( sv_2mortal( newSVnv( y ) ) );
+ PUSHs( sv_2mortal( newSVnv( w ) ) );
+ PUSHs( sv_2mortal( newSVnv( h ) ) );
+
+void
+wxGraphicsPath::GetCurrentPoint ( )
+ PREINIT:
+ wxDouble x, y;
+ PPCODE:
+ THIS->GetCurrentPoint( &x, &y );
+ EXTEND( SP, 2 );
+ PUSHs( sv_2mortal( newSVnv( x ) ) );
+ PUSHs( sv_2mortal( newSVnv( y ) ) );
+
+void
+wxGraphicsPath::Transform (matrix)
+ wxGraphicsMatrix* matrix
+ CODE:
+ THIS->Transform( *matrix );
+
+#endif
\ No newline at end of file
Index: XS/GraphicsMatrix.xs
===================================================================
--- XS/GraphicsMatrix.xs (revision 2108)
+++ XS/GraphicsMatrix.xs (working copy)
@@ -10,6 +10,8 @@
## modify it under the same terms as Perl itself
#############################################################################
+#include <wx/graphics.h>
+
#if wxUSE_GRAPHICS_CONTEXT
#include <wx/graphics.h>
@@ -20,23 +22,29 @@
wxGraphicsMatrix::Concat ( t )
wxGraphicsMatrix* t
- # to implement
- # wxGraphicsMatrix::Get
- # void Get(wxDouble* a=NULL, wxDouble* b=NULL, wxDouble* c=NULL, wxDouble* d=NULL, wxDouble* tx=NULL, wxDouble* ty=NULL) const
- # Returns the component values of the matrix via the argument pointers.
-
- # omit
- # wxGraphicsMatrix::GetNativeMatrix
- # void * GetNativeMatrix() const
- # Returns the native representation of the matrix. For CoreGraphics this is a CFAffineMatrix pointer. For GDIPlus a Matrix Pointer and for Cairo a cairo_matrix_t pointer.
-
void
+wxGraphicsMatrix::Get ( )
+ PREINIT:
+ wxDouble a, b, c, d, tx, ty;
+ PPCODE:
+ THIS->Get( &a, &b, &c, &d, &tx, &ty );
+ EXTEND( SP, 6 );
+ PUSHs( sv_2mortal( newSVnv( a ) ) );
+ PUSHs( sv_2mortal( newSVnv( b ) ) );
+ PUSHs( sv_2mortal( newSVnv( c ) ) );
+ PUSHs( sv_2mortal( newSVnv( d ) ) );
+ PUSHs( sv_2mortal( newSVnv( tx ) ) );
+ PUSHs( sv_2mortal( newSVnv( ty ) ) );
+
+void
wxGraphicsMatrix::Invert ()
bool
wxGraphicsMatrix::IsEqual ( t )
wxGraphicsMatrix* t
- C_ARGS: *t
+ CODE:
+ RETVAL = THIS->IsEqual(*t);
+ OUTPUT: RETVAL
bool
wxGraphicsMatrix::IsIdentity ()
@@ -63,15 +71,33 @@
wxDouble d
wxDouble tx
wxDouble ty
-
- # TODO
- # wxGraphicsMatrix::TransformPoint
- # void TransformPoint(wxDouble* x, wxDouble* y) const
- # Applies this matrix to a point.
-
- # TODO
- # wxGraphicsMatrix::TransformDistance
- # void TransformDistance(wxDouble* dx, wxDouble* dy) const
- # Applies this matrix to a distance (ie. performs all transforms except translations)
-#endif
+void
+wxGraphicsMatrix::TransformPoint ( x, y )
+ wxDouble x
+ wxDouble y
+ PREINIT:
+ wxDouble x_out, y_out;
+ PPCODE:
+ x_out = x;
+ y_out = y;
+ THIS->TransformPoint( &x, &y );
+ EXTEND( SP, 2 );
+ PUSHs( sv_2mortal( newSVnv( x ) ) );
+ PUSHs( sv_2mortal( newSVnv( y ) ) );
+
+void
+wxGraphicsMatrix::TransformDistance ( dx, dy )
+ wxDouble dx
+ wxDouble dy
+ PREINIT:
+ wxDouble dx_out, dy_out;
+ PPCODE:
+ dx_out = dx;
+ dy_out = dy;
+ THIS->TransformDistance( &dx, &dy );
+ EXTEND( SP, 2 );
+ PUSHs( sv_2mortal( newSVnv( dx ) ) );
+ PUSHs( sv_2mortal( newSVnv( dy ) ) );
+
+#endif
\ No newline at end of file