cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1 | /* |
cristy | 1454be7 | 2011-12-19 01:52:48 +0000 | [diff] [blame] | 2 | Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3 | 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) |
| 22 | extern "C" { |
| 23 | #endif |
| 24 | |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 25 | #include "MagickCore/geometry.h" |
| 26 | #include "MagickCore/image.h" |
| 27 | #include "MagickCore/pixel.h" |
| 28 | #include "MagickCore/type.h" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 29 | |
| 30 | typedef enum |
| 31 | { |
| 32 | UndefinedAlign, |
| 33 | LeftAlign, |
| 34 | CenterAlign, |
| 35 | RightAlign |
| 36 | } AlignType; |
| 37 | |
| 38 | typedef enum |
| 39 | { |
| 40 | UndefinedPathUnits, |
| 41 | UserSpace, |
| 42 | UserSpaceOnUse, |
| 43 | ObjectBoundingBox |
| 44 | } ClipPathUnits; |
| 45 | |
| 46 | typedef enum |
| 47 | { |
| 48 | UndefinedDecoration, |
| 49 | NoDecoration, |
| 50 | UnderlineDecoration, |
| 51 | OverlineDecoration, |
| 52 | LineThroughDecoration |
| 53 | } DecorationType; |
| 54 | |
| 55 | typedef enum |
| 56 | { |
cristy | c9b1295 | 2010-03-28 01:12:28 +0000 | [diff] [blame] | 57 | UndefinedDirection, |
cristy | bdcb4b7 | 2010-04-23 00:15:29 +0000 | [diff] [blame] | 58 | RightToLeftDirection, |
| 59 | LeftToRightDirection |
cristy | c9b1295 | 2010-03-28 01:12:28 +0000 | [diff] [blame] | 60 | } DirectionType; |
| 61 | |
| 62 | typedef enum |
| 63 | { |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 64 | UndefinedRule, |
| 65 | #undef EvenOddRule |
| 66 | EvenOddRule, |
| 67 | NonZeroRule |
| 68 | } FillRule; |
| 69 | |
| 70 | typedef enum |
| 71 | { |
| 72 | UndefinedGradient, |
| 73 | LinearGradient, |
| 74 | RadialGradient |
| 75 | } GradientType; |
| 76 | |
| 77 | typedef enum |
| 78 | { |
| 79 | UndefinedCap, |
| 80 | ButtCap, |
| 81 | RoundCap, |
| 82 | SquareCap |
| 83 | } LineCap; |
| 84 | |
| 85 | typedef enum |
| 86 | { |
| 87 | UndefinedJoin, |
| 88 | MiterJoin, |
| 89 | RoundJoin, |
| 90 | BevelJoin |
| 91 | } LineJoin; |
| 92 | |
| 93 | typedef enum |
| 94 | { |
| 95 | UndefinedMethod, |
| 96 | PointMethod, |
| 97 | ReplaceMethod, |
| 98 | FloodfillMethod, |
| 99 | FillToBorderMethod, |
| 100 | ResetMethod |
| 101 | } PaintMethod; |
| 102 | |
| 103 | typedef 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 | |
| 123 | typedef enum |
| 124 | { |
| 125 | UndefinedReference, |
| 126 | GradientReference |
| 127 | } ReferenceType; |
| 128 | |
| 129 | typedef enum |
| 130 | { |
| 131 | UndefinedSpread, |
| 132 | PadSpread, |
| 133 | ReflectSpread, |
| 134 | RepeatSpread |
| 135 | } SpreadMethod; |
| 136 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 137 | typedef struct _StopInfo |
| 138 | { |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 139 | PixelInfo |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 140 | color; |
| 141 | |
| 142 | MagickRealType |
| 143 | offset; |
| 144 | } StopInfo; |
| 145 | |
| 146 | typedef 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 | |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 160 | size_t |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 161 | number_stops; |
| 162 | |
| 163 | SpreadMethod |
| 164 | spread; |
| 165 | |
| 166 | MagickBooleanType |
| 167 | debug; |
| 168 | |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 169 | size_t |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 170 | signature; |
| 171 | |
| 172 | PointInfo |
| 173 | center; |
| 174 | |
| 175 | MagickRealType |
| 176 | radius; |
| 177 | } GradientInfo; |
| 178 | |
| 179 | typedef struct _ElementReference |
| 180 | { |
| 181 | char |
| 182 | *id; |
| 183 | |
| 184 | ReferenceType |
| 185 | type; |
| 186 | |
| 187 | GradientInfo |
| 188 | gradient; |
| 189 | |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 190 | size_t |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 191 | signature; |
| 192 | |
| 193 | struct _ElementReference |
| 194 | *previous, |
| 195 | *next; |
| 196 | } ElementReference; |
| 197 | |
| 198 | typedef struct _DrawInfo |
| 199 | { |
| 200 | char |
| 201 | *primitive, |
| 202 | *geometry; |
| 203 | |
| 204 | RectangleInfo |
| 205 | viewbox; |
| 206 | |
| 207 | AffineMatrix |
| 208 | affine; |
| 209 | |
cristy | 101ab70 | 2011-10-13 13:06:32 +0000 | [diff] [blame] | 210 | PixelInfo |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 211 | fill, |
anthony | fd706f9 | 2012-01-19 04:22:02 +0000 | [diff] [blame] | 212 | stroke, |
| 213 | undercolor, |
| 214 | border_color; |
| 215 | |
| 216 | Image |
| 217 | *fill_pattern, |
| 218 | *stroke_pattern; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 219 | |
| 220 | double |
| 221 | stroke_width; |
| 222 | |
| 223 | GradientInfo |
| 224 | gradient; |
| 225 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 226 | MagickBooleanType |
| 227 | stroke_antialias, |
| 228 | text_antialias; |
| 229 | |
| 230 | FillRule |
| 231 | fill_rule; |
| 232 | |
| 233 | LineCap |
| 234 | linecap; |
| 235 | |
| 236 | LineJoin |
| 237 | linejoin; |
| 238 | |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 239 | size_t |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 240 | miterlimit; |
| 241 | |
| 242 | double |
| 243 | dash_offset; |
| 244 | |
| 245 | DecorationType |
| 246 | decorate; |
| 247 | |
| 248 | CompositeOperator |
| 249 | compose; |
| 250 | |
| 251 | char |
anthony | fd706f9 | 2012-01-19 04:22:02 +0000 | [diff] [blame] | 252 | *text, |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 253 | *font, |
| 254 | *metrics, |
| 255 | *family; |
| 256 | |
anthony | fd706f9 | 2012-01-19 04:22:02 +0000 | [diff] [blame] | 257 | size_t |
| 258 | face; |
| 259 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 260 | StyleType |
| 261 | style; |
| 262 | |
| 263 | StretchType |
| 264 | stretch; |
| 265 | |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 266 | size_t |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 267 | weight; |
| 268 | |
| 269 | char |
| 270 | *encoding; |
| 271 | |
| 272 | double |
| 273 | pointsize; |
| 274 | |
| 275 | char |
| 276 | *density; |
| 277 | |
| 278 | AlignType |
| 279 | align; |
| 280 | |
anthony | fd706f9 | 2012-01-19 04:22:02 +0000 | [diff] [blame] | 281 | GravityType |
| 282 | gravity; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 283 | |
| 284 | char |
| 285 | *server_name; |
| 286 | |
| 287 | double |
| 288 | *dash_pattern; |
| 289 | |
| 290 | char |
| 291 | *clip_mask; |
| 292 | |
| 293 | SegmentInfo |
| 294 | bounds; |
| 295 | |
| 296 | ClipPathUnits |
| 297 | clip_units; |
| 298 | |
| 299 | Quantum |
cristy | 4c08aed | 2011-07-01 19:47:50 +0000 | [diff] [blame] | 300 | alpha; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 301 | |
| 302 | MagickBooleanType |
| 303 | render; |
| 304 | |
| 305 | ElementReference |
| 306 | element_reference; |
| 307 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 308 | double |
| 309 | kerning, |
cristy | b32b90a | 2009-09-07 21:45:48 +0000 | [diff] [blame] | 310 | interword_spacing, |
cristy | 6ac8b33 | 2010-04-22 02:24:11 +0000 | [diff] [blame] | 311 | interline_spacing; |
| 312 | |
| 313 | DirectionType |
cristy | c9b1295 | 2010-03-28 01:12:28 +0000 | [diff] [blame] | 314 | direction; |
cristy | c0c324c | 2011-10-29 23:14:03 +0000 | [diff] [blame] | 315 | |
| 316 | MagickBooleanType |
cristy | c0c324c | 2011-10-29 23:14:03 +0000 | [diff] [blame] | 317 | debug; |
| 318 | |
| 319 | size_t |
| 320 | signature; |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 321 | } DrawInfo; |
| 322 | |
anthony | fd706f9 | 2012-01-19 04:22:02 +0000 | [diff] [blame] | 323 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 324 | typedef struct _PrimitiveInfo |
| 325 | { |
| 326 | PointInfo |
| 327 | point; |
| 328 | |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 329 | size_t |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 330 | coordinates; |
| 331 | |
| 332 | PrimitiveType |
| 333 | primitive; |
| 334 | |
| 335 | PaintMethod |
| 336 | method; |
| 337 | |
| 338 | char |
| 339 | *text; |
| 340 | } PrimitiveInfo; |
| 341 | |
| 342 | typedef struct _TypeMetric |
| 343 | { |
| 344 | PointInfo |
| 345 | pixels_per_em; |
| 346 | |
| 347 | double |
| 348 | ascent, |
| 349 | descent, |
| 350 | width, |
| 351 | height, |
| 352 | max_advance, |
| 353 | underline_position, |
| 354 | underline_thickness; |
| 355 | |
| 356 | SegmentInfo |
| 357 | bounds; |
| 358 | |
| 359 | PointInfo |
| 360 | origin; |
| 361 | } TypeMetric; |
| 362 | |
| 363 | extern MagickExport DrawInfo |
| 364 | *AcquireDrawInfo(void), |
| 365 | *CloneDrawInfo(const ImageInfo *,const DrawInfo *), |
| 366 | *DestroyDrawInfo(DrawInfo *); |
| 367 | |
| 368 | extern MagickExport MagickBooleanType |
cristy | 947cb4c | 2011-10-20 18:41:46 +0000 | [diff] [blame] | 369 | DrawAffineImage(Image *,const Image *,const AffineMatrix *,ExceptionInfo *), |
cristy | 018f07f | 2011-09-04 21:15:19 +0000 | [diff] [blame] | 370 | DrawClipPath(Image *,const DrawInfo *,const char *,ExceptionInfo *), |
cristy | 947cb4c | 2011-10-20 18:41:46 +0000 | [diff] [blame] | 371 | DrawGradientImage(Image *,const DrawInfo *,ExceptionInfo *), |
cristy | 018f07f | 2011-09-04 21:15:19 +0000 | [diff] [blame] | 372 | DrawImage(Image *,const DrawInfo *,ExceptionInfo *), |
| 373 | DrawPatternPath(Image *,const DrawInfo *,const char *,Image **, |
| 374 | ExceptionInfo *), |
cristy | 947cb4c | 2011-10-20 18:41:46 +0000 | [diff] [blame] | 375 | DrawPrimitive(Image *,const DrawInfo *,const PrimitiveInfo *,ExceptionInfo *); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 376 | |
| 377 | extern MagickExport void |
| 378 | GetAffineMatrix(AffineMatrix *), |
| 379 | GetDrawInfo(const ImageInfo *,DrawInfo *); |
| 380 | |
| 381 | #if defined(__cplusplus) || defined(c_plusplus) |
| 382 | } |
| 383 | #endif |
| 384 | |
| 385 | #endif |