Allow -1 for width/height to mean "width/height of pixbuf" (Patch from

Wed Sep 19 16:12:16 2001  Owen Taylor  <otaylor@redhat.com>

	* gdk/gdkpixbuf-render.c: Allow -1 for width/height
	to mean "width/height of pixbuf" (Patch from Matthias Clasen,
	#59723)
This commit is contained in:
Owen Taylor 2001-09-19 20:13:16 +00:00 committed by Owen Taylor
parent de24d6cd79
commit 32b708985d
8 changed files with 67 additions and 9 deletions

View File

@ -1,3 +1,9 @@
Wed Sep 19 16:12:16 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkpixbuf-render.c: Allow -1 for width/height
to mean "width/height of pixbuf" (Patch from Matthias Clasen,
#59723)
Wed Sep 19 16:01:27 2001 Owen Taylor <otaylor@redhat.com>
Patch from Frank Belew #59037 for Solaris compilation.

View File

@ -1,3 +1,9 @@
Wed Sep 19 16:12:16 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkpixbuf-render.c: Allow -1 for width/height
to mean "width/height of pixbuf" (Patch from Matthias Clasen,
#59723)
Wed Sep 19 16:01:27 2001 Owen Taylor <otaylor@redhat.com>
Patch from Frank Belew #59037 for Solaris compilation.

View File

@ -1,3 +1,9 @@
Wed Sep 19 16:12:16 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkpixbuf-render.c: Allow -1 for width/height
to mean "width/height of pixbuf" (Patch from Matthias Clasen,
#59723)
Wed Sep 19 16:01:27 2001 Owen Taylor <otaylor@redhat.com>
Patch from Frank Belew #59037 for Solaris compilation.

View File

@ -1,3 +1,9 @@
Wed Sep 19 16:12:16 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkpixbuf-render.c: Allow -1 for width/height
to mean "width/height of pixbuf" (Patch from Matthias Clasen,
#59723)
Wed Sep 19 16:01:27 2001 Owen Taylor <otaylor@redhat.com>
Patch from Frank Belew #59037 for Solaris compilation.

View File

@ -1,3 +1,9 @@
Wed Sep 19 16:12:16 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkpixbuf-render.c: Allow -1 for width/height
to mean "width/height of pixbuf" (Patch from Matthias Clasen,
#59723)
Wed Sep 19 16:01:27 2001 Owen Taylor <otaylor@redhat.com>
Patch from Frank Belew #59037 for Solaris compilation.

View File

@ -1,3 +1,9 @@
Wed Sep 19 16:12:16 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkpixbuf-render.c: Allow -1 for width/height
to mean "width/height of pixbuf" (Patch from Matthias Clasen,
#59723)
Wed Sep 19 16:01:27 2001 Owen Taylor <otaylor@redhat.com>
Patch from Frank Belew #59037 for Solaris compilation.

View File

@ -1,3 +1,9 @@
Wed Sep 19 16:12:16 2001 Owen Taylor <otaylor@redhat.com>
* gdk/gdkpixbuf-render.c: Allow -1 for width/height
to mean "width/height of pixbuf" (Patch from Matthias Clasen,
#59723)
Wed Sep 19 16:01:27 2001 Owen Taylor <otaylor@redhat.com>
Patch from Frank Belew #59037 for Solaris compilation.

View File

@ -35,8 +35,8 @@
* @src_y: source Y coordinate.
* @dest_x: Destination X coordinate.
* @dest_y: Destination Y coordinate.
* @width: Width of region to threshold.
* @height: Height of region to threshold.
* @width: Width of region to threshold, or -1 to use pixbuf width
* @height: Height of region to threshold, or -1 to use pixbuf height
* @alpha_threshold: Opacity values below this will be painted as zero; all
* other values will be painted as one.
*
@ -60,11 +60,16 @@ gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf,
int start, start_status;
int status;
g_return_if_fail (pixbuf != NULL);
g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
g_return_if_fail (pixbuf->colorspace == GDK_COLORSPACE_RGB);
g_return_if_fail (pixbuf->n_channels == 3 || pixbuf->n_channels == 4);
g_return_if_fail (pixbuf->bits_per_sample == 8);
if (width == -1)
width = pixbuf->width;
if (height == -1)
height = pixbuf->height;
g_return_if_fail (bitmap != NULL);
g_return_if_fail (width >= 0 && height >= 0);
g_return_if_fail (src_x >= 0 && src_x + width <= pixbuf->width);
@ -139,8 +144,8 @@ gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf,
* @src_y: Source Y coordinate within pixbuf.
* @dest_x: Destination X coordinate within drawable.
* @dest_y: Destination Y coordinate within drawable.
* @width: Width of region to render, in pixels.
* @height: Height of region to render, in pixels.
* @width: Width of region to render, in pixels, or -1 to use pixbuf width
* @height: Height of region to render, in pixels, or -1 to use pixbuf height
* @dither: Dithering mode for GdkRGB.
* @x_dither: X offset for dither.
* @y_dither: Y offset for dither.
@ -171,7 +176,7 @@ gdk_pixbuf_render_to_drawable (GdkPixbuf *pixbuf,
int rowstride;
guchar *buf;
g_return_if_fail (pixbuf != NULL);
g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
g_return_if_fail (pixbuf->colorspace == GDK_COLORSPACE_RGB);
g_return_if_fail (pixbuf->n_channels == 3 || pixbuf->n_channels == 4);
g_return_if_fail (pixbuf->bits_per_sample == 8);
@ -179,6 +184,11 @@ gdk_pixbuf_render_to_drawable (GdkPixbuf *pixbuf,
g_return_if_fail (drawable != NULL);
g_return_if_fail (gc != NULL);
if (width == -1)
width = pixbuf->width;
if (height == -1)
height = pixbuf->height;
g_return_if_fail (width >= 0 && height >= 0);
g_return_if_fail (src_x >= 0 && src_x + width <= pixbuf->width);
g_return_if_fail (src_y >= 0 && src_y + height <= pixbuf->height);
@ -225,8 +235,8 @@ gdk_pixbuf_render_to_drawable (GdkPixbuf *pixbuf,
* @src_y: Source Y coordinates within pixbuf.
* @dest_x: Destination X coordinate within drawable.
* @dest_y: Destination Y coordinate within drawable.
* @width: Width of region to render, in pixels.
* @height: Height of region to render, in pixels.
* @width: Width of region to render, in pixels, or -1 to use pixbuf width.
* @height: Height of region to render, in pixels, or -1 to use pixbuf height.
* @alpha_mode: If the image does not have opacity information, this is ignored.
* Otherwise, specifies how to handle transparency when rendering.
* @alpha_threshold: If the image does have opacity information and @alpha_mode
@ -271,12 +281,18 @@ gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf,
GdkRegion *drect;
GdkRectangle tmp_rect;
g_return_if_fail (pixbuf != NULL);
g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
g_return_if_fail (pixbuf->colorspace == GDK_COLORSPACE_RGB);
g_return_if_fail (pixbuf->n_channels == 3 || pixbuf->n_channels == 4);
g_return_if_fail (pixbuf->bits_per_sample == 8);
g_return_if_fail (drawable != NULL);
if (width == -1)
width = pixbuf->width;
if (height == -1)
height = pixbuf->height;
g_return_if_fail (width >= 0 && height >= 0);
g_return_if_fail (src_x >= 0 && src_x + width <= pixbuf->width);
g_return_if_fail (src_y >= 0 && src_y + height <= pixbuf->height);