Removed the broken --enable-canvas-pixbuf option. Added the stuff

2000-01-16  Federico Mena Quintero  <federico@helixcode.com>

	* 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.
This commit is contained in:
Federico Mena Quintero 2000-01-17 01:48:21 +00:00 committed by Arturo Espinosa
parent ef80871e0a
commit 4f0f733060
16 changed files with 296 additions and 206 deletions

View File

@ -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 \

View File

@ -14,8 +14,7 @@ GdkPixbuf *pixbuf,
<USER_FUNCTION>
<NAME>ModuleFrameDoneNotifyFunc</NAME>
<RETURNS>void </RETURNS>
GdkPixbuf *pixbuf,
gint frame,
GdkPixbufFrame *frame,
gpointer user_data
</USER_FUNCTION>
<USER_FUNCTION>
@ -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
</FUNCTION>
<FUNCTION>
<NAME>gdk_pixbuf_render_pixmap_and_mask</NAME>
<RETURNS>void </RETURNS>
GdkPixbuf *pixbuf,GdkPixmap **pixmap_return, GdkBitmap **mask_return,int alpha_threshold
</FUNCTION>
<FUNCTION>
<NAME>gdk_pixbuf_get_from_drawable</NAME>
<RETURNS>GdkPixbuf *</RETURNS>
GdkPixbuf *dest,GdkDrawable *src, GdkColormap *cmap,int src_x, int src_y,int dest_x, int dest_y,int width, int height
</FUNCTION>
<FUNCTION>
<NAME>gdk_pixbuf_copy_area</NAME>
<RETURNS>void </RETURNS>
GdkPixbuf *src_pixbuf,int src_x, int src_y,int width, int height,GdkPixbuf *dest_pixbuf,int dest_x, int dest_y
</FUNCTION>
<FUNCTION>
<NAME>gdk_pixbuf_scale</NAME>
<RETURNS>void </RETURNS>
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
<RETURNS>void </RETURNS>
GdkPixbufAnimation *animation
</FUNCTION>
<FUNCTION>
<NAME>gdk_pixbuf_preinit</NAME>
<RETURNS>void </RETURNS>
gpointer app, gpointer modinfo
</FUNCTION>
<FUNCTION>
<NAME>gdk_pixbuf_postinit</NAME>
<RETURNS>void </RETURNS>
gpointer app, gpointer modinfo
</FUNCTION>
<MACRO>
<NAME>GNOME_TYPE_CANVAS_PIXBUF</NAME>
#define GNOME_TYPE_CANVAS_PIXBUF (gnome_canvas_pixbuf_get_type ())
@ -373,3 +392,23 @@ struct GnomeCanvasPixbuf {
<RETURNS>GtkType </RETURNS>
void
</FUNCTION>
<MACRO>
<NAME>GDK_PIXBUF_MAJOR</NAME>
#define GDK_PIXBUF_MAJOR (0)
</MACRO>
<MACRO>
<NAME>GDK_PIXBUF_MINOR</NAME>
#define GDK_PIXBUF_MINOR (4)
</MACRO>
<MACRO>
<NAME>GDK_PIXBUF_MICRO</NAME>
#define GDK_PIXBUF_MICRO (0)
</MACRO>
<MACRO>
<NAME>GDK_PIXBUF_VERSION</NAME>
#define GDK_PIXBUF_VERSION "0.4.0"
</MACRO>
<VARIABLE>
<NAME>gdk_pixbuf_version</NAME>
extern const char *gdk_pixbuf_version;
</VARIABLE>

View File

@ -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
</SECTION>
<SECTION>
@ -48,6 +49,7 @@ gdk_pixbuf_get_from_drawable
<SECTION>
<FILE>util</FILE>
gdk_pixbuf_add_alpha
gdk_pixbuf_copy_area
</SECTION>
<SECTION>

View File

@ -17,7 +17,7 @@
</ARG>
<ARG>
<NAME>GnomeCanvasPixbuf::width_pixels</NAME>
<NAME>GnomeCanvasPixbuf::width_in_pixels</NAME>
<TYPE>gboolean</TYPE>
<FLAGS>rw</FLAGS>
</ARG>
@ -35,7 +35,7 @@
</ARG>
<ARG>
<NAME>GnomeCanvasPixbuf::height_pixels</NAME>
<NAME>GnomeCanvasPixbuf::height_in_pixels</NAME>
<TYPE>gboolean</TYPE>
<FLAGS>rw</FLAGS>
</ARG>
@ -53,7 +53,7 @@
</ARG>
<ARG>
<NAME>GnomeCanvasPixbuf::x_pixels</NAME>
<NAME>GnomeCanvasPixbuf::x_in_pixels</NAME>
<TYPE>gboolean</TYPE>
<FLAGS>rw</FLAGS>
</ARG>
@ -71,7 +71,7 @@
</ARG>
<ARG>
<NAME>GnomeCanvasPixbuf::y_pixels</NAME>
<NAME>GnomeCanvasPixbuf::y_in_pixels</NAME>
<TYPE>gboolean</TYPE>
<FLAGS>rw</FLAGS>
</ARG>

View File

@ -14,6 +14,18 @@ gint arg4
GdkPixbufLoader *gdkpixbufloader
</SIGNAL>
<SIGNAL>
<NAME>GdkPixbufLoader::frame-done</NAME>
<RETURNS>void</RETURNS>
GdkPixbufLoader *gdkpixbufloader
</SIGNAL>
<SIGNAL>
<NAME>GdkPixbufLoader::animation-done</NAME>
<RETURNS>void</RETURNS>
GdkPixbufLoader *gdkpixbufloader
</SIGNAL>
<SIGNAL>
<NAME>GdkPixbufLoader::closed</NAME>
<RETURNS>void</RETURNS>

View File

@ -54,6 +54,7 @@ Application-driven progressive image loading.
frames are done.
</para>
</refsect2>
<!-- ##### SECTION See_Also ##### -->
<para>
gdk_pixbuf_new_from_file()
@ -146,6 +147,20 @@ Application-driven progressive image loading.
<!-- # Unused Parameters # -->
@loader: Loader which emitted the signal.
<!-- ##### SIGNAL GdkPixbufLoader::frame-done ##### -->
<para>
</para>
@gdkpixbufloader: the object which received the signal.
<!-- ##### SIGNAL GdkPixbufLoader::animation-done ##### -->
<para>
</para>
@gdkpixbufloader: the object which received the signal.
<!-- ##### SIGNAL GdkPixbufLoader::closed ##### -->
<para>
This signal is emitted when gdk_pixbuf_loader_close() is called.

View File

@ -1,14 +1,3 @@
<!-- ##### ARG GnomeCanvasPixbuf:width_in_pixels ##### -->
<para>
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.
</para>
<!-- ##### SECTION ./tmpl/gdk-pixbuf-io.sgml:See_Also ##### -->
<para>
@ -26,12 +15,10 @@
<!-- ##### ARG GnomeCanvasPixbuf:height_in_pixels ##### -->
<para>
Works in the same way as the <link
linkend="GnomeCanvasPixbuf--width-in-pixels">width_in_pixels</link>
argument. The default is %FALSE.
</para>
<!-- ##### ARG GnomeCanvasPixbuf:height_pixels ##### -->
<para>
</para>
<!-- ##### STRUCT GdkPixbufModule ##### -->
@ -48,19 +35,10 @@
@stop_load:
@load_increment:
<!-- ##### ARG GnomeCanvasPixbuf:y_in_pixels ##### -->
<para>
Works in the same way as the <link
linkend="GnomeCanvasPixbuf--x-in-pixels">x_in_pixels</link>
argument. The default is %FALSE.
</para>
<!-- ##### ARG GnomeCanvasPixbuf:y_pixels ##### -->
<para>
<!--
Local variables:
mode: sgml
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
End:
-->
</para>
<!-- ##### SECTION ./tmpl/gdk-pixbuf-io.sgml:Long_Description ##### -->
@ -93,6 +71,12 @@ gdk-pixbuf-io
@pixbuf:
@user_data:
<!-- ##### ARG GnomeCanvasPixbuf:x_pixels ##### -->
<para>
</para>
<!-- ##### FUNCTION gdk_pixbuf_get_module ##### -->
<para>
@ -102,14 +86,9 @@ gdk-pixbuf-io
@size:
@Returns:
<!-- ##### ARG GnomeCanvasPixbuf:x_in_pixels ##### -->
<para>
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.
</para>
<!-- ##### ARG GnomeCanvasPixbuf:width_pixels ##### -->
<para>
</para>

View File

@ -234,10 +234,15 @@ Canvas item to display #GdkPixbuf images.
used instead. This argument is %FALSE by default.
</para>
<!-- ##### ARG GnomeCanvasPixbuf:width_pixels ##### -->
<para>
</para>
<!-- ##### ARG GnomeCanvasPixbuf:width_in_pixels ##### -->
<para>
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.
</para>
<!-- ##### ARG GnomeCanvasPixbuf:height ##### -->
<para>
@ -258,10 +263,12 @@ Canvas item to display #GdkPixbuf images.
The default is %FALSE.
</para>
<!-- ##### ARG GnomeCanvasPixbuf:height_pixels ##### -->
<para>
</para>
<!-- ##### ARG GnomeCanvasPixbuf:height_in_pixels ##### -->
<para>
Works in the same way as the <link
linkend="GnomeCanvasPixbuf--width-in-pixels">width_in_pixels</link>
argument. The default is %FALSE.
</para>
<!-- ##### ARG GnomeCanvasPixbuf:x ##### -->
<para>
@ -280,10 +287,15 @@ Canvas item to display #GdkPixbuf images.
coordinates.
</para>
<!-- ##### ARG GnomeCanvasPixbuf:x_pixels ##### -->
<para>
</para>
<!-- ##### ARG GnomeCanvasPixbuf:x_in_pixels ##### -->
<para>
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.
</para>
<!-- ##### ARG GnomeCanvasPixbuf:y ##### -->
<para>
@ -302,8 +314,17 @@ Canvas item to display #GdkPixbuf images.
default is %FALSE.
</para>
<!-- ##### ARG GnomeCanvasPixbuf:y_pixels ##### -->
<para>
<!-- ##### ARG GnomeCanvasPixbuf:y_in_pixels ##### -->
<para>
Works in the same way as the <link
linkend="GnomeCanvasPixbuf--x-in-pixels">x_in_pixels</link>
argument. The default is %FALSE.
</para>
</para>
<!--
Local variables:
mode: sgml
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
End:
-->

View File

@ -115,3 +115,14 @@ End:
-->
<!-- ##### FUNCTION gdk_pixbuf_render_pixmap_and_mask ##### -->
<para>
</para>
@pixbuf:
@pixmap_return:
@mask_return:
@alpha_threshold:

View File

@ -152,11 +152,11 @@ expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
@check_size:
@color1:
@color2:
@Returns:
<!--
@Returns: <!--
Local variables:
mode: sgml
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
End:
-->
-->

View File

@ -35,3 +35,18 @@ End:
-->
<!-- ##### FUNCTION gdk_pixbuf_copy_area ##### -->
<para>
</para>
@src_pixbuf:
@src_x:
@src_y:
@width:
@height:
@dest_pixbuf:
@dest_x:
@dest_y:

View File

@ -1,8 +1,40 @@
2000-01-15 Federico Mena Quintero <federico@helixcode.com>
2000-01-16 Federico Mena Quintero <federico@helixcode.com>
* 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 <jrb@redhat.com>
* 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 <otaylor@redhat.com>

View File

@ -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

View File

@ -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);
}

View File

@ -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 */

View File

@ -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);
}
}