File: GraphicsRenderer.xsp

package info (click to toggle)
libwx-perl 1%3A0.9932-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,300 kB
  • sloc: cpp: 11,064; perl: 8,603; ansic: 711; makefile: 53
file content (163 lines) | stat: -rw-r--r-- 5,796 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#############################################################################
## Name:        XS/GraphicsRenderer.xsp
## Purpose:     XS for Wx::GraphicsRenderer
## Author:      Mattia Barbon
## Modified by:
## Created:     30/09/2007
## RCS-ID:      $Id: GraphicsRenderer.xsp 2952 2010-08-15 10:38:47Z mbarbon $
## Copyright:   (c) 2007, 2010 Klaas Hartmann
## Licence:     This program is free software; you can redistribute it and/or
##              modify it under the same terms as Perl itself
#############################################################################

%module{Wx};

%loadplugin{build::Wx::XSP::Overload};

#if wxUSE_GRAPHICS_CONTEXT

#include <wx/graphics.h>

## DECLARE_OVERLOAD( wmdc, Wx::MemoryDC )
## DECLARE_OVERLOAD( wwdc, Wx::WindowDC )
## DECLARE_OVERLOAD( wpdc, Wx::PrinterDC )

#if WXPERL_W_VERSION_GE( 2, 9, 1 )

%typemap{wxColour}{parsed}{%wxColour%};

%name{Wx::GraphicsGradientStop} class wxGraphicsGradientStop
{
public:
    wxGraphicsGradientStop( wxColour col = wxTransparentColour,
                            float pos = 0.);

%{
static void
wxGraphicsGradientStop::CLONE()
  CODE:
    wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );

## // thread OK
void
wxGraphicsGradientStop::DESTROY()
  CODE:
    wxPli_thread_sv_unregister( aTHX_ "Wx::GraphicsGradientStop", THIS, ST(0) );
    delete THIS;
%}

    const wxColour& GetColour() const;
    void SetColour( const wxColour& col );

    float GetPosition() const;
    void SetPosition( float pos );
};

%typemap{const wxGraphicsGradientStop&}{reference};

%name{Wx::GraphicsGradientStops} class wxGraphicsGradientStops
{
public:
    wxGraphicsGradientStops( wxColour startCol = wxTransparentColour,
                             wxColour endCol = wxTransparentColour );

%{
static void
wxGraphicsGradientStops::CLONE()
  CODE:
    wxPli_thread_sv_clone( aTHX_ CLASS, (wxPliCloneSV)wxPli_detach_object );

## // thread OK
void
wxGraphicsGradientStops::DESTROY()
  CODE:
    wxPli_thread_sv_unregister( aTHX_ "Wx::GraphicsGradientStop", THIS, ST(0) );
    delete THIS;
%}

    // Add a stop in correct order.
    %name{AddStop} void Add( const wxGraphicsGradientStop& stop ) %Overload;
    %name{AddColour} void Add( wxColour col, float pos ) %Overload;

    // Get the number of stops.
    unsigned GetCount() const;

    // Return the stop at the given index (which must be valid).
    const wxGraphicsGradientStop& Item( unsigned n ) const;

    // Get/set start and end colours.
    void SetStartColour( wxColour col );
    const wxColour& GetStartColour() const;
    void SetEndColour( wxColour col );
    const wxColour& GetEndColour() const;
};

%typemap{const wxGraphicsGradientStops&}{reference};

#endif

%name{Wx::GraphicsRenderer} class wxGraphicsRenderer
{
%{
wxGraphicsRenderer*
GetDefaultRenderer()
  CODE:
    RETVAL = wxGraphicsRenderer::GetDefaultRenderer();
  OUTPUT: RETVAL

void
CreateContext( ... )
  PPCODE:
    BEGIN_OVERLOAD()
        MATCH_REDISP( wxPliOvl_wwin, CreateFromWindow )   
#if defined(__WXMSW__) || WXPERL_W_VERSION_GE( 2, 9, 0 )       
        MATCH_REDISP( wxPliOvl_wmdc, CreateFromMemoryDC)
#endif     
#if wxPERL_USE_PRINTING_ARCHITECTURE && WXPERL_W_VERSION_GE( 2, 9, 0 )     
        MATCH_REDISP( wxPliOvl_wpdc, CreateFromPrinterDC)
#endif                  
        MATCH_REDISP( wxPliOvl_wwdc, CreateFromWindowDC )
    END_OVERLOAD( "Wx::GraphicsRenderer::CreateContext" )

%}

    %name{CreateFromWindowDC} wxGraphicsContext* CreateContext( const wxWindowDC& dc );
    %name{CreateFromWindow} wxGraphicsContext* CreateContext( wxWindow* window );
#if defined(__WXMSW__) || WXPERL_W_VERSION_GE( 2, 9, 0 )           
    %name{CreateFromMemoryDC} wxGraphicsContext* CreateContext( const wxMemoryDC& dc );
#endif
#if wxPERL_USE_PRINTING_ARCHITECTURE && WXPERL_W_VERSION_GE( 2, 9, 0 )     
    %name{CreateFromPrinterDC} wxGraphicsContext* CreateContext( const wxPrinterDC& dc );
#endif
    wxGraphicsContext* CreateMeasuringContext();
    const wxGraphicsPath& CreatePath();
    const wxGraphicsMatrix& CreateMatrix( wxDouble a=1.0, wxDouble b=0.0,
                                          wxDouble c=0.0, wxDouble d=1.0,
                                          wxDouble tx=0.0, wxDouble ty=0.0 );
##    const wxGraphicsPen& CreatePen( const wxGraphicsPenInfo& info );
    const wxGraphicsBrush& CreateBrush( const wxBrush& brush );

#if WXPERL_W_VERSION_LT( 2, 9, 1 )
    const wxGraphicsBrush& CreateLinearGradientBrush( wxDouble x1, wxDouble y1,
                                                      wxDouble x2, wxDouble y2,
                                                      const wxColour&c1, const wxColour&c2 );
    const wxGraphicsBrush& CreateRadialGradientBrush( wxDouble xo, wxDouble yo,
                                                      wxDouble xc, wxDouble yc,
                                                      wxDouble radius,
                                                      const wxColour &oColor, const wxColour &cColor );
#else
    const wxGraphicsBrush& CreateLinearGradientBrush( wxDouble x1, wxDouble y1,
                                                      wxDouble x2, wxDouble y2,
                                                      const wxGraphicsGradientStops& stops );
    const wxGraphicsBrush& CreateRadialGradientBrush( wxDouble xo, wxDouble yo,
                                                      wxDouble xc, wxDouble yc,
                                                      wxDouble radius,
                                                      const wxGraphicsGradientStops& stops );
#endif

#define wxBLACKPtr (wxColour*)wxBLACK
    const wxGraphicsFont& CreateFont( const wxFont& font,
                                      const wxColour& col = wxBLACKPtr );
};

#endif