|
Lines 17-23
Link Here
|
| 17 |
*/ |
17 |
*/ |
| 18 |
|
18 |
|
| 19 |
#include <Python.h> |
19 |
#include <Python.h> |
| 20 |
#include <wand/MagickWand.h> |
20 |
#include <wand/magick_wand.h> |
| 21 |
|
21 |
|
| 22 |
static PyObject * |
22 |
static PyObject * |
| 23 |
im_InitMagick(PyObject *self, PyObject *args) { |
23 |
im_InitMagick(PyObject *self, PyObject *args) { |
|
Lines 21-28
Link Here
|
| 21 |
|
21 |
|
| 22 |
static PyObject * |
22 |
static PyObject * |
| 23 |
im_InitMagick(PyObject *self, PyObject *args) { |
23 |
im_InitMagick(PyObject *self, PyObject *args) { |
|
|
24 |
const char *path = NULL; |
| 25 |
PyObject *py_path = NULL; |
| 26 |
if (PyArg_UnpackTuple(args, "path", 0, 1, &py_path)) { |
| 27 |
path = PyString_AsString(py_path); |
| 28 |
} |
| 24 |
|
29 |
|
| 25 |
MagickWandGenesis(); |
30 |
InitializeMagick(path); |
| 26 |
|
31 |
|
| 27 |
Py_INCREF(Py_None); |
32 |
Py_INCREF(Py_None); |
| 28 |
return Py_None; |
33 |
return Py_None; |
|
Lines 30-37
Link Here
|
| 30 |
|
35 |
|
| 31 |
static PyObject * |
36 |
static PyObject * |
| 32 |
im_TerminateMagick(PyObject *self, PyObject *args) { |
37 |
im_TerminateMagick(PyObject *self, PyObject *args) { |
| 33 |
|
38 |
DestroyMagick(); |
| 34 |
MagickWandTerminus(); |
|
|
| 35 |
|
39 |
|
| 36 |
Py_INCREF(Py_None); |
40 |
Py_INCREF(Py_None); |
| 37 |
return Py_None; |
41 |
return Py_None; |
|
Lines 53-59
Link Here
|
| 53 |
void *magick_pointer; |
57 |
void *magick_pointer; |
| 54 |
MagickWand *magick_wand; |
58 |
MagickWand *magick_wand; |
| 55 |
char *filepath = NULL; |
59 |
char *filepath = NULL; |
| 56 |
MagickBooleanType status; |
60 |
MagickBool status; |
| 57 |
|
61 |
|
| 58 |
if (!PyArg_ParseTuple(args, "Os", &magick_pointer, &filepath)){ |
62 |
if (!PyArg_ParseTuple(args, "Os", &magick_pointer, &filepath)){ |
| 59 |
return Py_BuildValue("i", 0); |
63 |
return Py_BuildValue("i", 0); |
|
Lines 75-81
Link Here
|
| 75 |
void *magick_pointer; |
79 |
void *magick_pointer; |
| 76 |
MagickWand *magick_wand; |
80 |
MagickWand *magick_wand; |
| 77 |
char *filepath = NULL; |
81 |
char *filepath = NULL; |
| 78 |
MagickBooleanType status; |
82 |
MagickBool status; |
| 79 |
|
83 |
|
| 80 |
if (!PyArg_ParseTuple(args, "Os", &magick_pointer, &filepath)){ |
84 |
if (!PyArg_ParseTuple(args, "Os", &magick_pointer, &filepath)){ |
| 81 |
return Py_BuildValue("i", 0); |
85 |
return Py_BuildValue("i", 0); |
|
Lines 130-136
Link Here
|
| 130 |
|
134 |
|
| 131 |
void *magick_pointer; |
135 |
void *magick_pointer; |
| 132 |
MagickWand *magick_wand; |
136 |
MagickWand *magick_wand; |
| 133 |
MagickBooleanType status; |
137 |
MagickBool status; |
| 134 |
|
138 |
|
| 135 |
if (!PyArg_ParseTuple(args, "O", &magick_pointer)){ |
139 |
if (!PyArg_ParseTuple(args, "O", &magick_pointer)){ |
| 136 |
Py_INCREF(Py_None); |
140 |
Py_INCREF(Py_None); |
|
Lines 165-171
Link Here
|
| 165 |
// ColorSeparationType, |
165 |
// ColorSeparationType, |
| 166 |
// ColorSeparationMatteType, |
166 |
// ColorSeparationMatteType, |
| 167 |
// OptimizeType, |
167 |
// OptimizeType, |
| 168 |
// PaletteBilevelMatteType |
|
|
| 169 |
|
168 |
|
| 170 |
static PyObject * |
169 |
static PyObject * |
| 171 |
im_GetImageType(PyObject *self, PyObject *args) { |
170 |
im_GetImageType(PyObject *self, PyObject *args) { |
|
Lines 212-220
Link Here
|
| 212 |
else if (img_type == OptimizeType){ |
211 |
else if (img_type == OptimizeType){ |
| 213 |
return Py_BuildValue("s", "OptimizeType"); |
212 |
return Py_BuildValue("s", "OptimizeType"); |
| 214 |
} |
213 |
} |
| 215 |
else if (img_type == PaletteBilevelMatteType){ |
|
|
| 216 |
return Py_BuildValue("s", "PaletteBilevelMatteType"); |
| 217 |
} |
| 218 |
else { |
214 |
else { |
| 219 |
return Py_BuildValue("s", "UndefinedType"); |
215 |
return Py_BuildValue("s", "UndefinedType"); |
| 220 |
} |
216 |
} |
|
Lines 227-233
Link Here
|
| 227 |
//GRAYColorspace, |
223 |
//GRAYColorspace, |
| 228 |
//TransparentColorspace, |
224 |
//TransparentColorspace, |
| 229 |
//OHTAColorspace, |
225 |
//OHTAColorspace, |
| 230 |
//LabColorspace, |
|
|
| 231 |
//XYZColorspace, |
226 |
//XYZColorspace, |
| 232 |
//YCbCrColorspace, |
227 |
//YCbCrColorspace, |
| 233 |
//YCCColorspace, |
228 |
//YCCColorspace, |
|
Lines 236-250
Link Here
|
| 236 |
//YUVColorspace, |
231 |
//YUVColorspace, |
| 237 |
//CMYKColorspace, |
232 |
//CMYKColorspace, |
| 238 |
//sRGBColorspace, |
233 |
//sRGBColorspace, |
| 239 |
//HSBColorspace, |
|
|
| 240 |
//HSLColorspace, |
234 |
//HSLColorspace, |
| 241 |
//HWBColorspace, |
235 |
//HWBColorspace, |
| 242 |
//Rec601LumaColorspace, |
236 |
//Rec601LumaColorspace, |
| 243 |
//Rec601YCbCrColorspace, |
237 |
//Rec601YCbCrColorspace, |
| 244 |
//Rec709LumaColorspace, |
238 |
//Rec709LumaColorspace, |
| 245 |
//Rec709YCbCrColorspace, |
239 |
//Rec709YCbCrColorspace, |
| 246 |
//LogColorspace, |
|
|
| 247 |
//CMYColorspace |
| 248 |
|
240 |
|
| 249 |
static PyObject * |
241 |
static PyObject * |
| 250 |
im_GetColorspace(PyObject *self, PyObject *args) { |
242 |
im_GetColorspace(PyObject *self, PyObject *args) { |
|
Lines 273-281
Link Here
|
| 273 |
else if (cs == OHTAColorspace){ |
265 |
else if (cs == OHTAColorspace){ |
| 274 |
return Py_BuildValue("s", "OHTAColorspace"); |
266 |
return Py_BuildValue("s", "OHTAColorspace"); |
| 275 |
} |
267 |
} |
| 276 |
else if (cs == LabColorspace){ |
|
|
| 277 |
return Py_BuildValue("s", "LabColorspace"); |
| 278 |
} |
| 279 |
else if (cs == XYZColorspace){ |
268 |
else if (cs == XYZColorspace){ |
| 280 |
return Py_BuildValue("s", "XYZColorspace"); |
269 |
return Py_BuildValue("s", "XYZColorspace"); |
| 281 |
} |
270 |
} |
|
Lines 300-308
Link Here
|
| 300 |
else if (cs == sRGBColorspace){ |
289 |
else if (cs == sRGBColorspace){ |
| 301 |
return Py_BuildValue("s", "sRGBColorspace"); |
290 |
return Py_BuildValue("s", "sRGBColorspace"); |
| 302 |
} |
291 |
} |
| 303 |
else if (cs == HSBColorspace){ |
|
|
| 304 |
return Py_BuildValue("s", "HSBColorspace"); |
| 305 |
} |
| 306 |
else if (cs == HSLColorspace){ |
292 |
else if (cs == HSLColorspace){ |
| 307 |
return Py_BuildValue("s", "HSLColorspace"); |
293 |
return Py_BuildValue("s", "HSLColorspace"); |
| 308 |
} |
294 |
} |
|
Lines 321-332
Link Here
|
| 321 |
else if (cs == Rec709YCbCrColorspace){ |
307 |
else if (cs == Rec709YCbCrColorspace){ |
| 322 |
return Py_BuildValue("s", "Rec709YCbCrColorspace"); |
308 |
return Py_BuildValue("s", "Rec709YCbCrColorspace"); |
| 323 |
} |
309 |
} |
| 324 |
else if (cs == LogColorspace){ |
|
|
| 325 |
return Py_BuildValue("s", "LogColorspace"); |
| 326 |
} |
| 327 |
else if (cs == CMYColorspace){ |
| 328 |
return Py_BuildValue("s", "CMYColorspace"); |
| 329 |
} |
| 330 |
else { |
310 |
else { |
| 331 |
return Py_BuildValue("s", "UndefinedColorspace"); |
311 |
return Py_BuildValue("s", "UndefinedColorspace"); |
| 332 |
} |
312 |
} |