contrib subdir

2000-10-06  Havoc Pennington  <hp@redhat.com>

	* Makefile.am (SRC_SUBDIRS): contrib subdir

	* gdk/gdkpixbuf.h: Move GdkPixbufAlphaMode to gdk-pixbuf library,
	so it can be used in Xlib version

	* demos/testpixbuf.c (update_timeout): error checking from 1.0
	tree

	* gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_get_pixbuf): Sync
	change from 1.0 tree that returns first frame of animation
	if the loaded file is an animation.

        * contrib: add new directory to hold stuff that comes with GTK+
	but isn't really part of GTK+ (for now, gdk-pixbuf-xlib)

	* configure.in: add contrib/*

2000-10-06  Havoc Pennington  <hp@redhat.com>

	* gdk-pixbuf.h: add GdkPixbufAlphaMode

2000-10-06  Havoc Pennington  <hp@redhat.com>

        This entry is a summary of the merged-in changes from 1.0.
	Relevant original ChangeLog entries are spliced in after
	this entry; the files they refer to are from the 1.0
	gdk-pixbuf sources.

	* pixops/pixops.c (pixops_composite_nearest): sync a small fix
	from 1.0

	* io-xpm.c (xpm_seek_string): add fscanf error check from 1.0
	Add progressive loader from 1.0

	* io-tiff.c (gdk_pixbuf__tiff_image_begin_load): mem leak fixes
	from 1.0 tree

	* io-pnm.c: new version from 1.0 tree

	* io-jpeg.c (gdk_pixbuf__jpeg_image_load): sync from 1.0, use
	malloc not g_malloc

	* io-gif.c (lzw_read_byte): sync from 1.0, change a g_error to
	g_warning
	(gif_get_next_step): return 0 here, sync from 1.0

	* gdk-pixbuf-util.c: sync email address change for Cody
	Russell

2000-09-11  Jeffrey Stedfast  <fejj@helixcode.com>

	* gdk-pixbuf/io-pnm.c: Pretty much totally rewrote again because
	last nights code was still "broken". Should now properly handle
	all error conditions gracefully.

2000-09-10  Jeffrey Stedfast  <fejj@helixcode.com>

	* gdk-pixbuf/io-pnm.c: Rewrote.

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

	* gdk-pixbuf/pixops/pixops.c (pixops_composite_nearest): Compute
	the correct dest offset.

2000-08-25  Federico Mena Quintero  <federico@helixcode.com>

	* gdk-pixbuf/io-xpm.c: #include <unistd.h>

2000-08-05  Larry Ewing  <lewing@helixcode.com>

	* gdk-pixbuf/io-tiff.c: stop leaking context->tempname.

	* gdk-pixbuf/io-xpm.c: same as above.

2000-07-26  Michael Meeks  <michael@helixcode.com>

	* gdk-pixbuf/io-jpeg.c (gdk_pixbuf__jpeg_image_load): make
	g_malloc a malloc.

2000-07-21  Larry Ewing  <lewing@helixcode.com>

	* gdk-pixbuf/io-xpm.c: add a fake progressive loader so that
	xpm at least supports the progressive interface like the one in
	io-tiff.c. This should be reimplemented as an actual progressive
	loader.

2000-07-19  Jonathan Blandford  <jrb@redhat.com>

	* demo/pixbuf-demo.c (update_timeout): changed scaling level to
	make it look better.
	* gdk-pixbuf/testpixbuf.c (update_timeout): Patch from michael
	meeks to handle errors better.
This commit is contained in:
Havoc Pennington 2000-10-09 17:22:20 +00:00 committed by Havoc Pennington
parent 25840ef4a5
commit 518f32d97e
52 changed files with 8207 additions and 574 deletions

View File

@ -1,3 +1,22 @@
2000-10-06 Havoc Pennington <hp@redhat.com>
* Makefile.am (SRC_SUBDIRS): contrib subdir
* gdk/gdkpixbuf.h: Move GdkPixbufAlphaMode to gdk-pixbuf library,
so it can be used in Xlib version
* demos/testpixbuf.c (update_timeout): error checking from 1.0
tree
* gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_get_pixbuf): Sync
change from 1.0 tree that returns first frame of animation
if the loaded file is an animation.
* contrib: add new directory to hold stuff that comes with GTK+
but isn't really part of GTK+ (for now, gdk-pixbuf-xlib)
* configure.in: add contrib/*
2000-10-05 Havoc Pennington <hp@redhat.com>
* demos/testpixbuf-save.c: add pixbuf save test

View File

@ -1,3 +1,22 @@
2000-10-06 Havoc Pennington <hp@redhat.com>
* Makefile.am (SRC_SUBDIRS): contrib subdir
* gdk/gdkpixbuf.h: Move GdkPixbufAlphaMode to gdk-pixbuf library,
so it can be used in Xlib version
* demos/testpixbuf.c (update_timeout): error checking from 1.0
tree
* gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_get_pixbuf): Sync
change from 1.0 tree that returns first frame of animation
if the loaded file is an animation.
* contrib: add new directory to hold stuff that comes with GTK+
but isn't really part of GTK+ (for now, gdk-pixbuf-xlib)
* configure.in: add contrib/*
2000-10-05 Havoc Pennington <hp@redhat.com>
* demos/testpixbuf-save.c: add pixbuf save test

View File

@ -1,3 +1,22 @@
2000-10-06 Havoc Pennington <hp@redhat.com>
* Makefile.am (SRC_SUBDIRS): contrib subdir
* gdk/gdkpixbuf.h: Move GdkPixbufAlphaMode to gdk-pixbuf library,
so it can be used in Xlib version
* demos/testpixbuf.c (update_timeout): error checking from 1.0
tree
* gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_get_pixbuf): Sync
change from 1.0 tree that returns first frame of animation
if the loaded file is an animation.
* contrib: add new directory to hold stuff that comes with GTK+
but isn't really part of GTK+ (for now, gdk-pixbuf-xlib)
* configure.in: add contrib/*
2000-10-05 Havoc Pennington <hp@redhat.com>
* demos/testpixbuf-save.c: add pixbuf save test

View File

@ -1,3 +1,22 @@
2000-10-06 Havoc Pennington <hp@redhat.com>
* Makefile.am (SRC_SUBDIRS): contrib subdir
* gdk/gdkpixbuf.h: Move GdkPixbufAlphaMode to gdk-pixbuf library,
so it can be used in Xlib version
* demos/testpixbuf.c (update_timeout): error checking from 1.0
tree
* gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_get_pixbuf): Sync
change from 1.0 tree that returns first frame of animation
if the loaded file is an animation.
* contrib: add new directory to hold stuff that comes with GTK+
but isn't really part of GTK+ (for now, gdk-pixbuf-xlib)
* configure.in: add contrib/*
2000-10-05 Havoc Pennington <hp@redhat.com>
* demos/testpixbuf-save.c: add pixbuf save test

View File

@ -1,3 +1,22 @@
2000-10-06 Havoc Pennington <hp@redhat.com>
* Makefile.am (SRC_SUBDIRS): contrib subdir
* gdk/gdkpixbuf.h: Move GdkPixbufAlphaMode to gdk-pixbuf library,
so it can be used in Xlib version
* demos/testpixbuf.c (update_timeout): error checking from 1.0
tree
* gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_get_pixbuf): Sync
change from 1.0 tree that returns first frame of animation
if the loaded file is an animation.
* contrib: add new directory to hold stuff that comes with GTK+
but isn't really part of GTK+ (for now, gdk-pixbuf-xlib)
* configure.in: add contrib/*
2000-10-05 Havoc Pennington <hp@redhat.com>
* demos/testpixbuf-save.c: add pixbuf save test

View File

@ -1,3 +1,22 @@
2000-10-06 Havoc Pennington <hp@redhat.com>
* Makefile.am (SRC_SUBDIRS): contrib subdir
* gdk/gdkpixbuf.h: Move GdkPixbufAlphaMode to gdk-pixbuf library,
so it can be used in Xlib version
* demos/testpixbuf.c (update_timeout): error checking from 1.0
tree
* gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_get_pixbuf): Sync
change from 1.0 tree that returns first frame of animation
if the loaded file is an animation.
* contrib: add new directory to hold stuff that comes with GTK+
but isn't really part of GTK+ (for now, gdk-pixbuf-xlib)
* configure.in: add contrib/*
2000-10-05 Havoc Pennington <hp@redhat.com>
* demos/testpixbuf-save.c: add pixbuf save test

View File

@ -1,3 +1,22 @@
2000-10-06 Havoc Pennington <hp@redhat.com>
* Makefile.am (SRC_SUBDIRS): contrib subdir
* gdk/gdkpixbuf.h: Move GdkPixbufAlphaMode to gdk-pixbuf library,
so it can be used in Xlib version
* demos/testpixbuf.c (update_timeout): error checking from 1.0
tree
* gtk/gdk-pixbuf-loader.c (gdk_pixbuf_loader_get_pixbuf): Sync
change from 1.0 tree that returns first frame of animation
if the loaded file is an animation.
* contrib: add new directory to hold stuff that comes with GTK+
but isn't really part of GTK+ (for now, gdk-pixbuf-xlib)
* configure.in: add contrib/*
2000-10-05 Havoc Pennington <hp@redhat.com>
* demos/testpixbuf-save.c: add pixbuf save test

View File

@ -1,6 +1,6 @@
## Makefile.am for GTK+
SRC_SUBDIRS = gdk-pixbuf gdk modules gtk demos
SRC_SUBDIRS = gdk-pixbuf gdk modules gtk demos contrib
SUBDIRS = po $(SRC_SUBDIRS) docs build
bin_SCRIPTS = gtk-config-2.0

View File

@ -825,6 +825,14 @@ AC_SUBST(GDK_PIXBUF_LIBDIR)
AC_SUBST(GDK_PIXBUF_INCLUDEDIR)
AC_SUBST(GDK_PIXBUF_LIBS)
GDK_PIXBUF_XLIB_LIBDIR=$GDK_PIXBUF_LIBDIR
GDK_PIXBUF_XLIB_INCLUDEDIR=$GDK_PIXBUF_INCLUDEDIR
GDK_PIXBUF_XLIB_LIBS="$GLIB_LIBS -lgdk_pixbuf_xlib $deps $X11_LIBS"
AC_SUBST(GDK_PIXBUF_XLIB_LIBDIR)
AC_SUBST(GDK_PIXBUF_XLIB_INCLUDEDIR)
AC_SUBST(GDK_PIXBUF_XLIB_LIBS)
# Checks to see if we should compile in MMX support (there will be
# a runtime test when the code is actually run to see if it should
# be used - this just checks if we can compile it.)
@ -1037,4 +1045,7 @@ gtk/gtkcompat.h
gtk/stock-icons/Makefile
modules/Makefile
modules/linux-fb/Makefile
contrib/Makefile
contrib/gdk-pixbuf-xlib/Makefile
contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-2.0.pc
], [chmod +x gtk-config-2.0])

View File

@ -0,0 +1,53 @@
2000-10-06 Havoc Pennington <hp@redhat.com>
* gdk-pixbuf-xlib.c: Put display/screen here, instead of in
the main gdk-pixbuf library as it was in 1.0; since the io-xpm
loader doesn't use these variables anymore it should be OK
2000-09-26 Federico Mena Quintero <federico@helixcode.com>
* gdk-pixbuf/gdk-pixbuf-xlib-drawable.c
(gdk_pixbuf_xlib_get_from_drawable): Do not use
gdk_screen_{width,height}(). Thanks to John Harper for pointing
this out.
2000-08-26 Federico Mena Quintero <federico@helixcode.com>
* gdk-pixbuf/gdk-pixbuf-xlibrgb.c: Added API reference docs.
2000-08-25 Federico Mena Quintero <federico@helixcode.com>
* gdk-pixbuf/gdk-pixbuf-xlib-drawable.c (handle_x_error): Return
0.
(xlib_window_is_viewable): Return FALSE in the last case.
* gdk-pixbuf/gdk-pixbuf-xlib-render.c: Updated the inline docs.
* gdk-pixbuf/gdk-pixbuf-xlib.c: Added API docs.
2000-08-25 John Harper <john@dcs.warwick.ac.uk>
Work to create an Xlib version of gdk-pixbuf (with the Xlib
port of GdkRGB for rendering):
* configure.in: check for X libraries, set and substitute
GDK_PIXBUF_XLIB_{LIBDIR,INCLUDEDIR,LIBS} variables
* gdk_pixbuf_xlibConf.sh.in: new file -- gnome-config details
for the gdk-pixbuf-xlib library
* Makefile.am: build and install gdk_pixbuf_xlibConf.sh
* gdk-pixbuf/gdk-pixbuf-xlib-render.c,
gdk-pixbuf/gdk-pixbuf-xlib.c, gdk-pixbuf/gdk-pixbuf-xlib.h,
gdk-pixbuf/gdk-pixbuf-xlib-private.h,
gdk-pixbuf/gdk-pixbuf-xlib-drawable.c: new files, ported the
GDK dependent parts of gdk-pixbuf to use Xlib. Functions that
were called gdk_pixbuf_FOO are now gdk_pixbuf_xlib_FOO
* gdk-pixbuf/gdk-pixbuf-xlibrgb.c,
gdk-pixbuf/gdk-pixbuf-xlibrgb.h: added Chris Blizzard's Xlib
port of GdkRGB (from Mozilla CVS)
* gdk-pixbuf/Makefile.am: build a library libgdk_pixbuf_xlib.la
including the non-GDK dependent objects from libgdk_pixbuf.la
plus the Xlib ports and xlibrgb

View File

@ -0,0 +1,11 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: GdkPixbufXlib
Description: Image loading and scaling for Xlib
Version: @VERSION@
Requires: gobject-2.0,gmodule-2.0,gdk-pixbuf-2.0
Libs: -L${libdir} -lgdk_pixbuf_xlib-1.3
Cflags: -I${includedir}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,30 @@
/* GdkPixbuf library - Xlib header file
*
* Authors: John Harper <john@dcs.warwick.ac.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef GDK_PIXBUF_XLIB_PRIVATE_H
#define GDK_PIXBUF_XLIB_PRIVATE_H
#include "gdk-pixbuf-xlib.h"
#include <X11/Xlib.h>
extern Display *gdk_pixbuf_dpy;
extern int gdk_pixbuf_screen;
#endif

View File

@ -0,0 +1,398 @@
/* GdkPixbuf library - Rendering functions
*
* Copyright (C) 1999 The Free Software Foundation
*
* Author: Federico Mena-Quintero <federico@gimp.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/* Trivially ported to Xlib(RGB) by John Harper. */
#include <config.h>
#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-xlib-private.h"
/**
* gdk_pixbuf_xlib_render_threshold_alpha:
* @pixbuf: A pixbuf.
* @bitmap: Bitmap where the bilevel mask will be painted to.
* @src_x: Source X coordinate.
* @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.
* @alpha_threshold: Opacity values below this will be painted as zero; all
* other values will be painted as one.
*
* Takes the opacity values in a rectangular portion of a pixbuf and thresholds
* them to produce a bi-level alpha mask that can be used as a clipping mask for
* a drawable.
*
**/
void
gdk_pixbuf_xlib_render_threshold_alpha (GdkPixbuf *pixbuf, Pixmap bitmap,
int src_x, int src_y,
int dest_x, int dest_y,
int width, int height,
int alpha_threshold)
{
GC gc;
XColor color;
int x, y;
guchar *p;
int start, start_status;
int status;
XGCValues gcv;
g_return_if_fail (pixbuf != NULL);
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 (bitmap != 0);
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);
g_return_if_fail (alpha_threshold >= 0 && alpha_threshold <= 255);
if (width == 0 || height == 0)
return;
gc = XCreateGC (gdk_pixbuf_dpy, bitmap, 0, &gcv);
if (!pixbuf->has_alpha) {
color.pixel = (alpha_threshold == 255) ? 0 : 1;
XSetForeground (gdk_pixbuf_dpy, gc, color.pixel);
XFillRectangle (gdk_pixbuf_dpy, bitmap, gc,
dest_x, dest_y, width, height);
XFreeGC (gdk_pixbuf_dpy, gc);
return;
}
color.pixel = 0;
XSetForeground (gdk_pixbuf_dpy, gc, color.pixel);
XFillRectangle (gdk_pixbuf_dpy, bitmap, gc,
dest_x, dest_y, width, height);
color.pixel = 1;
XSetForeground (gdk_pixbuf_dpy, gc, color.pixel);
for (y = 0; y < height; y++) {
p = (pixbuf->pixels + (y + src_y) * pixbuf->rowstride + src_x * pixbuf->n_channels
+ pixbuf->n_channels - 1);
start = 0;
start_status = *p < alpha_threshold;
for (x = 0; x < width; x++) {
status = *p < alpha_threshold;
if (status != start_status) {
if (!start_status)
XDrawLine (gdk_pixbuf_dpy, bitmap, gc,
start + dest_x, y + dest_y,
x - 1 + dest_x, y + dest_y);
start = x;
start_status = status;
}
p += pixbuf->n_channels;
}
if (!start_status)
XDrawLine (gdk_pixbuf_dpy, bitmap, gc,
start + dest_x, y + dest_y,
x - 1 + dest_x, y + dest_y);
}
XFreeGC (gdk_pixbuf_dpy, gc);
}
/* Creates a buffer by stripping the alpha channel of a pixbuf */
static guchar *
remove_alpha (GdkPixbuf *pixbuf, int x, int y, int width, int height, int *rowstride)
{
guchar *buf;
int xx, yy;
guchar *src, *dest;
g_assert (pixbuf->n_channels == 4);
g_assert (pixbuf->has_alpha);
g_assert (width > 0 && height > 0);
g_assert (x >= 0 && x + width <= pixbuf->width);
g_assert (y >= 0 && y + height <= pixbuf->height);
*rowstride = 4 * ((width * 3 + 3) / 4);
buf = g_new (guchar, *rowstride * height);
for (yy = 0; yy < height; yy++) {
src = pixbuf->pixels + pixbuf->rowstride * (yy + y) + x * pixbuf->n_channels;
dest = buf + *rowstride * yy;
for (xx = 0; xx < width; xx++) {
*dest++ = *src++;
*dest++ = *src++;
*dest++ = *src++;
src++;
}
}
return buf;
}
/**
* gdk_pixbuf_xlib_render_to_drawable:
* @pixbuf: A pixbuf.
* @drawable: Destination drawable.
* @gc: GC used for rendering.
* @src_x: Source X coordinate within 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.
* @dither: Dithering mode for XlibRGB.
* @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 XlibRGB, so the specified drawable must
* have the XlibRGB visual and colormap. Note that this function will ignore
* the opacity information for images with an alpha channel; the GC must already
* have the clipping mask set if you want transparent regions to show through.
*
* For an explanation of dither offsets, see the XlibRGB documentation. In
* brief, the dither offset is important when re-rendering partial regions of an
* image to a rendered version of the full image, or for when the offsets to a
* base position change, as in scrolling. The dither matrix has to be shifted
* for consistent visual results. If you do not have any of these cases, the
* dither offsets can be both zero.
**/
void
gdk_pixbuf_xlib_render_to_drawable (GdkPixbuf *pixbuf,
Drawable drawable, GC gc,
int src_x, int src_y,
int dest_x, int dest_y,
int width, int height,
XlibRgbDither dither,
int x_dither, int y_dither)
{
guchar *buf;
int rowstride;
g_return_if_fail (pixbuf != NULL);
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 != 0);
g_return_if_fail (gc != 0);
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);
if (width == 0 || height == 0)
return;
/* This will have to be modified once we support other image types.
* Also, GdkRGB does not have gdk_draw_rgb_32_image_dithalign(), so we
* have to pack the buffer first. Sigh.
*/
if (pixbuf->has_alpha)
buf = remove_alpha (pixbuf, src_x, src_y, width, height, &rowstride);
else {
buf = pixbuf->pixels + src_y * pixbuf->rowstride + src_x * 3;
rowstride = pixbuf->rowstride;
}
xlib_draw_rgb_image_dithalign (drawable, gc,
dest_x, dest_y,
width, height,
dither,
buf, rowstride,
x_dither, y_dither);
if (pixbuf->has_alpha)
g_free (buf);
}
/**
* gdk_pixbuf_xlib_render_to_drawable_alpha:
* @pixbuf: A pixbuf.
* @drawable: Destination drawable.
* @src_x: Source X coordinate within 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.
* @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
* is GDK_PIXBUF_ALPHA_BILEVEL, specifies the threshold value for opacity
* values.
* @dither: Dithering mode for XlibRGB.
* @x_dither: X offset for dither.
* @y_dither: Y offset for dither.
*
* Renders a rectangular portion of a pixbuf to a drawable. This is done using
* XlibRGB, so the specified drawable must have the XlibRGB visual and colormap.
*
* When used with #GDK_PIXBUF_ALPHA_BILEVEL, this function has to create a bitmap
* out of the thresholded alpha channel of the image and, it has to set this
* bitmap as the clipping mask for the GC used for drawing. This can be a
* significant performance penalty depending on the size and the complexity of
* the alpha channel of the image. If performance is crucial, consider handling
* the alpha channel yourself (possibly by caching it in your application) and
* using gdk_pixbuf_xlib_render_to_drawable() or GdkRGB directly instead.
**/
void
gdk_pixbuf_xlib_render_to_drawable_alpha (GdkPixbuf *pixbuf, Drawable drawable,
int src_x, int src_y,
int dest_x, int dest_y,
int width, int height,
GdkPixbufAlphaMode alpha_mode,
int alpha_threshold,
XlibRgbDither dither,
int x_dither, int y_dither)
{
Pixmap bitmap = 0;
GC gc;
XGCValues gcv;
g_return_if_fail (pixbuf != NULL);
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 != 0);
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);
if (width == 0 || height == 0)
return;
gc = XCreateGC (gdk_pixbuf_dpy, drawable, 0, &gcv);
if (pixbuf->has_alpha) {
/* Right now we only support GDK_PIXBUF_ALPHA_BILEVEL, so we
* unconditionally create the clipping mask.
*/
bitmap = XCreatePixmap (gdk_pixbuf_dpy,
RootWindow (gdk_pixbuf_dpy,
gdk_pixbuf_screen),
width, height, 1);
gdk_pixbuf_xlib_render_threshold_alpha (pixbuf, bitmap,
src_x, src_y,
0, 0,
width, height,
alpha_threshold);
XSetClipMask (gdk_pixbuf_dpy, gc, bitmap);
XSetClipOrigin (gdk_pixbuf_dpy, gc, dest_x, dest_y);
}
gdk_pixbuf_xlib_render_to_drawable (pixbuf, drawable, gc,
src_x, src_y,
dest_x, dest_y,
width, height,
dither,
x_dither, y_dither);
if (bitmap)
XFreePixmap (gdk_pixbuf_dpy, bitmap);
XFreeGC (gdk_pixbuf_dpy, gc);
}
/**
* gdk_pixbuf_xlib_render_pixmap_and_mask:
* @pixbuf: A pixbuf.
* @pixmap_return: Return value for the created pixmap.
* @mask_return: Return value for the created mask.
* @alpha_threshold: Threshold value for opacity values.
*
* 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_xlib_render_to_drawable_alpha() or
* gdk_pixbuf_xlib_render_to_drawable(), and
* gdk_pixbuf_xlib_render_threshold_alpha().
*
* If the pixbuf does not have an alpha channel, then *@mask_return will be set
* to None.
**/
void
gdk_pixbuf_xlib_render_pixmap_and_mask (GdkPixbuf *pixbuf,
Pixmap *pixmap_return,
Pixmap *mask_return,
int alpha_threshold)
{
g_return_if_fail (pixbuf != NULL);
if (pixmap_return) {
GC gc;
XGCValues gcv;
*pixmap_return = XCreatePixmap (gdk_pixbuf_dpy,
RootWindow (gdk_pixbuf_dpy,
gdk_pixbuf_screen),
pixbuf->width,
pixbuf->height,
xlib_rgb_get_depth ());
gc = XCreateGC (gdk_pixbuf_dpy, *pixmap_return, 0, &gcv);
gdk_pixbuf_xlib_render_to_drawable (pixbuf, *pixmap_return, gc,
0, 0, 0, 0,
pixbuf->width,
pixbuf->height,
XLIB_RGB_DITHER_NORMAL,
0, 0);
XFreeGC (gdk_pixbuf_dpy, gc);
}
if (mask_return) {
if (pixbuf->has_alpha) {
*mask_return = XCreatePixmap (gdk_pixbuf_dpy,
RootWindow (gdk_pixbuf_dpy,
gdk_pixbuf_screen),
pixbuf->width,
pixbuf->height, 1);
gdk_pixbuf_xlib_render_threshold_alpha (pixbuf,
*mask_return,
0, 0, 0, 0,
pixbuf->width,
pixbuf->height,
alpha_threshold);
} else
*mask_return = 0;
}
}

