gdk-pixbuf-transform.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /* GdkPixbuf library - transformations
  2. *
  3. * Copyright (C) 2003 The Free Software Foundation
  4. *
  5. * Authors: Mark Crichton <crichton@gimp.org>
  6. * Miguel de Icaza <miguel@gnu.org>
  7. * Federico Mena-Quintero <federico@gimp.org>
  8. * Havoc Pennington <hp@redhat.com>
  9. *
  10. * This library is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU Lesser General Public
  12. * License as published by the Free Software Foundation; either
  13. * version 2 of the License, or (at your option) any later version.
  14. *
  15. * This library is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * Lesser General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Lesser General Public
  21. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  22. */
  23. #ifndef GDK_PIXBUF_TRANSFORM_H
  24. #define GDK_PIXBUF_TRANSFORM_H
  25. #if defined(GDK_PIXBUF_DISABLE_SINGLE_INCLUDES) && !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION)
  26. #error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
  27. #endif
  28. #include <glib.h>
  29. #include <gdk-pixbuf/gdk-pixbuf-core.h>
  30. G_BEGIN_DECLS
  31. /* Scaling */
  32. /**
  33. * GdkInterpType:
  34. * @GDK_INTERP_NEAREST: Nearest neighbor sampling; this is the fastest
  35. * and lowest quality mode. Quality is normally unacceptable when scaling
  36. * down, but may be OK when scaling up.
  37. * @GDK_INTERP_TILES: This is an accurate simulation of the PostScript
  38. * image operator without any interpolation enabled. Each pixel is
  39. * rendered as a tiny parallelogram of solid color, the edges of which
  40. * are implemented with antialiasing. It resembles nearest neighbor for
  41. * enlargement, and bilinear for reduction.
  42. * @GDK_INTERP_BILINEAR: Best quality/speed balance; use this mode by
  43. * default. Bilinear interpolation. For enlargement, it is
  44. * equivalent to point-sampling the ideal bilinear-interpolated image.
  45. * For reduction, it is equivalent to laying down small tiles and
  46. * integrating over the coverage area.
  47. * @GDK_INTERP_HYPER: This is the slowest and highest quality
  48. * reconstruction function. It is derived from the hyperbolic filters in
  49. * Wolberg's "Digital Image Warping", and is formally defined as the
  50. * hyperbolic-filter sampling the ideal hyperbolic-filter interpolated
  51. * image (the filter is designed to be idempotent for 1:1 pixel mapping).
  52. * **Deprecated**: this interpolation filter is deprecated, as in reality
  53. * it has a lower quality than the @GDK_INTERP_BILINEAR filter
  54. * (Since: 2.38)
  55. *
  56. * Interpolation modes for scaling functions.
  57. *
  58. * The `GDK_INTERP_NEAREST` mode is the fastest scaling method, but has
  59. * horrible quality when scaling down; `GDK_INTERP_BILINEAR` is the best
  60. * choice if you aren't sure what to choose, it has a good speed/quality
  61. * balance.
  62. *
  63. * **Note**: Cubic filtering is missing from the list; hyperbolic
  64. * interpolation is just as fast and results in higher quality.
  65. */
  66. typedef enum {
  67. GDK_INTERP_NEAREST,
  68. GDK_INTERP_TILES,
  69. GDK_INTERP_BILINEAR,
  70. GDK_INTERP_HYPER
  71. } GdkInterpType;
  72. /**
  73. * GdkPixbufRotation:
  74. * @GDK_PIXBUF_ROTATE_NONE: No rotation.
  75. * @GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE: Rotate by 90 degrees.
  76. * @GDK_PIXBUF_ROTATE_UPSIDEDOWN: Rotate by 180 degrees.
  77. * @GDK_PIXBUF_ROTATE_CLOCKWISE: Rotate by 270 degrees.
  78. *
  79. * The possible rotations which can be passed to gdk_pixbuf_rotate_simple().
  80. *
  81. * To make them easier to use, their numerical values are the actual degrees.
  82. */
  83. typedef enum {
  84. GDK_PIXBUF_ROTATE_NONE = 0,
  85. GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE = 90,
  86. GDK_PIXBUF_ROTATE_UPSIDEDOWN = 180,
  87. GDK_PIXBUF_ROTATE_CLOCKWISE = 270
  88. } GdkPixbufRotation;
  89. GDK_PIXBUF_AVAILABLE_IN_ALL
  90. void gdk_pixbuf_scale (const GdkPixbuf *src,
  91. GdkPixbuf *dest,
  92. int dest_x,
  93. int dest_y,
  94. int dest_width,
  95. int dest_height,
  96. double offset_x,
  97. double offset_y,
  98. double scale_x,
  99. double scale_y,
  100. GdkInterpType interp_type);
  101. GDK_PIXBUF_AVAILABLE_IN_ALL
  102. void gdk_pixbuf_composite (const GdkPixbuf *src,
  103. GdkPixbuf *dest,
  104. int dest_x,
  105. int dest_y,
  106. int dest_width,
  107. int dest_height,
  108. double offset_x,
  109. double offset_y,
  110. double scale_x,
  111. double scale_y,
  112. GdkInterpType interp_type,
  113. int overall_alpha);
  114. GDK_PIXBUF_AVAILABLE_IN_ALL
  115. void gdk_pixbuf_composite_color (const GdkPixbuf *src,
  116. GdkPixbuf *dest,
  117. int dest_x,
  118. int dest_y,
  119. int dest_width,
  120. int dest_height,
  121. double offset_x,
  122. double offset_y,
  123. double scale_x,
  124. double scale_y,
  125. GdkInterpType interp_type,
  126. int overall_alpha,
  127. int check_x,
  128. int check_y,
  129. int check_size,
  130. guint32 color1,
  131. guint32 color2);
  132. GDK_PIXBUF_AVAILABLE_IN_ALL
  133. GdkPixbuf *gdk_pixbuf_scale_simple (const GdkPixbuf *src,
  134. int dest_width,
  135. int dest_height,
  136. GdkInterpType interp_type);
  137. GDK_PIXBUF_AVAILABLE_IN_ALL
  138. GdkPixbuf *gdk_pixbuf_composite_color_simple (const GdkPixbuf *src,
  139. int dest_width,
  140. int dest_height,
  141. GdkInterpType interp_type,
  142. int overall_alpha,
  143. int check_size,
  144. guint32 color1,
  145. guint32 color2);
  146. GDK_PIXBUF_AVAILABLE_IN_2_6
  147. GdkPixbuf *gdk_pixbuf_rotate_simple (const GdkPixbuf *src,
  148. GdkPixbufRotation angle);
  149. GDK_PIXBUF_AVAILABLE_IN_2_6
  150. GdkPixbuf *gdk_pixbuf_flip (const GdkPixbuf *src,
  151. gboolean horizontal);
  152. G_END_DECLS
  153. #endif /* GDK_PIXBUF_TRANSFORM_H */