gdk-pixbuf-transform.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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. *
  53. * This enumeration describes the different interpolation modes that
  54. * can be used with the scaling functions. @GDK_INTERP_NEAREST is
  55. * the fastest scaling method, but has horrible quality when
  56. * scaling down. @GDK_INTERP_BILINEAR is the best choice if you
  57. * aren't sure what to choose, it has a good speed/quality balance.
  58. *
  59. * <note>
  60. * Cubic filtering is missing from the list; hyperbolic
  61. * interpolation is just as fast and results in higher quality.
  62. * </note>
  63. */
  64. typedef enum {
  65. GDK_INTERP_NEAREST,
  66. GDK_INTERP_TILES,
  67. GDK_INTERP_BILINEAR,
  68. GDK_INTERP_HYPER
  69. } GdkInterpType;
  70. /**
  71. * GdkPixbufRotation:
  72. * @GDK_PIXBUF_ROTATE_NONE: No rotation.
  73. * @GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE: Rotate by 90 degrees.
  74. * @GDK_PIXBUF_ROTATE_UPSIDEDOWN: Rotate by 180 degrees.
  75. * @GDK_PIXBUF_ROTATE_CLOCKWISE: Rotate by 270 degrees.
  76. *
  77. * The possible rotations which can be passed to gdk_pixbuf_rotate_simple().
  78. * To make them easier to use, their numerical values are the actual degrees.
  79. */
  80. typedef enum {
  81. GDK_PIXBUF_ROTATE_NONE = 0,
  82. GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE = 90,
  83. GDK_PIXBUF_ROTATE_UPSIDEDOWN = 180,
  84. GDK_PIXBUF_ROTATE_CLOCKWISE = 270
  85. } GdkPixbufRotation;
  86. void gdk_pixbuf_scale (const GdkPixbuf *src,
  87. GdkPixbuf *dest,
  88. int dest_x,
  89. int dest_y,
  90. int dest_width,
  91. int dest_height,
  92. double offset_x,
  93. double offset_y,
  94. double scale_x,
  95. double scale_y,
  96. GdkInterpType interp_type);
  97. void gdk_pixbuf_composite (const GdkPixbuf *src,
  98. GdkPixbuf *dest,
  99. int dest_x,
  100. int dest_y,
  101. int dest_width,
  102. int dest_height,
  103. double offset_x,
  104. double offset_y,
  105. double scale_x,
  106. double scale_y,
  107. GdkInterpType interp_type,
  108. int overall_alpha);
  109. void gdk_pixbuf_composite_color (const GdkPixbuf *src,
  110. GdkPixbuf *dest,
  111. int dest_x,
  112. int dest_y,
  113. int dest_width,
  114. int dest_height,
  115. double offset_x,
  116. double offset_y,
  117. double scale_x,
  118. double scale_y,
  119. GdkInterpType interp_type,
  120. int overall_alpha,
  121. int check_x,
  122. int check_y,
  123. int check_size,
  124. guint32 color1,
  125. guint32 color2);
  126. GdkPixbuf *gdk_pixbuf_scale_simple (const GdkPixbuf *src,
  127. int dest_width,
  128. int dest_height,
  129. GdkInterpType interp_type);
  130. GdkPixbuf *gdk_pixbuf_composite_color_simple (const GdkPixbuf *src,
  131. int dest_width,
  132. int dest_height,
  133. GdkInterpType interp_type,
  134. int overall_alpha,
  135. int check_size,
  136. guint32 color1,
  137. guint32 color2);
  138. GdkPixbuf *gdk_pixbuf_rotate_simple (const GdkPixbuf *src,
  139. GdkPixbufRotation angle);
  140. GdkPixbuf *gdk_pixbuf_flip (const GdkPixbuf *src,
  141. gboolean horizontal);
  142. G_END_DECLS
  143. #endif /* GDK_PIXBUF_TRANSFORM_H */