draw.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  1. /*
  2. Copyright 1999 ImageMagick Studio LLC, a non-profit organization
  3. dedicated to making software imaging solutions freely available.
  4. You may not use this file except in compliance with the License. You may
  5. obtain a copy of the License at
  6. https://imagemagick.org/script/license.php
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. MagickCore drawing methods.
  13. */
  14. #ifndef MAGICKCORE_DRAW_H
  15. #define MAGICKCORE_DRAW_H
  16. #include "magick/geometry.h"
  17. #include "magick/image.h"
  18. #include "magick/pixel.h"
  19. #include "magick/type.h"
  20. #include "magick/color.h"
  21. #if defined(__cplusplus) || defined(c_plusplus)
  22. extern "C" {
  23. #endif
  24. typedef enum
  25. {
  26. UndefinedAlign,
  27. LeftAlign,
  28. CenterAlign,
  29. RightAlign
  30. } AlignType;
  31. typedef enum
  32. {
  33. UndefinedPathUnits,
  34. UserSpace,
  35. UserSpaceOnUse,
  36. ObjectBoundingBox
  37. } ClipPathUnits;
  38. typedef enum
  39. {
  40. UndefinedDecoration,
  41. NoDecoration,
  42. UnderlineDecoration,
  43. OverlineDecoration,
  44. LineThroughDecoration
  45. } DecorationType;
  46. typedef enum
  47. {
  48. UndefinedDirection,
  49. RightToLeftDirection,
  50. LeftToRightDirection,
  51. TopToBottomDirection
  52. } DirectionType;
  53. typedef enum
  54. {
  55. UndefinedRule,
  56. #undef EvenOddRule
  57. EvenOddRule,
  58. NonZeroRule
  59. } FillRule;
  60. typedef enum
  61. {
  62. UndefinedGradient,
  63. LinearGradient,
  64. RadialGradient
  65. } GradientType;
  66. typedef enum
  67. {
  68. UndefinedCap,
  69. ButtCap,
  70. RoundCap,
  71. SquareCap
  72. } LineCap;
  73. typedef enum
  74. {
  75. UndefinedJoin,
  76. MiterJoin,
  77. RoundJoin,
  78. BevelJoin
  79. } LineJoin;
  80. typedef enum
  81. {
  82. UndefinedMethod,
  83. PointMethod,
  84. ReplaceMethod,
  85. FloodfillMethod,
  86. FillToBorderMethod,
  87. ResetMethod
  88. } PaintMethod;
  89. typedef enum
  90. {
  91. UndefinedPrimitive,
  92. PointPrimitive,
  93. LinePrimitive,
  94. RectanglePrimitive,
  95. RoundRectanglePrimitive,
  96. ArcPrimitive,
  97. EllipsePrimitive,
  98. CirclePrimitive,
  99. PolylinePrimitive,
  100. PolygonPrimitive,
  101. BezierPrimitive,
  102. ColorPrimitive,
  103. MattePrimitive,
  104. TextPrimitive,
  105. ImagePrimitive,
  106. PathPrimitive
  107. } PrimitiveType;
  108. typedef enum
  109. {
  110. UndefinedReference,
  111. GradientReference
  112. } ReferenceType;
  113. typedef enum
  114. {
  115. UndefinedSpread,
  116. PadSpread,
  117. ReflectSpread,
  118. RepeatSpread
  119. } SpreadMethod;
  120. typedef struct _PointInfo
  121. {
  122. double
  123. x,
  124. y;
  125. } PointInfo;
  126. typedef struct _StopInfo
  127. {
  128. MagickPixelPacket
  129. color;
  130. MagickRealType
  131. offset;
  132. } StopInfo;
  133. typedef struct _GradientInfo
  134. {
  135. GradientType
  136. type;
  137. RectangleInfo
  138. bounding_box;
  139. SegmentInfo
  140. gradient_vector;
  141. StopInfo
  142. *stops;
  143. size_t
  144. number_stops;
  145. SpreadMethod
  146. spread;
  147. MagickBooleanType
  148. debug;
  149. size_t
  150. signature;
  151. PointInfo
  152. center;
  153. MagickRealType
  154. radius,
  155. angle;
  156. PointInfo
  157. radii;
  158. } GradientInfo;
  159. typedef struct _ElementReference
  160. {
  161. char
  162. *id;
  163. ReferenceType
  164. type;
  165. GradientInfo
  166. gradient;
  167. size_t
  168. signature;
  169. struct _ElementReference
  170. *previous,
  171. *next;
  172. } ElementReference;
  173. typedef struct _DrawInfo
  174. {
  175. char
  176. *primitive,
  177. *geometry;
  178. RectangleInfo
  179. viewbox;
  180. AffineMatrix
  181. affine;
  182. GravityType
  183. gravity;
  184. PixelPacket
  185. fill,
  186. stroke;
  187. double
  188. stroke_width;
  189. GradientInfo
  190. gradient;
  191. Image
  192. *fill_pattern,
  193. *tile,
  194. *stroke_pattern;
  195. MagickBooleanType
  196. stroke_antialias,
  197. text_antialias;
  198. FillRule
  199. fill_rule;
  200. LineCap
  201. linecap;
  202. LineJoin
  203. linejoin;
  204. size_t
  205. miterlimit;
  206. double
  207. dash_offset;
  208. DecorationType
  209. decorate;
  210. CompositeOperator
  211. compose;
  212. char
  213. *text;
  214. size_t
  215. face;
  216. char
  217. *font,
  218. *metrics,
  219. *family;
  220. StyleType
  221. style;
  222. StretchType
  223. stretch;
  224. size_t
  225. weight;
  226. char
  227. *encoding;
  228. double
  229. pointsize;
  230. char
  231. *density;
  232. AlignType
  233. align;
  234. PixelPacket
  235. undercolor,
  236. border_color;
  237. char
  238. *server_name;
  239. double
  240. *dash_pattern;
  241. char
  242. *clip_mask;
  243. SegmentInfo
  244. bounds;
  245. ClipPathUnits
  246. clip_units;
  247. Quantum
  248. opacity;
  249. MagickBooleanType
  250. render;
  251. ElementReference
  252. element_reference;
  253. MagickBooleanType
  254. debug;
  255. size_t
  256. signature;
  257. double
  258. kerning,
  259. interword_spacing,
  260. interline_spacing;
  261. DirectionType
  262. direction;
  263. double
  264. fill_opacity,
  265. stroke_opacity;
  266. MagickBooleanType
  267. clip_path;
  268. Image
  269. *clipping_mask;
  270. ComplianceType
  271. compliance;
  272. Image
  273. *composite_mask;
  274. char
  275. *id;
  276. ImageInfo
  277. *image_info;
  278. } DrawInfo;
  279. typedef struct _PrimitiveInfo
  280. {
  281. PointInfo
  282. point;
  283. size_t
  284. coordinates;
  285. PrimitiveType
  286. primitive;
  287. PaintMethod
  288. method;
  289. char
  290. *text;
  291. MagickBooleanType
  292. closed_subpath;
  293. } PrimitiveInfo;
  294. typedef struct _TypeMetric
  295. {
  296. PointInfo
  297. pixels_per_em;
  298. double
  299. ascent,
  300. descent,
  301. width,
  302. height,
  303. max_advance,
  304. underline_position,
  305. underline_thickness;
  306. SegmentInfo
  307. bounds;
  308. PointInfo
  309. origin;
  310. } TypeMetric;
  311. extern MagickExport DrawInfo
  312. *AcquireDrawInfo(void),
  313. *CloneDrawInfo(const ImageInfo *,const DrawInfo *),
  314. *DestroyDrawInfo(DrawInfo *);
  315. extern MagickExport MagickBooleanType
  316. DrawAffineImage(Image *,const Image *,const AffineMatrix *),
  317. DrawClipPath(Image *,const DrawInfo *,const char *),
  318. DrawGradientImage(Image *,const DrawInfo *),
  319. DrawImage(Image *,const DrawInfo *),
  320. DrawPatternPath(Image *,const DrawInfo *,const char *,Image **),
  321. DrawPrimitive(Image *,const DrawInfo *,const PrimitiveInfo *);
  322. extern MagickExport void
  323. GetAffineMatrix(AffineMatrix *),
  324. GetDrawInfo(const ImageInfo *,DrawInfo *);
  325. #if defined(__cplusplus) || defined(c_plusplus)
  326. }
  327. #endif
  328. #endif