MagickCore  6.9.12-67
Convert, Edit, Or Compose Bitmap Images
 All Data Structures
geometry.h
1 /*
2  Copyright 1999-2021 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 image geometry methods.
17 */
18 #ifndef MAGICKCORE_GEOMETRY_H
19 #define MAGICKCORE_GEOMETRY_H
20 
21 #if defined(__cplusplus) || defined(c_plusplus)
22 extern "C" {
23 #endif
24 
25 typedef 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,
49  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 */
58  SeparatorValue = 0x80000, /* 'x' separator found */
59  AspectRatioValue = 0x100000, /* '~' special handling needed */
60  AlphaValue = 0x200000, /* '/' alpha */
61 #undef AllValues
62  AllValues = 0x7fffffff
63 } GeometryFlags;
64 
65 #if defined(ForgetGravity)
66 #undef ForgetGravity
67 #undef NorthWestGravity
68 #undef NorthGravity
69 #undef NorthEastGravity
70 #undef WestGravity
71 #undef CenterGravity
72 #undef EastGravity
73 #undef SouthWestGravity
74 #undef SouthGravity
75 #undef SouthEastGravity
76 #undef StaticGravity
77 #endif
78 
79 typedef enum
80 {
81  UndefinedGravity,
82  ForgetGravity = 0,
83  NorthWestGravity = 1,
84  NorthGravity = 2,
85  NorthEastGravity = 3,
86  WestGravity = 4,
87  CenterGravity = 5,
88  EastGravity = 6,
89  SouthWestGravity = 7,
90  SouthGravity = 8,
91  SouthEastGravity = 9,
92  StaticGravity = 10
93 } GravityType;
94 
95 typedef struct _AffineMatrix
96 {
97  double
98  sx,
99  rx,
100  ry,
101  sy,
102  tx,
103  ty;
104 } AffineMatrix;
105 
106 typedef struct _GeometryInfo
107 {
108  double
109  rho,
110  sigma,
111  xi,
112  psi,
113  chi;
114 } GeometryInfo;
115 
116 typedef struct _OffsetInfo
117 {
118  ssize_t
119  x,
120  y;
121 } OffsetInfo;
122 
123 typedef struct _RectangleInfo
124 {
125  size_t
126  width,
127  height;
128 
129  ssize_t
130  x,
131  y;
132 } RectangleInfo;
133 
134 extern MagickExport char
135  *GetPageGeometry(const char *);
136 
137 extern MagickExport MagickBooleanType
138  IsGeometry(const char *),
139  IsSceneGeometry(const char *,const MagickBooleanType);
140 
141 extern MagickExport MagickStatusType
142  GetGeometry(const char *,ssize_t *,ssize_t *,size_t *,size_t *),
143  ParseAbsoluteGeometry(const char *,RectangleInfo *),
144  ParseAffineGeometry(const char *,AffineMatrix *,ExceptionInfo *),
145  ParseGeometry(const char *,GeometryInfo *),
146  ParseGravityGeometry(const Image *,const char *,RectangleInfo *,
147  ExceptionInfo *),
148  ParseMetaGeometry(const char *,ssize_t *,ssize_t *,size_t *,size_t *),
149  ParsePageGeometry(const Image *,const char *,RectangleInfo *,ExceptionInfo *),
150  ParseRegionGeometry(const Image *,const char *,RectangleInfo *,
151  ExceptionInfo *);
152 
153 extern MagickExport void
154  GravityAdjustGeometry(const size_t,const size_t,const GravityType,
155  RectangleInfo *),
156  SetGeometry(const Image *,RectangleInfo *),
157  SetGeometryInfo(GeometryInfo *);
158 
159 #if defined(__cplusplus) || defined(c_plusplus)
160 }
161 #endif
162 
163 #endif
Definition: image.h:152