cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 1 | /* |
Cristy | 7ce65e7 | 2015-12-12 18:03:16 -0500 | [diff] [blame] | 2 | Copyright 1999-2016 ImageMagick Studio LLC, a non-profit organization |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 3 | dedicated to making software imaging solutions freely available. |
anthony | 4553109 | 2012-04-23 00:33:53 +0000 | [diff] [blame] | 4 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 5 | You may not use this file except in compliance with the License. |
| 6 | obtain a copy of the License at |
anthony | 4553109 | 2012-04-23 00:33:53 +0000 | [diff] [blame] | 7 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 8 | http://www.imagemagick.org/script/license.php |
anthony | 4553109 | 2012-04-23 00:33:53 +0000 | [diff] [blame] | 9 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 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, |
anthony | bf5924f | 2010-05-07 03:33:10 +0000 | [diff] [blame] | 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 */ |
cristy | 1ad6c87 | 2012-08-02 11:54:05 +0000 | [diff] [blame] | 58 | SeparatorValue = 0x80000, /* 'x' separator found */ |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 59 | #undef AllValues |
| 60 | AllValues = 0x7fffffff |
| 61 | } GeometryFlags; |
| 62 | |
| 63 | #if defined(ForgetGravity) |
| 64 | #undef ForgetGravity |
| 65 | #undef NorthWestGravity |
| 66 | #undef NorthGravity |
| 67 | #undef NorthEastGravity |
| 68 | #undef WestGravity |
| 69 | #undef CenterGravity |
| 70 | #undef EastGravity |
| 71 | #undef SouthWestGravity |
| 72 | #undef SouthGravity |
| 73 | #undef SouthEastGravity |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 74 | #endif |
| 75 | |
| 76 | typedef enum |
| 77 | { |
| 78 | UndefinedGravity, |
| 79 | ForgetGravity = 0, |
| 80 | NorthWestGravity = 1, |
| 81 | NorthGravity = 2, |
| 82 | NorthEastGravity = 3, |
anthony | 4553109 | 2012-04-23 00:33:53 +0000 | [diff] [blame] | 83 | WestGravity = 4, |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 84 | CenterGravity = 5, |
| 85 | EastGravity = 6, |
| 86 | SouthWestGravity = 7, |
| 87 | SouthGravity = 8, |
cristy | 2105ce7 | 2013-02-12 18:56:22 +0000 | [diff] [blame] | 88 | SouthEastGravity = 9 |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 89 | } GravityType; |
| 90 | |
| 91 | typedef struct _AffineMatrix |
| 92 | { |
| 93 | double |
| 94 | sx, |
| 95 | rx, |
| 96 | ry, |
| 97 | sy, |
| 98 | tx, |
| 99 | ty; |
| 100 | } AffineMatrix; |
| 101 | |
| 102 | typedef struct _GeometryInfo |
| 103 | { |
| 104 | double |
| 105 | rho, |
| 106 | sigma, |
| 107 | xi, |
| 108 | psi, |
| 109 | chi; |
| 110 | } GeometryInfo; |
| 111 | |
cristy | 365e58f | 2010-02-15 02:00:01 +0000 | [diff] [blame] | 112 | typedef struct _OffsetInfo |
| 113 | { |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 114 | ssize_t |
cristy | 365e58f | 2010-02-15 02:00:01 +0000 | [diff] [blame] | 115 | x, |
| 116 | y; |
| 117 | } OffsetInfo; |
| 118 | |
cristy | 2a11bef | 2011-10-28 18:33:11 +0000 | [diff] [blame] | 119 | typedef struct _PointInfo |
| 120 | { |
| 121 | double |
| 122 | x, |
| 123 | y; |
| 124 | } PointInfo; |
| 125 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 126 | typedef struct _RectangleInfo |
| 127 | { |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 128 | size_t |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 129 | width, |
| 130 | height; |
| 131 | |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 132 | ssize_t |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 133 | x, |
| 134 | y; |
| 135 | } RectangleInfo; |
| 136 | |
| 137 | extern MagickExport char |
| 138 | *GetPageGeometry(const char *); |
| 139 | |
| 140 | extern MagickExport MagickBooleanType |
| 141 | IsGeometry(const char *), |
| 142 | IsSceneGeometry(const char *,const MagickBooleanType); |
| 143 | |
| 144 | extern MagickExport MagickStatusType |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 145 | GetGeometry(const char *,ssize_t *,ssize_t *,size_t *,size_t *), |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 146 | ParseAbsoluteGeometry(const char *,RectangleInfo *), |
| 147 | ParseAffineGeometry(const char *,AffineMatrix *,ExceptionInfo *), |
| 148 | ParseGeometry(const char *,GeometryInfo *), |
| 149 | ParseGravityGeometry(const Image *,const char *,RectangleInfo *, |
| 150 | ExceptionInfo *), |
cristy | bb50337 | 2010-05-27 20:51:26 +0000 | [diff] [blame] | 151 | ParseMetaGeometry(const char *,ssize_t *,ssize_t *,size_t *,size_t *), |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 152 | ParsePageGeometry(const Image *,const char *,RectangleInfo *,ExceptionInfo *), |
| 153 | ParseRegionGeometry(const Image *,const char *,RectangleInfo *, |
| 154 | ExceptionInfo *); |
| 155 | |
| 156 | extern MagickExport void |
cristy | ee31ab8 | 2014-10-06 11:35:27 +0000 | [diff] [blame] | 157 | GravityAdjustGeometry(const size_t,const size_t,const GravityType, |
| 158 | RectangleInfo *), |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 159 | SetGeometry(const Image *,RectangleInfo *), |
| 160 | SetGeometryInfo(GeometryInfo *); |
| 161 | |
| 162 | #if defined(__cplusplus) || defined(c_plusplus) |
| 163 | } |
| 164 | #endif |
| 165 | |
| 166 | #endif |