Mercurial > hg > orthanc-python
comparison Sources/Autogenerated/sdk_OrthancPluginImage.methods.h @ 129:5643e97d9367 fix-leak
reproducible code generation
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 30 Aug 2023 11:40:22 +0200 |
parents | |
children | e9be3c9294d4 |
comparison
equal
deleted
inserted
replaced
128:5b59ebc267e1 | 129:5643e97d9367 |
---|---|
1 // Actual implementation of the methods | |
2 static PyObject *sdk_OrthancPluginImage_OrthancPluginGetImagePixelFormat( | |
3 sdk_OrthancPluginImage_Object* self, PyObject *args) | |
4 { | |
5 PythonLock::LogCall("Calling method OrthancPluginGetImagePixelFormat() on object of class OrthancPluginImage"); | |
6 | |
7 if (self->object_ == NULL) | |
8 { | |
9 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
10 return NULL; | |
11 } | |
12 | |
13 | |
14 OrthancPluginPixelFormat value = OrthancPluginGetImagePixelFormat(OrthancPlugins::GetGlobalContext(), self->object_); | |
15 | |
16 return PyLong_FromLong(value); | |
17 } | |
18 | |
19 static PyObject *sdk_OrthancPluginImage_OrthancPluginGetImageWidth( | |
20 sdk_OrthancPluginImage_Object* self, PyObject *args) | |
21 { | |
22 PythonLock::LogCall("Calling method OrthancPluginGetImageWidth() on object of class OrthancPluginImage"); | |
23 | |
24 if (self->object_ == NULL) | |
25 { | |
26 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
27 return NULL; | |
28 } | |
29 | |
30 | |
31 long value = OrthancPluginGetImageWidth(OrthancPlugins::GetGlobalContext(), self->object_); | |
32 | |
33 return PyLong_FromLong(value); | |
34 } | |
35 | |
36 static PyObject *sdk_OrthancPluginImage_OrthancPluginGetImageHeight( | |
37 sdk_OrthancPluginImage_Object* self, PyObject *args) | |
38 { | |
39 PythonLock::LogCall("Calling method OrthancPluginGetImageHeight() on object of class OrthancPluginImage"); | |
40 | |
41 if (self->object_ == NULL) | |
42 { | |
43 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
44 return NULL; | |
45 } | |
46 | |
47 | |
48 long value = OrthancPluginGetImageHeight(OrthancPlugins::GetGlobalContext(), self->object_); | |
49 | |
50 return PyLong_FromLong(value); | |
51 } | |
52 | |
53 static PyObject *sdk_OrthancPluginImage_OrthancPluginGetImagePitch( | |
54 sdk_OrthancPluginImage_Object* self, PyObject *args) | |
55 { | |
56 PythonLock::LogCall("Calling method OrthancPluginGetImagePitch() on object of class OrthancPluginImage"); | |
57 | |
58 if (self->object_ == NULL) | |
59 { | |
60 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
61 return NULL; | |
62 } | |
63 | |
64 | |
65 long value = OrthancPluginGetImagePitch(OrthancPlugins::GetGlobalContext(), self->object_); | |
66 | |
67 return PyLong_FromLong(value); | |
68 } | |
69 | |
70 static PyObject *sdk_OrthancPluginImage_OrthancPluginConvertPixelFormat( | |
71 sdk_OrthancPluginImage_Object* self, PyObject *args) | |
72 { | |
73 PythonLock::LogCall("Calling method OrthancPluginConvertPixelFormat() on object of class OrthancPluginImage"); | |
74 | |
75 if (self->object_ == NULL) | |
76 { | |
77 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
78 return NULL; | |
79 } | |
80 | |
81 long int arg0 = 0; | |
82 | |
83 if (!PyArg_ParseTuple(args, "l", &arg0)) | |
84 { | |
85 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (1 arguments expected)"); | |
86 return NULL; | |
87 } | |
88 // This is the case of a constructor | |
89 OrthancPluginImage* obj = OrthancPluginConvertPixelFormat(OrthancPlugins::GetGlobalContext(), self->object_, static_cast<OrthancPluginPixelFormat>(arg0)); | |
90 | |
91 if (obj == NULL) | |
92 { | |
93 PythonLock::RaiseException(OrthancPluginErrorCode_InternalError); | |
94 return NULL; | |
95 } | |
96 else | |
97 { | |
98 PyObject *argList = Py_BuildValue("Lb", obj, false /* not borrowed */); | |
99 PyObject *python = PyObject_CallObject((PyObject *) &sdk_OrthancPluginImage_Type, argList); | |
100 Py_DECREF(argList); | |
101 return python; | |
102 } | |
103 } | |
104 | |
105 static PyObject *sdk_OrthancPluginImage_OrthancPluginDrawText( | |
106 sdk_OrthancPluginImage_Object* self, PyObject *args) | |
107 { | |
108 PythonLock::LogCall("Calling method OrthancPluginDrawText() on object of class OrthancPluginImage"); | |
109 | |
110 if (self->object_ == NULL) | |
111 { | |
112 PyErr_SetString(PyExc_ValueError, "Invalid object"); | |
113 return NULL; | |
114 } | |
115 | |
116 unsigned long arg0 = 0; | |
117 const char* arg1 = NULL; | |
118 long int arg2 = 0; | |
119 long int arg3 = 0; | |
120 unsigned char arg4 = 0; | |
121 unsigned char arg5 = 0; | |
122 unsigned char arg6 = 0; | |
123 | |
124 if (!PyArg_ParseTuple(args, "ksllbbb", &arg0, &arg1, &arg2, &arg3, &arg4, &arg5, &arg6)) | |
125 { | |
126 PyErr_SetString(PyExc_TypeError, "Bad types for the arguments (7 arguments expected)"); | |
127 return NULL; | |
128 } | |
129 OrthancPluginErrorCode code = OrthancPluginDrawText(OrthancPlugins::GetGlobalContext(), self->object_, arg0, arg1, arg2, arg3, arg4, arg5, arg6); | |
130 | |
131 | |
132 if (code == OrthancPluginErrorCode_Success) | |
133 { | |
134 Py_INCREF(Py_None); | |
135 return Py_None; | |
136 } | |
137 else | |
138 { | |
139 PythonLock::RaiseException(code); | |
140 return NULL; | |
141 } | |
142 } | |
143 |