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 enum
139 {
140  UndefinedWordBreakType,
141  NormalWordBreakType,
142  BreakWordBreakType
143 } WordBreakType;
144 
145 typedef struct _StopInfo
146 {
147  PixelInfo
148  color;
149 
150  double
151  offset;
152 } StopInfo;
153 
154 typedef struct _GradientInfo
155 {
156  GradientType
157  type;
158 
160  bounding_box;
161 
163  gradient_vector;
164 
165  StopInfo
166  *stops;
167 
168  size_t
169  number_stops;
170 
171  SpreadMethod
172  spread;
173 
174  MagickBooleanType
175  debug;
176 
177  PointInfo
178  center,
179  radii;
180 
181  double
182  radius,
183  angle;
184 
185  size_t
186  signature;
187 } GradientInfo;
188 
189 typedef struct _ElementReference
190 {
191  char
192  *id;
193 
194  ReferenceType
195  type;
196 
198  gradient;
199 
200  struct _ElementReference
201  *previous,
202  *next;
203 
204  size_t
205  signature;
207 
208 typedef struct _DrawInfo
209 {
210  char
211  *primitive,
212  *geometry;
213 
215  viewbox;
216 
218  affine;
219 
220  PixelInfo
221  fill,
222  stroke,
223  undercolor,
224  border_color;
225 
226  Image
227  *fill_pattern,
228  *stroke_pattern;
229 
230  double
231  stroke_width;
232 
234  gradient;
235 
236  MagickBooleanType
237  stroke_antialias,
238  text_antialias;
239 
240  FillRule
241  fill_rule;
242 
243  LineCap
244  linecap;
245 
246  LineJoin
247  linejoin;
248 
249  size_t
250  miterlimit;
251 
252  double
253  dash_offset;
254 
255  DecorationType
256  decorate;
257 
258  CompositeOperator
259  compose;
260 
261  char
262  *text,
263  *font,
264  *metrics,
265  *family;
266 
267  size_t
268  face;
269 
270  StyleType
271  style;
272 
273  StretchType
274  stretch;
275 
276  size_t
277  weight;
278 
279  char
280  *encoding;
281 
282  double
283  pointsize;
284 
285  char
286  *density;
287 
288  AlignType
289  align;
290 
291  GravityType
292  gravity;
293 
294  char
295  *server_name;
296 
297  double
298  *dash_pattern;
299 
300  char
301  *clip_mask;
302 
304  bounds;
305 
306  ClipPathUnits
307  clip_units;
308 
309  Quantum
310  alpha;
311 
312  MagickBooleanType
313  render;
314 
316  element_reference;
317 
318  double
319  kerning,
320  interword_spacing,
321  interline_spacing;
322 
323  DirectionType
324  direction;
325 
326  MagickBooleanType
327  debug;
328 
329  size_t
330  signature;
331 
332  double
333  fill_alpha,
334  stroke_alpha;
335 
336  MagickBooleanType
337  clip_path;
338 
339  Image
340  *clipping_mask;
341 
342  ComplianceType
343  compliance;
344 
345  Image
346  *composite_mask;
347 
348  char
349  *id;
350 
351  WordBreakType
352  word_break;
353 } DrawInfo;
354 
355 typedef struct _PrimitiveInfo
356 {
357  PointInfo
358  point;
359 
360  size_t
361  coordinates;
362 
363  PrimitiveType
364  primitive;
365 
366  PaintMethod
367  method;
368 
369  char
370  *text;
371 
372  MagickBooleanType
373  closed_subpath;
374 } PrimitiveInfo;
375 
376 typedef struct _TypeMetric
377 {
378  PointInfo
379  pixels_per_em;
380 
381  double
382  ascent,
383  descent,
384  width,
385  height,
386  max_advance,
387  underline_position,
388  underline_thickness;
389 
391  bounds;
392 
393  PointInfo
394  origin;
395 } TypeMetric;
396 
397 extern MagickExport DrawInfo
398  *AcquireDrawInfo(void),
399  *CloneDrawInfo(const ImageInfo *,const DrawInfo *),
400  *DestroyDrawInfo(DrawInfo *);
401 
402 extern MagickExport MagickBooleanType
403  DrawAffineImage(Image *,const Image *,const AffineMatrix *,ExceptionInfo *),
404  DrawClipPath(Image *,const DrawInfo *,const char *,ExceptionInfo *),
405  DrawGradientImage(Image *,const DrawInfo *,ExceptionInfo *),
406  DrawImage(Image *,const DrawInfo *,ExceptionInfo *),
407  DrawPatternPath(Image *,const DrawInfo *,const char *,Image **,
408  ExceptionInfo *),
409  DrawPrimitive(Image *,const DrawInfo *,const PrimitiveInfo *,ExceptionInfo *);
410 
411 extern MagickExport void
412  GetAffineMatrix(AffineMatrix *),
413  GetDrawInfo(const ImageInfo *,DrawInfo *);
414 
415 #if defined(__cplusplus) || defined(c_plusplus)
416 }
417 #endif
418 
419 #endif
Definition: image.h:152