diff --git a/docs/reference/gdk-pixbuf/Makefile.am b/docs/reference/gdk-pixbuf/Makefile.am
index b66ecede0..eef777148 100644
--- a/docs/reference/gdk-pixbuf/Makefile.am
+++ b/docs/reference/gdk-pixbuf/Makefile.am
@@ -9,15 +9,15 @@ DOC_MAIN_SGML_FILE=gdk-pixbuf.sgml
# The directory containing the source code (if it contains documentation).
DOC_SOURCE_DIR=$(GDK_PIXBUF_DIR)/gdk-pixbuf
-CFLAGS=`gnome-config --cflags gnomeui gdk_pixbuf`
-LDFLAGS=`gnome-config --libs gnomeui gdk_pixbuf`
+CFLAGS=`gnome-config --cflags gnomeui gdk_pixbuf gnomecanvaspixbuf`
+LDFLAGS=`gnome-config --libs gnomeui gdk_pixbuf gnomecanvaspixbuf`
HTML_DIR=$(datadir)/gnome/html
TARGET_DIR=$(HTML_DIR)/$(DOC_MODULE)
tmpl_sources = \
- tmpl/animation.sgml
+ tmpl/animation.sgml \
tmpl/creating.sgml \
tmpl/file-loading.sgml \
tmpl/from-drawables.sgml \
diff --git a/docs/reference/gdk-pixbuf/gdk-pixbuf-decl.txt b/docs/reference/gdk-pixbuf/gdk-pixbuf-decl.txt
index 884c3247b..b85363d39 100644
--- a/docs/reference/gdk-pixbuf/gdk-pixbuf-decl.txt
+++ b/docs/reference/gdk-pixbuf/gdk-pixbuf-decl.txt
@@ -14,8 +14,7 @@ GdkPixbuf *pixbuf,
ModuleFrameDoneNotifyFuncvoid
-GdkPixbuf *pixbuf,
- gint frame,
+GdkPixbufFrame *frame,
gpointer user_data
@@ -286,11 +285,21 @@ GdkPixbuf *pixbuf,GdkDrawable *drawable, GdkGC *gc,int src_x, int src_y,int dest
GdkPixbuf *pixbuf, GdkDrawable *drawable,int src_x, int src_y,int dest_x, int dest_y,int width, int height,GdkPixbufAlphaMode alpha_mode,int alpha_threshold,GdkRgbDither dither,int x_dither, int y_dither
+gdk_pixbuf_render_pixmap_and_mask
+void
+GdkPixbuf *pixbuf,GdkPixmap **pixmap_return, GdkBitmap **mask_return,int alpha_threshold
+
+gdk_pixbuf_get_from_drawableGdkPixbuf *
GdkPixbuf *dest,GdkDrawable *src, GdkColormap *cmap,int src_x, int src_y,int dest_x, int dest_y,int width, int height
+gdk_pixbuf_copy_area
+void
+GdkPixbuf *src_pixbuf,int src_x, int src_y,int width, int height,GdkPixbuf *dest_pixbuf,int dest_x, int dest_y
+
+gdk_pixbuf_scalevoid
GdkPixbuf *src,GdkPixbuf *dest,int dest_x,int dest_y,int dest_width,int dest_height,double offset_x,double offset_y,double scale_x,double scale_y,ArtFilterLevel filter_level
@@ -330,6 +339,16 @@ GdkPixbufAnimation *animation
void
GdkPixbufAnimation *animation
+
+gdk_pixbuf_preinit
+void
+gpointer app, gpointer modinfo
+
+
+gdk_pixbuf_postinit
+void
+gpointer app, gpointer modinfo
+GNOME_TYPE_CANVAS_PIXBUF
#define GNOME_TYPE_CANVAS_PIXBUF (gnome_canvas_pixbuf_get_type ())
@@ -373,3 +392,23 @@ struct GnomeCanvasPixbuf {
GtkType
void
+
+GDK_PIXBUF_MAJOR
+#define GDK_PIXBUF_MAJOR (0)
+
+
+GDK_PIXBUF_MINOR
+#define GDK_PIXBUF_MINOR (4)
+
+
+GDK_PIXBUF_MICRO
+#define GDK_PIXBUF_MICRO (0)
+
+
+GDK_PIXBUF_VERSION
+#define GDK_PIXBUF_VERSION "0.4.0"
+
+
+gdk_pixbuf_version
+extern const char *gdk_pixbuf_version;
+
diff --git a/docs/reference/gdk-pixbuf/gdk-pixbuf-sections.txt b/docs/reference/gdk-pixbuf/gdk-pixbuf-sections.txt
index 7de064ea7..82673441b 100644
--- a/docs/reference/gdk-pixbuf/gdk-pixbuf-sections.txt
+++ b/docs/reference/gdk-pixbuf/gdk-pixbuf-sections.txt
@@ -38,6 +38,7 @@ GdkPixbufAlphaMode
gdk_pixbuf_render_to_drawable_alpha
gdk_pixbuf_render_to_drawable
gdk_pixbuf_render_threshold_alpha
+gdk_pixbuf_render_pixmap_and_mask
@@ -48,6 +49,7 @@ gdk_pixbuf_get_from_drawable
util
gdk_pixbuf_add_alpha
+gdk_pixbuf_copy_area
diff --git a/docs/reference/gdk-pixbuf/gdk-pixbuf.args b/docs/reference/gdk-pixbuf/gdk-pixbuf.args
index b212136dc..8813bd7b3 100644
--- a/docs/reference/gdk-pixbuf/gdk-pixbuf.args
+++ b/docs/reference/gdk-pixbuf/gdk-pixbuf.args
@@ -17,7 +17,7 @@
-GnomeCanvasPixbuf::width_pixels
+GnomeCanvasPixbuf::width_in_pixelsgbooleanrw
@@ -35,7 +35,7 @@
-GnomeCanvasPixbuf::height_pixels
+GnomeCanvasPixbuf::height_in_pixelsgbooleanrw
@@ -53,7 +53,7 @@
-GnomeCanvasPixbuf::x_pixels
+GnomeCanvasPixbuf::x_in_pixelsgbooleanrw
@@ -71,7 +71,7 @@
-GnomeCanvasPixbuf::y_pixels
+GnomeCanvasPixbuf::y_in_pixelsgbooleanrw
diff --git a/docs/reference/gdk-pixbuf/gdk-pixbuf.signals b/docs/reference/gdk-pixbuf/gdk-pixbuf.signals
index d53d60782..7ac8646de 100644
--- a/docs/reference/gdk-pixbuf/gdk-pixbuf.signals
+++ b/docs/reference/gdk-pixbuf/gdk-pixbuf.signals
@@ -14,6 +14,18 @@ gint arg4
GdkPixbufLoader *gdkpixbufloader
+
+GdkPixbufLoader::frame-done
+void
+GdkPixbufLoader *gdkpixbufloader
+
+
+
+GdkPixbufLoader::animation-done
+void
+GdkPixbufLoader *gdkpixbufloader
+
+
GdkPixbufLoader::closedvoid
diff --git a/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-loader.sgml b/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-loader.sgml
index e15293700..ed5a432cf 100644
--- a/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-loader.sgml
+++ b/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-loader.sgml
@@ -54,6 +54,7 @@ Application-driven progressive image loading.
frames are done.
+
gdk_pixbuf_new_from_file()
@@ -146,6 +147,20 @@ Application-driven progressive image loading.
@loader: Loader which emitted the signal.
+
+
+
+
+
+@gdkpixbufloader: the object which received the signal.
+
+
+
+
+
+
+@gdkpixbufloader: the object which received the signal.
+
This signal is emitted when gdk_pixbuf_loader_close() is called.
diff --git a/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-unused.sgml b/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-unused.sgml
index 389771cf3..6f44cdc6b 100644
--- a/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-unused.sgml
+++ b/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-unused.sgml
@@ -1,14 +1,3 @@
-
-
- If this argument is %TRUE, then the width of the pixbuf will be
- considered to be in pixels, that is, it will not be visually
- scaled even if the item's affine transformation changes. If this
- is %FALSE, then the width of the pixbuf will be considered to be
- in canvas units, and so will be scaled normally by affine
- transformations. The default is %FALSE.
-
-
-
@@ -26,12 +15,10 @@
-
-
- Works in the same way as the width_in_pixels
- argument. The default is %FALSE.
-
+
+
+
+
@@ -48,19 +35,10 @@
@stop_load:
@load_increment:
-
-
- Works in the same way as the x_in_pixels
- argument. The default is %FALSE.
-
+
+
-
+
@@ -93,6 +71,12 @@ gdk-pixbuf-io
@pixbuf:
@user_data:
+
+
+
+
+
+
@@ -102,14 +86,9 @@ gdk-pixbuf-io
@size:
@Returns:
-
-
- If this argument is %TRUE, the pixbuf's translation with respect
- to its logical origin in item-relative coordinates will be in
- pixels, that is, the visible offset will not change even if the
- item's affine transformation changes. If it is %FALSE, the
- pixbuf's translation will be taken to be in canvas units, and thus
- will change along with the item's affine transformation.
-
+
+
+
+
diff --git a/docs/reference/gdk-pixbuf/tmpl/gnome-canvas-pixbuf.sgml b/docs/reference/gdk-pixbuf/tmpl/gnome-canvas-pixbuf.sgml
index cd2116528..fd5d97e5b 100644
--- a/docs/reference/gdk-pixbuf/tmpl/gnome-canvas-pixbuf.sgml
+++ b/docs/reference/gdk-pixbuf/tmpl/gnome-canvas-pixbuf.sgml
@@ -234,10 +234,15 @@ Canvas item to display #GdkPixbuf images.
used instead. This argument is %FALSE by default.
-
-
-
-
+
+
+ If this argument is %TRUE, then the width of the pixbuf will be
+ considered to be in pixels, that is, it will not be visually
+ scaled even if the item's affine transformation changes. If this
+ is %FALSE, then the width of the pixbuf will be considered to be
+ in canvas units, and so will be scaled normally by affine
+ transformations. The default is %FALSE.
+
@@ -258,10 +263,12 @@ Canvas item to display #GdkPixbuf images.
The default is %FALSE.
-
-
-
-
+
+
+ Works in the same way as the width_in_pixels
+ argument. The default is %FALSE.
+
@@ -280,10 +287,15 @@ Canvas item to display #GdkPixbuf images.
coordinates.
-
-
-
-
+
+
+ If this argument is %TRUE, the pixbuf's translation with respect
+ to its logical origin in item-relative coordinates will be in
+ pixels, that is, the visible offset will not change even if the
+ item's affine transformation changes. If it is %FALSE, the
+ pixbuf's translation will be taken to be in canvas units, and thus
+ will change along with the item's affine transformation.
+
@@ -302,8 +314,17 @@ Canvas item to display #GdkPixbuf images.
default is %FALSE.
-
-
+
+
+ Works in the same way as the x_in_pixels
+ argument. The default is %FALSE.
+
-
+
diff --git a/docs/reference/gdk-pixbuf/tmpl/rendering.sgml b/docs/reference/gdk-pixbuf/tmpl/rendering.sgml
index 09afa8c65..20365ab3c 100644
--- a/docs/reference/gdk-pixbuf/tmpl/rendering.sgml
+++ b/docs/reference/gdk-pixbuf/tmpl/rendering.sgml
@@ -115,3 +115,14 @@ End:
-->
+
+
+
+
+
+@pixbuf:
+@pixmap_return:
+@mask_return:
+@alpha_threshold:
+
+
diff --git a/docs/reference/gdk-pixbuf/tmpl/scaling.sgml b/docs/reference/gdk-pixbuf/tmpl/scaling.sgml
index 153a5cf43..37411cd4f 100644
--- a/docs/reference/gdk-pixbuf/tmpl/scaling.sgml
+++ b/docs/reference/gdk-pixbuf/tmpl/scaling.sgml
@@ -152,11 +152,11 @@ expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
@check_size:
@color1:
@color2:
-@Returns:
-
-
\ No newline at end of file
+-->
+
+
diff --git a/docs/reference/gdk-pixbuf/tmpl/util.sgml b/docs/reference/gdk-pixbuf/tmpl/util.sgml
index f84edb50e..2d29c7505 100644
--- a/docs/reference/gdk-pixbuf/tmpl/util.sgml
+++ b/docs/reference/gdk-pixbuf/tmpl/util.sgml
@@ -35,3 +35,18 @@ End:
-->
+
+
+
+
+
+@src_pixbuf:
+@src_x:
+@src_y:
+@width:
+@height:
+@dest_pixbuf:
+@dest_x:
+@dest_y:
+
+
diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog
index 1d63ea699..761097662 100644
--- a/gdk-pixbuf/ChangeLog
+++ b/gdk-pixbuf/ChangeLog
@@ -1,8 +1,40 @@
-2000-01-15 Federico Mena Quintero
+2000-01-16 Federico Mena Quintero
+
+ * configure.in: Removed the broken --enable-canvas-pixbuf option.
+ Added the stuff necessary to substitute the variables in
+ gnomecanvaspixbufConf.sh.in.
+
+ * gnomecanvaspixbufConf.sh.in: New gnome-config handler for the
+ tiny gnomecanvaspixbuf library.
+
+ * Makefile.am: Build gnomecanvaspixbufConf.sh.
+
+ * gdk-pixbuf/Makefile.am: Create a libgnomecanvaspixbuf and only
+ build it if gdk-pixbuf is being built outside of gnome-libs.
+
+ * doc/gdk-pixbuf-sections.txt: Added gdk_pixbuf_render_pixmap_and_mask().
+
+ * gdk-pixbuf/gdk-pixbuf-render.c
+ (gdk_pixbuf_render_pixmap_and_mask): Renamed from
+ gdk_pixbuf_render_pixmap(). Do not create the mask if it is not
+ needed, and do not use a clipping mask when rendering the pixmap.
+ Tweaked documentation a little.
* HACKING: New file with hacking policies for the gdk-pixbuf
module.
+ * doc/Makefile.am (tmpl_sources): Added missing backslash.
+
+ * doc/Makefile.am: Use gnomecanvaspixbuf in gnome-config when
+ scanning for docstrings.
+
+ * gdk-pixbuf/gdk-pixbuf-util.c (gdk_pixbuf_copy_area): Made sanity
+ checks more stringent. Removed "gint" abominations. Made
+ documentation consistent with the rest of the functions.
+
+ * doc/gdk-pixbuf-sections.txt: Added gdk_pixbuf_copy_area() to the
+ utilities section.
+
2000-01-14 Jonathan Blandford
* gdk-pixbuf/gdk-pixbuf-render.c (gdk_pixbuf_render_pixmap): new
@@ -17,9 +49,14 @@
* configure.in, gdk-pixbuf/Makefile.am: Build a libcanvas_pixbuf.
- * configure.in: Define version macros. Generate gdk-pixbuf/gdk-pixbuf-features.h. Always INSIDE_GNOME.
+ * configure.in: Define version macros. Generate
+ gdk-pixbuf/gdk-pixbuf-features.h. Always INSIDE_GNOME.
+
* gdk-pixbuf/Makefile.am: Add gdk-pixbuf-features.h
- * gdk-pixbuf/gdk-pixbuf.c: Add definitions of gdk-pixbuf-features.h declarations, plus some initialization stubs.
+
+ * gdk-pixbuf/gdk-pixbuf.c: Add definitions of
+ gdk-pixbuf-features.h declarations, plus some initialization
+ stubs.
2000-01-05 Owen Taylor
diff --git a/gdk-pixbuf/Makefile.am b/gdk-pixbuf/Makefile.am
index 20ae6888b..600408bdc 100644
--- a/gdk-pixbuf/Makefile.am
+++ b/gdk-pixbuf/Makefile.am
@@ -1,16 +1,21 @@
SUBDIRS = pixops
-if CANVAS_PIXBUF
-CPLIB=libcanvas_pixbuf.la
-libcanvas_pixbuf_la_SOURCES=gnome-canvas-pixbuf.c
-CANVAS_HEADERFILES=gnome-canvas-pixbuf.h
+if INSIDE_GNOME_LIBS
+CANVAS_PIXBUF_LIB =
+CANVAS_PIXBUF_HEADERFILES =
+EXTRA_GNOME_LIBS =
else
-CPLIB=
-CANVAS_HEADERFILES=
+CANVAS_PIXBUF_LIB = libgnomecanvaspixbuf.la
+CANVAS_PIXBUF_HEADERFILES=gnome-canvas-pixbuf.h
+EXTRA_GNOME_LIBS = $(GNOME_LIBS)
endif
+
lib_LTLIBRARIES = \
libgdk_pixbuf.la \
- $(CPLIB)
+ $(CANVAS_PIXBUF_LIB)
+
+libgnomecanvaspixbuf_la_SOURCES = gnome-canvas-pixbuf.c
+libgnomecanvaspixbuf_la_LDFLAGS = $(EXTRA_GNOME_LIBS)
libexecdir = $(libdir)/gdk-pixbuf/loaders
@@ -58,9 +63,10 @@ INCLUDES = -I$(top_srcdir) -I$(top_builddir) \
$(GLIB_CFLAGS) $(LIBART_CFLAGS) $(GTK_CFLAGS)
AM_CPPFLAGS = "-DPIXBUF_LIBDIR=\"$(libexecdir)\""
+if INSIDE_GNOME_LIBS
LDADDS = libgdk_pixbuf.la $(LIBART_LIBS) $(GLIB_LIBS) $(GTK_LIBS)
-
-if CANVAS_PIXBUF
+else
+LDADDS = libgdk_pixbuf.la libgnomecanvaspixbuf.la $(LIBART_LIBS) $(GLIB_LIBS) $(GTK_LIBS)
endif
if INSIDE_GNOME_LIBS
@@ -81,13 +87,6 @@ GDK_PIXBUF_LIBS = $(LIBART_LIBS) $(GLIB_LIBS) $(GTK_LIBS)
#
# The GdkPixBuf library
#
-if INSIDE_GNOME_LIBS
-CANVAS_SOURCEFILES=
-CANVAS_HEADERFILES=
-else
-CANVAS_SOURCEFILES= gnome-canvas-pixbuf.c
-CANVAS_HEADERFILES= gnome-canvas-pixbuf.h
-endif
libgdk_pixbufincludedir = $(includedir)/gdk-pixbuf
@@ -100,24 +99,16 @@ libgdk_pixbuf_la_SOURCES = \
gdk-pixbuf-loader.c \
gdk-pixbuf-render.c \
gdk-pixbuf-scale.c \
- gdk-pixbuf-util.c \
- $(CANVAS_SOURCEFILES)
-
-if INSIDE_GNOME_LIBS
-EXTRA_GNOME_LIBS = ""
-else
-EXTRA_GNOME_LIBS = $(GNOME_LIBS)
-endif
+ gdk-pixbuf-util.c
libgdk_pixbuf_la_LDFLAGS = -version-info 1:0:0 $(EXTRA_GNOME_LIBS)
libgdk_pixbuf_la_LIBADD = pixops/libpixops.la
-
libgdk_pixbufinclude_HEADERS = \
gdk-pixbuf.h \
gdk-pixbuf-loader.h \
gdk-pixbuf-features.h \
- $(CANVAS_HEADERFILES)
+ $(CANVAS_PIXBUF_HEADERFILES)
noinst_HEADERS = \
gdk-pixbuf-io.h
diff --git a/gdk-pixbuf/gdk-pixbuf-util.c b/gdk-pixbuf/gdk-pixbuf-util.c
index 2bc7e98b0..36dbed13c 100644
--- a/gdk-pixbuf/gdk-pixbuf-util.c
+++ b/gdk-pixbuf/gdk-pixbuf-util.c
@@ -97,58 +97,47 @@ gdk_pixbuf_add_alpha (GdkPixbuf *pixbuf, gboolean substitute_color, guchar r, gu
/**
* gdk_pixbuf_copy_area:
- * @src_pixbuf: The pixbuf to be copied.
- * @src_x: The X coordinate of the upper left corner of the area to copy.
- * @src_y: The Y coordinate of the upper left corner of the area to copy.
- * @width: The width of the area to copy.
- * @height: The height of the area to copy.
- * @dest_pixbuf: The pixbuf to store the copy in.
- * @dest_x: X coordinate for the upper left corner of the rectangle to draw to in @dest_pixbuf.
- * @dest_y: Y coordinate for the upper left corner of the rectangle to draw to in @dest_pixbuf.
+ * @src_pixbuf: Source pixbuf.
+ * @src_x: Source X coordinate within @src_pixbuf.
+ * @src_y: Source Y coordinate within @src_pixbuf.
+ * @width: Width of the area to copy.
+ * @height: Height of the area to copy.
+ * @dest_pixbuf: Destination pixbuf.
+ * @dest_x: X coordinate within @dest_pixbuf.
+ * @dest_y: Y coordinate within @dest_pixbuf.
*
- * Takes a rectangle area beginning at (@src_x, @src_y) @width pixels wide
- * and @height pixels high from @src_pixbuf and copy it into @dest_pixbuf
- * at (@dest_x, @dest_y). @dest_pixbuf must already be created and must be
- * large enough to hold the requested area.
- *
- * Return value: void
+ * Copies a rectangular area from @src_pixbuf to @dest_pixbuf. Conversion of
+ * pixbuf formats is done automatically.
**/
-void gdk_pixbuf_copy_area(GdkPixbuf *src_pixbuf,
- gint src_x, gint src_y,
- gint width, gint height,
- GdkPixbuf *dest_pixbuf,
- gint dest_x, gint dest_y)
+void
+gdk_pixbuf_copy_area (GdkPixbuf *src_pixbuf,
+ int src_x, int src_y,
+ int width, int height,
+ GdkPixbuf *dest_pixbuf,
+ int dest_x, int dest_y)
{
- gint src_width, src_height, dest_width, dest_height;
+ ArtPixBuf *src_apb, *dest_apb;
- /* Ensure that we have a source pixbuf, and that the requested
- * area is not larger than that pixbuf.
- */
- g_return_if_fail(src_pixbuf != NULL);
+ g_return_if_fail (src_pixbuf != NULL);
+ g_return_if_fail (dest_pixbuf != NULL);
- src_width = gdk_pixbuf_get_width(src_pixbuf);
- src_height = gdk_pixbuf_get_height(src_pixbuf);
+ src_apb = src_pixbuf->art_pixbuf;
+ dest_apb = dest_pixbuf->art_pixbuf;
- g_return_if_fail(src_x >= 0 && width <= src_width);
- g_return_if_fail(src_y >= 0 && height <= src_height);
+ g_return_if_fail (src_x >= 0 && src_x + width <= src_apb->width);
+ g_return_if_fail (src_y >= 0 && src_y + height <= src_apb->height);
- /* Ensure that we have a destination pixbuf, and that the
- * requested area is not larger than that pixbuf.
- */
- g_return_if_fail(dest_pixbuf != NULL);
+ g_return_if_fail (dest_x >= 0 && dest_x + width <= dest_apb->width);
+ g_return_if_fail (dest_y >= 0 && dest_y + height <= dest_apb->height);
- dest_width = gdk_pixbuf_get_width(dest_pixbuf);
- dest_height = gdk_pixbuf_get_height(dest_pixbuf);
+ /* This will perform format conversions automatically */
- g_return_if_fail(dest_x >= 0 && width <= dest_width);
- g_return_if_fail(dest_y >= 0 && height <= dest_height);
-
- /* Scale 1:1 the source pixbuf into the destination pixbuf. */
- gdk_pixbuf_scale(src_pixbuf,
- dest_pixbuf,
- dest_x, dest_y,
- width, height,
- (double)(dest_x - src_x),
- (double)(dest_y - src_y),
- 1., 1., ART_FILTER_NEAREST);
+ gdk_pixbuf_scale (src_pixbuf,
+ dest_pixbuf,
+ dest_x, dest_y,
+ width, height,
+ (double) (dest_x - src_x),
+ (double) (dest_y - src_y),
+ 1.0, 1.0,
+ ART_FILTER_NEAREST);
}
diff --git a/gdk-pixbuf/gdk-pixbuf.h b/gdk-pixbuf/gdk-pixbuf.h
index 9b5265bc4..097c25644 100644
--- a/gdk-pixbuf/gdk-pixbuf.h
+++ b/gdk-pixbuf/gdk-pixbuf.h
@@ -147,11 +147,6 @@ void gdk_pixbuf_render_to_drawable (GdkPixbuf *pixbuf,
GdkRgbDither dither,
int x_dither, int y_dither);
-void gdk_pixbuf_render_pixmap (GdkPixbuf *pixbuf,
- GdkPixmap **pixmap,
- GdkBitmap **mask,
- gint alpha_threshold);
-
void gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf, GdkDrawable *drawable,
int src_x, int src_y,
int dest_x, int dest_y,
@@ -161,6 +156,10 @@ void gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf, GdkDrawable *drawab
GdkRgbDither dither,
int x_dither, int y_dither);
+void gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
+ GdkPixmap **pixmap_return, GdkBitmap **mask_return,
+ int alpha_threshold);
+
/* Fetching a region from a drawable */
GdkPixbuf *gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
GdkDrawable *src, GdkColormap *cmap,
@@ -168,12 +167,12 @@ GdkPixbuf *gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
int dest_x, int dest_y,
int width, int height);
-/* Copy an area of a pixbuf into another one */
+/* Copy an area of a pixbuf onto another one */
void gdk_pixbuf_copy_area (GdkPixbuf *src_pixbuf,
- gint src_x, gint src_y,
- gint width, gint height,
+ int src_x, int src_y,
+ int width, int height,
GdkPixbuf *dest_pixbuf,
- gint dest_x, gint dest_y);
+ int dest_x, int dest_y);
/* Scaling */
diff --git a/gdk/gdkpixbuf-render.c b/gdk/gdkpixbuf-render.c
index 5496aeb5d..742e49c4c 100644
--- a/gdk/gdkpixbuf-render.c
+++ b/gdk/gdkpixbuf-render.c
@@ -170,7 +170,7 @@ remove_alpha (ArtPixBuf *apb, int x, int y, int width, int height, int *rowstrid
* @dither: Dithering mode for GdkRGB.
* @x_dither: X offset for dither.
* @y_dither: Y offset for dither.
- *
+ *
* Renders a rectangular portion of a pixbuf to a drawable while using the
* specified GC. This is done using GdkRGB, so the specified drawable must have
* the GdkRGB visual and colormap. Note that this function will ignore the
@@ -199,7 +199,7 @@ gdk_pixbuf_render_to_drawable (GdkPixbuf *pixbuf,
g_return_if_fail (pixbuf != NULL);
apb = pixbuf->art_pixbuf;
-
+
g_return_if_fail (apb->format == ART_PIX_RGB);
g_return_if_fail (apb->n_channels == 3 || apb->n_channels == 4);
g_return_if_fail (apb->bits_per_sample == 8);
@@ -321,69 +321,49 @@ gdk_pixbuf_render_to_drawable_alpha (GdkPixbuf *pixbuf, GdkDrawable *drawable,
}
/**
- * gdk_pixbuf_render_pixmap:
+ * gdk_pixbuf_render_pixmap_and_mask:
* @pixbuf: A pixbuf
- * @pixmap: A pointer to a pixmap to fill in.
- * @mask_retval: A pointer to the mask to be filled in.
- * @alpha_threshold: Specifies the threshold value for opacity
- * values if the pixbuf has opacity.
+ * @pixmap_return: Return value for the created pixmap.
+ * @mask_return: Return value for the created mask.
+ * @alpha_threshold: Threshold value for opacity values.
*
- * Generates a #GdkPixmap from a #GdkPixbuf, along with an optional mask. The
- * alpha threshold can be used to determine how the mask is created, if the
- * pixbuf has an alpha channel. This function is mainly provided for
- * compatibility reasons, as you will rarely want a #GdkPixmap.
- *
+ * Creates a pixmap and a mask bitmap which are returned in the @pixmap_return
+ * and @mask_return arguments, respectively, and renders a pixbuf and its
+ * corresponding tresholded alpha mask to them. This is merely a convenience
+ * function; applications that need to render pixbufs with dither offsets or to
+ * given drawables should use gdk_pixbuf_render_to_drawable_alpha() or
+ * gdk_pixbuf_render_to_drawable(), and gdk_pixbuf_render_threshold_alpha().
**/
void
-gdk_pixbuf_render_pixmap (GdkPixbuf *pixbuf,
- GdkPixmap **pixmap,
- GdkBitmap **mask_retval,
- gint alpha_threshold)
+gdk_pixbuf_render_pixmap_and_mask (GdkPixbuf *pixbuf,
+ GdkPixmap **pixmap_return, GdkBitmap **mask_return,
+ int alpha_threshold)
{
- GdkBitmap *mask = NULL;
+ ArtPixBuf *apb;
- g_return_if_fail(pixbuf != NULL);
+ g_return_if_fail (pixbuf != NULL);
- /* generate mask */
- if (gdk_pixbuf_get_has_alpha(pixbuf)) {
- mask = gdk_pixmap_new(NULL,
- gdk_pixbuf_get_width(pixbuf),
- gdk_pixbuf_get_height(pixbuf),
- 1);
+ apb = pixbuf->art_pixbuf;
- gdk_pixbuf_render_threshold_alpha(pixbuf, mask,
- 0, 0, 0, 0,
- gdk_pixbuf_get_width(pixbuf),
- gdk_pixbuf_get_height(pixbuf),
- alpha_threshold);
- }
+ if (pixmap_return) {
+ GdkGC *gc;
- /* Draw to pixmap */
- if (pixmap != NULL) {
- GdkGC* gc;
+ *pixmap_return = gdk_pixmap_new (NULL, apb->width, apb->height,
+ gdk_rgb_get_visual ()->depth);
+ gc = gdk_gc_new (*pixmap_return);
+ gdk_pixbuf_render_to_drawable (pixbuf, *pixmap_return, gc,
+ 0, 0, 0, 0,
+ apb->width, apb->height,
+ GDK_RGB_DITHER_NORMAL,
+ 0, 0);
+ gdk_gc_unref (gc);
+ }
- *pixmap = gdk_pixmap_new(NULL,
- gdk_pixbuf_get_width(pixbuf),
- gdk_pixbuf_get_height(pixbuf),
- gdk_rgb_get_visual()->depth);
-
- gc = gdk_gc_new(*pixmap);
-
- gdk_gc_set_clip_mask(gc, mask);
-
- gdk_pixbuf_render_to_drawable(pixbuf, *pixmap,
- gc,
- 0, 0, 0, 0,
- gdk_pixbuf_get_width(pixbuf),
- gdk_pixbuf_get_height(pixbuf),
- GDK_RGB_DITHER_NORMAL,
- 0, 0);
-
- gdk_gc_unref(gc);
- }
-
- if (mask_retval)
- *mask_retval = mask;
- else
- gdk_bitmap_unref(mask);
+ if (mask_return) {
+ *mask_return = gdk_pixmap_new (NULL, apb->width, apb->height, 1);
+ gdk_pixbuf_render_threshold_alpha (pixbuf, *mask_return,
+ 0, 0, 0, 0,
+ apb->width, apb->height,
+ alpha_threshold);
+ }
}