View File

@ -0,0 +1,63 @@
/* GdkPixbuf library - Initialization functions
*
* Author: John Harper <john@dcs.warwick.ac.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <X11/Xlib.h>
#include <gdk-pixbuf/gdk-pixbuf-private.h>
#include "gdk-pixbuf-xlib-private.h"
Display *gdk_pixbuf_dpy = NULL;
int gdk_pixbuf_screen = -1;
/**
* gdk_pixbuf_xlib_init:
* @display: X display to use.
* @screen_num: Screen number.
*
* Initializes the gdk-pixbuf Xlib machinery by calling xlib_rgb_init(). This
* function should be called near the beginning of your program, or before using
* any of the gdk-pixbuf-xlib functions.
**/
void
gdk_pixbuf_xlib_init (Display *display, int screen_num)
{
xlib_rgb_init (display, ScreenOfDisplay (display, screen_num));
gdk_pixbuf_dpy = display;
gdk_pixbuf_screen = screen_num;
}
/**
* gdk_pixbuf_xlib_init_with_depth:
* @display: X display to use.
* @screen_num: Screen number.
* @prefDepth: Preferred depth for XlibRGB.
*
* Similar to gdk_pixbuf_xlib_init(), but also lets you specify the preferred
* depth for XlibRGB if you do not want it to use the default depth it picks.
**/
void
gdk_pixbuf_xlib_init_with_depth (Display *display,
int screen_num, int prefDepth)
{
xlib_rgb_init_with_depth (display, ScreenOfDisplay (display, screen_num),
prefDepth);
gdk_pixbuf_dpy = display;
gdk_pixbuf_screen = screen_num;
}

