blob: e331327b2511d09650f032237ad2c3f5f853ea3f [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001/*
cristy7e41fe82010-12-04 23:12:08 +00002 Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization
cristy3ed852e2009-09-05 21:47:34 +00003 dedicated to making software imaging solutions freely available.
4
5 You may not use this file except in compliance with the License.
6 obtain a copy of the License at
7
8 http://www.imagemagick.org/script/license.php
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16 MagickCore drawing methods.
17*/
18#ifndef _MAGICKCORE_DRAW_H
19#define _MAGICKCORE_DRAW_H
20
21#if defined(__cplusplus) || defined(c_plusplus)
22extern "C" {
23#endif
24
cristy4c08aed2011-07-01 19:47:50 +000025#include "MagickCore/geometry.h"
26#include "MagickCore/image.h"
27#include "MagickCore/pixel.h"
28#include "MagickCore/type.h"
cristy3ed852e2009-09-05 21:47:34 +000029
30typedef enum
31{
32 UndefinedAlign,
33 LeftAlign,
34 CenterAlign,
35 RightAlign
36} AlignType;
37
38typedef enum
39{
40 UndefinedPathUnits,
41 UserSpace,
42 UserSpaceOnUse,
43 ObjectBoundingBox
44} ClipPathUnits;
45
46typedef enum
47{
48 UndefinedDecoration,
49 NoDecoration,
50 UnderlineDecoration,
51 OverlineDecoration,
52 LineThroughDecoration
53} DecorationType;
54
55typedef enum
56{
cristyc9b12952010-03-28 01:12:28 +000057 UndefinedDirection,
cristybdcb4b72010-04-23 00:15:29 +000058 RightToLeftDirection,
59 LeftToRightDirection
cristyc9b12952010-03-28 01:12:28 +000060} DirectionType;
61
62typedef enum
63{
cristy3ed852e2009-09-05 21:47:34 +000064 UndefinedRule,
65#undef EvenOddRule
66 EvenOddRule,
67 NonZeroRule
68} FillRule;
69
70typedef enum
71{
72 UndefinedGradient,
73 LinearGradient,
74 RadialGradient
75} GradientType;
76
77typedef enum
78{
79 UndefinedCap,
80 ButtCap,
81 RoundCap,
82 SquareCap
83} LineCap;
84
85typedef enum
86{
87 UndefinedJoin,
88 MiterJoin,
89 RoundJoin,
90 BevelJoin
91} LineJoin;
92
93typedef enum
94{
95 UndefinedMethod,
96 PointMethod,
97 ReplaceMethod,
98 FloodfillMethod,
99 FillToBorderMethod,
100 ResetMethod
101} PaintMethod;
102
103typedef enum
104{
105 UndefinedPrimitive,
106 PointPrimitive,
107 LinePrimitive,
108 RectanglePrimitive,
109 RoundRectanglePrimitive,
110 ArcPrimitive,
111 EllipsePrimitive,
112 CirclePrimitive,
113 PolylinePrimitive,
114 PolygonPrimitive,
115 BezierPrimitive,
116 ColorPrimitive,
117 MattePrimitive,
118 TextPrimitive,
119 ImagePrimitive,
120 PathPrimitive
121} PrimitiveType;
122
123typedef enum
124{
125 UndefinedReference,
126 GradientReference
127} ReferenceType;
128
129typedef enum
130{
131 UndefinedSpread,
132 PadSpread,
133 ReflectSpread,
134 RepeatSpread
135} SpreadMethod;
136
cristy3ed852e2009-09-05 21:47:34 +0000137typedef struct _StopInfo
138{
cristy4c08aed2011-07-01 19:47:50 +0000139 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +0000140 color;
141
142 MagickRealType
143 offset;
144} StopInfo;
145
146typedef struct _GradientInfo
147{
148 GradientType
149 type;
150
151 RectangleInfo
152 bounding_box;
153
154 SegmentInfo
155 gradient_vector;
156
157 StopInfo
158 *stops;
159
cristybb503372010-05-27 20:51:26 +0000160 size_t
cristy3ed852e2009-09-05 21:47:34 +0000161 number_stops;
162
163 SpreadMethod
164 spread;
165
166 MagickBooleanType
167 debug;
168
cristybb503372010-05-27 20:51:26 +0000169 size_t
cristy3ed852e2009-09-05 21:47:34 +0000170 signature;
171
172 PointInfo
173 center;
174
175 MagickRealType
176 radius;
177} GradientInfo;
178
179typedef struct _ElementReference
180{
181 char
182 *id;
183
184 ReferenceType
185 type;
186
187 GradientInfo
188 gradient;
189
cristybb503372010-05-27 20:51:26 +0000190 size_t
cristy3ed852e2009-09-05 21:47:34 +0000191 signature;
192
193 struct _ElementReference
194 *previous,
195 *next;
196} ElementReference;
197
198typedef struct _DrawInfo
199{
200 char
201 *primitive,
202 *geometry;
203
204 RectangleInfo
205 viewbox;
206
207 AffineMatrix
208 affine;
209
210 GravityType
211 gravity;
212
cristy101ab702011-10-13 13:06:32 +0000213 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +0000214 fill,
215 stroke;
216
217 double
218 stroke_width;
219
220 GradientInfo
221 gradient;
222
223 Image
224 *fill_pattern,
cristy3ed852e2009-09-05 21:47:34 +0000225 *stroke_pattern;
226
227 MagickBooleanType
228 stroke_antialias,
229 text_antialias;
230
231 FillRule
232 fill_rule;
233
234 LineCap
235 linecap;
236
237 LineJoin
238 linejoin;
239
cristybb503372010-05-27 20:51:26 +0000240 size_t
cristy3ed852e2009-09-05 21:47:34 +0000241 miterlimit;
242
243 double
244 dash_offset;
245
246 DecorationType
247 decorate;
248
249 CompositeOperator
250 compose;
251
252 char
253 *text;
254
cristybb503372010-05-27 20:51:26 +0000255 size_t
cristy3ed852e2009-09-05 21:47:34 +0000256 face;
257
258 char
259 *font,
260 *metrics,
261 *family;
262
263 StyleType
264 style;
265
266 StretchType
267 stretch;
268
cristybb503372010-05-27 20:51:26 +0000269 size_t
cristy3ed852e2009-09-05 21:47:34 +0000270 weight;
271
272 char
273 *encoding;
274
275 double
276 pointsize;
277
278 char
279 *density;
280
281 AlignType
282 align;
283
cristy101ab702011-10-13 13:06:32 +0000284 PixelInfo
cristy3ed852e2009-09-05 21:47:34 +0000285 undercolor,
286 border_color;
287
288 char
289 *server_name;
290
291 double
292 *dash_pattern;
293
294 char
295 *clip_mask;
296
297 SegmentInfo
298 bounds;
299
300 ClipPathUnits
301 clip_units;
302
303 Quantum
cristy4c08aed2011-07-01 19:47:50 +0000304 alpha;
cristy3ed852e2009-09-05 21:47:34 +0000305
306 MagickBooleanType
307 render;
308
309 ElementReference
310 element_reference;
311
312 MagickBooleanType
313 debug;
314
cristybb503372010-05-27 20:51:26 +0000315 size_t
cristy3ed852e2009-09-05 21:47:34 +0000316 signature;
317
318 double
319 kerning,
cristyb32b90a2009-09-07 21:45:48 +0000320 interword_spacing,
cristy6ac8b332010-04-22 02:24:11 +0000321 interline_spacing;
322
323 DirectionType
cristyc9b12952010-03-28 01:12:28 +0000324 direction;
cristy3ed852e2009-09-05 21:47:34 +0000325} DrawInfo;
326
327typedef struct _PrimitiveInfo
328{
329 PointInfo
330 point;
331
cristybb503372010-05-27 20:51:26 +0000332 size_t
cristy3ed852e2009-09-05 21:47:34 +0000333 coordinates;
334
335 PrimitiveType
336 primitive;
337
338 PaintMethod
339 method;
340
341 char
342 *text;
343} PrimitiveInfo;
344
345typedef struct _TypeMetric
346{
347 PointInfo
348 pixels_per_em;
349
350 double
351 ascent,
352 descent,
353 width,
354 height,
355 max_advance,
356 underline_position,
357 underline_thickness;
358
359 SegmentInfo
360 bounds;
361
362 PointInfo
363 origin;
364} TypeMetric;
365
366extern MagickExport DrawInfo
367 *AcquireDrawInfo(void),
368 *CloneDrawInfo(const ImageInfo *,const DrawInfo *),
369 *DestroyDrawInfo(DrawInfo *);
370
371extern MagickExport MagickBooleanType
cristy947cb4c2011-10-20 18:41:46 +0000372 DrawAffineImage(Image *,const Image *,const AffineMatrix *,ExceptionInfo *),
cristy018f07f2011-09-04 21:15:19 +0000373 DrawClipPath(Image *,const DrawInfo *,const char *,ExceptionInfo *),
cristy947cb4c2011-10-20 18:41:46 +0000374 DrawGradientImage(Image *,const DrawInfo *,ExceptionInfo *),
cristy018f07f2011-09-04 21:15:19 +0000375 DrawImage(Image *,const DrawInfo *,ExceptionInfo *),
376 DrawPatternPath(Image *,const DrawInfo *,const char *,Image **,
377 ExceptionInfo *),
cristy947cb4c2011-10-20 18:41:46 +0000378 DrawPrimitive(Image *,const DrawInfo *,const PrimitiveInfo *,ExceptionInfo *);
cristy3ed852e2009-09-05 21:47:34 +0000379
380extern MagickExport void
381 GetAffineMatrix(AffineMatrix *),
382 GetDrawInfo(const ImageInfo *,DrawInfo *);
383
384#if defined(__cplusplus) || defined(c_plusplus)
385}
386#endif
387
388#endif