diff options
author | Havoc Pennington <hp@redhat.com> | 2000-10-09 17:22:20 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2000-10-09 17:22:20 +0000 |
commit | 518f32d97e0e097c10a99d65da8e0e215c796c3a (patch) | |
tree | 3bdd86d81f59adff2ac1c3dff7bc19672ea9e23f /docs | |
parent | 25840ef4a566630948e838ec69bccd392befca9e (diff) | |
download | gtk+-518f32d97e0e097c10a99d65da8e0e215c796c3a.tar.gz |
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.
Diffstat (limited to 'docs')
21 files changed, 1511 insertions, 132 deletions
diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 7021e4b4f6..695d665520 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -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 diff --git a/docs/reference/gdk-pixbuf/Makefile.am b/docs/reference/gdk-pixbuf/Makefile.am index f5cd156c12..b399994664 100644 --- a/docs/reference/gdk-pixbuf/Makefile.am +++ b/docs/reference/gdk-pixbuf/Makefile.am @@ -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 diff --git a/docs/reference/gdk-pixbuf/compiling.sgml b/docs/reference/gdk-pixbuf/compiling.sgml index dc335ef6d1..6224909f8c 100644 --- a/docs/reference/gdk-pixbuf/compiling.sgml +++ b/docs/reference/gdk-pixbuf/compiling.sgml @@ -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> diff --git a/docs/reference/gdk-pixbuf/gdk-pixbuf-sections.txt b/docs/reference/gdk-pixbuf/gdk-pixbuf-sections.txt index 51192a0645..39fc15ddc6 100644 --- a/docs/reference/gdk-pixbuf/gdk-pixbuf-sections.txt +++ b/docs/reference/gdk-pixbuf/gdk-pixbuf-sections.txt @@ -140,4 +140,50 @@ GdkPixbufModule gdk_pixbuf_get_module gdk_pixbuf_get_named_module gdk_pixbuf_load_module -</SECTION>
\ No newline at end of file +</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> diff --git a/docs/reference/gdk-pixbuf/gdk-pixbuf.sgml b/docs/reference/gdk-pixbuf/gdk-pixbuf.sgml index 16252c70a8..60907f1350 100644 --- a/docs/reference/gdk-pixbuf/gdk-pixbuf.sgml +++ b/docs/reference/gdk-pixbuf/gdk-pixbuf.sgml @@ -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> diff --git a/docs/reference/gdk-pixbuf/porting-from-imlib.sgml b/docs/reference/gdk-pixbuf/porting-from-imlib.sgml new file mode 100644 index 0000000000..b736200cfd --- /dev/null +++ b/docs/reference/gdk-pixbuf/porting-from-imlib.sgml @@ -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: +--> + diff --git a/docs/reference/gdk-pixbuf/tmpl/animation.sgml b/docs/reference/gdk-pixbuf/tmpl/animation.sgml index 128863b5b7..6a64ac85dd 100644 --- a/docs/reference/gdk-pixbuf/tmpl/animation.sgml +++ b/docs/reference/gdk-pixbuf/tmpl/animation.sgml @@ -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 ##### --> diff --git a/docs/reference/gdk-pixbuf/tmpl/file-loading.sgml b/docs/reference/gdk-pixbuf/tmpl/file-loading.sgml index 0a35bd4f4d..3f00def6c4 100644 --- a/docs/reference/gdk-pixbuf/tmpl/file-loading.sgml +++ b/docs/reference/gdk-pixbuf/tmpl/file-loading.sgml @@ -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> diff --git a/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-unused.sgml b/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-unused.sgml index a8f01a9aa0..094a3a188a 100644 --- a/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-unused.sgml +++ b/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-unused.sgml @@ -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 ‘forget’ 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 diff --git a/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-xlib-from-drawables.sgml b/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-xlib-from-drawables.sgml new file mode 100644 index 0000000000..fd59f2db62 --- /dev/null +++ b/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-xlib-from-drawables.sgml @@ -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: +--> + + diff --git a/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-xlib-init.sgml b/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-xlib-init.sgml new file mode 100644 index 0000000000..e841a19b02 --- /dev/null +++ b/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-xlib-init.sgml @@ -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: +--> + + diff --git a/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-xlib-rendering.sgml b/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-xlib-rendering.sgml new file mode 100644 index 0000000000..46c6ac0847 --- /dev/null +++ b/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-xlib-rendering.sgml @@ -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: +--> + + diff --git a/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-xlib-rgb.sgml b/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-xlib-rgb.sgml new file mode 100644 index 0000000000..7ddc621436 --- /dev/null +++ b/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-xlib-rgb.sgml @@ -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 “high color” + 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: +--> + + diff --git a/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf.sgml b/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf.sgml index 9decee1787..08b549d0fc 100644 --- a/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf.sgml +++ b/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf.sgml @@ -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: diff --git a/docs/reference/gdk-pixbuf/tmpl/module_interface.sgml b/docs/reference/gdk-pixbuf/tmpl/module_interface.sgml index b1719b7974..c0a33f2eee 100644 --- a/docs/reference/gdk-pixbuf/tmpl/module_interface.sgml +++ b/docs/reference/gdk-pixbuf/tmpl/module_interface.sgml @@ -68,6 +68,7 @@ Module Interface @stop_load: @load_increment: @load_animation: +@save: <!-- ##### FUNCTION gdk_pixbuf_get_module ##### --> <para> diff --git a/docs/reference/gdk-pixbuf/tmpl/scaling.sgml b/docs/reference/gdk-pixbuf/tmpl/scaling.sgml index 0e4cf95a56..a8d41a1170 100644 --- a/docs/reference/gdk-pixbuf/tmpl/scaling.sgml +++ b/docs/reference/gdk-pixbuf/tmpl/scaling.sgml @@ -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> diff --git a/docs/reference/gdk/gdk-decl.txt b/docs/reference/gdk/gdk-decl.txt index 0d40604f54..297dddb11a 100644 --- a/docs/reference/gdk/gdk-decl.txt +++ b/docs/reference/gdk/gdk-decl.txt @@ -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> diff --git a/docs/reference/gdk/gdk-docs.sgml b/docs/reference/gdk/gdk-docs.sgml index 8da5b43773..51d744473e 100644 --- a/docs/reference/gdk/gdk-docs.sgml +++ b/docs/reference/gdk/gdk-docs.sgml @@ -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> diff --git a/docs/reference/gdk/tmpl/gdk-unused.sgml b/docs/reference/gdk/tmpl/gdk-unused.sgml index 7b727e7c23..f455390216 100644 --- a/docs/reference/gdk/tmpl/gdk-unused.sgml +++ b/docs/reference/gdk/tmpl/gdk-unused.sgml @@ -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. diff --git a/docs/reference/gdk/tmpl/pixbufs.sgml b/docs/reference/gdk/tmpl/pixbufs.sgml index b11da1c1dd..a0a8e3e911 100644 --- a/docs/reference/gdk/tmpl/pixbufs.sgml +++ b/docs/reference/gdk/tmpl/pixbufs.sgml @@ -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> diff --git a/docs/reference/gdk/tmpl/windows.sgml b/docs/reference/gdk/tmpl/windows.sgml index 1aa9d0d86a..8a2a6032e4 100644 --- a/docs/reference/gdk/tmpl/windows.sgml +++ b/docs/reference/gdk/tmpl/windows.sgml @@ -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> |