1 #include "gdk-pixbuf.h"
2 #include "pixops/pixops.h"
8 * @dest: the #GdkPixbuf into which to render the results
9 * @dest_x: the left coordinate for region to render
10 * @dest_y: the top coordinate for region to render
11 * @dest_width: the width of the region to render
12 * @dest_height: the height of the region to render
13 * @offset_x: the offset in the X direction (currently rounded to an integer)
14 * @offset_y: the offset in the Y direction (currently rounded to an integer)
15 * @scale_x: the scale factor in the X direction
16 * @scale_y: the scale factor in the Y direction
17 * @filter_level: the filter quality for the transformation.
19 * Transforms the image by source image by scaling by @scale_x and @scale_y then
20 * translating by @offset_x and @offset_y, then renders the rectangle
21 * (@dest,@dest_y,@dest_width,@dest_height) of the resulting image onto the
22 * destination drawable replacing the previous contents.
25 gdk_pixbuf_scale (const GdkPixbuf *src,
35 ArtFilterLevel filter_level)
37 offset_x = floor (offset_x + 0.5);
38 offset_y = floor (offset_y + 0.5);
40 pixops_scale (dest->art_pixbuf->pixels + dest_y * dest->art_pixbuf->rowstride + dest_x * dest->art_pixbuf->n_channels,
41 -offset_x, -offset_y, dest_width - offset_x, dest_height - offset_y,
42 dest->art_pixbuf->rowstride, dest->art_pixbuf->n_channels, dest->art_pixbuf->has_alpha,
43 src->art_pixbuf->pixels, src->art_pixbuf->width, src->art_pixbuf->height,
44 src->art_pixbuf->rowstride, src->art_pixbuf->n_channels, src->art_pixbuf->has_alpha,
45 scale_x, scale_y, filter_level);
49 * gdk_pixbuf_composite:
51 * @dest: the #GdkPixbuf into which to render the results
52 * @dest_x: the left coordinate for region to render
53 * @dest_y: the top coordinate for region to render
54 * @dest_width: the width of the region to render
55 * @dest_height: the height of the region to render
56 * @offset_x: the offset in the X direction (currently rounded to an integer)
57 * @offset_y: the offset in the Y direction (currently rounded to an integer)
58 * @scale_x: the scale factor in the X direction
59 * @scale_y: the scale factor in the Y direction
60 * @filter_level: the filter quality for the transformation.
61 * @overall_alpha: overall alpha for source image (0..255)
63 * Transforms the image by source image by scaling by @scale_x and @scale_y then
64 * translating by @offset_x and @offset_y, then composites the rectangle
65 * (@dest,@dest_y,@dest_width,@dest_height) of the resulting image onto the
66 * destination drawable.
69 gdk_pixbuf_composite (const GdkPixbuf *src,
79 ArtFilterLevel filter_level,
82 offset_x = floor (offset_x + 0.5);
83 offset_y = floor (offset_y + 0.5);
84 pixops_composite (dest->art_pixbuf->pixels + dest_y * dest->art_pixbuf->rowstride + dest_x * dest->art_pixbuf->n_channels,
85 -offset_x, -offset_y, dest_width - offset_x, dest_height - offset_y,
86 dest->art_pixbuf->rowstride, dest->art_pixbuf->n_channels, dest->art_pixbuf->has_alpha,
87 src->art_pixbuf->pixels, src->art_pixbuf->width, src->art_pixbuf->height,
88 src->art_pixbuf->rowstride, src->art_pixbuf->n_channels, src->art_pixbuf->has_alpha,
89 scale_x, scale_y, filter_level, overall_alpha);
93 * gdk_pixbuf_composite_color:
95 * @dest: the #GdkPixbuf into which to render the results
96 * @dest_x: the left coordinate for region to render
97 * @dest_y: the top coordinate for region to render
98 * @dest_width: the width of the region to render
99 * @dest_height: the height of the region to render
100 * @offset_x: the offset in the X direction (currently rounded to an integer)
101 * @offset_y: the offset in the Y direction (currently rounded to an integer)
102 * @scale_x: the scale factor in the X direction
103 * @scale_y: the scale factor in the Y direction
104 * @filter_level: the filter quality for the transformation.
105 * @overall_alpha: overall alpha for source image (0..255)
106 * @check_x: the X offset for the checkboard (origin of checkboard is at -@check_x, -@check_y)
107 * @check_y: the Y offset for the checkboard
108 * @check_size: the size of checks in the checkboard (must be a power of two)
109 * @color1: the color of check at upper left
110 * @color2: the color of the other check
112 * Transforms the image by source image by scaling by @scale_x and @scale_y then
113 * translating by @offset_x and @offset_y, then composites the rectangle
114 * (@dest,@dest_y,@dest_width,@dest_height) of the resulting image with
115 * a checkboard of the colors @color1 and @color2 and renders it onto the
116 * destination drawable.
119 gdk_pixbuf_composite_color (const GdkPixbuf *src,
129 ArtFilterLevel filter_level,
137 offset_x = floor (offset_x + 0.5);
138 offset_y = floor (offset_y + 0.5);
140 pixops_composite_color (dest->art_pixbuf->pixels + dest_y * dest->art_pixbuf->rowstride + dest_x * dest->art_pixbuf->n_channels,
141 -offset_x, -offset_y, dest_width - offset_x, dest_height - offset_y,
142 dest->art_pixbuf->rowstride, dest->art_pixbuf->n_channels, dest->art_pixbuf->has_alpha,
143 src->art_pixbuf->pixels, src->art_pixbuf->width, src->art_pixbuf->height,
144 src->art_pixbuf->rowstride, src->art_pixbuf->n_channels, src->art_pixbuf->has_alpha,
145 scale_x, scale_y, filter_level, overall_alpha, check_x, check_y, check_size, color1, color2);
149 * gdk_pixbuf_scale_simple:
151 * @dest_width: the width of destination image
152 * @dest_height: the height of destination image
153 * @filter_level: the filter quality for the transformation.
155 * Scale the #GdkPixbuf @src to @dest_width x @dest_height and render the result into
158 * Return value: the new #GdkPixbuf
161 gdk_pixbuf_scale_simple (const GdkPixbuf *src,
164 ArtFilterLevel filter_level)
166 GdkPixbuf *dest = gdk_pixbuf_new (ART_PIX_RGB, src->art_pixbuf->has_alpha, 8, dest_width, dest_height);
168 gdk_pixbuf_scale (src, dest, 0, 0, dest_width, dest_height, 0, 0,
169 (double)dest_width / src->art_pixbuf->width,
170 (double)dest_height / src->art_pixbuf->height,
177 * gdk_pixbuf_composite_color_simple:
179 * @dest_width: the width of destination image
180 * @dest_height: the height of destination image
181 * @filter_level: the filter quality for the transformation.
182 * @overall_alpha: overall alpha for source image (0..255)
183 * @check_size: the size of checks in the checkboard (must be a power of two)
184 * @color1: the color of check at upper left
185 * @color2: the color of the other check
187 * Scale the #GdkPixbuf @src to @dest_width x @dest_height composite the result with
188 * a checkboard of colors @color1 and @color2 and render the result into
191 * Return value: the new #GdkPixbuf
194 gdk_pixbuf_composite_color_simple (const GdkPixbuf *src,
197 ArtFilterLevel filter_level,
203 GdkPixbuf *dest = gdk_pixbuf_new (ART_PIX_RGB, src->art_pixbuf->has_alpha, 8, dest_width, dest_height);
205 gdk_pixbuf_composite_color (src, dest, 0, 0, dest_width, dest_height, 0, 0,
206 (double)dest_width / src->art_pixbuf->width,
207 (double)dest_height / src->art_pixbuf->height,
208 filter_level, overall_alpha, 0, 0, check_size, color1, color2);