View File

@ -0,0 +1,82 @@
/* GdkPixbuf library - Xlib header file
*
* Authors: John Harper <john@dcs.warwick.ac.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef GDK_PIXBUF_XLIB_H
#define GDK_PIXBUF_XLIB_H
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk-pixbuf-xlib/gdk-pixbuf-xlibrgb.h>
#include <X11/Xlib.h>
/* init */
void gdk_pixbuf_xlib_init (Display *display, int screen_num);
void gdk_pixbuf_xlib_init_with_depth (Display *display, int screen_num,
int prefDepth);
/* render */
void gdk_pixbuf_xlib_render_threshold_alpha (GdkPixbuf *pixbuf, Pixmap bitmap,
int src_x, int src_y,
int dest_x, int dest_y,
int width, int height,
int alpha_threshold);
void gdk_pixbuf_xlib_render_to_drawable (GdkPixbuf *pixbuf,
Drawable drawable, GC gc,
int src_x, int src_y,
int dest_x, int dest_y,
int width, int height,
XlibRgbDither dither,
int x_dither, int y_dither);
void gdk_pixbuf_xlib_render_to_drawable_alpha (GdkPixbuf *pixbuf,
Drawable drawable,
int src_x, int src_y,
int dest_x, int dest_y,
int width, int height,
GdkPixbufAlphaMode alpha_mode,
int alpha_threshold,
XlibRgbDither dither,
int x_dither, int y_dither);
void gdk_pixbuf_xlib_render_pixmap_and_mask (GdkPixbuf *pixbuf,
Pixmap *pixmap_return,
Pixmap *mask_return,
int alpha_threshold);
/* drawable */
GdkPixbuf *gdk_pixbuf_xlib_get_from_drawable (GdkPixbuf *dest,
Drawable src,
Colormap cmap, Visual *visual,
int src_x, int src_y,
int dest_x, int dest_y,
int width, int height);
#endif /* GDK_PIXBUF_XLIB_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,195 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "MPL"); you may not use this file except in
* compliance with the MPL. You may obtain a copy of the MPL at
* http://www.mozilla.org/MPL/
*
* Software distributed under the MPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the MPL
* for the specific language governing rights and limitations under the
* MPL.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Library General Public License (the "LGPL"), in
* which case the provisions of the LGPL are applicable instead of
* those above. If you wish to allow use of your version of this file
* only under the terms of the LGPL and not to allow others to use
* your version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice and
* other provisions required by the LGPL. If you do not delete the
* provisions above, a recipient may use your version of this file
* under either the MPL or the LGPL.
*/
/*
* This code is derived from GdkRgb.
* For more information on GdkRgb, see http://www.levien.com/gdkrgb/
* Raph Levien <raph@acm.org>
*/
/* Ported by Christopher Blizzard to Xlib. With permission from the
* original authors of this file, the contents of this file are also
* redistributable under the terms of the Mozilla Public license. For
* information about the Mozilla Public License, please see the
* license information at http://www.mozilla.org/MPL/
*/
/* This code is copyright the following authors:
* Raph Levien <raph@acm.org>
* Manish Singh <manish@gtk.org>
* Tim Janik <timj@gtk.org>
* Peter Mattis <petm@xcf.berkeley.edu>
* Spencer Kimball <spencer@xcf.berkeley.edu>
* Josh MacDonald <jmacd@xcf.berkeley.edu>
* Christopher Blizzard <blizzard@redhat.com>
* Owen Taylor <otaylor@redhat.com>
* Shawn T. Amundson <amundson@gtk.org>
*/
#ifndef __XLIB_RGB_H__
#define __XLIB_RGB_H__
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <X11/Intrinsic.h>
#include <glib.h>
typedef struct _XlibRgbCmap XlibRgbCmap;
struct _XlibRgbCmap {
unsigned int colors[256];
unsigned char lut[256]; /* for 8-bit modes */
};
void
xlib_rgb_init (Display *display, Screen *screen);
void
xlib_rgb_init_with_depth (Display *display, Screen *screen, int prefDepth);
unsigned long
xlib_rgb_xpixel_from_rgb (guint32 rgb);
void
xlib_rgb_gc_set_foreground (GC gc, guint32 rgb);
void
xlib_rgb_gc_set_background (GC gc, guint32 rgb);
typedef enum
{
XLIB_RGB_DITHER_NONE,
XLIB_RGB_DITHER_NORMAL,
XLIB_RGB_DITHER_MAX
} XlibRgbDither;
void
xlib_draw_rgb_image (Drawable drawable,
GC gc,
int x,
int y,
int width,
int height,
XlibRgbDither dith,
unsigned char *rgb_buf,
int rowstride);
void
xlib_draw_rgb_image_dithalign (Drawable drawable,
GC gc,
int x,
int y,
int width,
int height,
XlibRgbDither dith,
unsigned char *rgb_buf,
int rowstride,
int xdith,
int ydith);
void
xlib_draw_rgb_32_image (Drawable drawable,
GC gc,
int x,
int y,
int width,
int height,
XlibRgbDither dith,
unsigned char *buf,
int rowstride);
void
xlib_draw_gray_image (Drawable drawable,
GC gc,
int x,
int y,
int width,
int height,
XlibRgbDither dith,
unsigned char *buf,
int rowstride);
XlibRgbCmap *
xlib_rgb_cmap_new (guint32 *colors, int n_colors);
void
xlib_rgb_cmap_free (XlibRgbCmap *cmap);
void
xlib_draw_indexed_image (Drawable drawable,
GC gc,
int x,
int y,
int width,
int height,
XlibRgbDither dith,
unsigned char *buf,
int rowstride,
XlibRgbCmap *cmap);
/* Below are some functions which are primarily useful for debugging
and experimentation. */
Bool
xlib_rgb_ditherable (void);
void
xlib_rgb_set_verbose (Bool verbose);
/* experimental colormap stuff */
void
xlib_rgb_set_install (Bool install);
void
xlib_rgb_set_min_colors (int min_colors);
Colormap
xlib_rgb_get_cmap (void);
Visual *
xlib_rgb_get_visual (void);
XVisualInfo *
xlib_rgb_get_visual_info (void);
int
xlib_rgb_get_depth (void);
Display *
xlib_rgb_get_display (void);
Screen *
xlib_rgb_get_screen (void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __XLIB_RGB_H__ */

View File

@ -370,7 +370,8 @@ new_testrgb_window (GdkPixbuf *pixbuf, gchar *title)
GtkWidget *button;
GtkWidget *drawing_area;
gint w, h;
g_return_val_if_fail (pixbuf != NULL, NULL);
w = gdk_pixbuf_get_width (pixbuf);
h = gdk_pixbuf_get_height (pixbuf);
@ -427,18 +428,34 @@ static gint
update_timeout(gpointer data)
{
ProgressFileStatus *status = data;
gboolean done;
done = TRUE;
gboolean done, error;
done = FALSE;
error = FALSE;
if (!feof(status->imagefile)) {
gint nbytes;
nbytes = fread(status->buf, 1, status->readlen,
status->imagefile);
done = !gdk_pixbuf_loader_write (GDK_PIXBUF_LOADER (status->loader), status->buf, nbytes);
}
error = !gdk_pixbuf_loader_write (GDK_PIXBUF_LOADER (status->loader), status->buf, nbytes);
if (error) {
G_BREAKPOINT();
}
} else { /* Really done */
GdkPixbuf *pixbuf = gdk_pixbuf_loader_get_pixbuf (status->loader);
new_testrgb_window (pixbuf, "After progressive load");
done = TRUE;
}
if (error) {
g_warning ("Serious error writing to loader");
done = TRUE;
}
if (done) {
gtk_widget_queue_draw(*status->rgbwin);

View File

@ -1,3 +1,14 @@
2000-10-06 Havoc Pennington <hp@redhat.com>
* gdk-pixbuf/*.sgml, gdk-pixbuf/tmpl/*.sgml: copy in from 1.0
* gdk-pixbuf/gdk-pixbuf-sections.txt: add Xlib sections from 1.0
tree
* gdk-pixbuf/Makefile.am: add stuff from 1.0 tree
* gdk-pixbuf/compiling.sgml: copy from 1.0 tree
2000-09-26 Havoc Pennington <hp@redhat.com>
* gtk/tmpl/gtkrc.sgml: Document stock icon stuff

View File

@ -8,12 +8,13 @@ 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
SECOND_DOC_SOURCE_DIR=$(top_srcdir)/contrib/gdk-pixbuf-xlib
# Extra options to supply to gtkdoc-fixref
FIXXREF_OPTIONS=
# Header files to ignore when scanning
IGNORE_HFILES=pixops.h pixops-internal.h
IGNORE_HFILES=pixops.h pixops-internal.h gdk-pixbuf-xlib-private.h
# Extra files to add when scanning
EXTRA_HFILES= \
@ -34,12 +35,17 @@ tmpl_sources = \
tmpl/module_interface.sgml \
tmpl/refcounting.sgml \
tmpl/scaling.sgml \
tmpl/util.sgml
tmpl/util.sgml \
tmpl/gdk-pixbuf-xlib-from-drawables.sgml \
tmpl/gdk-pixbuf-xlib-init.sgml \
tmpl/gdk-pixbuf-xlib-rendering.sgml \
tmpl/gdk-pixbuf-xlib-rgb.sgml
# Extra SGML files that are included by DOC_MAIN_SGML_FILE
content_files = \
compiling.sgml \
gdk-pixbuf.sgml
gdk-pixbuf.sgml \
porting-from-imlib.sgml
####################################
# Everything below here is generic #
@ -71,14 +77,14 @@ endif
scan:
-(cd $(srcdir) \
&& gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(EXTRA_HFILES))
&& gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --source-dir=$(SECOND_DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(EXTRA_HFILES))
templates:
cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE)
sgml:
cd $(srcdir) \
&& gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR)
&& gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --source-dir=$(SECOND_DOC_SOURCE_DIR)
html:
test -d $(srcdir)/html || mkdir $(srcdir)/html

View File

@ -1,25 +1,22 @@
<appendix id="compiling">
<title>Compiling the <application>gdk-pixbuf</application>
library</title>
<title>Compiling the &gdk-pixbuf; library</title>
<para>
This appendix describes the special options you can use while
compiling the <application>gdk-pixbuf</application> library.
compiling the &gdk-pixbuf; library.
</para>
<sect1 id="building">
<title>Building the Library</title>
<para>
The <application>gdk-pixbuf</application> library uses the
standard GNU build system, using
<application>autoconf</application> for package configuration
and resolving portability issues,
The &gdk-pixbuf; library uses the standard GNU build system,
using <application>autoconf</application> for package
configuration and resolving portability issues,
<application>automake</application> for building makefiles
that comply with the GNU Coding Standards, and
<application>libtool</application> for building shared
libraries on multiple platforms. The normal sequence for
compiling and installing the
<application>gdk-pixbuf</application> library is thus:
compiling and installing the &gdk-pixbuf; library is thus:
<literallayout>
<userinput>./configure</userinput>
@ -43,9 +40,8 @@
<para>
In addition to the normal options, the
<command>configure</command> script in the
<application>gdk-pixbuf</application> library supports these
additional arguments:
<command>configure</command> script in the &gdk-pixbuf;
library supports these additional arguments:
<cmdsynopsis>
<command>configure</command>
@ -67,15 +63,13 @@
<systemitem>--enable-modules</systemitem></title>
<para>
Normally <application>gdk-pixbuf</application> will try to
build the image file format loaders as little shared
libraries that are loaded on demand. The
<systemitem>--disable-modules</systemitem> argument
indicates that they should all be built statically into the
<application>gdk-pixbuf</application> library instead. This
is useful for people who need to produce statically-linked
binaries. If neither
<systemitem>--disable-modules</systemitem> nor
Normally &gdk-pixbuf; will try to build the image file
format loaders as little shared libraries that are loaded on
demand. The <systemitem>--disable-modules</systemitem>
argument indicates that they should all be built statically
into the &gdk-pixbuf; library instead. This is useful for
people who need to produce statically-linked binaries. If
neither <systemitem>--disable-modules</systemitem> nor
<systemitem>--enable-modules</systemitem> is specified, then
the <command>configure</command> script will try to
auto-detect whether shared modules work on your system.
@ -91,11 +85,11 @@
to auto-detect whether the
<application>gtk-doc</application> package is installed. If
it is, then it will use it to extract and build the
documentation for the <application>gdk-pixbuf</application>
library. These options can be used to explicitly control
whether gtk-doc should be used or not. If it is not used,
the distributed, pre-generated HTML files will be installed
instead of building them on your machine.
documentation for the &gdk-pixbuf; library. These options
can be used to explicitly control whether gtk-doc should be
used or not. If it is not used, the distributed,
pre-generated HTML files will be installed instead of
building them on your machine.
</para>
</formalpara>
</sect1>

View File

@ -140,4 +140,50 @@ GdkPixbufModule
gdk_pixbuf_get_module
gdk_pixbuf_get_named_module
gdk_pixbuf_load_module
</SECTION>
</SECTION>
<SECTION>
<FILE>gdk-pixbuf-xlib-init</FILE>
gdk_pixbuf_xlib_init
gdk_pixbuf_xlib_init_with_depth
</SECTION>
<SECTION>
<FILE>gdk-pixbuf-xlib-rendering</FILE>
gdk_pixbuf_xlib_render_threshold_alpha
gdk_pixbuf_xlib_render_to_drawable
gdk_pixbuf_xlib_render_to_drawable_alpha
gdk_pixbuf_xlib_render_pixmap_and_mask
</SECTION>
<SECTION>
<FILE>gdk-pixbuf-xlib-from-drawables</FILE>
gdk_pixbuf_xlib_get_from_drawable
</SECTION>
<SECTION>
<FILE>gdk-pixbuf-xlib-rgb</FILE>
XlibRgbCmap
XlibRgbDither
xlib_rgb_init
xlib_rgb_init_with_depth
xlib_rgb_gc_set_foreground
xlib_rgb_gc_set_background
xlib_draw_rgb_image
xlib_draw_rgb_image_dithalign
xlib_draw_rgb_32_image
xlib_draw_gray_image
xlib_rgb_cmap_new
xlib_rgb_cmap_free
xlib_draw_indexed_image
xlib_rgb_ditherable
xlib_rgb_set_verbose
xlib_rgb_set_install
xlib_rgb_set_min_colors
xlib_rgb_get_cmap
xlib_rgb_get_visual
xlib_rgb_get_visual_info
xlib_rgb_get_depth
xlib_rgb_get_display
xlib_rgb_get_screen
</SECTION>

View File

@ -1,23 +1,28 @@
<!doctype book PUBLIC "-//Davenport//DTD DocBook V3.0//EN" [
<!entity gdk-pixbuf-Initialization-and-Versions SYSTEM "sgml/initialization_versions.sgml">
<!doctype book PUBLIC "-//Davenport//DTD DocBook V3.0//EN"[
<!entity gdk-pixbuf-gdk-pixbuf SYSTEM "sgml/gdk-pixbuf.sgml">
<!entity gdk-pixbuf-refcounting SYSTEM "sgml/refcounting.sgml">
<!entity gdk-pixbuf-file-loading SYSTEM "sgml/file-loading.sgml">
<!entity gdk-pixbuf-creating SYSTEM "sgml/creating.sgml">
<!entity gdk-pixbuf-rendering SYSTEM "sgml/rendering.sgml">
<!entity gdk-pixbuf-scaling SYSTEM "sgml/scaling.sgml">
<!entity gdk-pixbuf-from-drawables SYSTEM "sgml/from-drawables.sgml">
<!entity gdk-pixbuf-util SYSTEM "sgml/util.sgml">
<!entity gdk-pixbuf-animation SYSTEM "sgml/animation.sgml">
<!entity gdk-pixbuf-Module-Interface SYSTEM "sgml/module_interface.sgml">
<!entity GdkPixbufLoader SYSTEM "sgml/gdk-pixbuf-loader.sgml">
<!entity GnomeCanvasPixbuf SYSTEM "sgml/gnome-canvas-pixbuf.sgml">
<!entity gdk-pixbuf-gdk-pixbuf-xlib-init SYSTEM "sgml/gdk-pixbuf-xlib-init.sgml">
<!entity gdk-pixbuf-gdk-pixbuf-xlib-rendering SYSTEM "sgml/gdk-pixbuf-xlib-rendering.sgml">
<!entity gdk-pixbuf-gdk-pixbuf-xlib-from-drawables SYSTEM "sgml/gdk-pixbuf-xlib-from-drawables.sgml">
<!entity gdk-pixbuf-gdk-pixbuf-xlib-rgb SYSTEM "sgml/gdk-pixbuf-xlib-rgb.sgml">
<!entity Porting-From-Imlib SYSTEM "porting-from-imlib.sgml">
<!entity Compiling SYSTEM "compiling.sgml">
<!entity gdk-pixbuf "<application>gdk-pixbuf</application>">
<!entity Imlib "<application>Imlib</application>">
]>
<book id="index">
<bookinfo>
<title>The <application>gdk-pixbuf</application> Library</title>
<title>The &gdk-pixbuf; Library</title>
<authorgroup>
<author>
@ -32,24 +37,53 @@
</authorgroup>
<copyright>
<year>1999</year>
<year>2000</year>
<holder>The Free Software Foundation</holder>
</copyright>
<legalnotice>
<para>
Permission is granted to copy, distribute and/or modify this
document under the terms of the <citetitle>GNU Free
Documentation License</citetitle>, Version 1.1 or any later
version published by the Free Software Foundation with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover
Texts. You may obtain a copy of the <citetitle>GNU Free
Documentation License</citetitle> from the Free Software
Foundation by visiting <ulink type="http"
url="http://www.fsf.org">their Web site</ulink> or by writing
to:
<address>
The Free Software Foundation, Inc.,
<street>59 Temple Place</street> - Suite 330,
<city>Boston</city>, <state>MA</state> <postcode>02111-1307</postcode>,
<country>USA</country>
</address>
</para>
<para>
Many of the names used by companies to distinguish their
products and services are claimed as trademarks. Where those
names appear in any GNOME documentation, and those trademarks
are made aware to the members of the GNOME Documentation
Project, the names have been printed in caps or initial caps.
</para>
</legalnotice>
</bookinfo>
<reference id="api">
<reference>
<title>API Reference</title>
<partintro>
<para>
This part presents the class and function reference for the
<application>gdk-pixbuf</application> library. Classes are
described together with their methods; individual functions
are grouped by functional group.
&gdk-pixbuf; library. Classes are described together with
their methods; individual functions are grouped by functional
group.
</para>
</partintro>
&gdk-pixbuf-Initialization-and-Versions;
&gdk-pixbuf-gdk-pixbuf;
&gdk-pixbuf-refcounting;
&gdk-pixbuf-file-loading;
@ -57,15 +91,51 @@
&gdk-pixbuf-scaling;
&gdk-pixbuf-util;
&gdk-pixbuf-animation;
&GdkPixbufLoader;
&GnomeCanvasPixbuf;
</reference>
<reference id="internals">
<title>Internals</title>
&gdk-pixbuf-Module-Interface;
&gdk-pixbuf-gdk-pixbuf-xlib-init;
&gdk-pixbuf-gdk-pixbuf-xlib-rendering;
&gdk-pixbuf-gdk-pixbuf-xlib-from-drawables;
&gdk-pixbuf-gdk-pixbuf-xlib-rgb;
</reference>
&Porting-From-Imlib;
&Compiling;
<!-- License -->
<appendix id="license">
<title>License</title>
<para>
This library is free software; you can redistribute it and/or
modify it under the terms of the <citetitle>GNU Library General
Public License</citetitle> as published by the Free Software
Foundation; either version 2 of the License, or (at your option)
any later version.
</para>
<para>
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
<citetitle>GNU Library General Public License</citetitle> for
more details.
</para>
<para>
You may obtain a copy of the <citetitle>GNU Library General
Public License</citetitle> from the Free Software Foundation by
visiting <ulink type="http" url="http://www.fsf.org">their Web
site</ulink> or by writing to:
<address>
Free Software Foundation, Inc.
<street>59 Temple Place</street> - Suite 330
<city>Boston</city>, <state>MA</state> <postcode>02111-1307</postcode>
<country>USA</country>
</address>
</para>
</appendix>
</book>

View File

@ -0,0 +1,360 @@
<appendix>
<title>Porting applications from &Imlib; to &gdk-pixbuf;</title>
<para>
This appendix contains the basic steps needed to port an
application that uses the &Imlib; library to use &gdk-pixbuf;
instead.
</para>
<note>
<para>
This appendix refers to version 1 of the &Imlib; library; this
discussion is not relevant to Imlib 2. Also, we discuss the
gdk_imlib API instead of the Xlib-based API.
</para>
</note>
<!-- Introduction -->
<sect1>
<title>Introduction</title>
<para>
Prior to the GNOME 1.2 platform, the &Imlib; library was the
preferred way of loading and rendering images in GNOME
applications. Unfortunately, &Imlib; has important design
limitations that make it hard to write efficient and highly
modular applications.
</para>
<para>
The &gdk-pixbuf; library was designed as a solution to
&Imlib;'s shortcomings. It provides a simple, orthogonal API
and convenience functions for the most common operations. In
addition, it supports full transparency information for
images, or alpha channel. More importantly, it has
well-defined semantics for memory management through the use
of reference counting; &Imlib; has an intractably complex
memory management mechanism and cache that will make your head
spin.
</para>
</sect1>
<!-- Differences between Imlib and gdk-pixbuf -->
<sect1>
<title>Differences between &Imlib; and &gdk-pixbuf;</title>
<para>
Generally, applications that use &Imlib; do not have to be
changed extensively to use &gdk-pixbuf;; its simple and
flexible API makes things easy. This section describes the
differences between &Imlib; and &gdk-pixbuf;; you should take
these into account when modifying your applications to use
&gdk-pixbuf;.
</para>
<!-- Initialization -->
<sect2>
<title>Initialization</title>
<para>
The &gdk-pixbuf; library does not need to be initialized.
However, if you intend to use the rendering functions or
anything else from the <application>GdkRGB</application>
library, you should call <function>gdk_rgb_init()</function>
after calling <function>gtk_init()</function> or
<function>gnome_init()</function> in your program.
</para>
<note>
<para>
In GNOME applications you normally don't need to
initialize &Imlib;, as <function>gnome_init()</function>
calls <function>gdk_imlib_init()</function> automatically.
</para>
</note>
</sect2>
<!-- Memory management -->
<sect2>
<title>Memory management</title>
<para>
The &gdk-pixbuf; library provides a simple, well-defined
memory management mechanism for images in the form of
reference counting. This makes it very convenient to use
for large-scale applications that need to share images
between different parts of the program. In stark contrast,
&Imlib; has a terribly complex mechanism of an image and
pixmap cache which makes it very hard for applications to
share image structures between different parts of the
program. Unfortunately this mechanism makes things very
prone to memory leaks and tricky bugs.
</para>
<para>
The basic principle in &gdk-pixbuf; is that when you obtain
a new <link linkend="GdkPixbuf">GdkPixbuf</link> structure,
it is created with an initial reference count of 1. When
another part of the program wants to keep a reference to the
pixbuf, it should call <link
linkend="gdk-pixbuf-ref">gdk_pixbuf_ref()</link>; this will
increase the reference count by 1. When some part of the
program does not need to keep a reference to a pixbuf
anymore and wants to release the pixbuf, it should call
<link linkend="gdk-pixbuf-unref">gdk_pixbuf_unref()</link>;
this will decrease the reference count by 1. When the
reference count drops to zero, the pixbuf gets destroyed or
<emphasis>finalized</emphasis> and its memory is freed.
</para>
<para>
For applications that need to implement a cache of loaded
images, &gdk-pixbuf; provides a way to hook to the last
unreference operation of a pixbuf; instead of finalizing the
pixbuf, the user-installed hook can decide to keep it around
in a cache instead.
</para>
<para>
Finally, &gdk-pixbuf; does not provide a cache of rendered
pixmaps. This is unnecessary for most applications, since
the scaling and rendering functions are quite fast and
applications may need to use subtly different values each
time they call these functions, for example, to take into
account dithering and zooming offsets.
</para>
<para>
Most applications will simply need to call
<function>gdk_pixbuf_ref()</function> when they want to keep
an extra reference to a pixbuf, and then
<function>gdk_pixbuf_unref()</function> when they are done
with it.
</para>
</sect2>
<!-- The Rendering Process -->
<sect2>
<title>The Rendering Process</title>
<para>
The &gdk-pixbuf; library has the policy of always rendering
pixbufs to Gdk drawables you provide; it will not create
them for you. This is in general more flexible than
&Imlib;'s policy of always creating a pixmap and making you
use that instead.
</para>
<para>
The disadvantage of always having a pixmap created for you
is that it wastes memory in the X server if you intend to
copy that rendered data onto another drawable, for example,
the final destination window or a temporary pixmap for
drawing. This is the most common case, unfortunately, so
the &Imlib; policy introduces unnecessary copying.
</para>
<para>
Also, &Imlib; can only render pixmaps that are the whole
size of the source image; you cannot render just a subset
region of the image. This is inconvenient for applications
that need to render small portions at a time, such as
applications that do scrolling. Since the whole image must
be rendered at a time, this can lead to performance and
memory usage problems.
</para>
<para>
The &gdk-pixbuf; library lets you render any rectangular
region from an image onto any drawable that you provide.
This lets the application have fine control the way images
are rendered.
</para>
</sect2>
</sect1>
<!-- Converting Applications to gdk-pixbuf -->
<sect1>
<title>Converting Applications to &gdk-pixbuf;</title>
<para>
This sections describes the actual changes you need to make in
an &Imlib; program to make it use &gdk-pixbuf; instead.
</para>
<!-- Image loading and creation -->
<sect2>
<title>Image loading and creation</title>
<para>
The &gdk-pixbuf; library can load image files synchronously
(i.e. with a single function call), create images from RGB
data in memory, and as a convenience, it can also create
images from inline XPM data.
</para>
<para>
To load an image file in a single function call, simply use
<function>gdk_pixbuf_new_from_file()</function>. Note that
this will make the program block until the whole file has
been read. This function effectively replaces
<function>gdk_imlib_load_image()</function>.
</para>
<para>
If you have RGB data in memory, you can use
<function>gdk_pixbuf_new_from_data()</function> to create a
pixbuf out of it; this is a replacement for
<function>gdk_imlib_create_image_from_data()</function>.
&gdk-pixbuf; does not copy the image data; it is up to you
to define the ownership policy by providing a destroy
notification function that will be called when the image
data needs to be freed. The function you provide can then
free the data or do something else, as appropriate.
</para>
<para>
As a convenience, you can use the
<function>gdk_pixbuf_new_from_xpm_data()</function> function
to create a pixbuf out of inline XPM data that was compiled
into your C program. This is a replacement for
<function>gdk_imlib_create_image_from_xpm_data()</function>.
</para>
<para>
After you have created a pixbuf, you can manipulate it in
any way you please and then finally call
<function>gdk_pixbuf_unref()</function> when you are done
with it. This can be thought of as a replacement for
<function>gdk_imlib_destroy_image()</function> but with much
cleaner semantics.
</para>
</sect2>
<!-- Rendering Images -->
<sect2>
<title>Rendering Images</title>
<para>
Applications that use &Imlib; must first call
<function>gdk_imlib_render()</function> to render the whole
image data onto a pixmap that &Imlib; creates. Then they
must copy that pixmap's data into the final destination for
the image.
</para>
<para>
In contrast, &gdk-pixbuf; provides convenience functions to
render arbitrary rectangular regions of an image onto a
drawable that your application provides. You can use
<function>gdk_pixbuf_render_to_drawable()</function> or
<function>gdk_pixbuf_render_to_drawable_alpha()</function>
to do this; having your application provide the destination
drawable and specify an arbitrary region means your
application has complete control over the way images are
rendered.
</para>
<para>
As a convenience, &gdk-pixbuf; also provides the
<function>gdk_pixbuf_render_pixmap_and_mask()</function>
function; this will create new pixmap and mask drawables for
a whole pixbuf and render the image data onto them. Only
trivially simple applications should find a use for this
function, since usually you want finer control of how things
are rendered.
</para>
</sect2>
<!-- Scaling Images -->
<sect2>
<title>Scaling Images</title>
<para>
&Imlib; lets you render scaled image data at the time you
call <function>gdk_imlib_render()</function>. Again, this
unfortunately scales and renders the whole image onto a new
pixmap.
</para>
<para>
&gdk-pixbuf; provides a number of functions that do scaling
of arbitrary regions of a source pixbuf onto a destination
one. These functions can also perform compositing
operations against the data in the destination pixbuf or
against a solid color or a colored checkerboard.
<footnote>
<para>
You can use a colored checkerboard as the background for
compositing when you want to provide a visual indication
that the image has partially opaque areas. This is
normally used in image editing and viewing programs.
</para>
<para>
Compositing against a single solid color is actually a
special case of a checkerboard; it simply uses checks of
the same color.
</para>
</footnote>
</para>
<para>
Very simple applications may find it sufficient to use
<function>gdk_pixbuf_scale_simple()</function> or
<function>gdk_pixbuf_composite_color_simple()</function>.
These functions scale the whole source image at a time and
create a new pixbuf with the result.
</para>
<para>
More sophisticated applications will need to use
<function>gdk_pixbuf_scale()</function>,
<function>gdk_pixbuf_composite()</function>, or
<function>gdk_pixbuf_composite_color()</function> instead.
These functions let you scale and composite an arbitrary
region of the source pixbuf onto a destination pixbuf that
you provide.
</para>
</sect2>
<!-- Getting Image Data from a Drawable -->
<sect2>
<title>Getting Image Data from a Drawable</title>
<para>
&Imlib; lets you create an image by fetching a drawable's
contents from the X server and converting those into RGB
data. This is done with the
<function>gdk_imlib_create_image_from_drawable()</function>
function.
</para>
<para>
&gdk-pixbuf; provides the
<function>gdk_pixbuf_get_from_drawable()</function> function
instead. It lets you specify a destination pixbuf instead
of always creating a new one for you.
</para>
</sect2>
</sect1>
</appendix>
<!--
Local variables:
mode: sgml
sgml-parent-document: ("gdk-pixbuf.sgml" "book" "book" "")
End:
-->

View File

@ -6,12 +6,11 @@ Animations as multi-frame structures.
<!-- ##### SECTION Long_Description ##### -->
<para>
The <application>gdk-pixbuf</application> library provides a
simple mechanism to load and represent animations, primarily
animated GIF files. Animations are represented as lists of
#GdkPixbufFrame structures. Each frame structure contains a
#GdkPixbuf structure and information about the frame's overlay
mode and duration.
The &gdk-pixbuf; library provides a simple mechanism to load and
represent animations, primarily animated GIF files. Animations
are represented as lists of #GdkPixbufFrame structures. Each
frame structure contains a #GdkPixbuf structure and information
about the frame's overlay mode and duration.
</para>
<!-- ##### SECTION See_Also ##### -->

View File

@ -6,12 +6,11 @@ Loading a pixbuf from a file.
<!-- ##### SECTION Long_Description ##### -->
<para>
The <application>gdk-pixbuf</application> library provides a
simple mechanism for loading an image from a file in synchronous
fashion. This means that the library takes control of the
application while the file is being loaded; from the user's point
of view, the application will block until the image is done
loading.
The &gdk-pixbuf; library provides a simple mechanism for loading
an image from a file in synchronous fashion. This means that the
library takes control of the application while the file is being
loaded; from the user's point of view, the application will block
until the image is done loading.
</para>
<para>

View File

@ -31,6 +31,10 @@ Drawables to Pixbufs
</para>
<!-- ##### SECTION ./tmpl/xlib-from-drawables.sgml:Title ##### -->
X Drawables to Pixbufs
<!-- ##### FUNCTION gdk_pixbuf_render_pixmap_and_mask ##### -->
<para>
@ -46,6 +50,21 @@ sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
End:
-->
<!-- ##### ARG GnomeCanvasPixbuf:width ##### -->
<para>
Indicates the width the pixbuf will be scaled to. This argument
will only be used if the <link
linkend="GnomeCanvasPixbuf--width-set">width_set</link> argument
is %TRUE. If the <link
linkend="GnomeCanvasPixbuf--width-in-pixels">width_in_pixels</link>
argument is %FALSE, the width will be taken to be in canvas units,
and thus will be scaled along with the canvas item's affine
transformation. If width_in_pixels is %TRUE, the width will be
taken to be in pixels, and will visually remain a constant size
even if the item's affine transformation changes.
</para>
<!-- ##### FUNCTION gdk_pixbuf_render_to_drawable ##### -->
<para>
@ -85,6 +104,43 @@ sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
End:
-->
<!-- ##### ARG GnomeCanvasPixbuf:x ##### -->
<para>
Indicates the horizontal translation offset of the pixbuf item's
image. This offset may not actually appear horizontal, since it
will be affected by the item's affine transformation. The default
is 0.0.
</para>
<!-- ##### ARG GnomeCanvasPixbuf:y ##### -->
<para>
Indicates the vertical translation offset of the pixbuf item's
image. Works in the same way as the <link
linkend="GnomeCanvasPixbuf--x">x</link> argument. The default is
0.0.
</para>
<!-- ##### SECTION ./tmpl/xlib-init.sgml:Short_Description ##### -->
Initializing the &gdk-pixbuf; Xlib library.
<!-- ##### SECTION ./tmpl/xlib-from-drawables.sgml:Long_Description ##### -->
<para>
The functions in this section allow you to take the image data
from an X drawable and dump it into a #GdkPixbuf. This can be
used for screenshots and other special effects. Note that these
operations can be expensive, since the image data has to be
transferred from the X server to the client program and converted.
</para>
<para>
These functions are analogous to those for the Gdk version of
&gdk-pixbuf;.
</para>
<!-- ##### FUNCTION gdk_pixbuf_new_from_art_pixbuf ##### -->
<para>
@ -93,16 +149,94 @@ End:
@art_pixbuf:
@Returns:
<!-- ##### SECTION ./tmpl/xlib-init.sgml:See_Also ##### -->
<para>
XlibRGB
</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, but controls whether the <link
linkend="GnomeCanvasPixbuf--y">y</link> translation offset is
scaled or not. The default is %FALSE.
</para>
<!--
Local variables:
mode: sgml
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
End:
-->
<!-- ##### SECTION ./tmpl/gnome-canvas-pixbuf.sgml:See_Also ##### -->
<para>
#GnomeCanvas, #GdkPixbuf
</para>
<!-- ##### ARG GnomeCanvasPixbuf:pixbuf ##### -->
<para>
Contains a pointer to a #GdkPixbuf structure that will be used by
the pixbuf canvas item as an image source. When a pixbuf is set
its reference count is incremented; if the pixbuf item kept a
pointer to another #GdkPixbuf structure, the reference count of
this structure will be decremented. Also, the GdkPixbuf's
reference count will automatically be decremented when the
#GnomeCanvasPixbuf item is destroyed. When a pixbuf is queried, a
reference count will not be added to the return value; you must do
this yourself if you intend to keep the pixbuf structure around.
</para>
<!-- ##### ARG GnomeCanvasPixbuf:y_pixels ##### -->
<para>
</para>
<!-- ##### SECTION ./tmpl/xlib-rgb.sgml:See_Also ##### -->
<para>
GdkRGB
</para>
<!-- ##### SECTION ./tmpl/xlib-rendering.sgml:Long_Description ##### -->
<para>
The &gdk-pixbuf; Xlib library provides several convenience
functions to render pixbufs to X drawables. It uses XlibRGB to
render the image data.
</para>
<para>
These functions are analogous to those for the Gdk version of
&gdk-pixbuf;.
</para>
<!-- ##### SECTION ./tmpl/gdk-pixbuf-io.sgml:Short_Description ##### -->
<!-- ##### SECTION ./tmpl/gnome-canvas-pixbuf.sgml:Short_Description ##### -->
Canvas item to display #GdkPixbuf images.
<!-- ##### 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. The
default is %FALSE.
</para>
<!-- ##### SECTION ./tmpl/from-drawables.sgml:Long_Description ##### -->
<para>
The functions in this section allow you to take the image data
@ -113,12 +247,36 @@ End:
</para>
<!-- ##### SECTION ./tmpl/xlib-rgb.sgml:Long_Description ##### -->
<para>
The XlibRGB set of functions is a port of the GdkRGB library to
use plain Xlib and X drawables. You can use these functions to
render RGB buffers into drawables very quickly with high-quality
dithering.
</para>
<!-- ##### SECTION ./tmpl/xlib-rgb.sgml:Short_Description ##### -->
Functions for rendering RGB buffers to X drawables.
<!-- ##### MACRO GNOME_CANVAS_PIXBUF ##### -->
<para>
Casts a #GtkOjbect to a #GnomeCanvasPixbuf.
</para>
@obj: A GTK+ object.
<!-- ##### SECTION ./tmpl/gdk-pixbuf-io.sgml:See_Also ##### -->
<para>
</para>
<!-- ##### SECTION ./tmpl/xlib-rendering.sgml:Short_Description ##### -->
Rendering a pixbuf to an X drawable.
<!-- ##### FUNCTION gdk_pixbuf_finalize ##### -->
<para>
@ -153,6 +311,31 @@ Rendering a pixbuf to a GDK drawable.
</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>
<!-- ##### SECTION ./tmpl/xlib-init.sgml:Long_Description ##### -->
<para>
In addition to the normal Gdk-specific functions, the &gdk-pixbuf;
package provides a small library that lets Xlib-only applications
use #GdkPixbuf structures and render them to X drawables. The
functions in this section are used to initialize the &gdk-pixbuf;
Xlib library. This library must be initialized near the beginning
or the program or before calling any of the other &gdk-pixbuf;
Xlib functions; it cannot be initialized automatically since
Xlib-only applications do not call gdk_rgb_init() like GNOME
applications do.
</para>
<!-- ##### FUNCTION gdk_pixbuf_get_format ##### -->
<para>
@ -161,6 +344,30 @@ Rendering a pixbuf to a GDK drawable.
@pixbuf:
@Returns:
<!-- ##### 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>
<!-- ##### SECTION ./tmpl/xlib-rendering.sgml:See_Also ##### -->
<para>
</para>
<!-- ##### ARG GnomeCanvasPixbuf:width_set ##### -->
<para>
Determines whether the <link
linkend="GnomeCanvasPixbuf--width">width</link> argument is taken
into account when scaling the pixbuf item. If this argument is
%FALSE, then the width value of the pixbuf will be used instead.
This argument is %FALSE by default.
</para>
<!-- ##### FUNCTION gdk_pixbuf_render_to_drawable_alpha ##### -->
<para>
@ -180,22 +387,54 @@ Rendering a pixbuf to a GDK drawable.
@x_dither:
@y_dither:
<!-- ##### SECTION ./tmpl/xlib-init.sgml:Title ##### -->
&gdk-pixbuf; Xlib initialization
<!-- ##### SECTION ./tmpl/xlib-from-drawables.sgml:Short_Description ##### -->
Getting parts of an X drawable's image data into a pixbuf.
<!-- ##### SECTION ./tmpl/xlib-rgb.sgml:Title ##### -->
XlibRGB
<!-- ##### ARG GnomeCanvasPixbuf:x_pixels ##### -->
<para>
</para>
<!-- ##### ARG GnomeCanvasPixbuf:height ##### -->
<para>
Indicates the height the pixbuf will be scaled to. This argument
will only be used if the <link
linkend="GnomeCanvasPixbuf--height-set">height_set</link> argument
is %TRUE. Works in the same way as the <link
linkend="GnomeCanvasPixbuf--width">width</link> argument.
</para>
<!-- ##### SECTION ./tmpl/from-drawables.sgml:See_Also ##### -->
<para>
gdk_image_get().
</para>
<!-- ##### SECTION ./tmpl/xlib-from-drawables.sgml:See_Also ##### -->
<para>
</para>
<!-- ##### SECTION ./tmpl/rendering.sgml:Title ##### -->
Rendering
<!-- ##### SECTION ./tmpl/gnome-canvas-pixbuf.sgml:Title ##### -->
GnomeCanvasPixbuf
<!-- ##### MACRO GDK_PIXBUF_LOADER ##### -->
<para>
Casts a #GtkObject to a #GdkPixbufLoader.
@ -216,19 +455,18 @@ Rendering
<!-- ##### SECTION ./tmpl/rendering.sgml:Long_Description ##### -->
<para>
The <application>gdk-pixbuf</application> library provides several
convenience functions to render pixbufs to GDK drawables. It uses
the GdkRGB to render the image data.
The &gdk-pixbuf; library provides several convenience functions to
render pixbufs to GDK drawables. It uses the GdkRGB to render the
image data.
</para>
<para>
At this point there is not a standard alpha channel extension for
the X Window System, so it is not possible to use full opacity
information when painting images to arbitrary drawables. The
<application>gdk-pixbuf</application> convenience functions will
threshold the opacity information to create a bi-level clipping
mask (black and white), and use that to draw the image onto a
drawable.
&gdk-pixbuf; convenience functions will threshold the opacity
information to create a bi-level clipping mask (black and white),
and use that to draw the image onto a drawable.
</para>
<important>
@ -290,6 +528,190 @@ In the future it will do full alpha compositing.
</para>
<!-- ##### SECTION ./tmpl/gnome-canvas-pixbuf.sgml:Long_Description ##### -->
<para>
This canvas item displays #GdkPixbuf images. It handles full
affine transformations in both GDK and antialiased modes, and also
supports the <ulink url="http://www.w3.org">W3C</ulink>'s <ulink
url="http://www.w3.org/Graphics/SVG/">SVG</ulink>-like scaling and
translation semantics for absolute pixel values.
</para>
<para>
#GdkPixbuf structures may be shared among different pixbuf canvas
items; the pixbuf item uses #GdkPixbuf's reference counting
functions for this.
</para>
<refsect2>
<title>Custom Scaling and Translation</title>
<para>
In addition to the normal affine transformations supported by
canvas items, the #GnomeCanvasPixbuf item supports independent
object arguments for scaling and translation. This is useful
for explicitly setting a size to which the pixbuf's image will
be scaled, and for specifying translation offsets that take
place in the item's local coordinate system.
</para>
<para>
By default, the pixbuf canvas item will attain the size in units
of the #GdkPixbuf it contains. If a #GnomeCanvasPixbuf is
configured to use a #GdkPixbuf that has a size of 300 by 200
pixels, then the pixbuf item will automatically obtain a size of
300 by 200 units in the item's local coordinate system. If the
item is transformed with a scaling transformation of (0.5, 2.0),
then the final image size will be of 150 by 400 pixels.
</para>
<para>
To set custom width and height values, you must set the <link
linkend="GnomeCanvasPixbuf--width-set">width_set</link> or <link
linkend="GnomeCanvasPixbuf--height-set">height_set</link>
arguments to %TRUE, and then set the <link
linkend="GnomeCanvasPixbuf--width">width</link> or <link
linkend="GnomeCanvasPixbuf--height">height</link> arguments to
the desired values. The former two arguments control whether
the latter two are used when computing the final image's size;
they are both %FALSE by default so that the pixbuf item will
attain a size in units equal to the size in pixels of the
#GdkPixbuf that the item contains.
</para>
<para>
The custom translation offsets are controlled by the <link
linkend="GnomeCanvasPixbuf--x">x</link> and <link
linkend="GnomeCanvasPixbuf--y">y</link> arguments. The logical
upper-left vertex of the image will be translated by the
specified distance, aligned with the item's local coordinate
system.
</para>
</refsect2>
<refsect2>
<title>Absolute Pixel Scaling and Translation</title>
<para>
The <ulink url="http://www.w3.org/Graphics/SVG/">Scalable Vector
Graphics</ulink> specification (SVG) of the <ulink
url="http://www.w3.org">World Wide Web Consortium</ulink> also
allows images to be translated and scaled by absolute pixel
values that are independent of an item's normal affine
transformation.
</para>
<para>
Normally, the pixbuf item's translation and scaling arguments
are interpreted in units, so they will be modified by the item's
affine transformation. The <link
linkend="GnomeCanvasPixbuf--width-in-pixels">width_in_pixels</link>,
<link
linkend="GnomeCanvasPixbuf--height-in-pixels">height_in_pixels</link>,
<link
linkend="GnomeCanvasPixbuf--x-in-pixels">x_in_pixels</link>, and
<link
linkend="GnomeCanvasPixbuf--y-in-pixels">y_in_pixels</link>
object arguments can be used to modify this behavior. If one of
these arguments is %TRUE, then the corresponding scaling or
translation value will not be affected lengthwise by the pixbuf
item's affine transformation.
</para>
<para>
For example, consider a pixbuf item whose size is (300, 200).
If the item is modified with a scaling transformation of (0.5,
2.0) but the <link
linkend="GnomeCanvasPixbuf--width-in-pixels">width_in_pixels</link>
is set to %TRUE, then the item will appear to be (300, 400)
pixels in size. This means that in this case the item's affine
transformation only applies to the height value, while the width
value is kept in absolute pixels.
</para>
<para>
Likewise, consider a pixbuf item whose (<link
linkend="GnomeCanvasPixbuf--x">x</link>, <link
linkend="GnomeCanvasPixbuf--y">y</link>) arguments are set to
(30, 40). If the item is then modified by the same scaling
transformation of (0.5, 2.0) but the <link
linkend="GnomeCanvasPixbuf--y-in-pixels">y_in_pixels</link>
argument is set to %TRUE, then the image's upper-left corner
will appear to be at position (15, 40). In this case, the
affine transformation is applied only to the x offset, while the
y offset is kept in absolute pixels.
</para>
<para>
In short, these arguments control whether a particular dimension
of a pixbuf item is scaled or not in the normal way by the
item's affine transformation.
</para>
</refsect2>
<refsect2>
<title>Resource Management</title>
<para>
When you set the #GdkPixbuf structure that a #GnomeCanvasPixbuf
item will use by setting the <link
linkend="GnomeCanvasPixbuf--pixbuf">pixbuf</link> argument, a
reference count will be added to that #GdkPixbuf structure.
When the pixbuf item no longer needs the #GdkPixbuf structure,
such as when the item is destroyed or when a new pixbuf
structure is passed to it, then the old #GdkPixbuf structure
will be automatically unreferenced.
</para>
<para>
This means that if an application just needs to load a pixbuf
image and set it into a pixbuf canvas item, it can do the
following to &lsquo;forget&rsquo; about the pixbuf structure:
<programlisting>
GdkPixbuf *pixbuf;
GnomeCanvasItem *item;
pixbuf = gdk_pixbuf_new_from_file ("foo.png");
g_assert (pixbuf != NULL);
item = gnome_canvas_item_new (gnome_canvas_root (my_canvas),
gnome_canvas_pixbuf_get_type (),
"pixbuf", pixbuf,
NULL);
gdk_pixbuf_unref (pixbuf);
</programlisting>
</para>
<para>
After this happens, the reference count of the pixbuf structure
will be 1: the gdk_pixbuf_new_from_file() function creates it
with a reference count of 1, then setting the <link
linkend="GnomeCanvasPixbuf--pixbuf">pixbuf</link> argument of
the #GnomeCanvasPixbuf item increases it to 2, and then it is
decremented to 1 by the call to gdk_pixbuf_unref(). When the
canvas item is destroyed, it will automatically unreference the
pixbuf structure again, causing its reference count to drop to
zero and thus be freed.
</para>
</refsect2>
<!-- ##### SECTION ./tmpl/xlib-rendering.sgml:Title ##### -->
Xlib Rendering
<!-- ##### ARG GnomeCanvasPixbuf:height_set ##### -->
<para>
Determines whether the <link
linkend="GnomeCanvasPixbuf--height">height</link> argument is
taken into account when scaling the pixbuf item. Works in the
same way as the <link
linkend="GnomeCanvasPixbuf--width-set">width_set</link> argument.
The default is %FALSE.
</para>
<!-- ##### SECTION ./tmpl/gdk-pixbuf-io.sgml:Title ##### -->
gdk-pixbuf-io

View File

@ -0,0 +1,48 @@
<!-- ##### SECTION Title ##### -->
X Drawables to Pixbufs
<!-- ##### SECTION Short_Description ##### -->
Getting parts of an X drawable's image data into a pixbuf.
<!-- ##### SECTION Long_Description ##### -->
<para>
The functions in this section allow you to take the image data
from an X drawable and dump it into a #GdkPixbuf. This can be
used for screenshots and other special effects. Note that these
operations can be expensive, since the image data has to be
transferred from the X server to the client program and converted.
</para>
<para>
These functions are analogous to those for the Gdk version of
&gdk-pixbuf;.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
<!-- ##### FUNCTION gdk_pixbuf_xlib_get_from_drawable ##### -->
<para>
</para>
@dest:
@src:
@cmap:
@visual:
@src_x:
@src_y:
@dest_x:
@dest_y:
@width:
@height:
@Returns: <!--
Local variables:
mode: sgml
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
End:
-->

View File

@ -0,0 +1,48 @@
<!-- ##### SECTION Title ##### -->
&gdk-pixbuf; Xlib initialization
<!-- ##### SECTION Short_Description ##### -->
Initializing the &gdk-pixbuf; Xlib library.
<!-- ##### SECTION Long_Description ##### -->
<para>
In addition to the normal Gdk-specific functions, the &gdk-pixbuf;
package provides a small library that lets Xlib-only applications
use #GdkPixbuf structures and render them to X drawables. The
functions in this section are used to initialize the &gdk-pixbuf;
Xlib library. This library must be initialized near the beginning
or the program or before calling any of the other &gdk-pixbuf;
Xlib functions; it cannot be initialized automatically since
Xlib-only applications do not call gdk_rgb_init() like GNOME
applications do.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
XlibRGB
</para>
<!-- ##### FUNCTION gdk_pixbuf_xlib_init ##### -->
<para>
</para>
@display:
@screen_num:
<!-- ##### FUNCTION gdk_pixbuf_xlib_init_with_depth ##### -->
<para>
</para>
@display:
@screen_num:
@prefDepth: <!--
Local variables:
mode: sgml
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
End:
-->

View File

@ -0,0 +1,94 @@
<!-- ##### SECTION Title ##### -->
Xlib Rendering
<!-- ##### SECTION Short_Description ##### -->
Rendering a pixbuf to an X drawable.
<!-- ##### SECTION Long_Description ##### -->
<para>
The &gdk-pixbuf; Xlib library provides several convenience
functions to render pixbufs to X drawables. It uses XlibRGB to
render the image data.
</para>
<para>
These functions are analogous to those for the Gdk version of
&gdk-pixbuf;.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
<!-- ##### FUNCTION gdk_pixbuf_xlib_render_threshold_alpha ##### -->
<para>
</para>
@pixbuf:
@bitmap:
@src_x:
@src_y:
@dest_x:
@dest_y:
@width:
@height:
@alpha_threshold:
<!-- ##### FUNCTION gdk_pixbuf_xlib_render_to_drawable ##### -->
<para>
</para>
@pixbuf:
@drawable:
@gc:
@src_x:
@src_y:
@dest_x:
@dest_y:
@width:
@height:
@dither:
@x_dither:
@y_dither:
<!-- ##### FUNCTION gdk_pixbuf_xlib_render_to_drawable_alpha ##### -->
<para>
</para>
@pixbuf:
@drawable:
@src_x:
@src_y:
@dest_x:
@dest_y:
@width:
@height:
@alpha_mode:
@alpha_threshold:
@dither:
@x_dither:
@y_dither:
<!-- ##### FUNCTION gdk_pixbuf_xlib_render_pixmap_and_mask ##### -->
<para>
</para>
@pixbuf:
@pixmap_return:
@mask_return:
@alpha_threshold: <!--
Local variables:
mode: sgml
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
End:
-->

View File

@ -0,0 +1,268 @@
<!-- ##### SECTION Title ##### -->
XlibRGB
<!-- ##### SECTION Short_Description ##### -->
Functions for rendering RGB buffers to X drawables.
<!-- ##### SECTION Long_Description ##### -->
<para>
The XlibRGB set of functions is a port of the GdkRGB library to
use plain Xlib and X drawables. You can use these functions to
render RGB buffers into drawables very quickly with high-quality
dithering.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
GdkRGB
</para>
<!-- ##### STRUCT XlibRgbCmap ##### -->
<para>
FIXME: Describe this.
</para>
@colors: FIXME.
@lut: FIXME.
<!-- ##### ENUM XlibRgbDither ##### -->
<para>
These values are used to specify which dithering method should be
used. <symbol>XLIB_RGB_DITHER_NONE</symbol> will use no dithering
and simply map the colors in an RGB buffer to the closest colors
that the display can provide.
<symbol>XLIB_RGB_DITHER_NORMAL</symbol> will provide dithering
only on pseudocolor displays.
<symbol>XLIB_RGB_DITHER_MAX</symbol> will provide dithering on
pseudocolor and 16-bit truecolor or &ldquo;high color&rdquo;
displays.
</para>
@XLIB_RGB_DITHER_NONE: Specifies no dithering.
@XLIB_RGB_DITHER_NORMAL: Specifies dithering only on pseudocolor
displays.
@XLIB_RGB_DITHER_MAX: Specifies dithering on high color displays.
<!-- ##### FUNCTION xlib_rgb_init ##### -->
<para>
</para>
@display:
@screen:
<!-- ##### FUNCTION xlib_rgb_init_with_depth ##### -->
<para>
</para>
@display:
@screen:
@prefDepth:
<!-- ##### FUNCTION xlib_rgb_gc_set_foreground ##### -->
<para>
</para>
@gc:
@rgb:
<!-- ##### FUNCTION xlib_rgb_gc_set_background ##### -->
<para>
</para>
@gc:
@rgb:
<!-- ##### FUNCTION xlib_draw_rgb_image ##### -->
<para>
</para>
@drawable:
@gc:
@x:
@y:
@width:
@height:
@dith:
@rgb_buf:
@rowstride:
<!-- ##### FUNCTION xlib_draw_rgb_image_dithalign ##### -->
<para>
</para>
@drawable:
@gc:
@x:
@y:
@width:
@height:
@dith:
@rgb_buf:
@rowstride:
@xdith:
@ydith:
<!-- ##### FUNCTION xlib_draw_rgb_32_image ##### -->
<para>
</para>
@drawable:
@gc:
@x:
@y:
@width:
@height:
@dith:
@buf:
@rowstride:
<!-- ##### FUNCTION xlib_draw_gray_image ##### -->
<para>
</para>
@drawable:
@gc:
@x:
@y:
@width:
@height:
@dith:
@buf:
@rowstride:
<!-- ##### FUNCTION xlib_rgb_cmap_new ##### -->
<para>
</para>
@colors:
@n_colors:
@Returns:
<!-- ##### FUNCTION xlib_rgb_cmap_free ##### -->
<para>
</para>
@cmap:
<!-- ##### FUNCTION xlib_draw_indexed_image ##### -->
<para>
</para>
@drawable:
@gc:
@x:
@y:
@width:
@height:
@dith:
@buf:
@rowstride:
@cmap:
<!-- ##### FUNCTION xlib_rgb_ditherable ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION xlib_rgb_set_verbose ##### -->
<para>
</para>
@verbose:
<!-- ##### FUNCTION xlib_rgb_set_install ##### -->
<para>
</para>
@install:
<!-- ##### FUNCTION xlib_rgb_set_min_colors ##### -->
<para>
</para>
@min_colors:
<!-- ##### FUNCTION xlib_rgb_get_cmap ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION xlib_rgb_get_visual ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION xlib_rgb_get_visual_info ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION xlib_rgb_get_depth ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION xlib_rgb_get_display ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION xlib_rgb_get_screen ##### -->
<para>
</para>
@Returns: <!--
Local variables:
mode: sgml
sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
End:
-->

View File

@ -18,19 +18,17 @@ Information that describes an image.
<!-- ##### ENUM GdkColorspace ##### -->
<para>
This enumeration defines the color spaces that are supported by
the <application>gdk-pixbuf</application> library. Currently only
RGB is supported.
the &gdk-pixbuf; library. Currently only RGB is supported.
</para>
@GDK_COLORSPACE_RGB: Indicates a red/green/blue additive color space.
<!-- ##### STRUCT GdkPixbuf ##### -->
<para>
This is the main structure in the
<application>gdk-pixbuf</application> library. It is used to
represent images. It contains information about the image's pixel
data, its color space, bits per sample, width and height, and the
rowstride or number of bytes between rows.
This is the main structure in the &gdk-pixbuf; library. It is
used to represent images. It contains information about the
image's pixel data, its color space, bits per sample, width and
height, and the rowstride or number of bytes between rows.
</para>
@parent_instance:

View File

@ -68,6 +68,7 @@ Module Interface
@stop_load:
@load_increment:
@load_animation:
@save:
<!-- ##### FUNCTION gdk_pixbuf_get_module ##### -->
<para>

View File

@ -6,12 +6,11 @@ Scaling pixbufs and scaling and compositing pixbufs
<!-- ##### SECTION Long_Description ##### -->
<para>
The <application>gdk-pixbuf</application> contains functions to
scale pixbufs, to scale pixbufs and composite against an existing
image, and to scale pixbufs and composite against a solid color or
checkerboard. Compositing a checkerboard is a common way to show
an image with an alpha channel in image-viewing and editing
software.
The &gdk-pixbuf; contains functions to scale pixbufs, to scale
pixbufs and composite against an existing image, and to scale
pixbufs and composite against a solid color or checkerboard.
Compositing a checkerboard is a common way to show an image with
an alpha channel in image-viewing and editing software.
</para>
<para>

View File

@ -2611,6 +2611,31 @@ void
<RETURNS>void </RETURNS>
PangoContext *context,GdkColormap *colormap
</FUNCTION>
<FUNCTION>
<NAME>gdk_pixbuf_render_threshold_alpha</NAME>
<RETURNS>void </RETURNS>
GdkPixbuf *pixbuf,GdkBitmap *bitmap,int src_x,int src_y,int dest_x,int dest_y,int width,int height,int alpha_threshold
</FUNCTION>
<FUNCTION>
<NAME>gdk_pixbuf_render_to_drawable</NAME>
<RETURNS>void </RETURNS>
GdkPixbuf *pixbuf,GdkDrawable *drawable,GdkGC *gc,int src_x,int src_y,int dest_x,int dest_y,int width,int height,GdkRgbDither dither,int x_dither,int y_dither
</FUNCTION>
<FUNCTION>
<NAME>gdk_pixbuf_render_to_drawable_alpha</NAME>
<RETURNS>void </RETURNS>
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>
<STRUCT>
<NAME>GdkPixmapObject</NAME>
</STRUCT>
@ -3359,12 +3384,13 @@ typedef enum
<NAME>GdkWindowHints</NAME>
typedef enum
{
GDK_HINT_POS = 1 << 0,
GDK_HINT_MIN_SIZE = 1 << 1,
GDK_HINT_MAX_SIZE = 1 << 2,
GDK_HINT_BASE_SIZE = 1 << 3,
GDK_HINT_ASPECT = 1 << 4,
GDK_HINT_RESIZE_INC = 1 << 5
GDK_HINT_POS = 1 << 0,
GDK_HINT_MIN_SIZE = 1 << 1,
GDK_HINT_MAX_SIZE = 1 << 2,
GDK_HINT_BASE_SIZE = 1 << 3,
GDK_HINT_ASPECT = 1 << 4,
GDK_HINT_RESIZE_INC = 1 << 5,
GDK_HINT_WIN_GRAVITY = 1 << 6
} GdkWindowHints;
</ENUM>
<ENUM>
@ -3392,6 +3418,22 @@ typedef enum
GDK_FUNC_CLOSE = 1 << 5
} GdkWMFunction;
</ENUM>
<ENUM>
<NAME>GdkGravity</NAME>
typedef enum
{
GDK_GRAVITY_NORTH_WEST = 1,
GDK_GRAVITY_NORTH,
GDK_GRAVITY_NORTH_EAST,
GDK_GRAVITY_WEST,
GDK_GRAVITY_CENTER,
GDK_GRAVITY_EAST,
GDK_GRAVITY_SOUTH_WEST,
GDK_GRAVITY_SOUTH,
GDK_GRAVITY_SOUTH_EAST,
GDK_GRAVITY_STATIC
} GdkGravity;
</ENUM>
<STRUCT>
<NAME>GdkWindowAttr</NAME>
struct GdkWindowAttr
@ -3424,7 +3466,7 @@ struct GdkGeometry {
gint height_inc;
gdouble min_aspect;
gdouble max_aspect;
/* GdkGravity gravity; */
GdkGravity win_gravity;
};
</STRUCT>
<STRUCT>
@ -3795,6 +3837,11 @@ GdkWindow *window,GdkWMFunction functions
void
</FUNCTION>
<FUNCTION>
<NAME>gdk_window_iconify</NAME>
<RETURNS>void </RETURNS>
GdkWindow *window
</FUNCTION>
<FUNCTION>
<NAME>gdk_window_register_dnd</NAME>
<RETURNS>void </RETURNS>
GdkWindow *window
@ -3846,36 +3893,3 @@ GdkWindow *window,gboolean update_children
<NAME>GDK_HAVE_WCTYPE_H</NAME>
#define GDK_HAVE_WCTYPE_H 1
</MACRO>
<ENUM>
<NAME>GdkPixbufAlphaMode</NAME>
typedef enum
{
GDK_PIXBUF_ALPHA_BILEVEL,
GDK_PIXBUF_ALPHA_FULL
} GdkPixbufAlphaMode;
</ENUM>
<FUNCTION>
<NAME>gdk_pixbuf_render_threshold_alpha</NAME>
<RETURNS>void </RETURNS>
GdkPixbuf *pixbuf,GdkBitmap *bitmap,int src_x,int src_y,int dest_x,int dest_y,int width,int height,int alpha_threshold
</FUNCTION>
<FUNCTION>
<NAME>gdk_pixbuf_render_to_drawable</NAME>
<RETURNS>void </RETURNS>
GdkPixbuf *pixbuf,GdkDrawable *drawable,GdkGC *gc,int src_x,int src_y,int dest_x,int dest_y,int width,int height,GdkRgbDither dither,int x_dither,int y_dither
</FUNCTION>
<FUNCTION>
<NAME>gdk_pixbuf_render_to_drawable_alpha</NAME>
<RETURNS>void </RETURNS>
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>

View File

@ -25,9 +25,9 @@
<!entity gdk-Cursors SYSTEM "sgml/cursors.sgml">
<!entity gdk-Input SYSTEM "sgml/input.sgml">
<!entity gdk-Drag-and-Drop SYSTEM "sgml/dnd.sgml">
<!entity gdk-X-Window-System-Interaction SYSTEM
"sgml/x_interaction.sgml">
<!entity gdk-X-Window-System-Interaction SYSTEM "sgml/x_interaction.sgml">
]>
<book id="index">
<bookinfo>
<title>GDK Reference Manual</title>

