1 /* 2 Copyright 1999-2016 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. 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 #include "MagickCore/geometry.h" 22 #include "MagickCore/image.h" 23 #include "MagickCore/pixel.h" 24 #include "MagickCore/type.h" 25 26 #if defined(__cplusplus) || defined(c_plusplus) 27 extern "C" { 28 #endif 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 { 57 UndefinedDirection, 58 RightToLeftDirection, 59 LeftToRightDirection 60 } DirectionType; 61 62 typedef enum 63 { 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 AlphaPrimitive, 107 ArcPrimitive, 108 BezierPrimitive, 109 CirclePrimitive, 110 ColorPrimitive, 111 EllipsePrimitive, 112 ImagePrimitive, 113 LinePrimitive, 114 PathPrimitive, 115 PointPrimitive, 116 PolygonPrimitive, 117 PolylinePrimitive, 118 RectanglePrimitive, 119 RoundRectanglePrimitive, 120 TextPrimitive 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 137 typedef struct _StopInfo 138 { 139 PixelInfo 140 color; 141 142 double 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 160 size_t 161 number_stops; 162 163 SpreadMethod 164 spread; 165 166 MagickBooleanType 167 debug; 168 169 PointInfo 170 center, 171 radii; 172 173 double 174 radius, 175 angle; 176 177 size_t 178 signature; 179 } GradientInfo; 180 181 typedef struct _ElementReference 182 { 183 char 184 *id; 185 186 ReferenceType 187 type; 188 189 GradientInfo 190 gradient; 191 192 struct _ElementReference 193 *previous, 194 *next; 195 196 size_t 197 signature; 198 } ElementReference; 199 200 typedef struct _DrawInfo 201 { 202 char 203 *primitive, 204 *geometry; 205 206 RectangleInfo 207 viewbox; 208 209 AffineMatrix 210 affine; 211 212 PixelInfo 213 fill, 214 stroke, 215 undercolor, 216 border_color; 217 218 Image 219 *fill_pattern, 220 *stroke_pattern; 221 222 double 223 stroke_width; 224 225 GradientInfo 226 gradient; 227 228 MagickBooleanType 229 stroke_antialias, 230 text_antialias; 231 232 FillRule 233 fill_rule; 234 235 LineCap 236 linecap; 237 238 LineJoin 239 linejoin; 240 241 size_t 242 miterlimit; 243 244 double 245 dash_offset; 246 247 DecorationType 248 decorate; 249 250 CompositeOperator 251 compose; 252 253 char 254 *text, 255 *font, 256 *metrics, 257 *family; 258 259 size_t 260 face; 261 262 StyleType 263 style; 264 265 StretchType 266 stretch; 267 268 size_t 269 weight; 270 271 char 272 *encoding; 273 274 double 275 pointsize; 276 277 char 278 *density; 279 280 AlignType 281 align; 282 283 GravityType 284 gravity; 285 286 char 287 *server_name; 288 289 double 290 *dash_pattern; 291 292 char 293 *clip_mask; 294 295 SegmentInfo 296 bounds; 297 298 ClipPathUnits 299 clip_units; 300 301 Quantum 302 alpha; 303 304 MagickBooleanType 305 render; 306 307 ElementReference 308 element_reference; 309 310 double 311 kerning, 312 interword_spacing, 313 interline_spacing; 314 315 DirectionType 316 direction; 317 318 MagickBooleanType 319 debug; 320 321 size_t 322 signature; 323 324 double 325 fill_alpha, 326 stroke_alpha; 327 } DrawInfo; 328 329 330 typedef struct _PrimitiveInfo 331 { 332 PointInfo 333 point; 334 335 size_t 336 coordinates; 337 338 PrimitiveType 339 primitive; 340 341 PaintMethod 342 method; 343 344 char 345 *text; 346 } PrimitiveInfo; 347 348 typedef struct _TypeMetric 349 { 350 PointInfo 351 pixels_per_em; 352 353 double 354 ascent, 355 descent, 356 width, 357 height, 358 max_advance, 359 underline_position, 360 underline_thickness; 361 362 SegmentInfo 363 bounds; 364 365 PointInfo 366 origin; 367 } TypeMetric; 368 369 extern MagickExport DrawInfo 370 *AcquireDrawInfo(void), 371 *CloneDrawInfo(const ImageInfo *,const DrawInfo *), 372 *DestroyDrawInfo(DrawInfo *); 373 374 extern MagickExport MagickBooleanType 375 DrawAffineImage(Image *,const Image *,const AffineMatrix *,ExceptionInfo *), 376 DrawClipPath(Image *,const DrawInfo *,const char *,ExceptionInfo *), 377 DrawGradientImage(Image *,const DrawInfo *,ExceptionInfo *), 378 DrawImage(Image *,const DrawInfo *,ExceptionInfo *), 379 DrawPatternPath(Image *,const DrawInfo *,const char *,Image **, 380 ExceptionInfo *), 381 DrawPrimitive(Image *,const DrawInfo *,const PrimitiveInfo *,ExceptionInfo *); 382 383 extern MagickExport void 384 GetAffineMatrix(AffineMatrix *), 385 GetDrawInfo(const ImageInfo *,DrawInfo *); 386 387 #if defined(__cplusplus) || defined(c_plusplus) 388 } 389 #endif 390 391 #endif 392