|
From: Peter <sw...@ho...> - 2007-01-20 23:06:14
|
On Sat, 20 Jan 2007 22:02:46 +0000, Peter wrote:
OK, some adjustments needed to be made, and here's the gist of it. Still
needs more testing but in order to center or otherwise manipulate the
image, two new variables, offset_x and y needed to be declared. Then, they
are applied in the call to gdk_pixbuf. Before, x,y would default to 0,0
for the placement and 0,0 for the offset. The offset can be negative, so
when an image is overscaled, it can be offset at a negative location thus
centering the image.
offset_x = (screen_width - width * scale) / 2;
offset_y = (screen_height - height * scale) / 2;
dest_x = MAX(offset_x, 0);
dest_y = MAX(offset_y, 0);
gdk_pixbuf_composite(old, pixbuf,
dest_x, dest_y,
MIN(screen_width, width * scale),
MIN(screen_height, height * scale),
offset_x, offset_y, scale, scale,
o_pinboard_image_scaling.int_value?
GDK_INTERP_BILINEAR: GDK_INTERP_HYPER,
255);
By declaring offset_x and y, different image locations can be selected.
Dest x and y have to be 0,0 or greater otherwise gdk will assert.
Looks good so far.
--
Peter
|