View File

@ -110,6 +110,14 @@ configuration information.
</para>
<!-- ##### ENUM GdkPixbufAlphaMode ##### -->
<para>
</para>
@GDK_PIXBUF_ALPHA_BILEVEL:
@GDK_PIXBUF_ALPHA_FULL:
<!-- ##### FUNCTION gdk_regions_subtract ##### -->
<para>
Subtracts one region from another.

View File

@ -14,14 +14,6 @@ Pixbufs
</para>
<!-- ##### ENUM GdkPixbufAlphaMode ##### -->
<para>
</para>
@GDK_PIXBUF_ALPHA_BILEVEL:
@GDK_PIXBUF_ALPHA_FULL:
<!-- ##### FUNCTION gdk_pixbuf_render_threshold_alpha ##### -->
<para>

View File

@ -86,6 +86,7 @@ Windows
@GDK_HINT_BASE_SIZE:
@GDK_HINT_ASPECT:
@GDK_HINT_RESIZE_INC:
@GDK_HINT_WIN_GRAVITY:
<!-- ##### STRUCT GdkGeometry ##### -->
<para>
@ -102,6 +103,7 @@ Windows
@height_inc:
@min_aspect:
@max_aspect:
@win_gravity:
<!-- ##### FUNCTION gdk_window_new ##### -->
<para>

