geometry.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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 image geometry methods.
  13. */
  14. #ifndef MAGICKCORE_GEOMETRY_H
  15. #define MAGICKCORE_GEOMETRY_H
  16. #if defined(__cplusplus) || defined(c_plusplus)
  17. extern "C" {
  18. #endif
  19. typedef enum
  20. {
  21. #undef NoValue
  22. NoValue = 0x0000,
  23. #undef XValue
  24. XValue = 0x0001,
  25. XiValue = 0x0001,
  26. #undef YValue
  27. YValue = 0x0002,
  28. PsiValue = 0x0002,
  29. #undef WidthValue
  30. WidthValue = 0x0004,
  31. RhoValue = 0x0004,
  32. #undef HeightValue
  33. HeightValue = 0x0008,
  34. SigmaValue = 0x0008,
  35. ChiValue = 0x0010,
  36. XiNegative = 0x0020,
  37. #undef XNegative
  38. XNegative = 0x0020,
  39. PsiNegative = 0x0040,
  40. #undef YNegative
  41. YNegative = 0x0040,
  42. ChiNegative = 0x0080,
  43. PercentValue = 0x1000, /* '%' percentage of something */
  44. AspectValue = 0x2000, /* '!' resize no-aspect - special use flag */
  45. NormalizeValue = 0x2000, /* '!' ScaleKernelValue() in morphology.c */
  46. LessValue = 0x4000, /* '<' resize smaller - special use flag */
  47. GreaterValue = 0x8000, /* '>' resize larger - spacial use flag */
  48. MinimumValue = 0x10000, /* '^' special handling needed */
  49. CorrelateNormalizeValue = 0x10000, /* '^' see ScaleKernelValue() */
  50. AreaValue = 0x20000, /* '@' resize to area - special use flag */
  51. DecimalValue = 0x40000, /* '.' floating point numbers found */
  52. SeparatorValue = 0x80000, /* 'x' separator found */
  53. AspectRatioValue = 0x100000, /* '~' special handling needed */
  54. AlphaValue = 0x200000, /* '/' alpha */
  55. #undef AllValues
  56. AllValues = 0x7fffffff
  57. } GeometryFlags;
  58. #if defined(ForgetGravity)
  59. #undef ForgetGravity
  60. #undef NorthWestGravity
  61. #undef NorthGravity
  62. #undef NorthEastGravity
  63. #undef WestGravity
  64. #undef CenterGravity
  65. #undef EastGravity
  66. #undef SouthWestGravity
  67. #undef SouthGravity
  68. #undef SouthEastGravity
  69. #undef StaticGravity
  70. #endif
  71. typedef enum
  72. {
  73. UndefinedGravity,
  74. ForgetGravity = 0,
  75. NorthWestGravity = 1,
  76. NorthGravity = 2,
  77. NorthEastGravity = 3,
  78. WestGravity = 4,
  79. CenterGravity = 5,
  80. EastGravity = 6,
  81. SouthWestGravity = 7,
  82. SouthGravity = 8,
  83. SouthEastGravity = 9,
  84. StaticGravity = 10
  85. } GravityType;
  86. typedef struct _AffineMatrix
  87. {
  88. double
  89. sx,
  90. rx,
  91. ry,
  92. sy,
  93. tx,
  94. ty;
  95. } AffineMatrix;
  96. typedef struct _GeometryInfo
  97. {
  98. double
  99. rho,
  100. sigma,
  101. xi,
  102. psi,
  103. chi;
  104. } GeometryInfo;
  105. typedef struct _OffsetInfo
  106. {
  107. ssize_t
  108. x,
  109. y;
  110. } OffsetInfo;
  111. typedef struct _RectangleInfo
  112. {
  113. size_t
  114. width,
  115. height;
  116. ssize_t
  117. x,
  118. y;
  119. } RectangleInfo;
  120. extern MagickExport char
  121. *GetPageGeometry(const char *);
  122. extern MagickExport MagickBooleanType
  123. IsGeometry(const char *),
  124. IsSceneGeometry(const char *,const MagickBooleanType);
  125. extern MagickExport MagickStatusType
  126. GetGeometry(const char *,ssize_t *,ssize_t *,size_t *,size_t *),
  127. ParseAbsoluteGeometry(const char *,RectangleInfo *),
  128. ParseAffineGeometry(const char *,AffineMatrix *,ExceptionInfo *),
  129. ParseGeometry(const char *,GeometryInfo *),
  130. ParseGravityGeometry(const Image *,const char *,RectangleInfo *,
  131. ExceptionInfo *),
  132. ParseMetaGeometry(const char *,ssize_t *,ssize_t *,size_t *,size_t *),
  133. ParsePageGeometry(const Image *,const char *,RectangleInfo *,ExceptionInfo *),
  134. ParseRegionGeometry(const Image *,const char *,RectangleInfo *,
  135. ExceptionInfo *);
  136. extern MagickExport void
  137. GravityAdjustGeometry(const size_t,const size_t,const GravityType,
  138. RectangleInfo *),
  139. SetGeometry(const Image *,RectangleInfo *),
  140. SetGeometryInfo(GeometryInfo *);
  141. #if defined(__cplusplus) || defined(c_plusplus)
  142. }
  143. #endif
  144. #endif