Coverage for /home/martinb/.local/share/virtualenvs/camcops/lib/python3.6/site-packages/wand/cdefs/drawing_wand.py : 95%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1""":mod:`wand.cdefs.drawing_wand` --- Drawing-Wand definitions
2~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4.. versionadded:: 0.5.0
5"""
6from ctypes import (POINTER, c_void_p, c_char_p, c_double, c_int, c_uint,
7 c_size_t, c_ubyte, c_ulong)
8from wand.cdefs.wandtypes import c_magick_char_p, c_ssize_t
9from wand.cdefs.structures import PointInfo
11__all__ = ('load',)
14def load(lib, IM_VERSION):
15 """Define Drawing Wand methods. The ImageMagick version is given as a
16 second argument for comparison. This will quick to determine which methods
17 are available from the library, and can be implemented as::
19 if IM_VERSION < 0x700:
20 # ... do ImageMagick-6 methods ...
21 else
22 # ... do ImageMagick-7 methods ...
24 .. seealso::
26 #include "wand/drawing-wand.h"
27 // Or
28 #include "MagickWand/drawing-wand.h"
30 :param lib: the loaded ``MagickWand`` library
31 :type lib: :class:`ctypes.CDLL`
32 :param IM_VERSION: the ImageMagick version number (i.e. 0x0689)
33 :type IM_VERSION: :class:`numbers.Integral`
35 .. versionadded:: 0.5.0
37 """
38 is_im_6 = IM_VERSION < 0x700
39 is_im_7 = IM_VERSION >= 0x700
40 lib.NewDrawingWand.restype = c_void_p
41 lib.CloneDrawingWand.argtypes = [c_void_p]
42 lib.CloneDrawingWand.restype = c_void_p
43 lib.DestroyDrawingWand.argtypes = [c_void_p]
44 lib.DestroyDrawingWand.restype = c_void_p
45 lib.IsDrawingWand.argtypes = [c_void_p]
46 lib.IsDrawingWand.restype = c_int
47 lib.DrawGetException.argtypes = [c_void_p, POINTER(c_int)]
48 lib.DrawGetException.restype = c_magick_char_p
49 lib.DrawClearException.argtypes = [c_void_p]
50 lib.DrawClearException.restype = c_int
51 lib.DrawAffine.argtypes = [c_void_p, c_void_p]
52 if is_im_7:
53 lib.DrawAlpha.argtypes = [c_void_p, c_double, c_double, c_int]
54 lib.DrawComment.argtypes = [c_void_p, c_char_p]
55 lib.DrawComposite.argtypes = [
56 c_void_p, c_int, c_double, c_double, c_double, c_double, c_void_p
57 ]
58 lib.DrawComposite.restype = c_uint
59 lib.DrawSetBorderColor.argtypes = [c_void_p, c_void_p]
60 lib.DrawSetClipPath.argtypes = [c_void_p, c_char_p]
61 lib.DrawSetClipPath.restype = c_int
62 lib.DrawSetClipRule.argtypes = [c_void_p, c_uint]
63 lib.DrawSetClipUnits.argtypes = [c_void_p, c_uint]
64 lib.DrawSetFont.argtypes = [c_void_p, c_char_p]
65 lib.DrawSetFontFamily.argtypes = [c_void_p, c_char_p]
66 lib.DrawSetFontFamily.restype = c_uint
67 lib.DrawSetFontResolution.argtypes = [c_void_p, c_double, c_double]
68 lib.DrawSetFontResolution.restype = c_uint
69 lib.DrawSetFontSize.argtypes = [c_void_p, c_double]
70 lib.DrawSetFontStretch.argtypes = [c_void_p, c_int]
71 lib.DrawSetFontStyle.argtypes = [c_void_p, c_int]
72 lib.DrawSetFontWeight.argtypes = [c_void_p, c_size_t]
73 lib.DrawSetFillColor.argtypes = [c_void_p, c_void_p]
74 lib.DrawSetFillOpacity.argtypes = [c_void_p, c_double]
75 lib.DrawSetFillPatternURL.argtypes = [c_void_p, c_char_p]
76 lib.DrawSetFillPatternURL.restype = c_uint
77 lib.DrawSetFillRule.argtypes = [c_void_p, c_uint]
78 lib.DrawSetOpacity.argtypes = [c_void_p, c_double]
79 lib.DrawSetStrokeAntialias.argtypes = [c_void_p, c_int]
80 lib.DrawSetStrokeColor.argtypes = [c_void_p, c_void_p]
81 lib.DrawSetStrokeDashArray.argtypes = [
82 c_void_p, c_size_t, POINTER(c_double)
83 ]
84 lib.DrawSetStrokeDashOffset.argtypes = [c_void_p, c_double]
85 lib.DrawSetStrokeLineCap.argtypes = [c_void_p, c_int]
86 lib.DrawSetStrokeLineJoin.argtypes = [c_void_p, c_int]
87 lib.DrawSetStrokeMiterLimit.argtypes = [c_void_p, c_size_t]
88 lib.DrawSetStrokeOpacity.argtypes = [c_void_p, c_double]
89 lib.DrawSetStrokePatternURL.argtypes = [c_void_p, c_char_p]
90 lib.DrawSetStrokePatternURL.restype = c_uint
91 lib.DrawSetStrokeWidth.argtypes = [c_void_p, c_double]
92 lib.DrawSetTextAlignment.argtypes = [c_void_p, c_int]
93 lib.DrawSetTextAntialias.argtypes = [c_void_p, c_int]
94 lib.DrawSetTextDecoration.argtypes = [c_void_p, c_int]
95 try:
96 lib.DrawSetTextDirection.argtypes = [c_void_p, c_int]
97 except AttributeError:
98 lib.DrawSetTextDirection = None
99 lib.DrawSetTextEncoding.argtypes = [c_void_p, c_char_p]
100 try:
101 lib.DrawSetTextInterlineSpacing.argtypes = [c_void_p, c_double]
102 except AttributeError:
103 lib.DrawSetTextInterlineSpacing = None
104 lib.DrawSetTextInterwordSpacing.argtypes = [c_void_p, c_double]
105 lib.DrawSetTextKerning.argtypes = [c_void_p, c_double]
106 lib.DrawSetTextUnderColor.argtypes = [c_void_p, c_void_p]
107 lib.DrawSetVectorGraphics.argtypes = [c_void_p, c_char_p]
108 lib.DrawSetVectorGraphics.restype = c_int
109 lib.DrawResetVectorGraphics.argtypes = [c_void_p]
110 lib.DrawSetViewbox.argtypes = [
111 c_void_p, c_ssize_t, c_ssize_t, c_ssize_t, c_ssize_t
112 ]
113 lib.DrawGetBorderColor.argtypes = [c_void_p, c_void_p]
114 lib.DrawGetClipPath.argtypes = [c_void_p]
115 lib.DrawGetClipPath.restype = c_magick_char_p
116 lib.DrawGetClipRule.argtypes = [c_void_p]
117 lib.DrawGetClipRule.restype = c_uint
118 lib.DrawGetClipUnits.argtypes = [c_void_p]
119 lib.DrawGetClipUnits.restype = c_uint
120 lib.DrawGetFillColor.argtypes = [c_void_p, c_void_p]
121 lib.DrawGetFillOpacity.argtypes = [c_void_p]
122 lib.DrawGetFillOpacity.restype = c_double
123 lib.DrawGetFillRule.argtypes = [c_void_p]
124 lib.DrawGetFillRule.restype = c_uint
125 lib.DrawGetOpacity.argtypes = [c_void_p]
126 lib.DrawGetOpacity.restype = c_double
127 lib.DrawGetStrokeAntialias.argtypes = [c_void_p]
128 lib.DrawGetStrokeAntialias.restype = c_int
129 lib.DrawGetStrokeColor.argtypes = [c_void_p, c_void_p]
130 lib.DrawGetStrokeDashArray.argtypes = [c_void_p, POINTER(c_size_t)]
131 lib.DrawGetStrokeDashArray.restype = POINTER(c_double)
132 lib.DrawGetStrokeDashOffset.argtypes = [c_void_p]
133 lib.DrawGetStrokeDashOffset.restype = c_double
134 lib.DrawGetStrokeLineCap.argtypes = [c_void_p]
135 lib.DrawGetStrokeLineCap.restype = c_int
136 lib.DrawGetStrokeLineJoin.argtypes = [c_void_p]
137 lib.DrawGetStrokeLineJoin.restype = c_int
138 lib.DrawGetStrokeMiterLimit.argtypes = [c_void_p]
139 lib.DrawGetStrokeMiterLimit.restype = c_size_t
140 lib.DrawGetStrokeOpacity.argtypes = [c_void_p]
141 lib.DrawGetStrokeOpacity.restype = c_double
142 lib.DrawGetStrokeWidth.argtypes = [c_void_p]
143 lib.DrawGetStrokeWidth.restype = c_double
144 lib.DrawGetFont.argtypes = [c_void_p]
145 lib.DrawGetFont.restype = c_magick_char_p
146 lib.DrawGetFontFamily.argtypes = [c_void_p]
147 lib.DrawGetFontFamily.restype = c_magick_char_p
148 lib.DrawGetFontResolution.argtypes = [
149 c_void_p, POINTER(c_double), POINTER(c_double)
150 ]
151 lib.DrawGetFontResolution.restype = c_uint
152 lib.DrawGetFontSize.argtypes = [c_void_p]
153 lib.DrawGetFontSize.restype = c_double
154 lib.DrawGetFontStyle.argtypes = [c_void_p]
155 lib.DrawGetFontStyle.restype = c_int
156 lib.DrawGetFontWeight.argtypes = [c_void_p]
157 lib.DrawGetFontWeight.restype = c_size_t
158 lib.DrawGetFontStretch.argtypes = [c_void_p]
159 lib.DrawGetFontStretch.restype = c_int
160 lib.DrawGetTextAlignment.argtypes = [c_void_p]
161 lib.DrawGetTextAlignment.restype = c_int
162 lib.DrawGetTextAntialias.argtypes = [c_void_p]
163 lib.DrawGetTextAntialias.restype = c_int
164 lib.DrawGetTextDecoration.argtypes = [c_void_p]
165 lib.DrawGetTextDecoration.restype = c_int
166 try:
167 lib.DrawGetTextDirection.argtypes = [c_void_p]
168 lib.DrawGetTextDirection.restype = c_int
169 except AttributeError:
170 lib.DrawGetTextDirection = None
171 lib.DrawGetTextEncoding.argtypes = [c_void_p]
172 lib.DrawGetTextEncoding.restype = c_magick_char_p
173 try:
174 lib.DrawGetTextInterlineSpacing.argtypes = [c_void_p]
175 lib.DrawGetTextInterlineSpacing.restype = c_double
176 except AttributeError:
177 lib.DrawGetTextInterlineSpacing = None
178 lib.DrawGetTextInterwordSpacing.argtypes = [c_void_p]
179 lib.DrawGetTextInterwordSpacing.restype = c_double
180 lib.DrawGetTextKerning.argtypes = [c_void_p]
181 lib.DrawGetTextKerning.restype = c_double
182 lib.DrawGetTextUnderColor.argtypes = [c_void_p, c_void_p]
183 lib.DrawGetVectorGraphics.argtypes = [c_void_p]
184 lib.DrawGetVectorGraphics.restype = c_magick_char_p
185 lib.DrawSetGravity.argtypes = [c_void_p, c_int]
186 lib.DrawGetGravity.argtypes = [c_void_p]
187 lib.DrawGetGravity.restype = c_int
188 lib.ClearDrawingWand.argtypes = [c_void_p]
189 lib.DrawAnnotation.argtypes = [
190 c_void_p, c_double, c_double, POINTER(c_ubyte)
191 ]
192 lib.DrawArc.argtypes = [
193 c_void_p, c_double, c_double, c_double, c_double, c_double, c_double
194 ]
195 lib.DrawBezier.argtypes = [c_void_p, c_ulong, POINTER(PointInfo)]
196 lib.DrawCircle.argtypes = [
197 c_void_p, c_double, c_double, c_double, c_double
198 ]
199 lib.DrawColor.argtypes = [c_void_p, c_double, c_double, c_uint]
200 lib.DrawEllipse.argtypes = [
201 c_void_p, c_double, c_double, c_double, c_double, c_double, c_double
202 ]
203 lib.DrawLine.argtypes = [c_void_p, c_double, c_double, c_double, c_double]
204 if is_im_6:
205 lib.DrawMatte.argtypes = [c_void_p, c_double, c_double, c_int]
206 else:
207 lib.DrawMatte = None
208 lib.DrawPathClose.argtypes = [c_void_p]
209 lib.DrawPathCurveToAbsolute.argtypes = [
210 c_void_p, c_double, c_double, c_double, c_double, c_double, c_double
211 ]
212 lib.DrawPathCurveToRelative.argtypes = [
213 c_void_p, c_double, c_double, c_double, c_double, c_double, c_double
214 ]
215 lib.DrawPathCurveToQuadraticBezierAbsolute.argtypes = [
216 c_void_p, c_double, c_double, c_double, c_double
217 ]
218 lib.DrawPathCurveToQuadraticBezierRelative.argtypes = [
219 c_void_p, c_double, c_double, c_double, c_double
220 ]
221 lib.DrawPathCurveToQuadraticBezierSmoothAbsolute.argtypes = [
222 c_void_p, c_double, c_double
223 ]
224 lib.DrawPathCurveToQuadraticBezierSmoothRelative.argtypes = [
225 c_void_p, c_double, c_double
226 ]
227 lib.DrawPathCurveToSmoothAbsolute.argtypes = [
228 c_void_p, c_double, c_double, c_double, c_double
229 ]
230 lib.DrawPathCurveToSmoothRelative.argtypes = [
231 c_void_p, c_double, c_double, c_double, c_double
232 ]
233 lib.DrawPathEllipticArcAbsolute.argtypes = [
234 c_void_p, c_double, c_double, c_double, c_uint, c_uint, c_double,
235 c_double
236 ]
237 lib.DrawPathEllipticArcRelative.argtypes = [
238 c_void_p, c_double, c_double, c_double, c_uint, c_uint, c_double,
239 c_double
240 ]
241 lib.DrawPathFinish.argtypes = [c_void_p]
242 lib.DrawPathLineToAbsolute.argtypes = [c_void_p, c_double, c_double]
243 lib.DrawPathLineToRelative.argtypes = [c_void_p, c_double, c_double]
244 lib.DrawPathLineToHorizontalAbsolute.argtypes = [c_void_p, c_double]
245 lib.DrawPathLineToHorizontalRelative.argtypes = [c_void_p, c_double]
246 lib.DrawPathLineToVerticalAbsolute.argtypes = [c_void_p, c_double]
247 lib.DrawPathLineToVerticalRelative.argtypes = [c_void_p, c_double]
248 lib.DrawPathMoveToAbsolute.argtypes = [c_void_p, c_double, c_double]
249 lib.DrawPathMoveToRelative.argtypes = [c_void_p, c_double, c_double]
250 lib.DrawPathStart.argtypes = [c_void_p]
251 lib.DrawPoint.argtypes = [c_void_p, c_double, c_double]
252 lib.DrawPolygon.argtypes = [c_void_p, c_ulong, POINTER(PointInfo)]
253 lib.DrawPolyline.argtypes = [c_void_p, c_ulong, POINTER(PointInfo)]
254 lib.DrawRotate.argtypes = [c_void_p, c_double]
255 lib.DrawRectangle.argtypes = [
256 c_void_p, c_double, c_double, c_double, c_double
257 ]
258 lib.DrawRoundRectangle.argtypes = [
259 c_void_p, c_double, c_double, c_double, c_double, c_double, c_double
260 ]
261 lib.DrawScale.argtypes = [c_void_p, c_double, c_double]
262 lib.DrawSkewX.argtypes = [c_void_p, c_double]
263 lib.DrawSkewY.argtypes = [c_void_p, c_double]
264 lib.DrawTranslate.argtypes = [c_void_p, c_double, c_double]
265 lib.PushDrawingWand.argtypes = [c_void_p]
266 lib.PushDrawingWand.restype = c_uint
267 lib.DrawPushClipPath.argtypes = [c_void_p, c_char_p]
268 lib.DrawPushDefs.argtypes = [c_void_p]
269 lib.DrawPushPattern.argtypes = [
270 c_void_p, c_char_p, c_double, c_double, c_double, c_double
271 ]
272 lib.DrawPushClipPath.restype = c_uint
273 lib.PopDrawingWand.argtypes = [c_void_p]
274 lib.PopDrawingWand.restype = c_uint
275 lib.DrawPopClipPath.argtypes = [c_void_p]
276 lib.DrawPopDefs.argtypes = [c_void_p]
277 lib.DrawPopPattern.argtypes = [c_void_p]