View File

@ -1,3 +1,79 @@
2000-10-06 Havoc Pennington <hp@redhat.com>
* gdk-pixbuf.h: add GdkPixbufAlphaMode
2000-10-06 Havoc Pennington <hp@redhat.com>
This entry is a summary of the merged-in changes from 1.0.
Relevant original ChangeLog entries are spliced in after
this entry; the files they refer to are from the 1.0
gdk-pixbuf sources.
* pixops/pixops.c (pixops_composite_nearest): sync a small fix
from 1.0
* io-xpm.c (xpm_seek_string): add fscanf error check from 1.0
Add progressive loader from 1.0
* io-tiff.c (gdk_pixbuf__tiff_image_begin_load): mem leak fixes
from 1.0 tree
* io-pnm.c: new version from 1.0 tree
* io-jpeg.c (gdk_pixbuf__jpeg_image_load): sync from 1.0, use
malloc not g_malloc
* io-gif.c (lzw_read_byte): sync from 1.0, change a g_error to
g_warning
(gif_get_next_step): return 0 here, sync from 1.0
* gdk-pixbuf-util.c: sync email address change for Cody
Russell
2000-09-11 Jeffrey Stedfast <fejj@helixcode.com>
* gdk-pixbuf/io-pnm.c: Pretty much totally rewrote again because
last nights code was still "broken". Should now properly handle
all error conditions gracefully.
2000-09-10 Jeffrey Stedfast <fejj@helixcode.com>
* gdk-pixbuf/io-pnm.c: Rewrote.
2000-09-09 Federico Mena Quintero <federico@helixcode.com>
* gdk-pixbuf/pixops/pixops.c (pixops_composite_nearest): Compute
the correct dest offset.
2000-08-25 Federico Mena Quintero <federico@helixcode.com>
* gdk-pixbuf/io-xpm.c: #include <unistd.h>
2000-08-05 Larry Ewing <lewing@helixcode.com>
* gdk-pixbuf/io-tiff.c: stop leaking context->tempname.
* gdk-pixbuf/io-xpm.c: same as above.
2000-07-26 Michael Meeks <michael@helixcode.com>
* gdk-pixbuf/io-jpeg.c (gdk_pixbuf__jpeg_image_load): make
g_malloc a malloc.
2000-07-21 Larry Ewing <lewing@helixcode.com>
* gdk-pixbuf/io-xpm.c: add a fake progressive loader so that
xpm at least supports the progressive interface like the one in
io-tiff.c. This should be reimplemented as an actual progressive
loader.
2000-07-19 Jonathan Blandford <jrb@redhat.com>
* demo/pixbuf-demo.c (update_timeout): changed scaling level to
make it look better.
* gdk-pixbuf/testpixbuf.c (update_timeout): Patch from michael
meeks to handle errors better.
2000-10-07 Tor Lillqvist <tml@iki.fi>
* gdk_pixbuf.def

