MagickCore  6.9.13-22
Convert, Edit, Or Compose Bitmap Images
draw.h
1 /*
2  Copyright 1999 ImageMagick Studio LLC, a non-profit organization
3  dedicated to making software imaging solutions freely available.
4 
5  You may not use this file except in compliance with the License. You may
6  obtain a copy of the License at
7 
8  https://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 #include "magick/geometry.h"
22 #include "magick/image.h"
23 #include "magick/pixel.h"
24 #include "magick/type.h"
25 #include "magick/color.h"
26 
27 #if defined(__cplusplus) || defined(c_plusplus)
28 extern "C" {
29 #endif
30 
31 typedef enum
32 {
33  UndefinedAlign,
34  LeftAlign,
35  CenterAlign,
36  RightAlign
37 } AlignType;
38 
39 typedef enum
40 {
41  UndefinedPathUnits,
42  UserSpace,
43  UserSpaceOnUse,
44  ObjectBoundingBox
45 } ClipPathUnits;
46 
47 typedef enum
48 {
49  UndefinedDecoration,
50  NoDecoration,
51  UnderlineDecoration,
52  OverlineDecoration,
53  LineThroughDecoration
54 } DecorationType;
55 
56 typedef enum
57 {
58  UndefinedDirection,
59  RightToLeftDirection,
60  LeftToRightDirection,
61  TopToBottomDirection
62 } DirectionType;
63 
64 typedef enum
65 {
66  UndefinedRule,
67 #undef EvenOddRule
68  EvenOddRule,
69  NonZeroRule
70 } FillRule;
71 
72 typedef enum
73 {
74  UndefinedGradient,
75  LinearGradient,
76  RadialGradient
77 } GradientType;
78 
79 typedef enum
80 {
81  UndefinedCap,
82  ButtCap,
83  RoundCap,
84  SquareCap
85 } LineCap;
86 
87 typedef enum
88 {
89  UndefinedJoin,
90  MiterJoin,
91  RoundJoin,
92  BevelJoin
93 } LineJoin;
94 
95 typedef enum
96 {
97  UndefinedMethod,
98  PointMethod,
99  ReplaceMethod,
100  FloodfillMethod,
101  FillToBorderMethod,
102  ResetMethod
103 } PaintMethod;
104 
105 typedef enum
106 {
107  UndefinedPrimitive,
108  PointPrimitive,
109  LinePrimitive,
110  RectanglePrimitive,
111  RoundRectanglePrimitive,
112  ArcPrimitive,
113  EllipsePrimitive,
114  CirclePrimitive,
115  PolylinePrimitive,
116  PolygonPrimitive,
117  BezierPrimitive,
118  ColorPrimitive,
119  MattePrimitive,
120  TextPrimitive,
121  ImagePrimitive,
122  PathPrimitive
123 } PrimitiveType;
124 
125 typedef enum
126 {
127  UndefinedReference,
128  GradientReference
129 } ReferenceType;
130 
131 typedef enum
132 {
133  UndefinedSpread,
134  PadSpread,
135  ReflectSpread,
136  RepeatSpread
137 } SpreadMethod;
138 
139 typedef struct _PointInfo
140 {
141  double
142  x,
143  y;
144 } PointInfo;
145 
146 typedef struct _StopInfo
147 {
149  color;
150 
151  MagickRealType
152  offset;
153 } StopInfo;
154 
155 typedef struct _GradientInfo
156 {
157  GradientType
158  type;
159 
161  bounding_box;
162 
164  gradient_vector;
165 
166  StopInfo
167  *stops;
168 
169  size_t
170  number_stops;
171 
172  SpreadMethod
173  spread;
174 
175  MagickBooleanType
176  debug;
177 
178  size_t
179  signature;
180 
181  PointInfo
182  center;
183 
184  MagickRealType
185  radius,
186  angle;
187 
188  PointInfo
189  radii;
190 } GradientInfo;
191 
192 typedef struct _ElementReference
193 {
194  char
195  *id;
196 
197  ReferenceType
198  type;
199 
201  gradient;
202 
203  size_t
204  signature;
205 
206  struct _ElementReference
207  *previous,
208  *next;
210 
211 typedef struct _DrawInfo
212 {
213  char
214  *primitive,
215  *geometry;
216 
218  viewbox;
219 
221  affine;
222 
223  GravityType
224  gravity;
225 
227  fill,
228  stroke;
229 
230  double
231  stroke_width;
232 
234  gradient;
235 
236  Image
237  *fill_pattern,
238  *tile,
239  *stroke_pattern;
240 
241  MagickBooleanType
242  stroke_antialias,
243  text_antialias;
244 
245  FillRule
246  fill_rule;
247 
248  LineCap
249  linecap;
250 
251  LineJoin
252  linejoin;
253 
254  size_t
255  miterlimit;
256 
257  double
258  dash_offset;
259 
260  DecorationType
261  decorate;
262 
263  CompositeOperator
264  compose;
265 
266  char
267  *text;
268 
269  size_t
270  face;
271 
272  char
273  *font,
274  *metrics,
275  *family;
276 
277  StyleType
278  style;
279 
280  StretchType
281  stretch;
282 
283  size_t
284  weight;
285 
286  char
287  *encoding;
288 
289  double
290  pointsize;
291 
292  char
293  *density;
294 
295  AlignType
296  align;
297 
299  undercolor,
300  border_color;
301 
302  char
303  *server_name;
304 
305  double
306  *dash_pattern;
307 
308  char
309  *clip_mask;
310 
312  bounds;
313 
314  ClipPathUnits
315  clip_units;
316 
317  Quantum
318  opacity;
319 
320  MagickBooleanType
321  render;
322 
324  element_reference;
325 
326  MagickBooleanType
327  debug;
328 
329  size_t
330  signature;
331 
332  double
333  kerning,
334  interword_spacing,
335  interline_spacing;
336 
337  DirectionType
338  direction;
339 
340  double
341  fill_opacity,
342  stroke_opacity;
343 
344  MagickBooleanType
345  clip_path;
346 
347  Image
348  *clipping_mask;
349 
350  ComplianceType
351  compliance;
352 
353  Image
354  *composite_mask;
355 
356  char
357  *id;
358 
359  ImageInfo
360  *image_info;
361 } DrawInfo;
362 
363 typedef struct _PrimitiveInfo
364 {
365  PointInfo
366  point;
367 
368  size_t
369  coordinates;
370 
371  PrimitiveType
372  primitive;
373 
374  PaintMethod
375  method;
376 
377  char
378  *text;
379 
380  MagickBooleanType
381  closed_subpath;
382 } PrimitiveInfo;
383 
384 typedef struct _TypeMetric
385 {
386  PointInfo
387  pixels_per_em;
388 
389  double
390  ascent,
391  descent,
392  width,
393  height,
394  max_advance,
395  underline_position,
396  underline_thickness;
397 
399  bounds;
400 
401  PointInfo
402  origin;
403 } TypeMetric;
404 
405 extern MagickExport DrawInfo
406  *AcquireDrawInfo(void),
407  *CloneDrawInfo(const ImageInfo *,const DrawInfo *),
408  *DestroyDrawInfo(DrawInfo *);
409 
410 extern MagickExport MagickBooleanType
411  DrawAffineImage(Image *,const Image *,const AffineMatrix *),
412  DrawClipPath(Image *,const DrawInfo *,const char *),
413  DrawGradientImage(Image *,const DrawInfo *),
414  DrawImage(Image *,const DrawInfo *),
415  DrawPatternPath(Image *,const DrawInfo *,const char *,Image **),
416  DrawPrimitive(Image *,const DrawInfo *,const PrimitiveInfo *);
417 
418 extern MagickExport void
419  GetAffineMatrix(AffineMatrix *),
420  GetDrawInfo(const ImageInfo *,DrawInfo *);
421 
422 #if defined(__cplusplus) || defined(c_plusplus)
423 }
424 #endif
425 
426 #endif
Definition: image.h:134