2 %module
(package
="gfxprim.core") c_core
5 #include
"core/GP_Core.h"
9 * Basic types and common methods
14 %include
"GP_Transform.h"
15 %include
"GP_GetSetBits.h"
16 %include
"GP_Transform.h"
19 * Make members of GP_DebugMsg structure immutable
21 %immutable GP_DebugMsg
::level
;
22 %immutable GP_DebugMsg
::file
;
23 %immutable GP_DebugMsg
::fn
;
24 %immutable GP_DebugMsg
::line
;
25 %immutable GP_DebugMsg
::msg
;
26 %ignore GP_DebugPrint
;
34 %include
"GP_Pixel.gen.h" /* Includes enum GP_PixelType definition
*/
35 %include
"GP_Convert.h"
36 %import
"GP_Convert.gen.h"
37 %import
"GP_Convert_Scale.gen.h"
39 %import
"GP_FnPerBpp.h"
40 %import
"GP_FnPerBpp.gen.h"
43 const GP_PixelTypeDescription
*GP_PixelTypes_access
(GP_PixelType no
)
45 if
((signed
)no
< 0 || no
>= GP_PIXEL_MAX
) no
= GP_PIXEL_UNKNOWN
;
46 return
&GP_PixelTypes[no];
54 /* Make some members RO
*/
55 %immutable GP_Pixmap
::w
;
56 %immutable GP_Pixmap
::h
;
57 %immutable GP_Pixmap
::pixel_type
;
58 %immutable GP_Pixmap
::bpp
;
59 %immutable GP_Pixmap
::bytes_per_row
;
60 /* Rename
"internal" GP_Pixmap
*/
61 %rename
("_%s") "GP_Pixmap::pixels";
62 %rename
("_%s") "GP_Pixmap::offset";
63 %rename
("_%s") "GP_Pixmap::axes_swap";
64 %rename
("_%s") "GP_Pixmap::x_swap";
65 %rename
("_%s") "GP_Pixmap::y_swap";
66 %rename
("_%s") "GP_Pixmap::bit_endian";
67 %rename
("_%s") "GP_Pixmap::free_pixels";
70 PyObject
*GP_PixmapToByteArray
(GP_Pixmap
*self
)
72 return PyByteArray_FromStringAndSize
((char
*)self-
>pixels
,
73 self-
>bytes_per_row
* self-
>h
);
77 %feature
("autodoc", "Proxy of C GP_Pixmap struct
79 You can pass this class to wrapped GP_DrawSomething(...) as GP_Pixmap.
80 All attributes of GP_Pixmap are accessible directly as _attribute
81 (self._w etc.), but it is reccomended to use redefined properties:
83 self.w: Pixmap width (transformed)
84 self.h: Pixmap height (transformed)
85 self.pixel_type: Pixmap pixel type (number)
87 Some pixmap-related methods are provided as class members for convenience.
89 GP_Pixmap memory allocation is handled by gfxprim, deallocation by GP_PixmapFree().
90 The wrapper can be used without owning the GP_Pixmap struct by setting self.this
91 and self.thisown.") GP_Pixmap
;
95 GP_DEBUG
(2, "[wrapper] GP_PixmapFree (%dx%d raw, %dbpp, free_pixels:%d)",
96 $self-
>w
, $self-
>h
, $self-
>bpp
, $self-
>free_pixels
);
99 GP_Pixmap
(GP_Coord w
, GP_Coord h
, GP_PixelType typeno
) {
100 return GP_PixmapAlloc
(w
, h
, typeno
);
106 ERROR_ON_NONZERO
(GP_PixmapResize
);
107 ERROR_ON_NULL
(GP_PixmapAlloc
);
108 ERROR_ON_NULL
(GP_PixmapCopy
);
109 ERROR_ON_NULL
(GP_PixmapConvertAlloc
);
110 ERROR_ON_NULL
(GP_SubPixmapAlloc
);
112 /* Indicate new wrapper-owned GP_Pixmap
*/
113 %newobject GP_PixmapAlloc
;
114 %newobject GP_PixmapCopy
;
115 %newobject GP_PixmapConvertAlloc
;
116 %newobject GP_SubPixmapAlloc
;
118 %include
"GP_Pixmap.h"
121 * Pixmap manipulation
123 %include
"GP_GetPutPixel.h"
124 %import
"GP_GetPutPixel.gen.h"
125 %include
"GP_WritePixel.h"