View File

@ -492,14 +492,17 @@ gdk_pixbuf_loader_new_with_type (const char *image_type)
* gdk_pixbuf_loader_get_pixbuf:
* @loader: A pixbuf loader.
*
* Queries the GdkPixbuf that a pixbuf loader is currently creating. In general
* it only makes sense to call this function afer the "area_prepared" signal has
* been emitted by the loader; this means that enough data has been read to know
* the size of the image that will be allocated. If the loader has not received
* enough data via gdk_pixbuf_loader_write(), then this function returns NULL.
* The returned pixbuf will be the same in all future calls to the loader, so
* simply calling gdk_pixbuf_ref() should be sufficient to continue using it.
*
* Queries the GdkPixbuf that a pixbuf loader is currently creating.
* In general it only makes sense to call this function afer the
* "area_prepared" signal has been emitted by the loader; this means
* that enough data has been read to know the size of the image that
* will be allocated. If the loader has not received enough data via
* gdk_pixbuf_loader_write(), then this function returns NULL. The
* returned pixbuf will be the same in all future calls to the loader,
* so simply calling gdk_pixbuf_ref() should be sufficient to continue
* using it. Additionally, if the loader is an animation, it will
* return the first frame of the animation.
*
* Return value: The GdkPixbuf that the loader is creating, or NULL if not
* enough data has been read to determine how to create the image buffer.
**/
@ -512,6 +515,19 @@ gdk_pixbuf_loader_get_pixbuf (GdkPixbufLoader *loader)
g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), NULL);
priv = loader->private;
if (priv->animation)
{
GList *list;
list = gdk_pixbuf_animation_get_frames (priv->animation);
if (list != NULL)
{
GdkPixbufFrame *frame = list->data;
return gdk_pixbuf_frame_get_pixbuf (frame);
}
}
return priv->pixbuf;
}

