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 MaximumValue = 0x400000, /* '#' special handling needed */ 62 #undef AllValues 63 AllValues = 0x7fffffff 64 } GeometryFlags; 65 66 #if defined(ForgetGravity) 67 #undef ForgetGravity 68 #undef NorthWestGravity 69 #undef NorthGravity 70 #undef NorthEastGravity 71 #undef WestGravity 72 #undef CenterGravity 73 #undef EastGravity 74 #undef SouthWestGravity 75 #undef SouthGravity 76 #undef SouthEastGravity 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 } GravityType; 93 94 typedef struct _AffineMatrix 95 { 96 double 97 sx, 98 rx, 99 ry, 100 sy, 101 tx, 102 ty; 103 } AffineMatrix; 104 105 typedef struct _GeometryInfo 106 { 107 double 108 rho, 109 sigma, 110 xi, 111 psi, 112 chi; 113 } GeometryInfo; 114 115 typedef struct _OffsetInfo 116 { 117 ssize_t 118 x, 119 y; 120 } OffsetInfo; 121 122 typedef struct _PointInfo 123 { 124 double 125 x, 126 y; 127 } PointInfo; 128 129 typedef struct _RectangleInfo 130 { 131 size_t 132 width, 133 height; 134 135 ssize_t 136 x, 137 y; 138 } RectangleInfo; 139 140 extern MagickExport char 141 *GetPageGeometry(const char *); 142 143 extern MagickExport MagickBooleanType 144 IsGeometry(const char *), 145 IsSceneGeometry(const char *,const MagickBooleanType); 146 147 extern MagickExport MagickStatusType 148 GetGeometry(const char *,ssize_t *,ssize_t *,size_t *,size_t *), 149 ParseAbsoluteGeometry(const char *,RectangleInfo *), 150 ParseAffineGeometry(const char *,AffineMatrix *,ExceptionInfo *), 151 ParseGeometry(const char *,GeometryInfo *), 152 ParseGravityGeometry(const Image *,const char *,RectangleInfo *, 153 ExceptionInfo *), 154 ParseMetaGeometry(const char *,ssize_t *,ssize_t *,size_t *,size_t *), 155 ParsePageGeometry(const Image *,const char *,RectangleInfo *,ExceptionInfo *), 156 ParseRegionGeometry(const Image *,const char *,RectangleInfo *, 157 ExceptionInfo *); 158 159 extern MagickExport void 160 GravityAdjustGeometry(const size_t,const size_t,const GravityType, 161 RectangleInfo *), 162 SetGeometry(const Image *,RectangleInfo *), 163 SetGeometryInfo(GeometryInfo *); 164 165 #if defined(__cplusplus) || defined(c_plusplus) 166 } 167 #endif 168 169 #endif 170