MagickCore  7.1.0
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 "MagickCore/geometry.h"
22 #include "MagickCore/image.h"
23 #include "MagickCore/pixel.h"
24 #include "MagickCore/type.h"
25 #include "MagickCore/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 } DirectionType;
62 
63 typedef enum
64 {
65  UndefinedRule,
66 #undef EvenOddRule
67  EvenOddRule,
68  NonZeroRule
69 } FillRule;
70 
71 typedef enum
72 {
73  UndefinedGradient,
74  LinearGradient,
75  RadialGradient
76 } GradientType;
77 
78 typedef enum
79 {
80  UndefinedCap,
81  ButtCap,
82  RoundCap,
83  SquareCap
84 } LineCap;
85 
86 typedef enum
87 {
88  UndefinedJoin,
89  MiterJoin,
90  RoundJoin,
91  BevelJoin
92 } LineJoin;
93 
94 typedef enum
95 {
96  UndefinedMethod,
97  PointMethod,
98  ReplaceMethod,
99  FloodfillMethod,
100  FillToBorderMethod,
101  ResetMethod
102 } PaintMethod;
103 
104 typedef enum
105 {
106  UndefinedPrimitive,
107  AlphaPrimitive,
108  ArcPrimitive,
109  BezierPrimitive,
110  CirclePrimitive,
111  ColorPrimitive,
112  EllipsePrimitive,
113  ImagePrimitive,
114  LinePrimitive,
115  PathPrimitive,
116  PointPrimitive,
117  PolygonPrimitive,
118  PolylinePrimitive,
119  RectanglePrimitive,
120  RoundRectanglePrimitive,
121  TextPrimitive
122 } PrimitiveType;
123 
124 typedef enum
125 {
126  UndefinedReference,
127  GradientReference
128 } ReferenceType;
129 
130 typedef enum
131 {
132  UndefinedSpread,
133  PadSpread,
134  ReflectSpread,
135  RepeatSpread
136 } SpreadMethod;
137 
138 typedef struct _StopInfo
139 {
140  PixelInfo
141  color;
142 
143  double
144  offset;
145 } StopInfo;
146 
147 typedef struct _GradientInfo
148 {
149  GradientType
150  type;
151 
153  bounding_box;
154 
156  gradient_vector;
157 
158  StopInfo
159  *stops;
160 
161  size_t
162  number_stops;
163 
164  SpreadMethod
165  spread;
166 
167  MagickBooleanType
168  debug;
169 
170  PointInfo
171  center,
172  radii;
173 
174  double
175  radius,
176  angle;
177 
178  size_t
179  signature;
180 } GradientInfo;
181 
182 typedef struct _ElementReference
183 {
184  char
185  *id;
186 
187  ReferenceType
188  type;
189 
191  gradient;
192 
193  struct _ElementReference
194  *previous,
195  *next;
196 
197  size_t
198  signature;
200 
201 typedef struct _DrawInfo
202 {
203  char
204  *primitive,
205  *geometry;
206 
208  viewbox;
209 
211  affine;
212 
213  PixelInfo
214  fill,
215  stroke,
216  undercolor,
217  border_color;
218 
219  Image
220  *fill_pattern,
221  *stroke_pattern;
222 
223  double
224  stroke_width;
225 
227  gradient;
228 
229  MagickBooleanType
230  stroke_antialias,
231  text_antialias;
232 
233  FillRule
234  fill_rule;
235 
236  LineCap
237  linecap;
238 
239  LineJoin
240  linejoin;
241 
242  size_t
243  miterlimit;
244 
245  double
246  dash_offset;
247 
248  DecorationType
249  decorate;
250 
251  CompositeOperator
252  compose;
253 
254  char
255  *text,
256  *font,
257  *metrics,
258  *family;
259 
260  size_t
261  face;
262 
263  StyleType
264  style;
265 
266  StretchType
267  stretch;
268 
269  size_t
270  weight;
271 
272  char
273  *encoding;
274 
275  double
276  pointsize;
277 
278  char
279  *density;
280 
281  AlignType
282  align;
283 
284  GravityType
285  gravity;
286 
287  char
288  *server_name;
289 
290  double
291  *dash_pattern;
292 
293  char
294  *clip_mask;
295 
297  bounds;
298 
299  ClipPathUnits
300  clip_units;
301 
302  Quantum
303  alpha;
304 
305  MagickBooleanType
306  render;
307 
309  element_reference;
310 
311  double
312  kerning,
313  interword_spacing,
314  interline_spacing;
315 
316  DirectionType
317  direction;
318 
319  MagickBooleanType
320  debug;
321 
322  size_t
323  signature;
324 
325  double
326  fill_alpha,
327  stroke_alpha;
328 
329  MagickBooleanType
330  clip_path;
331 
332  Image
333  *clipping_mask;
334 
335  ComplianceType
336  compliance;
337 
338  Image
339  *composite_mask;
340 
341  char
342  *id;
343 } DrawInfo;
344 
345 typedef struct _PrimitiveInfo
346 {
347  PointInfo
348  point;
349 
350  size_t
351  coordinates;
352 
353  PrimitiveType
354  primitive;
355 
356  PaintMethod
357  method;
358 
359  char
360  *text;
361 
362  MagickBooleanType
363  closed_subpath;
364 } PrimitiveInfo;
365 
366 typedef struct _TypeMetric
367 {
368  PointInfo
369  pixels_per_em;
370 
371  double
372  ascent,
373  descent,
374  width,
375  height,
376  max_advance,
377  underline_position,
378  underline_thickness;
379 
381  bounds;
382 
383  PointInfo
384  origin;
385 } TypeMetric;
386 
387 extern MagickExport DrawInfo
388  *AcquireDrawInfo(void),
389  *CloneDrawInfo(const ImageInfo *,const DrawInfo *),
390  *DestroyDrawInfo(DrawInfo *);
391 
392 extern MagickExport MagickBooleanType
393  DrawAffineImage(Image *,const Image *,const AffineMatrix *,ExceptionInfo *),
394  DrawClipPath(Image *,const DrawInfo *,const char *,ExceptionInfo *),
395  DrawGradientImage(Image *,const DrawInfo *,ExceptionInfo *),
396  DrawImage(Image *,const DrawInfo *,ExceptionInfo *),
397  DrawPatternPath(Image *,const DrawInfo *,const char *,Image **,
398  ExceptionInfo *),
399  DrawPrimitive(Image *,const DrawInfo *,const PrimitiveInfo *,ExceptionInfo *);
400 
401 extern MagickExport void
402  GetAffineMatrix(AffineMatrix *),
403  GetDrawInfo(const ImageInfo *,DrawInfo *);
404 
405 #if defined(__cplusplus) || defined(c_plusplus)
406 }
407 #endif
408 
409 #endif
Definition: image.h:152