blob: 9fa8f3b4bbc0634c9f589dab458b660e2c457a50 [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001/*
cristy7e41fe82010-12-04 23:12:08 +00002 Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization
cristy3ed852e2009-09-05 21:47:34 +00003 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 image geometry methods.
17*/
18#ifndef _MAGICKCORE_GEOMETRY_H
19#define _MAGICKCORE_GEOMETRY_H
20
21#if defined(__cplusplus) || defined(c_plusplus)
22extern "C" {
23#endif
24
25typedef enum
26{
27#undef NoValue
28 NoValue = 0x0000,
29#undef XValue
30 XValue = 0x0001,
31 XiValue = 0x0001,
32#undef YValue
33 YValue = 0x0002,
34 PsiValue = 0x0002,
35#undef WidthValue
36 WidthValue = 0x0004,
37 RhoValue = 0x0004,
38#undef HeightValue
39 HeightValue = 0x0008,
40 SigmaValue = 0x0008,
41 ChiValue = 0x0010,
42 XiNegative = 0x0020,
43#undef XNegative
44 XNegative = 0x0020,
45 PsiNegative = 0x0040,
46#undef YNegative
47 YNegative = 0x0040,
48 ChiNegative = 0x0080,
anthonybf5924f2010-05-07 03:33:10 +000049 PercentValue = 0x1000, /* '%' percentage of something */
50 AspectValue = 0x2000, /* '!' resize no-aspect - special use flag */
51 NormalizeValue = 0x2000, /* '!' ScaleKernelValue() in morphology.c */
52 LessValue = 0x4000, /* '<' resize smaller - special use flag */
53 GreaterValue = 0x8000, /* '>' resize larger - spacial use flag */
54 MinimumValue = 0x10000, /* '^' special handling needed */
55 CorrelateNormalizeValue = 0x10000, /* '^' see ScaleKernelValue() */
56 AreaValue = 0x20000, /* '@' resize to area - special use flag */
57 DecimalValue = 0x40000, /* '.' floating point numbers found */
cristy3ed852e2009-09-05 21:47:34 +000058#undef AllValues
59 AllValues = 0x7fffffff
60} GeometryFlags;
61
62#if defined(ForgetGravity)
63#undef ForgetGravity
64#undef NorthWestGravity
65#undef NorthGravity
66#undef NorthEastGravity
67#undef WestGravity
68#undef CenterGravity
69#undef EastGravity
70#undef SouthWestGravity
71#undef SouthGravity
72#undef SouthEastGravity
73#undef StaticGravity
74#endif
75
76typedef enum
77{
78 UndefinedGravity,
79 ForgetGravity = 0,
80 NorthWestGravity = 1,
81 NorthGravity = 2,
82 NorthEastGravity = 3,
83 WestGravity = 4,
84 CenterGravity = 5,
85 EastGravity = 6,
86 SouthWestGravity = 7,
87 SouthGravity = 8,
88 SouthEastGravity = 9,
89 StaticGravity = 10
90} GravityType;
91
92typedef struct _AffineMatrix
93{
94 double
95 sx,
96 rx,
97 ry,
98 sy,
99 tx,
100 ty;
101} AffineMatrix;
102
103typedef struct _GeometryInfo
104{
105 double
106 rho,
107 sigma,
108 xi,
109 psi,
110 chi;
111} GeometryInfo;
112
cristy365e58f2010-02-15 02:00:01 +0000113typedef struct _OffsetInfo
114{
cristybb503372010-05-27 20:51:26 +0000115 ssize_t
cristy365e58f2010-02-15 02:00:01 +0000116 x,
117 y;
118} OffsetInfo;
119
cristy3ed852e2009-09-05 21:47:34 +0000120typedef struct _RectangleInfo
121{
cristybb503372010-05-27 20:51:26 +0000122 size_t
cristy3ed852e2009-09-05 21:47:34 +0000123 width,
124 height;
125
cristybb503372010-05-27 20:51:26 +0000126 ssize_t
cristy3ed852e2009-09-05 21:47:34 +0000127 x,
128 y;
129} RectangleInfo;
130
131extern MagickExport char
132 *GetPageGeometry(const char *);
133
134extern MagickExport MagickBooleanType
135 IsGeometry(const char *),
136 IsSceneGeometry(const char *,const MagickBooleanType);
137
138extern MagickExport MagickStatusType
cristybb503372010-05-27 20:51:26 +0000139 GetGeometry(const char *,ssize_t *,ssize_t *,size_t *,size_t *),
cristy3ed852e2009-09-05 21:47:34 +0000140 ParseAbsoluteGeometry(const char *,RectangleInfo *),
141 ParseAffineGeometry(const char *,AffineMatrix *,ExceptionInfo *),
142 ParseGeometry(const char *,GeometryInfo *),
143 ParseGravityGeometry(const Image *,const char *,RectangleInfo *,
144 ExceptionInfo *),
cristybb503372010-05-27 20:51:26 +0000145 ParseMetaGeometry(const char *,ssize_t *,ssize_t *,size_t *,size_t *),
cristy3ed852e2009-09-05 21:47:34 +0000146 ParsePageGeometry(const Image *,const char *,RectangleInfo *,ExceptionInfo *),
147 ParseRegionGeometry(const Image *,const char *,RectangleInfo *,
148 ExceptionInfo *);
149
150extern MagickExport void
cristybb503372010-05-27 20:51:26 +0000151 GravityAdjustGeometry(const size_t,const size_t,
cristy3ed852e2009-09-05 21:47:34 +0000152 const GravityType,RectangleInfo *),
153 SetGeometry(const Image *,RectangleInfo *),
154 SetGeometryInfo(GeometryInfo *);
155
156#if defined(__cplusplus) || defined(c_plusplus)
157}
158#endif
159
160#endif