View File

@ -3,7 +3,7 @@
* Copyright (C) 1999 The Free Software Foundation
*
* Authors: Federico Mena-Quintero <federico@gimp.org>
* Cody Russell <bratsche@dfw.net>
* Cody Russell <bratsche@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public

View File

@ -36,6 +36,13 @@ extern "C" {
/* Alpha compositing mode */
typedef enum
{
GDK_PIXBUF_ALPHA_BILEVEL,
GDK_PIXBUF_ALPHA_FULL
} GdkPixbufAlphaMode;
/* Color spaces; right now only RGB is supported.
* Note that these values are encoded in inline pixbufs
* as ints, so don't reorder them

View File

@ -537,7 +537,7 @@ lzw_read_byte (GifContext *context)
unsigned char buf[260];
/*g_error (" DID WE EVER EVER GET HERE\n");*/
g_error ("Unhandled Case. If you have an image that causes this, let me <jrb@redhat.com> know.\n");
g_warning ("Unhandled Case. If you have an image that causes this, let me <jrb@redhat.com> know.\n");
if (ZeroDataBlock) {
return -2;
@ -982,7 +982,7 @@ gif_get_next_step (GifContext *context)
/* hmm. Not 100% sure what to do about this. Should
* i try to return a blank image instead? */
context->state = GIF_DONE;
return -2;
return 0;
}
if (c == '!') {

View File

@ -196,7 +196,7 @@ gdk_pixbuf__jpeg_image_load (FILE *f)
w = cinfo.output_width;
h = cinfo.output_height;
pixels = g_malloc (h * w * 3);
pixels = malloc (h * w * 3);
if (!pixels) {
jpeg_destroy_decompress (&cinfo);
return NULL;

File diff suppressed because it is too large Load Diff

View File

@ -171,12 +171,14 @@ gdk_pixbuf__tiff_image_begin_load (ModulePreparedNotifyFunc prepare_func,
fd = open (context->tempname, O_RDWR);
#endif
if (fd < 0) {
g_free (context->tempname);
g_free (context);
return NULL;
}
context->file = fdopen (fd, "w");
if (context->file == NULL) {
g_free (context->tempname);
g_free (context);
return NULL;
}

View File

@ -28,6 +28,7 @@
#include <string.h>
#include <glib.h>
#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-io.h"
@ -977,7 +978,8 @@ xpm_seek_string (FILE *infile, const gchar *str, gint skip_comments)
char instr[1024];
while (!feof (infile)) {
fscanf (infile, "%1023s", instr);
if (fscanf (infile, "%1023s", instr) < 0)
return FALSE;
if (skip_comments == TRUE && strcmp (instr, "/*") == 0) {
fscanf (infile, "%1023s", instr);
while (!feof (infile) && strcmp (instr, "*/") != 0)
@ -1373,3 +1375,97 @@ gdk_pixbuf__xpm_image_load_xpm_data (const gchar **data)
return pixbuf;
}
/* Progressive loader */
typedef struct _XPMContext XPMContext;
struct _XPMContext
{
ModulePreparedNotifyFunc prepare_func;
ModuleUpdatedNotifyFunc update_func;
gpointer user_data;
gchar *tempname;
FILE *file;
gboolean all_okay;
};
/*
* FIXME xpm loading progressively is not properly implemented.
* Instead we will buffer to a file then load that file when done.
* This is very broken but it should be relayively simple to fix
* in the future.
*/
gpointer
gdk_pixbuf__xpm_image_begin_load (ModulePreparedNotifyFunc prepare_func,
ModuleUpdatedNotifyFunc update_func,
ModuleFrameDoneNotifyFunc frame_done_func,
ModuleAnimationDoneNotifyFunc anim_done_func,
gpointer user_data)
{
XPMContext *context;
gint fd;
g_warning ("load start");
context = g_new (XPMContext, 1);
context->prepare_func = prepare_func;
context->update_func = update_func;
context->user_data = user_data;
context->all_okay = TRUE;
context->tempname = g_strdup ("/tmp/gdkpixbuf-xpm-tmp.XXXXXX");
fd = mkstemp (context->tempname);
if (fd < 0) {
g_free (context->tempname);
g_free (context);
return NULL;
}
context->file = fdopen (fd, "w+");
if (context->file == NULL) {
g_free (context->tempname);
g_free (context);
return NULL;
}
return context;
}
void
gdk_pixbuf__xpm_image_stop_load (gpointer data)
{
XPMContext *context = (XPMContext*) data;
GdkPixbuf *pixbuf;
g_return_if_fail (data != NULL);
g_warning ("stopped loading");
fflush (context->file);
rewind (context->file);
if (context->all_okay) {
pixbuf = gdk_pixbuf__xpm_image_load (context->file);
(* context->prepare_func) (pixbuf, context->user_data);
(* context->update_func) (pixbuf, 0, 0, pixbuf->width, pixbuf->height, context->user_data);
gdk_pixbuf_unref (pixbuf);
}
fclose (context->file);
unlink (context->tempname);
g_free (context->tempname);
g_free ((XPMContext *) context);
}
gboolean
gdk_pixbuf__xpm_image_load_increment (gpointer data, guchar *buf, guint size)
{
XPMContext *context = (XPMContext *) data;
g_return_val_if_fail (data != NULL, FALSE);
g_warning ("load increment");
if (fwrite (buf, sizeof (guchar), size, context->file) != size) {
context->all_okay = FALSE;
return FALSE;
}
return TRUE;
}

View File

@ -160,7 +160,8 @@ pixops_composite_nearest (guchar *dest_buf,
for (i = 0; i < (render_y1 - render_y0); i++)
{
const guchar *src = src_buf + (((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT) * src_rowstride;
guchar *dest = dest_buf + i * dest_rowstride + render_x0 * dest_channels;
/* FIXME Owen needs to look at this */
guchar *dest = dest_buf + i * dest_rowstride;
x = render_x0 * x_step + x_step / 2;

View File

@ -11,13 +11,6 @@ extern "C" {
/* Rendering to a drawable */
/* Alpha compositing mode */
typedef enum
{
GDK_PIXBUF_ALPHA_BILEVEL,
GDK_PIXBUF_ALPHA_FULL
} GdkPixbufAlphaMode;
void gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf,
GdkBitmap *bitmap,
int src_x,

View File

@ -492,14 +492,17 @@ gdk_pixbuf_loader_new_with_type (const char *image_type)
* gdk_pixbuf_loader_get_pixbuf:
* @loader: A pixbuf loader.
*
* Queries the GdkPixbuf that a pixbuf loader is currently creating. In general
* it only makes sense to call this function afer the "area_prepared" signal has
* been emitted by the loader; this means that enough data has been read to know
* the size of the image that will be allocated. If the loader has not received
* enough data via gdk_pixbuf_loader_write(), then this function returns NULL.
* The returned pixbuf will be the same in all future calls to the loader, so
* simply calling gdk_pixbuf_ref() should be sufficient to continue using it.
*
* Queries the GdkPixbuf that a pixbuf loader is currently creating.
* In general it only makes sense to call this function afer the
* "area_prepared" signal has been emitted by the loader; this means
* that enough data has been read to know the size of the image that
* will be allocated. If the loader has not received enough data via
* gdk_pixbuf_loader_write(), then this function returns NULL. The
* returned pixbuf will be the same in all future calls to the loader,
* so simply calling gdk_pixbuf_ref() should be sufficient to continue
* using it. Additionally, if the loader is an animation, it will
* return the first frame of the animation.
*
* Return value: The GdkPixbuf that the loader is creating, or NULL if not
* enough data has been read to determine how to create the image buffer.
**/
@ -512,6 +515,19 @@ gdk_pixbuf_loader_get_pixbuf (GdkPixbufLoader *loader)
g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), NULL);
priv = loader->private;
if (priv->animation)
{
GList *list;
list = gdk_pixbuf_animation_get_frames (priv->animation);
if (list != NULL)
{
GdkPixbufFrame *frame = list->data;
return gdk_pixbuf_frame_get_pixbuf (frame);
}
}
return priv->pixbuf;
}