summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2010-06-26 01:06:30 -0400
committerMatthias Clasen <mclasen@redhat.com>2010-06-26 01:09:05 -0400
commit16ecf558321030a12795cdd0b67ebbdc198d5c43 (patch)
treec3c4ff539366a54230e56861c7f0ac740ba326f5
parentd722adb76abce67984f24a98433c245d86674b5c (diff)
downloadgtk+-16ecf558321030a12795cdd0b67ebbdc198d5c43.tar.gz
Make GTK+ use an external gdk-pixbuf
-rw-r--r--INSTALL.in16
-rw-r--r--Makefile.am4
-rw-r--r--configure.ac479
-rw-r--r--contrib/Makefile.am8
-rw-r--r--contrib/gdk-pixbuf-xlib/ChangeLog354
-rw-r--r--contrib/gdk-pixbuf-xlib/Makefile.am42
-rw-r--r--contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-3.0.pc.in11
-rw-r--r--contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-drawable.c1338
-rw-r--r--contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-private.h30
-rw-r--r--contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-render.c398
-rw-r--r--contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib.c63
-rw-r--r--contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib.h87
-rw-r--r--contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlibrgb.c3724
-rw-r--r--contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlibrgb.h188
-rw-r--r--demos/Makefile.am16
-rw-r--r--demos/gtk-demo/Makefile.am5
-rw-r--r--docs/reference/Makefile.am2
-rw-r--r--docs/reference/gdk-pixbuf/Makefile.am116
-rw-r--r--docs/reference/gdk-pixbuf/apple-red-1a.pngbin29895 -> 0 bytes
-rw-r--r--docs/reference/gdk-pixbuf/apple-red-2c.pngbin19103 -> 0 bytes
-rw-r--r--docs/reference/gdk-pixbuf/composite.diabin2351 -> 0 bytes
-rw-r--r--docs/reference/gdk-pixbuf/composite.pngbin106599 -> 0 bytes
-rw-r--r--docs/reference/gdk-pixbuf/gdk-pixbuf-csource-3.0.xml177
-rw-r--r--docs/reference/gdk-pixbuf/gdk-pixbuf-from-drawables.sgml29
-rw-r--r--docs/reference/gdk-pixbuf/gdk-pixbuf-query-loaders-3.0.xml74
-rw-r--r--docs/reference/gdk-pixbuf/gdk-pixbuf-rendering.sgml32
-rw-r--r--docs/reference/gdk-pixbuf/gdk-pixbuf.sgml192
-rw-r--r--docs/reference/gdk-pixbuf/gdk-pixbuf3-sections.txt298
-rw-r--r--docs/reference/gdk-pixbuf/gdk-pixbuf3.types8
-rw-r--r--docs/reference/gdk-pixbuf/gnome-gmush-1.pngbin23814 -> 0 bytes
-rw-r--r--docs/reference/gdk-pixbuf/porting-from-imlib.sgml358
-rw-r--r--docs/reference/gdk-pixbuf/tmpl/animation.sgml183
-rw-r--r--docs/reference/gdk-pixbuf/tmpl/creating.sgml129
-rw-r--r--docs/reference/gdk-pixbuf/tmpl/file-loading.sgml109
-rw-r--r--docs/reference/gdk-pixbuf/tmpl/file-saving.sgml143
-rw-r--r--docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-loader.sgml209
-rw-r--r--docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-unused.sgml585
-rw-r--r--docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-xlib-from-drawables.sgml54
-rw-r--r--docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-xlib-init.sgml52
-rw-r--r--docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-xlib-rendering.sgml100
-rw-r--r--docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-xlib-rgb.sgml290
-rw-r--r--docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf.sgml292
-rw-r--r--docs/reference/gdk-pixbuf/tmpl/initialization_versions.sgml106
-rw-r--r--docs/reference/gdk-pixbuf/tmpl/inline.sgml137
-rw-r--r--docs/reference/gdk-pixbuf/tmpl/module_interface.sgml382
-rw-r--r--docs/reference/gdk-pixbuf/tmpl/refcounting.sgml67
-rw-r--r--docs/reference/gdk-pixbuf/tmpl/scaling.sgml246
-rw-r--r--docs/reference/gdk-pixbuf/tmpl/util.sgml87
-rw-r--r--docs/reference/gdk-pixbuf/version.xml.in1
-rw-r--r--docs/reference/gdk/Makefile.am2
-rw-r--r--docs/reference/gtk/Makefile.am4
-rw-r--r--docs/reference/gtk/building.sgml23
-rw-r--r--docs/tools/Makefile.am13
-rw-r--r--gdk-pixbuf/ChangeLog6289
-rw-r--r--gdk-pixbuf/Makefile.am748
-rwxr-xr-xgdk-pixbuf/abicheck.sh5
-rw-r--r--gdk-pixbuf/gdk-pixbuf-animation.c704
-rw-r--r--gdk-pixbuf/gdk-pixbuf-animation.h146
-rw-r--r--gdk-pixbuf/gdk-pixbuf-core.h260
-rw-r--r--gdk-pixbuf/gdk-pixbuf-csource.191
-rw-r--r--gdk-pixbuf/gdk-pixbuf-csource.c304
-rw-r--r--gdk-pixbuf/gdk-pixbuf-data.c83
-rw-r--r--gdk-pixbuf/gdk-pixbuf-enum-types.c.template38
-rw-r--r--gdk-pixbuf/gdk-pixbuf-enum-types.h.template28
-rw-r--r--gdk-pixbuf/gdk-pixbuf-features.h.in39
-rw-r--r--gdk-pixbuf/gdk-pixbuf-i18n.h32
-rw-r--r--gdk-pixbuf/gdk-pixbuf-io.c2678
-rw-r--r--gdk-pixbuf/gdk-pixbuf-io.h172
-rw-r--r--gdk-pixbuf/gdk-pixbuf-loader.c789
-rw-r--r--gdk-pixbuf/gdk-pixbuf-loader.h102
-rw-r--r--gdk-pixbuf/gdk-pixbuf-marshal.list28
-rw-r--r--gdk-pixbuf/gdk-pixbuf-private.h102
-rw-r--r--gdk-pixbuf/gdk-pixbuf-scale.c463
-rw-r--r--gdk-pixbuf/gdk-pixbuf-scaled-anim.c286
-rw-r--r--gdk-pixbuf/gdk-pixbuf-scaled-anim.h47
-rw-r--r--gdk-pixbuf/gdk-pixbuf-simple-anim.c553
-rw-r--r--gdk-pixbuf/gdk-pixbuf-simple-anim.h61
-rw-r--r--gdk-pixbuf/gdk-pixbuf-transform.h119
-rw-r--r--gdk-pixbuf/gdk-pixbuf-util.c337
-rw-r--r--gdk-pixbuf/gdk-pixbuf-xform.c104
-rw-r--r--gdk-pixbuf/gdk-pixbuf.c732
-rw-r--r--gdk-pixbuf/gdk-pixbuf.h45
-rw-r--r--gdk-pixbuf/gdk-pixbuf.symbols202
-rw-r--r--gdk-pixbuf/gdk-pixdata.c903
-rw-r--r--gdk-pixbuf/gdk-pixdata.h170
-rw-r--r--gdk-pixbuf/gdk_pixbuf.rc.in30
-rwxr-xr-xgdk-pixbuf/gen-color-table.pl74
-rw-r--r--gdk-pixbuf/io-ani-animation.c347
-rw-r--r--gdk-pixbuf/io-ani-animation.h113
-rw-r--r--gdk-pixbuf/io-ani.c720
-rw-r--r--gdk-pixbuf/io-bmp.c1429
-rw-r--r--gdk-pixbuf/io-gdip-animation.c383
-rw-r--r--gdk-pixbuf/io-gdip-animation.h117
-rw-r--r--gdk-pixbuf/io-gdip-bmp.c87
-rw-r--r--gdk-pixbuf/io-gdip-emf.c64
-rw-r--r--gdk-pixbuf/io-gdip-gif.c85
-rw-r--r--gdk-pixbuf/io-gdip-ico.c64
-rw-r--r--gdk-pixbuf/io-gdip-jpeg.c141
-rw-r--r--gdk-pixbuf/io-gdip-native.h264
-rw-r--r--gdk-pixbuf/io-gdip-png.c138
-rw-r--r--gdk-pixbuf/io-gdip-propertytags.h228
-rw-r--r--gdk-pixbuf/io-gdip-tiff.c87
-rw-r--r--gdk-pixbuf/io-gdip-utils.c1022
-rw-r--r--gdk-pixbuf/io-gdip-utils.h52
-rw-r--r--gdk-pixbuf/io-gdip-wmf.c63
-rw-r--r--gdk-pixbuf/io-gif-animation.c602
-rw-r--r--gdk-pixbuf/io-gif-animation.h175
-rw-r--r--gdk-pixbuf/io-gif.c1698
-rw-r--r--gdk-pixbuf/io-icns.c404
-rw-r--r--gdk-pixbuf/io-ico.c1254
-rw-r--r--gdk-pixbuf/io-jasper.c313
-rw-r--r--gdk-pixbuf/io-jpeg.c1315
-rw-r--r--gdk-pixbuf/io-pcx.c761
-rw-r--r--gdk-pixbuf/io-png.c1117
-rw-r--r--gdk-pixbuf/io-pnm.c1086
-rw-r--r--gdk-pixbuf/io-qtif.c608
-rw-r--r--gdk-pixbuf/io-ras.c551
-rw-r--r--gdk-pixbuf/io-tga.c1013
-rw-r--r--gdk-pixbuf/io-tiff.c875
-rw-r--r--gdk-pixbuf/io-wbmp.c380
-rw-r--r--gdk-pixbuf/io-xbm.c497
-rw-r--r--gdk-pixbuf/io-xpm.c821
-rw-r--r--gdk-pixbuf/make-inline-pixbuf.c230
-rw-r--r--gdk-pixbuf/makefile.msc197
-rwxr-xr-xgdk-pixbuf/makegdkpixbufalias.pl137
-rw-r--r--gdk-pixbuf/pixops/DETAILS355
-rw-r--r--gdk-pixbuf/pixops/Makefile.am34
-rw-r--r--gdk-pixbuf/pixops/README163
-rw-r--r--gdk-pixbuf/pixops/composite_line_22_4a4_mmx.S241
-rw-r--r--gdk-pixbuf/pixops/composite_line_color_22_4a4_mmx.S253
-rw-r--r--gdk-pixbuf/pixops/have_mmx.S76
-rw-r--r--gdk-pixbuf/pixops/makefile.msc65
-rw-r--r--gdk-pixbuf/pixops/pixbuf-transform-math.ltx112
-rw-r--r--gdk-pixbuf/pixops/pixops-internal.h25
-rw-r--r--gdk-pixbuf/pixops/pixops.c2560
-rw-r--r--gdk-pixbuf/pixops/pixops.h120
-rw-r--r--gdk-pixbuf/pixops/scale_line_22_33_mmx.S206
-rw-r--r--gdk-pixbuf/pixops/timescale.c267
-rwxr-xr-xgdk-pixbuf/pltcheck.sh17
-rw-r--r--gdk-pixbuf/queryloaders.c361
-rw-r--r--gdk-pixbuf/test-gdk-pixbuf.c241
-rw-r--r--gdk-pixbuf/xpm-color-table.h1521
-rw-r--r--gdk/Makefile.am29
-rw-r--r--gdk/gdkdraw.c41
-rw-r--r--gdk/gdkpixbuf-drawable.c31
-rw-r--r--gdk/gdkpixbuf-render.c26
-rw-r--r--gdk/x11/Makefile.am2
-rw-r--r--gtk/Makefile.am18
-rw-r--r--gtk/tests/Makefile.am2
-rw-r--r--gtk/theme-bits/Makefile.am4
-rw-r--r--modules/engines/pixbuf/Makefile.am1
-rw-r--r--modules/input/Makefile.am4
-rw-r--r--modules/other/gail/Makefile.am1
-rw-r--r--perf/Makefile.am2
-rw-r--r--po-properties/POTFILES.in24
-rw-r--r--po/POTFILES.in32
-rw-r--r--tests/Makefile.am5
157 files changed, 116 insertions, 54188 deletions
diff --git a/INSTALL.in b/INSTALL.in
index 5181298014..baf00d8fba 100644
--- a/INSTALL.in
+++ b/INSTALL.in
@@ -3,22 +3,12 @@ Prerequisites
GTK+ requires the following packages:
- - The GLib, Pango, ATK and cairo libraries, available at the same
- location as GTK+. GTK+ @GTK_VERSION@ requires at least GLib 2.23.6,
- Pango 1.20, ATK 1.29.2 and cairo 1.6.0.
+ - The GLib, Pango, GdkPixbuf, ATK and cairo libraries, available at
+ the same location as GTK+. GTK+ @GTK_VERSION@ requires at least
+ GLib 2.23.6, Pango 1.20, GdkPixbuf 2.21.0 ATK 1.29.2 and cairo 1.6.0.
- gobject-introspection 0.6.7 or newer.
- - The TIFF, PNG, and JPEG image loading libraries. You most
- likely have these installed on your system already. If not
- these libraries are available from:
-
- http://www.libtiff.org/
- http://www.libpng.org/
- http://www.ijg.org/
-
- libtiff must be version 3.6.0 or higher.
-
Simple install procedure
========================
diff --git a/Makefile.am b/Makefile.am
index 522df65b05..b5f6c145d0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,7 @@
## Makefile.am for GTK+
include $(top_srcdir)/Makefile.decl
-SRC_SUBDIRS = gdk-pixbuf gdk gtk modules demos tests perf contrib
+SRC_SUBDIRS = gdk gtk modules demos tests perf
SUBDIRS = po po-properties $(SRC_SUBDIRS) docs m4macros build
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
@@ -147,7 +147,7 @@ gdk-$(GDKTARGET)-3.0-uninstalled.pc: gdk-3.0-uninstalled.pc
cp gdk-3.0-uninstalled.pc gdk-$(GDKTARGET)-3.0-uninstalled.pc
pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = gdk-pixbuf-3.0.pc gdk-$(GDKTARGET)-3.0.pc gtk+-$(GDKTARGET)-3.0.pc gail-3.0.pc
+pkgconfig_DATA = gdk-$(GDKTARGET)-3.0.pc gtk+-$(GDKTARGET)-3.0.pc gail-3.0.pc
if OS_UNIX
pkgconfig_DATA += gtk+-unix-print-3.0.pc
diff --git a/configure.ac b/configure.ac
index 116d0eccdb..4c1a9b5cee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,6 +35,7 @@ m4_define([glib_required_version], [2.25.9])
m4_define([pango_required_version], [1.20])
m4_define([atk_required_version], [1.29.2])
m4_define([cairo_required_version], [1.6])
+m4_define([gdk_pixbuf_required_version], [2.21.0])
AC_INIT([gtk+], [gtk_version],
@@ -107,19 +108,6 @@ m4_define([gail_lt_current_minus_age],[m4_eval(gail_lt_current - gail_lt_age)])
AC_SUBST([GAIL_LT_VERSION_INFO],[gail_lt_version_info])
AC_SUBST([GAIL_LT_CURRENT_MINUS_AGE],[gail_lt_current_minus_age])
-#
-# gdk-pixbuf gets versioned separately, and for now, using standard
-# libtool versioning, not GTK+-style versioning
-#
-GDK_PIXBUF_MAJOR=gtk_major_version
-GDK_PIXBUF_MINOR=gtk_minor_version
-GDK_PIXBUF_MICRO=gtk_micro_version
-GDK_PIXBUF_VERSION="${GDK_PIXBUF_MAJOR}.${GDK_PIXBUF_MINOR}.${GDK_PIXBUF_MICRO}"
-AC_SUBST(GDK_PIXBUF_MAJOR)
-AC_SUBST(GDK_PIXBUF_MINOR)
-AC_SUBST(GDK_PIXBUF_MICRO)
-AC_SUBST(GDK_PIXBUF_VERSION)
-
# Checks for programs.
AC_PROG_CC
AC_PROG_CC_C_O
@@ -376,7 +364,8 @@ PKG_CHECK_MODULES(BASE_DEPENDENCIES,
[glib-2.0 >= glib_required_version dnl
atk >= atk_required_version dnl
pango >= pango_required_version dnl
- cairo >= cairo_required_version])
+ cairo >= cairo_required_version dnl
+ gdk-pixbuf-2.0 >= gdk_pixbuf_required_version])
## In addition to checking that cairo is present, we also need to
## check that the correct cairo backend is there. E.g. if the GDK
@@ -396,7 +385,7 @@ if test "$os_win32" != yes; then
# right now, symbols starting with _ are not exported
LIBTOOL_EXPORT_OPTIONS='-export-symbols-regex "^[[^_]].*"'
else
- # We currently use .def files on Windows (for gdk-pixbuf, gdk and gtk)
+ # We currently use .def files on Windows (for gdk and gtk)
LIBTOOL_EXPORT_OPTIONS=
fi
AC_SUBST(LIBTOOL_EXPORT_OPTIONS)
@@ -605,7 +594,7 @@ AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
# Run AM_PATH_GLIB_2_0 to make sure that GLib is installed and working
#
-GLIB_PACKAGES="gobject-2.0 gmodule-no-export-2.0"
+GLIB_PACKAGES="gobject-2.0 gio-2.0 gmodule-no-export-2.0"
AM_PATH_GLIB_2_0(glib_required_version, :,
AC_MSG_ERROR([
@@ -751,28 +740,6 @@ AC_MSG_RESULT($gtk_uxtheme_h)
AC_CHECK_HEADERS(crt_externs.h)
AC_CHECK_FUNCS(_NSGetEnviron)
-
-##################################################
-# Checks for gdk-pixbuf
-##################################################
-
-dnl ********************************************************
-dnl * See whether we need to load our modules as .la files *
-dnl ********************************************************
-
-use_la_modules=false
-case $host in
- *-aix*) use_la_modules=true
-esac
-
-if $use_la_modules ; then
- AC_DEFINE(USE_LA_MODULES, 1,
- [Whether to load modules via .la files rather than directly])
-fi
-
-
-AC_MSG_CHECKING(whether to build gmodulized gdk-pixbuf)
-
AC_ARG_ENABLE(modules,
[AC_HELP_STRING([--disable-modules],
[disable dynamic module loading])])
@@ -793,13 +760,13 @@ else
dnl Now we check to see if our libtool supports shared lib deps
dnl (in a rather ugly way even)
if $dynworks; then
- pixbuf_libtool_config="${CONFIG_SHELL-/bin/sh} ./libtool --config"
- pixbuf_deplibs_check=`$pixbuf_libtool_config | \
+ module_libtool_config="${CONFIG_SHELL-/bin/sh} ./libtool --config"
+ module_deplibs_check=`$module_libtool_config | \
grep '^[[a-z_]]*check[[a-z_]]*_method=[['\''"]]' | \
sed 's/.*[['\''"]]\(.*\)[['\''"]]$/\1/'`
- if test "x$pixbuf_deplibs_check" = "xnone" || \
- test "x$pixbuf_deplibs_check" = "xunknown" || \
- test "x$pixbuf_deplibs_check" = "x"; then
+ if test "x$module_deplibs_check" = "xnone" || \
+ test "x$module_deplibs_check" = "xunknown" || \
+ test "x$module_deplibs_check" = "x"; then
dynworks=false
fi
fi
@@ -813,299 +780,9 @@ else
fi
fi
-dnl We allow people to disable image loaders explicitely, but if they don't we error
-dnl out so that people don't accidentally build without them.
-
-AC_ARG_WITH(libpng,
- [AC_HELP_STRING([--without-libpng],
- [disable PNG loader for gdk-pixbuf])])
-AC_ARG_WITH(libjpeg,
- [AC_HELP_STRING([--without-libjpeg],
- [disable JPEG loader for gdk-pixbuf])])
-AC_ARG_WITH(libtiff,
- [AC_HELP_STRING([--without-libtiff],
- [disable TIFF loader for gdk-pixbuf])])
-AC_ARG_WITH(libjasper,
- [AC_HELP_STRING([--with-libjasper],
- [enable JPEG2000 loader for gdk-pixbuf])])
-
-AC_ARG_ENABLE(gdiplus,
- [AC_HELP_STRING([--enable-gdiplus],
- [enble GDI+ loaders for gdk-pixbuf (currently known to be broken)])],,
- [enable_gdiplus=no])
-
-AM_CONDITIONAL(BUILD_GDIPLUS_LOADERS, [ test x$os_win32 = xyes && test x$enable_gdiplus != xno ])
-
-dnl Test for libtiff
-if test x$os_win32 = xno || test x$enable_gdiplus = xno; then
- if test x$with_libtiff != xno && test -z "$LIBTIFF"; then
- AC_CHECK_LIB(tiff, TIFFReadRGBAImageOriented,
- [AC_CHECK_HEADER(tiffio.h,
- TIFF='tiff'; LIBTIFF='-ltiff',
- AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
- [AC_CHECK_LIB(tiff, TIFFWriteScanline,
- [AC_CHECK_HEADER(tiffio.h,
- TIFF='tiff'; LIBTIFF='-ltiff -ljpeg -lz',
- AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
- [AC_CHECK_LIB(tiff34, TIFFFlushData,
- [AC_CHECK_HEADER(tiffio.h,
- TIFF='tiff'; LIBTIFF='-ltiff34 -ljpeg -lz',
- AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
- AC_MSG_WARN(*** TIFF loader will not be built (TIFF library not found) ***), -ljpeg -lz -lm)], -ljpeg -lz -lm)], -lm)
- fi
-
- if test x$with_libtiff != xno && test -z "$LIBTIFF"; then
- AC_MSG_ERROR([
-*** Checks for TIFF loader failed. You can build without it by passing
-*** --without-libtiff to configure but some programs using GTK+ may
-*** not work properly])
- fi
-fi
-
-dnl Test for libjpeg
-if test x$os_win32 = xno || test x$enable_gdiplus = xno; then
- if test x$with_libjpeg != xno && test -z "$LIBJPEG"; then
- AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
- jpeg_ok=yes,
- jpeg_ok=no
- AC_MSG_WARN(*** JPEG loader will not be built (JPEG library not found) ***))
- if test "$jpeg_ok" = yes; then
- AC_MSG_CHECKING([for jpeglib.h])
- AC_TRY_CPP(
-[#include <stdio.h>
-#undef PACKAGE
-#undef VERSION
-#undef HAVE_STDLIB_H
-#include <jpeglib.h>],
- jpeg_ok=yes,
- jpeg_ok=no)
- AC_MSG_RESULT($jpeg_ok)
- if test "$jpeg_ok" = yes; then
- LIBJPEG='-ljpeg'
- AC_CHECK_LIB(jpeg, jpeg_simple_progression,
- AC_DEFINE(HAVE_PROGRESSIVE_JPEG, 1,
- [Define to 1 is libjpeg supports progressive JPEG]),
- AC_MSG_WARN(JPEG library does not support progressive saving.))
- else
- AC_MSG_WARN(*** JPEG loader will not be built (JPEG header file not found) ***)
- fi
- fi
- fi
-
- if test x$with_libjpeg != xno && test -z "$LIBJPEG"; then
- AC_MSG_ERROR([
-*** Checks for JPEG loader failed. You can build without it by passing
-*** --without-libjpeg to configure but some programs using GTK+ may
-*** not work properly])
- fi
-fi
-
-dnl Test for libpng
- if test x$with_libpng != xno && test -z "$LIBPNG"; then
- AC_MSG_CHECKING(for libpng12)
- if $PKG_CONFIG --exists libpng12 ; then
- AC_MSG_RESULT(yes)
- PNG='png'
- PNG_DEP_CFLAGS_PACKAGES=libpng12
- LIBPNG=`$PKG_CONFIG --libs libpng12`
- else
- AC_MSG_RESULT(no)
- AC_CHECK_LIB(png, png_read_info,
- [AC_CHECK_HEADER(png.h,
- png_ok=yes,
- png_ok=no)],
- AC_MSG_WARN(*** PNG loader will not be built (PNG library not found) ***), -lz -lm)
- if test "$png_ok" = yes; then
- AC_MSG_CHECKING([for png_structp in png.h])
- AC_TRY_COMPILE([#include <png.h>],
- [png_structp pp; png_infop info; png_colorp cmap; png_create_read_struct;],
- png_ok=yes,
- png_ok=no)
- AC_MSG_RESULT($png_ok)
- if test "$png_ok" = yes; then
- PNG='png'; LIBPNG='-lpng -lz'
- else
- AC_MSG_WARN(*** PNG loader will not be built (PNG library is too old) ***)
- fi
- else
- AC_MSG_WARN(*** PNG loader will not be built (PNG header file not found) ***)
- fi
- fi
- fi
-
- if test x$with_libpng != xno && test -z "$LIBPNG"; then
- AC_MSG_ERROR([
-*** Checks for PNG loader failed. You can build without it by passing
-*** --without-libpng to configure but many programs using GTK+ will
-*** not work properly. The PNG loader is also needed if you are compiling
-*** from CVS.])
- fi
-
-dnl Test for libjasper
- if test x$with_libjasper = xyes && test -z "$LIBJASPER"; then
- AC_CHECK_LIB(jasper, jas_init, LIBJASPER=-ljasper, [], -ljpeg -lm)
- fi
-
- if test x$with_libjasper = xyes && test -z "$LIBJASPER"; then
- AC_MSG_ERROR([
-*** Checks for JPEG2000 loader failed. You can build without it by passing
-*** --without-libjasper to configure])
- fi
-
-AC_SUBST(LIBTIFF)
-AC_SUBST(LIBJPEG)
-AC_SUBST(LIBPNG)
-AC_SUBST(LIBJASPER)
-
AM_CONDITIONAL(BUILD_DYNAMIC_MODULES, $dynworks)
#
-# Allow building some or all gdk-pixbuf loaders included
-#
-AC_MSG_CHECKING(pixbuf loaders to build)
-
-dnl due to an autoconf bug, commas in the first arg to
-dnl AC_HELP_STRING cause problems.
-dnl AC_HELP_STRING([--with-included-loaders=LOADER1 LOADER2 ...],
-dnl [build the specified loaders into gdk-pixbuf])
-AC_ARG_WITH(included_loaders,
-[ --with-included-loaders=LOADER1,LOADER2,...
- build the specified loaders into gdk-pixbuf])
-
-if $dynworks; then
- :
-else
- ## if the option was specified, leave it; otherwise disable included loaders
- if test x$with_included_loaders = xno; then
- with_included_loaders=yes
- fi
-fi
-
-# Use the traditional png loader instead of the GDI+ one on Windows,
-# because some important apps like GIMP need to read and write
-# arbitrary tEXt chunks which doesn't seem to be possible through GDI+
-
-all_loaders="ani,icns,pcx,ras,tga,png,pnm,wbmp,xbm,xpm,qtif"
-if test x$with_libjasper != xno; then
- all_loaders="$all_loaders,jasper"
-fi
-if test x$os_win32 = xyes && test x$enable_gdiplus != xno; then
- # Skip PNG, see comment above
- gdip_formats="bmp emf gif ico jpeg tiff wmf"
- for f in $gdip_formats; do
- all_loaders="$all_loaders,gdip-$f"
- done
-else
- all_loaders="$all_loaders,bmp,gif,ico,jpeg,tiff"
-fi
-included_loaders=""
-# If no loaders specified, include all
-if test "x$with_included_loaders" = xyes ; then
- included_loaders="$all_loaders"
-else
- included_loaders="$with_included_loaders"
-fi
-
-AC_MSG_RESULT($included_loaders)
-
-INCLUDED_LOADER_OBJ=
-INCLUDED_LOADER_DEFINE=
-
-IFS="${IFS= }"; gtk_save_ifs="$IFS"; IFS=","
-for loader in $included_loaders; do
- if echo "$all_loaders" | egrep "(^|,)$loader(\$|,)" > /dev/null; then
- :
- else
- AC_MSG_ERROR([the specified loader $loader does not exist])
- fi
-
- loader_underscores=`echo $loader | sed -e 's/-/_/g'`
- INCLUDED_LOADER_OBJ="$INCLUDED_LOADER_OBJ libstatic-pixbufloader-$loader.la"
-
- # Don't bother defining separate -DINCLUDE_gdip_foo for each gdip-foo loader
- case $loader in
- gdip-*) ;;
- *) INCLUDED_LOADER_DEFINE="$INCLUDED_LOADER_DEFINE -DINCLUDE_$loader_underscores";;
- esac
- eval INCLUDE_$loader_underscores=yes
-done
-
-# Just define one -DINCLUDE_gdiplus for all the gdip-foo loaders
-# (except gdip-png, which isn't built at all)
-if test x"$INCLUDE_gdip_ico" = xyes; then
- INCLUDED_LOADER_DEFINE="$INCLUDED_LOADER_DEFINE -DINCLUDE_gdiplus"
-fi
-
-IFS="$gtk_save_ifs"
-AC_SUBST(INCLUDED_LOADER_OBJ)
-AC_SUBST(INCLUDED_LOADER_DEFINE)
-
-AM_CONDITIONAL(INCLUDE_PNG, [test x"$INCLUDE_png" = xyes])
-AM_CONDITIONAL(INCLUDE_BMP, [test x"$INCLUDE_bmp" = xyes])
-AM_CONDITIONAL(INCLUDE_WBMP, [test x"$INCLUDE_wbmp" = xyes])
-AM_CONDITIONAL(INCLUDE_GIF, [test x"$INCLUDE_gif" = xyes])
-AM_CONDITIONAL(INCLUDE_ICO, [test x"$INCLUDE_ico" = xyes])
-AM_CONDITIONAL(INCLUDE_ANI, [test x"$INCLUDE_ani" = xyes])
-AM_CONDITIONAL(INCLUDE_JPEG, [test x"$INCLUDE_jpeg" = xyes])
-AM_CONDITIONAL(INCLUDE_PNM, [test x"$INCLUDE_pnm" = xyes])
-AM_CONDITIONAL(INCLUDE_RAS, [test x"$INCLUDE_ras" = xyes])
-AM_CONDITIONAL(INCLUDE_TIFF, [test x"$INCLUDE_tiff" = xyes])
-AM_CONDITIONAL(INCLUDE_XPM, [test x"$INCLUDE_xpm" = xyes])
-AM_CONDITIONAL(INCLUDE_XBM, [test x"$INCLUDE_xbm" = xyes])
-AM_CONDITIONAL(INCLUDE_TGA, [test x"$INCLUDE_tga" = xyes])
-AM_CONDITIONAL(INCLUDE_PCX, [test x"$INCLUDE_pcx" = xyes])
-AM_CONDITIONAL(INCLUDE_ICNS, [test x"$INCLUDE_icns" = xyes])
-AM_CONDITIONAL(INCLUDE_JASPER, [test x"$INCLUDE_jasper" = xyes])
-AM_CONDITIONAL(INCLUDE_QTIF, [test x"$INCLUDE_qtif" = xyes])
-# As all GDI+ loaders are either built-in or not, arbitrarily just
-# check one of the variables here
-AM_CONDITIONAL(INCLUDE_GDIPLUS, [test x"$INCLUDE_gdip_ico" = xyes])
-
-if test x$gio_can_sniff = x; then
- AC_MSG_CHECKING([if gio can sniff png])
- gtk_save_LIBS="$LIBS"
- gtk_save_CFLAGS="$CFLAGS"
- LIBS="`$PKG_CONFIG --libs gio-2.0`"
- CFLAGS="`$PKG_CONFIG --cflags gio-2.0`"
- AC_RUN_IFELSE([AC_LANG_SOURCE([[
- #include <gio/gio.h>
- static const gsize data_size = 159;
- static const guint8 data[] =
- {
- 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d,
- 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
- 0x08, 0x02, 0x00, 0x00, 0x00, 0x90, 0x77, 0x53, 0xde, 0x00, 0x00, 0x00,
- 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, 0x1c, 0xe9, 0x00, 0x00,
- 0x00, 0x09, 0x70, 0x48, 0x59, 0x73, 0x00, 0x00, 0x0b, 0x13, 0x00, 0x00,
- 0x0b, 0x13, 0x01, 0x00, 0x9a, 0x9c, 0x18, 0x00, 0x00, 0x00, 0x07, 0x74,
- 0x49, 0x4d, 0x45, 0x07, 0xd8, 0x07, 0x0f, 0x10, 0x08, 0x15, 0x61, 0xd8,
- 0x35, 0x37, 0x00, 0x00, 0x00, 0x19, 0x74, 0x45, 0x58, 0x74, 0x43, 0x6f,
- 0x6d, 0x6d, 0x65, 0x6e, 0x74, 0x00, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65,
- 0x64, 0x20, 0x77, 0x69, 0x74, 0x68, 0x20, 0x47, 0x49, 0x4d, 0x50, 0x57,
- 0x81, 0x0e, 0x17, 0x00, 0x00, 0x00, 0x0c, 0x49, 0x44, 0x41, 0x54, 0x08,
- 0xd7, 0x63, 0xf8, 0xff, 0xff, 0x3f, 0x00, 0x05, 0xfe, 0x02, 0xfe, 0xdc,
- 0xcc, 0x59, 0xe7, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae,
- 0x42, 0x60, 0x82
- };
- int
- main (int argc, char **argv)
- {
- char *content_type;
- char *image_png;
- g_type_init ();
- content_type = g_content_type_guess (NULL, data, data_size, NULL);
- image_png = g_content_type_from_mime_type ("image/png");
- return !!g_strcmp0 (content_type, image_png);
- }]])],
- [gio_can_sniff=yes
- AC_DEFINE(GDK_PIXBUF_USE_GIO_MIME, 1, [Define if gio can sniff image data])],
- [gio_can_sniff=no])
- AC_MSG_RESULT($gio_can_sniff)
- LIBS="$gtk_save_LIBS"
- CFLAGS="$gtk_save_CFLAGS"
-fi
-
-#
# Allow building some or all immodules included
#
AC_MSG_CHECKING(immodules to build)
@@ -1184,29 +861,6 @@ AC_HEADER_SYS_WAIT
AC_TYPE_SIGNAL
-AM_CONDITIONAL(HAVE_TIFF, test "x$LIBTIFF" != x)
-AM_CONDITIONAL(HAVE_PNG, test "x$LIBPNG" != x)
-AM_CONDITIONAL(HAVE_JPEG, test "x$LIBJPEG" != x)
-AM_CONDITIONAL(HAVE_JASPER, test "x$LIBJASPER" != x)
-
-if $dynworks ; then
- STATIC_LIB_DEPS=
- if echo "$included_loaders" | egrep '(^|,)tiff($|,)' > /dev/null; then
- STATIC_LIB_DEPS="$STATIC_LIB_DEPS $LIBTIFF"
- fi
- if echo "$included_loaders" | egrep '(^|,)jpeg($|,)' > /dev/null; then
- STATIC_LIB_DEPS="$STATIC_LIB_DEPS $LIBJPEG"
- fi
- if echo "$included_loaders" | egrep '(^|,)png($|,)' > /dev/null; then
- STATIC_LIB_DEPS="$STATIC_LIB_DEPS $LIBPNG"
- fi
- if echo "$included_loaders" | egrep '(^|,)jasper($|,)' > /dev/null; then
- STATIC_LIB_DEPS="$STATIC_LIB_DEPS $LIBJASPER"
- fi
-else
- STATIC_LIB_DEPS="$LIBTIFF $LIBJPEG $LIBPNG $LIBJASPER"
-fi
-
# Checks to see whether we should include mediaLib
# support.
#
@@ -1239,64 +893,19 @@ fi
AM_CONDITIONAL(USE_MEDIALIB, test $use_mlib = yes)
AM_CONDITIONAL(USE_MEDIALIB25, test $use_mlib25 = yes)
-# 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.)
-#
-# This code is partially taken from Mesa
-#
-AC_MSG_CHECKING(for x86 platform)
-case $host_cpu in
- i386|i486|i586|i686|i786|k6|k7)
- use_x86_asm=yes
- ;;
- *)
- use_x86_asm=no
-esac
-AC_MSG_RESULT($use_x86_asm)
-
-use_mmx_asm=no
-if test $use_x86_asm = yes; then
- save_ac_ext=$ac_ext
- ac_ext=S
-
- AC_MSG_CHECKING(compiler support for MMX)
- cp $srcdir/gdk-pixbuf/pixops/scale_line_22_33_mmx.S conftest.S
- if AC_TRY_EVAL(ac_compile); then
- use_mmx_asm=yes
- fi
-
- rm -rf conftest*
-
- ac_ext=$save_ac_ext
- if test $use_mmx_asm = yes; then
- AC_DEFINE(USE_MMX, 1,
- [Define to 1 if XXM is available and should be used])
- AC_MSG_RESULT(yes)
- else
- AC_MSG_RESULT(no)
- fi
-fi
-
-AM_CONDITIONAL(USE_MMX, test x$use_mmx_asm = xyes)
-
-REBUILD_PNGS=
-if test -z "$LIBPNG" && test x"$os_win32" = xno -o x$enable_gdiplus = xno; then
- REBUILD_PNGS=#
-fi
-
dnl Look for a host system's gdk-pixbuf-csource if we are cross-compiling
AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
if test $cross_compiling = yes; then
- AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no)
AC_PATH_PROG(GTK_UPDATE_ICON_CACHE, gtk-update-icon-cache, no)
if test x$GTK_UPDATE_ICON_CACHE = xno; then
REBUILD_PNGS=#
fi
fi
+AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no)
+
if test ! -f $srcdir/gtk/gtkbuiltincache.h &&
test "x$REBUILD_PNGS" = "x#" ; then
AC_MSG_ERROR([
@@ -1305,22 +914,10 @@ if test ! -f $srcdir/gtk/gtkbuiltincache.h &&
*** don't have a prebuilt gtk-update-icon-cache on the build system.])
fi
-AC_SUBST(REBUILD_PNGS)
-
-GDK_PIXBUF_PACKAGES="gmodule-no-export-2.0 gobject-2.0 gio-2.0"
-GDK_PIXBUF_EXTRA_LIBS="$STATIC_LIB_DEPS $MATH_LIB $MEDIA_LIB"
-GDK_PIXBUF_EXTRA_CFLAGS=
-GDK_PIXBUF_DEP_LIBS="`$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES` $GDK_PIXBUF_EXTRA_LIBS"
-GDK_PIXBUF_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PIXBUF_PACKAGES $PNG_DEP_CFLAGS_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS"
-
########################################
# Windowing system checks
########################################
-GDK_PIXBUF_XLIB_PACKAGES=
-GDK_PIXBUF_XLIB_EXTRA_CFLAGS=
-GDK_PIXBUF_XLIB_EXTRA_LIBS=
-
GDK_EXTRA_LIBS="$GDK_WLIBS"
GDK_EXTRA_CFLAGS=
@@ -1359,7 +956,6 @@ if test "x$gdktarget" = "xx11"; then
esac
done
- GDK_PIXBUF_XLIB_PACKAGES="x11"
GTK_PACKAGES_FOR_X="x11"
else
have_base_x_pc=false
@@ -1371,8 +967,6 @@ if test "x$gdktarget" = "xx11"; then
x_cflags="$X_CFLAGS"
x_libs_for_checks="$X_LIBS -lXext -lXrender -lX11 $X_EXTRA_LIBS"
- GDK_PIXBUF_XLIB_EXTRA_CFLAGS="$x_cflags"
- GDK_PIXBUF_XLIB_EXTRA_LIBS="$X_LIBS -lX11 $X_EXTRA_LIBS"
GTK_DEP_LIBS_FOR_X="$X_LIBS -lXrender -lX11 $X_EXTRA_LIBS"
fi
@@ -1654,15 +1248,6 @@ else
AM_CONDITIONAL(USE_QUARTZ, false)
fi
-GDK_PIXBUF_XLIB_DEP_LIBS="`$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $GDK_PIXBUF_XLIB_PACKAGES` $GDK_PIXBUF_XLIB_EXTRA_LIBS $GDK_PIXBUF_EXTRA_LIBS"
-GDK_PIXBUF_XLIB_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PIXBUF_PACKAGES $GDK_PIXBUF_XLIB_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS $GDK_PIXBUF_XLIB_EXTRA_CFLAGS"
-
-AC_SUBST(GDK_PIXBUF_XLIB_PACKAGES)
-AC_SUBST(GDK_PIXBUF_XLIB_EXTRA_LIBS)
-AC_SUBST(GDK_PIXBUF_XLIB_EXTRA_CFLAGS)
-AC_SUBST(GDK_PIXBUF_XLIB_DEP_LIBS)
-AC_SUBST(GDK_PIXBUF_XLIB_DEP_CFLAGS)
-
if test "x$gdktarget" = "xdirectfb"; then
DIRECTFB_REQUIRED_VERSION=1.0.0
AC_MSG_CHECKING(for DirectFB)
@@ -1713,13 +1298,13 @@ LDFLAGS="$saved_ldflags"
# Pull in gio-unix for GDesktopAppInfo usage, see at least gdkapplaunchcontext-x11.c
if test "x$gdktarget" = "xx11"; then
- GDK_PACKAGES="$PANGO_PACKAGES gio-unix-2.0 $X_PACKAGES cairo-$cairo_backend"
+ GDK_PACKAGES="$PANGO_PACKAGES gio-unix-2.0 $X_PACKAGES gdk-pixbuf-2.0 cairo-$cairo_backend"
else
- GDK_PACKAGES="$PANGO_PACKAGES $X_PACKAGES cairo-$cairo_backend"
+ GDK_PACKAGES="$PANGO_PACKAGES $X_PACKAGES gdk-pixbuf-2.0 cairo-$cairo_backend"
fi
-GDK_DEP_LIBS="$GDK_EXTRA_LIBS `$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $GDK_PACKAGES` $GDK_PIXBUF_EXTRA_LIBS"
-GDK_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PIXBUF_PACKAGES $GDK_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS $GDK_EXTRA_CFLAGS"
+GDK_DEP_LIBS="$GDK_EXTRA_LIBS `$PKG_CONFIG --libs $GDK_PACKAGES`"
+GDK_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PACKAGES` $GDK_EXTRA_CFLAGS"
#
# If we aren't writing explicit dependencies, then don't put the extra libraries we need
# into the pkg-config files
@@ -1765,14 +1350,14 @@ else
LIBS="$gtk_save_LIBS"
fi
-GTK_PACKAGES="atk cairo gio-2.0"
+GTK_PACKAGES="atk cairo gdk-pixbuf-2.0 gio-2.0"
if test "x$gdktarget" = "xx11"; then
GTK_PACKAGES="$GTK_PACKAGES pangoft2"
fi
GTK_EXTRA_LIBS=
GTK_EXTRA_CFLAGS=
-GTK_DEP_LIBS="$GDK_EXTRA_LIBS $GTK_DEP_LIBS_FOR_X `$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $PANGO_PACKAGES $GTK_PACKAGES_FOR_X $GTK_PACKAGES` $GTK_EXTRA_LIBS $GDK_PIXBUF_EXTRA_LIBS"
-GTK_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PIXBUF_PACKAGES $GDK_PACKAGES $GTK_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS $GDK_EXTRA_CFLAGS $GTK_EXTRA_CFLAGS"
+GTK_DEP_LIBS="$GDK_EXTRA_LIBS $GTK_DEP_LIBS_FOR_X `$PKG_CONFIG --libs $PANGO_PACKAGES $GTK_PACKAGES_FOR_X $GTK_PACKAGES` $GTK_EXTRA_LIBS"
+GTK_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PACKAGES $GTK_PACKAGES` $GDK_EXTRA_CFLAGS $GTK_EXTRA_CFLAGS"
if test x"$os_win32" = xyes; then
GTK_EXTRA_CFLAGS="$msnative_struct"
@@ -1783,16 +1368,6 @@ ATK_PREFIX="`$PKG_CONFIG --variable=prefix atk`"
PANGO_PREFIX="`$PKG_CONFIG --variable=prefix pango`"
CAIRO_PREFIX="`$PKG_CONFIG --variable=prefix cairo`"
-if test $enable_explicit_deps != yes ; then
- GDK_PIXBUF_EXTRA_LIBS=
-fi
-
-AC_SUBST(GDK_PIXBUF_PACKAGES)
-AC_SUBST(GDK_PIXBUF_EXTRA_LIBS)
-AC_SUBST(GDK_PIXBUF_EXTRA_CFLAGS)
-AC_SUBST(GDK_PIXBUF_DEP_LIBS)
-AC_SUBST(GDK_PIXBUF_DEP_CFLAGS)
-
AC_SUBST(GTK_PACKAGES)
AC_SUBST(GTK_EXTRA_LIBS)
AC_SUBST(GTK_EXTRA_CFLAGS)
@@ -1807,6 +1382,9 @@ AC_SUBST(CAIRO_PREFIX)
AC_SUBST(GTK_DEBUG_FLAGS)
AC_SUBST(GTK_XIM_FLAGS)
+GDK_PIXBUF_LIBS=`$PKG_CONFIG --libs gdk-pixbuf-2.0`
+AC_SUBST(GDK_PIXBUF_LIBS)
+
########################
# Checks needed for gail
########################
@@ -1968,8 +1546,6 @@ AM_CONDITIONAL(TEST_PRINT_BACKEND, test "x$enable_test_print_backend" != "xno")
export SED
export_dynamic=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
if test -n "$export_dynamic"; then
- GDK_PIXBUF_DEP_LIBS=`echo $GDK_PIXBUF_DEP_LIBS | sed -e "s/$export_dynamic//"`
- GDK_PIXBUF_XLIB_DEP_LIBS=`echo $GDK_PIXBUF_XLIB_DEP_LIBS | sed -e "s/$export_dynamic//"`
GDK_DEP_LIBS=`echo $GDK_DEP_LIBS | sed -e "s/$export_dynamic//"`
GTK_DEP_LIBS=`echo $GTK_DEP_LIBS | sed -e "s/$export_dynamic//"`
fi
@@ -2101,12 +1677,10 @@ AC_CONFIG_FILES([
config.h.win32
gtk-zip.sh
Makefile
-gdk-pixbuf-3.0.pc
gdk-3.0.pc
gtk+-3.0.pc
gtk+-unix-print-3.0.pc
gail-3.0.pc
-gdk-pixbuf-3.0-uninstalled.pc
gdk-3.0-uninstalled.pc
gtk+-3.0-uninstalled.pc
gail-3.0-uninstalled.pc
@@ -2119,8 +1693,6 @@ demos/gtk-demo/geninclude.pl
tests/Makefile
docs/Makefile
docs/reference/Makefile
-docs/reference/gdk-pixbuf/Makefile
-docs/reference/gdk-pixbuf/version.xml
docs/reference/gdk/Makefile
docs/reference/gdk/version.xml
docs/reference/gtk/Makefile
@@ -2132,10 +1704,6 @@ docs/tutorial/Makefile
build/Makefile
build/win32/Makefile
build/win32/vs9/Makefile
-gdk-pixbuf/Makefile
-gdk-pixbuf/gdk_pixbuf.rc
-gdk-pixbuf/gdk-pixbuf-features.h
-gdk-pixbuf/pixops/Makefile
gdk/Makefile
gdk/x11/Makefile
gdk/win32/Makefile
@@ -2168,9 +1736,6 @@ modules/printbackends/file/Makefile
modules/printbackends/papi/Makefile
modules/printbackends/test/Makefile
perf/Makefile
-contrib/Makefile
-contrib/gdk-pixbuf-xlib/Makefile
-contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-3.0.pc
])
AC_OUTPUT
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
deleted file mode 100644
index feb4bdbf82..0000000000
--- a/contrib/Makefile.am
+++ /dev/null
@@ -1,8 +0,0 @@
-include $(top_srcdir)/Makefile.decl
-
-SUBDIRS =
-if USE_X11
-SUBDIRS += gdk-pixbuf-xlib
-endif
-
--include $(top_srcdir)/git.mk
diff --git a/contrib/gdk-pixbuf-xlib/ChangeLog b/contrib/gdk-pixbuf-xlib/ChangeLog
deleted file mode 100644
index 58ae652f63..0000000000
--- a/contrib/gdk-pixbuf-xlib/ChangeLog
+++ /dev/null
@@ -1,354 +0,0 @@
-=== ChangeLog discontinued ===
-
- With the move to git, GTK+ is switching from a ChangeLog file
- to relying on commit messages to provide change history. Please
- see README.commits for guidance on the expected message format.
-
-2009-03-13 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.16.0 ===
-
-2009-03-02 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.15.5 ===
-
-2009-02-17 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.15.4 ===
-
-2009-02-02 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.15.3 ===
-
-2009-01-27 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.15.2 ===
-
-2009-01-23 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.15.1 ===
-
-2009-01-01 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.15.0 ===
-
-2008-09-17 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.14.2 ===
-
-2008-09-04 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.14.1 ===
-
-2008-09-04 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.14.0 ===
-
-2008-08-18 Matthias Clasen <mclasen@redhat.com>
-
- * ==== Released 2.13.7 ===
-
-2008-08-05 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.13.6 ===
-
-2008-07-21 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.13.5 ===
-
-2008-07-05 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.13.4 ===
-
-2008-06-13 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.13.3 ===
-
-2008-06-03 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.13.2 ===
-
-2008-05-29 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.13.1 ===
-
-2008-05-26 Michael Natterer <mitch@imendio.com>
-
- * gdk-pixbuf-xlib.h
- * gdk-pixbuf-xlibrgb.h: use G_BEGIN/END_DECLS.
-
-2008-02-16 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.13.0 ===
-
-2007-10-16 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.12.1 ===
-
-2007-09-13 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.12.0 ===
-
-2007-07-21 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.11.6 ===
-
-2007-07-02 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.11.5 ===
-
-2007-06-19 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.11.4 ===
-
-2007-06-15 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.11.3 ===
-
-2007-06-06 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.11.2 ===
-
-2007-06-04 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.11.1 ===
-
-2007-05-24 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.11.0 ===
-
-2006-10-08 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-xlib.c: Apply a cleanup patch by
- Kjartan Maraas (#341812)
-
-2006-08-17 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.10.2 ===
-
-2006-07-23 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.10.1 ===
-
-2006-07-02 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.10.0 ===
-
-2006-06-21 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.9.4 ===
-
-2006-06-12 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.9.3 ===
-
-2006-06-05 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.9.2 ===
-
-2006-05-16 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.9.1 ====
-
-2006-05-04 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.9.0 ===
-
-2005-11-17 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-xlib-drawable.c:
- * gdk-pixbuf-xlibrgb.c: const correctness fixes
- found by Arjan van de Ven and gcc.
-
-2005-10-05 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-xlib-2.0.pc.in (Requires): Require
- gmodule-no-export-2.0 instead of gmodule-2.0
-
-2005-08-24 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.8.2 ===
-
- * === Released 2.8.1 ===
-
-2005-08-13 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.8.0 ===
-
-2005-08-02 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.7.5 ===
-
-2005-07-22 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.7.4 ===
-
-2005-07-15 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.7.3 ===
-
-2005-07-08 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.7.2 ===
-
-2005-07-01 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.7.1 ===
-
-2005-06-20 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.7.0 ===
-
-2005-01-08 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.6.1 ===
-
-2004-12-16 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.6.0 ===
-
-2004-12-02 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.5.6 ===
-
-2004-11-12 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.5.5 ===
-
-2004-10-27 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.5.4 ===
-
-2004-09-19 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.5.3 ===
-
-2004-08-25 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.5.2 ===
-
-2004-08-01 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.5.1 ===
-
-Tue Jul 20 23:26:10 2004 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-xlibrgb.c: Include config.h first. (#148034)
-
-Sun Jul 18 20:17:41 2004 Soeren Sandmann <sandmann@daimi.au.dk>
-
- * === released 2.5.0 ==
-
-Tue Mar 9 09:33:54 2004 Owen Taylor <otaylor@redhat.com>
-
- * === Released 2.3.6 ===
-
-Wed Mar 3 15:50:28 2004 Owen Taylor <otaylor@redhat.com>
-
- * Makefile.am (libgdk_pixbuf_xlib_2_0_la_LIBADD): Add
- a shared library dependency on libgdk-pixbuf (#124687)
-
-Tue Feb 24 14:45:03 2004 Owen Taylor <otaylor@redhat.com>
-
- * === Released 2.3.3 ===
-
-Fri Feb 13 10:32:09 2004 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixbuf-xlibrgb.h: Remove a couple of unneeded
- #includes. Isn't unsupported code fun?
- (133833, Gregory Merchan)
-
-Tue Oct 7 23:30:00 2003 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-xlib.h: Add C++ guards. (123955, Harring Figueiredo)
-
-2002-08-06 jacob berkman <jacob@ximian.com>
-
- * Makefile.am (lib_LTLIBRARIES): link against xlibs
-
-2002-01-25 Federico Mena Quintero <federico@ximian.com>
-
- Merge from gdk-pixbuf stable.
-
- * gdk-pixbuf-xlib-drawable.c (rgb565msb): Fixed the endianness
- conversion --- swap the individual 16 bit values instead of taking
- everying as a 32 bit value.
- (rgb565lsb): Likewise.
- (rgb555lsb): Likewise.
- (rgb555msb): Likewise.
-
-2001-11-26 Akira TAGOH <tagoh@redhat.com>
-
- * Makefile.am (libgdk_pixbuf_xlib_1_3_la_LDFLAGS):
- Added -version-info.
-
-2001-05-19 Havoc Pennington <hp@pobox.com>
-
- * gdk-pixbuf-xlibrgb.c: docs
-
-2001-06-04 Havoc Pennington <hp@redhat.com>
-
- * gdk-pixbuf-xlibrgb.c (xlib_rgb_init): remove C++ comment,
- reported by Dan McNichol
-
-Mon Jan 8 11:41:41 2001 Owen Taylor <otaylor@redhat.com>
-
- * Makefile.am (INCLUDES): Add @x_cflags@ (#36310)
-
-2001-01-02 Havoc Pennington <hp@redhat.com>
-
- * gdk-pixbuf-xlib-2.0.pc.in (Description): fix up description a bit.
-
-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
diff --git a/contrib/gdk-pixbuf-xlib/Makefile.am b/contrib/gdk-pixbuf-xlib/Makefile.am
deleted file mode 100644
index 9ddcefa7df..0000000000
--- a/contrib/gdk-pixbuf-xlib/Makefile.am
+++ /dev/null
@@ -1,42 +0,0 @@
-include $(top_srcdir)/Makefile.decl
-
-if PLATFORM_WIN32
-no_undefined = -no-undefined
-endif
-
-lib_LTLIBRARIES=libgdk_pixbuf_xlib-3.0.la
-
-INCLUDES = \
- -I$(top_srcdir) -I$(top_builddir) \
- -I$(top_srcdir)/gdk-pixbuf \
- -I$(top_srcdir)/contrib \
- $(GDK_PIXBUF_XLIB_DEP_CFLAGS)
-
-libgdk_pixbuf_xlib_3_0_la_LDFLAGS = \
- -export-dynamic \
- $(no_undefined) \
- -version-info $(LT_VERSION_INFO)
-
-libgdk_pixbuf_xlib_3_0_la_LIBADD = \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
- $(GDK_PIXBUF_XLIB_DEP_LIBS)
-
-libgdk_pixbuf_xlib_3_0_la_SOURCES = \
- gdk-pixbuf-xlib-private.h \
- gdk-pixbuf-xlib.c \
- gdk-pixbuf-xlib-render.c \
- gdk-pixbuf-xlib-drawable.c \
- gdk-pixbuf-xlibrgb.c
-
-libgdk_pixbuf_xlibincludedir=$(includedir)/gtk-3.0/gdk-pixbuf-xlib
-
-libgdk_pixbuf_xlibinclude_HEADERS = \
- gdk-pixbuf-xlib.h \
- gdk-pixbuf-xlibrgb.h
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = gdk-pixbuf-xlib-3.0.pc
-
-EXTRA_DIST += gdk-pixbuf-xlib-3.0.pc.in
-
--include $(top_srcdir)/git.mk
diff --git a/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-3.0.pc.in b/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-3.0.pc.in
deleted file mode 100644
index b55d8562b5..0000000000
--- a/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-3.0.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: GdkPixbuf Xlib
-Description: GdkPixbuf rendering for Xlib
-Version: @VERSION@
-Requires: gobject-2.0,gmodule-no-export-2.0,gdk-pixbuf-3.0
-Libs: -L${libdir} -lgdk_pixbuf_xlib-@GTK_API_VERSION@
-Cflags: -I${includedir}
diff --git a/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-drawable.c b/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-drawable.c
deleted file mode 100644
index 3f642ed314..0000000000
--- a/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-drawable.c
+++ /dev/null
@@ -1,1338 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* GdkPixbuf library - convert X drawable information to RGB
- *
- * Copyright (C) 1999 Michael Zucchi
- *
- * Authors: Michael Zucchi <zucchi@zedzone.mmc.com.au>
- * Cody Russell <bratsche@dfw.net>
- * 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.
- */
-
-/* Ported to Xlib by John Harper <john@dcs.warwick.ac.uk> */
-
-
-#include "config.h"
-#include <stdio.h>
-#include <string.h>
-#include <gdk-pixbuf/gdk-pixbuf-private.h>
-#include "gdk-pixbuf-xlib-private.h"
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-#if (G_BYTE_ORDER == G_LITTLE_ENDIAN)
-#define LITTLE
-#endif
-#define d(x)
-
-
-
-static const guint32 mask_table[] = {
- 0x00000000, 0x00000001, 0x00000003, 0x00000007,
- 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f,
- 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff,
- 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff,
- 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff,
- 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff,
- 0x00ffffff, 0x01ffffff, 0x03ffffff, 0x07ffffff,
- 0x0fffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff,
- 0xffffffff
-};
-
-
-/* color handling */
-
-typedef struct xlib_colormap_struct xlib_colormap;
-struct xlib_colormap_struct {
- int size;
- XColor *colors;
- Visual *visual;
- Colormap colormap;
-};
-
-static xlib_colormap *
-xlib_get_colormap (Colormap id, Visual *visual)
-{
- int i;
- xlib_colormap *xc = g_new (xlib_colormap, 1);
-
- xc->size = visual->map_entries;
- xc->colors = g_new (XColor, xc->size);
- xc->visual = visual;
- xc->colormap = id;
-
- for (i = 0; i < xc->size; i++) {
- xc->colors[i].pixel = i;
- xc->colors[i].flags = DoRed | DoGreen | DoBlue;
- }
-
- XQueryColors (gdk_pixbuf_dpy, xc->colormap, xc->colors, xc->size);
-
- return xc;
-}
-
-static void
-xlib_colormap_free (xlib_colormap *xc)
-{
- g_free (xc->colors);
- g_free (xc);
-}
-
-/* from gdkvisual.c */
-static void
-visual_decompose_mask (gulong mask,
- gint *shift,
- gint *prec)
-{
- *shift = 0;
- *prec = 0;
-
- while (!(mask & 0x1)) {
- (*shift)++;
- mask >>= 1;
- }
-
- while (mask & 0x1) {
- (*prec)++;
- mask >>= 1;
- }
-}
-
-static gboolean x_error;
-
-static int
-handle_x_error (Display *dpy, XErrorEvent *ev)
-{
- x_error = TRUE;
- return 0;
-}
-
-static gboolean
-drawable_is_pixmap (Drawable d)
-{
- /* copied from Imlib */
-
- XErrorHandler errh;
- XWindowAttributes wa;
- gboolean is_pixmap;
-
- errh = XSetErrorHandler (handle_x_error);
- x_error = FALSE;
- XGetWindowAttributes (gdk_pixbuf_dpy, d, &wa);
- XSync (gdk_pixbuf_dpy, False);
- is_pixmap = x_error;
- XSetErrorHandler (errh);
-
- return is_pixmap;
-}
-
-
-
-/*
- convert 1 bits-pixel data
- no alpha
-*/
-static void
-rgb1 (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap)
-{
- int xx, yy;
- int width, height;
- int bpl;
- register guint8 data;
- guint8 *o;
- guint8 *srow = (guint8 *)image->data, *orow = pixels;
-
- d (printf ("1 bits/pixel\n"));
-
- /* convert upto 8 pixels/time */
- /* its probably not worth trying to make this run very fast, who uses
- 1 bit displays anymore? */
- width = image->width;
- height = image->height;
- bpl = image->bytes_per_line;
-
- for (yy = 0; yy < height; yy++) {
- o = orow;
-
- for (xx = 0; xx < width; xx ++) {
- data = srow[xx >> 3] >> (7 - (xx & 7)) & 1;
- *o++ = colormap->colors[data].red;
- *o++ = colormap->colors[data].green;
- *o++ = colormap->colors[data].blue;
- }
- srow += bpl;
- orow += rowstride;
- }
-}
-
-/*
- convert 1 bits/pixel data
- with alpha
-*/
-static void
-rgb1a (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap)
-{
- int xx, yy;
- int width, height;
- int bpl;
- register guint8 data;
- guint8 *o;
- guint8 *srow = (guint8 *)image->data, *orow = pixels;
- guint32 remap[2];
-
- d (printf ("1 bits/pixel\n"));
-
- /* convert upto 8 pixels/time */
- /* its probably not worth trying to make this run very fast, who uses
- 1 bit displays anymore? */
- width = image->width;
- height = image->height;
- bpl = image->bytes_per_line;
-
- for (xx = 0; xx < 2; xx++) {
-#ifdef LITTLE
- remap[xx] = 0xff000000
- | colormap->colors[xx].blue << 16
- | colormap->colors[xx].green << 8
- | colormap->colors[xx].red;
-#else
- remap[xx] = 0xff
- | colormap->colors[xx].red << 24
- | colormap->colors[xx].green << 16
- | colormap->colors[xx].blue << 8;
-#endif
- }
-
- for (yy = 0; yy < height; yy++) {
- o = orow;
-
- for (xx = 0; xx < width; xx ++) {
- data = srow[xx >> 3] >> (7 - (xx & 7)) & 1;
- *o++ = remap[data];
- }
- srow += bpl;
- orow += rowstride;
- }
-}
-
-/*
- convert 8 bits/pixel data
- no alpha
-*/
-static void
-rgb8 (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap)
-{
- int xx, yy;
- int width, height;
- int bpl;
- guint32 mask;
- register guint32 data;
- guint8 *srow = (guint8 *)image->data, *orow = pixels;
- register guint8 *s;
- register guint8 *o;
-
- width = image->width;
- height = image->height;
- bpl = image->bytes_per_line;
-
- d (printf ("8 bit, no alpha output\n"));
-
- mask = mask_table[image->depth];
-
- for (yy = 0; yy < height; yy++) {
- s = srow;
- o = orow;
- for (xx = 0; xx < width; xx++) {
- data = *s++ & mask;
- *o++ = colormap->colors[data].red;
- *o++ = colormap->colors[data].green;
- *o++ = colormap->colors[data].blue;
- }
- srow += bpl;
- orow += rowstride;
- }
-}
-
-/*
- convert 8 bits/pixel data
- with alpha
-*/
-static void
-rgb8a (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap)
-{
- int xx, yy;
- int width, height;
- int bpl;
- guint32 mask;
- register guint32 data;
- guint32 remap[256];
- register guint8 *s; /* read 2 pixels at once */
- register guint32 *o;
- guint8 *srow = (guint8 *)image->data, *orow = pixels;
-
- width = image->width;
- height = image->height;
- bpl = image->bytes_per_line;
-
- d (printf ("8 bit, with alpha output\n"));
-
- mask = mask_table[image->depth];
-
- for (xx = 0; xx < colormap->size; xx++) {
-#ifdef LITTLE
- remap[xx] = 0xff000000
- | colormap->colors[xx].blue << 16
- | colormap->colors[xx].green << 8
- | colormap->colors[xx].red;
-#else
- remap[xx] = 0xff
- | colormap->colors[xx].red << 24
- | colormap->colors[xx].green << 16
- | colormap->colors[xx].blue << 8;
-#endif
- }
-
- for (yy = 0; yy < height; yy++) {
- s = srow;
- o = (guint32 *) orow;
- for (xx = 0; xx < width; xx ++) {
- data = *s++ & mask;
- *o++ = remap[data];
- }
- srow += bpl;
- orow += rowstride;
- }
-}
-
-/*
- convert 16 bits/pixel data
- no alpha
- data in lsb format
-*/
-static void
-rgb565lsb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap)
-{
- int xx, yy;
- int width, height;
- int bpl;
-
-#ifdef LITTLE
- register guint32 *s; /* read 2 pixels at once */
-#else
- register guint8 *s; /* read 2 pixels at once */
-#endif
- register guint16 *o;
- guint8 *srow = (guint8 *)image->data, *orow = pixels;
-
- width = image->width;
- height = image->height;
- bpl = image->bytes_per_line;
-
- for (yy = 0; yy < height; yy++) {
-#ifdef LITTLE
- s = (guint32 *) srow;
-#else
- s = srow;
-#endif
- o = (guint16 *) orow;
- for (xx = 1; xx < width; xx += 2) {
- register guint32 data;
-#ifdef LITTLE
- data = *s++;
- *o++ = (data & 0xf800) >> 8 | (data & 0xe000) >> 13
- | (data & 0x7e0) << 5 | (data & 0x600) >> 1;
- *o++ = (data & 0x1f) << 3 | (data & 0x1c) >> 2
- | (data & 0xf8000000) >> 16 | (data & 0xe0000000) >> 21;
- *o++ = (data & 0x7e00000) >> 19 | (data & 0x6000000) >> 25
- | (data & 0x1f0000) >> 5 | (data & 0x1c0000) >> 10;
-#else
- /* swap endianness first */
- data = s[1] | s[0] << 8 | s[3] << 16 | s[2] << 24;
- s += 4;
- *o++ = (data & 0xf800) | (data & 0xe000) >> 5
- | (data & 0x7e0) >> 3 | (data & 0x600) >> 9;
- *o++ = (data & 0x1f) << 11 | (data & 0x1c) << 6
- | (data & 0xf8000000) >> 24 | (data & 0xe0000000) >> 29;
- *o++ = (data & 0x7e00000) >> 11 | (data & 0x6000000) >> 17
- | (data & 0x1f0000) >> 13 | (data & 0x1c0000) >> 18;
-#endif
- }
- /* check for last remaining pixel */
- if (width & 1) {
- register guint16 data;
-#ifdef LITTLE
- data = *((short *) s);
-#else
- data = *((short *) s);
- data = ((data >> 8) & 0xff) | ((data & 0xff) << 8);
-#endif
- ((char *) o)[0] = ((data >> 8) & 0xf8) | ((data >> 13) & 0x7);
- ((char *) o)[1] = ((data >> 3) & 0xfc) | ((data >> 9) & 0x3);
- ((char *) o)[2] = ((data << 3) & 0xf8) | ((data >> 2) & 0x7);
- }
- srow += bpl;
- orow += rowstride;
- }
-}
-
-/*
- convert 16 bits/pixel data
- no alpha
- data in msb format
-*/
-static void
-rgb565msb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap)
-{
- int xx, yy;
- int width, height;
- int bpl;
-
-#ifdef LITTLE
- register guint8 *s; /* need to swap data order */
-#else
- register guint32 *s; /* read 2 pixels at once */
-#endif
- register guint16 *o;
- guint8 *srow = (guint8 *)image->data, *orow = pixels;
-
- width = image->width;
- height = image->height;
- bpl = image->bytes_per_line;
-
- for (yy = 0; yy < height; yy++) {
-#ifdef LITTLE
- s = srow;
-#else
- s = (guint32 *) srow;
-#endif
- o = (guint16 *) orow;
- for (xx = 1; xx < width; xx += 2) {
- register guint32 data;
-#ifdef LITTLE
- /* swap endianness first */
- data = s[1] | s[0] << 8 | s[3] << 16 | s[2] << 24;
- s += 4;
- *o++ = (data & 0xf800) >> 8 | (data & 0xe000) >> 13
- | (data & 0x7e0) << 5 | (data & 0x600) >> 1;
- *o++ = (data & 0x1f) << 3 | (data & 0x1c) >> 2
- | (data & 0xf8000000) >> 16 | (data & 0xe0000000) >> 21;
- *o++ = (data & 0x7e00000) >> 19 | (data & 0x6000000) >> 25
- | (data & 0x1f0000) >> 5 | (data & 0x1c0000) >> 10;
-#else
- data = *s++;
- *o++ = (data & 0xf800) | (data & 0xe000) >> 5
- | (data & 0x7e0) >> 3 | (data & 0x600) >> 9;
- *o++ = (data & 0x1f) << 11 | (data & 0x1c) << 6
- | (data & 0xf8000000) >> 24 | (data & 0xe0000000) >> 29;
- *o++ = (data & 0x7e00000) >> 11 | (data & 0x6000000) >> 17
- | (data & 0x1f0000) >> 13 | (data & 0x1c0000) >> 18;
-#endif
- }
- /* check for last remaining pixel */
- if (width & 1) {
- register guint16 data;
-#ifdef LITTLE
- data = *((short *) s);
- data = ((data >> 8) & 0xff) | ((data & 0xff) << 8);
-#else
- data = *((short *) s);
-#endif
- ((char *) o)[0] = ((data >> 8) & 0xf8) | ((data >> 13) & 0x7);
- ((char *) o)[1] = ((data >> 3) & 0xfc) | ((data >> 9) & 0x3);
- ((char *) o)[2] = ((data << 3) & 0xf8) | ((data >> 2) & 0x7);
- }
- srow += bpl;
- orow += rowstride;
- }
-}
-
-/*
- convert 16 bits/pixel data
- with alpha
- data in lsb format
-*/
-static void
-rgb565alsb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap)
-{
- int xx, yy;
- int width, height;
- int bpl;
-
-#ifdef LITTLE
- register guint16 *s; /* read 1 pixels at once */
-#else
- register guint8 *s;
-#endif
- register guint32 *o;
-
- guint8 *srow = (guint8 *)image->data, *orow = pixels;
-
- width = image->width;
- height = image->height;
- bpl = image->bytes_per_line;
-
- for (yy = 0; yy < height; yy++) {
-#ifdef LITTLE
- s = (guint16 *) srow;
-#else
- s = (guint8 *) srow;
-#endif
- o = (guint32 *) orow;
- for (xx = 0; xx < width; xx ++) {
- register guint32 data;
- /* rrrrrggg gggbbbbb -> rrrrrRRR ggggggGG bbbbbBBB aaaaaaaa */
- /* little endian: aaaaaaaa bbbbbBBB ggggggGG rrrrrRRR */
-#ifdef LITTLE
- data = *s++;
- *o++ = (data & 0xf800) >> 8 | (data & 0xe000) >> 13
- | (data & 0x7e0) << 5 | (data & 0x600) >> 1
- | (data & 0x1f) << 19 | (data & 0x1c) << 14
- | 0xff000000;
-#else
- /* swap endianness first */
- data = s[0] | s[1] << 8;
- s += 2;
- *o++ = (data & 0xf800) << 16 | (data & 0xe000) << 11
- | (data & 0x7e0) << 13 | (data & 0x600) << 7
- | (data & 0x1f) << 11 | (data & 0x1c) << 6
- | 0xff;
-#endif
- }
- srow += bpl;
- orow += rowstride;
- }
-}
-
-/*
- convert 16 bits/pixel data
- with alpha
- data in msb format
-*/
-static void
-rgb565amsb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap)
-{
- int xx, yy;
- int width, height;
- int bpl;
-
-#ifdef LITTLE
- register guint8 *s;
-#else
- register guint16 *s; /* read 1 pixels at once */
-#endif
- register guint32 *o;
-
- guint8 *srow = (guint8 *)image->data, *orow = pixels;
-
- width = image->width;
- height = image->height;
- bpl = image->bytes_per_line;
-
- for (yy = 0; yy < height; yy++) {
-#ifdef LITTLE
- s = srow;
-#else
- s = (guint16 *) srow;
-#endif
- o = (guint32 *) orow;
- for (xx = 0; xx < width; xx ++) {
- register guint32 data;
- /* rrrrrggg gggbbbbb -> rrrrrRRR gggggg00 bbbbbBBB aaaaaaaa */
- /* little endian: aaaaaaaa bbbbbBBB gggggg00 rrrrrRRR */
-#ifdef LITTLE
- /* swap endianness first */
- data = s[0] | s[1] << 8;
- s += 2;
- *o++ = (data & 0xf800) >> 8 | (data & 0xe000) >> 13
- | (data & 0x7e0) << 5 | (data & 0x600) >> 1
- | (data & 0x1f) << 19 | (data & 0x1c) << 14
- | 0xff000000;
-#else
- data = *s++;
- *o++ = (data & 0xf800) << 16 | (data & 0xe000) << 11
- | (data & 0x7e0) << 13 | (data & 0x600) << 7
- | (data & 0x1f) << 11 | (data & 0x1c) << 6
- | 0xff;
-#endif
- }
- srow += bpl;
- orow += rowstride;
- }
-}
-
-/*
- convert 15 bits/pixel data
- no alpha
- data in lsb format
-*/
-static void
-rgb555lsb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap)
-{
- int xx, yy;
- int width, height;
- int bpl;
-
-#ifdef LITTLE
- register guint32 *s; /* read 2 pixels at once */
-#else
- register guint8 *s; /* read 2 pixels at once */
-#endif
- register guint16 *o;
- guint8 *srow = (guint8 *)image->data, *orow = pixels;
-
- width = image->width;
- height = image->height;
- bpl = image->bytes_per_line;
-
- for (yy = 0; yy < height; yy++) {
-#ifdef LITTLE
- s = (guint32 *) srow;
-#else
- s = srow;
-#endif
- o = (guint16 *) orow;
- for (xx = 1; xx < width; xx += 2) {
- register guint32 data;
-#ifdef LITTLE
- data = *s++;
- *o++ = (data & 0x7c00) >> 7 | (data & 0x7000) >> 12
- | (data & 0x3e0) << 6 | (data & 0x380) << 1;
- *o++ = (data & 0x1f) << 3 | (data & 0x1c) >> 2
- | (data & 0x7c000000) >> 15 | (data & 0x70000000) >> 20;
- *o++ = (data & 0x3e00000) >> 18 | (data & 0x3800000) >> 23
- | (data & 0x1f0000) >> 5 | (data & 0x1c0000) >> 10;
-#else
- /* swap endianness first */
- data = s[1] | s[0] << 8 | s[3] << 16 | s[2] << 24;
- s += 4;
- *o++ = (data & 0x7c00) << 1 | (data & 0x7000) >> 4
- | (data & 0x3e0) >> 2 | (data & 0x380) >> 7;
- *o++ = (data & 0x1f) << 11 | (data & 0x1c) << 6
- | (data & 0x7c000000) >> 23 | (data & 0x70000000) >> 28;
- *o++ = (data & 0x3e00000) >> 10 | (data & 0x3800000) >> 15
- | (data & 0x1f0000) >> 13 | (data & 0x1c0000) >> 18;
-#endif
- }
- /* check for last remaining pixel */
- if (width & 1) {
- register guint16 data;
-#ifdef LITTLE
- data = *((short *) s);
-#else
- data = *((short *) s);
- data = ((data >> 8) & 0xff) | ((data & 0xff) << 8);
-#endif
- ((char *) o)[0] = (data & 0x7c00) >> 7 | (data & 0x7000) >> 12;
- ((char *) o)[1] = (data & 0x3e0) >> 2 | (data & 0x380) >> 7;
- ((char *) o)[2] = (data & 0x1f) << 3 | (data & 0x1c) >> 2;
- }
- srow += bpl;
- orow += rowstride;
- }
-}
-
-/*
- convert 15 bits/pixel data
- no alpha
- data in msb format
-*/
-static void
-rgb555msb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap)
-{
- int xx, yy;
- int width, height;
- int bpl;
-
-#ifdef LITTLE
- register guint8 *s; /* read 2 pixels at once */
-#else
- register guint32 *s; /* read 2 pixels at once */
-#endif
- register guint16 *o;
- guint8 *srow = (guint8 *)image->data, *orow = pixels;
-
- width = image->width;
- height = image->height;
- bpl = image->bytes_per_line;
-
- for (yy = 0; yy < height; yy++) {
-#ifdef LITTLE
- s = srow;
-#else
- s = (guint32 *) srow;
-#endif
- o = (guint16 *) orow;
- for (xx = 1; xx < width; xx += 2) {
- register guint32 data;
-#ifdef LITTLE
- /* swap endianness first */
- data = s[1] | s[0] << 8 | s[3] << 16 | s[2] << 24;
- s += 4;
- *o++ = (data & 0x7c00) >> 7 | (data & 0x7000) >> 12
- | (data & 0x3e0) << 6 | (data & 0x380) << 1;
- *o++ = (data & 0x1f) << 3 | (data & 0x1c) >> 2
- | (data & 0x7c000000) >> 15 | (data & 0x70000000) >> 20;
- *o++ = (data & 0x3e00000) >> 18 | (data & 0x3800000) >> 23
- | (data & 0x1f0000) >> 5 | (data & 0x1c0000) >> 10;
-#else
- data = *s++;
- *o++ = (data & 0x7c00) << 1 | (data & 0x7000) >> 4
- | (data & 0x3e0) >> 2 | (data & 0x380) >> 7;
- *o++ = (data & 0x1f) << 11 | (data & 0x1c) << 6
- | (data & 0x7c000000) >> 23 | (data & 0x70000000) >> 28;
- *o++ = (data & 0x3e00000) >> 10 | (data & 0x3800000) >> 15
- | (data & 0x1f0000) >> 13 | (data & 0x1c0000) >> 18;
-#endif
- }
- /* check for last remaining pixel */
- if (width & 1) {
- register guint16 data;
-#ifdef LITTLE
- data = *((short *) s);
- data = ((data >> 8) & 0xff) | ((data & 0xff) << 8);
-#else
- data = *((short *) s);
-#endif
- ((char *) o)[0] = (data & 0x7c00) >> 7 | (data & 0x7000) >> 12;
- ((char *) o)[1] = (data & 0x3e0) >> 2 | (data & 0x380) >> 7;
- ((char *) o)[2] = (data & 0x1f) << 3 | (data & 0x1c) >> 2;
- }
- srow += bpl;
- orow += rowstride;
- }
-}
-
-/*
- convert 15 bits/pixel data
- with alpha
- data in lsb format
-*/
-static void
-rgb555alsb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap)
-{
- int xx, yy;
- int width, height;
- int bpl;
-
-#ifdef LITTLE
- register guint16 *s; /* read 1 pixels at once */
-#else
- register guint8 *s;
-#endif
- register guint32 *o;
-
- guint8 *srow = (guint8 *)image->data, *orow = pixels;
-
- width = image->width;
- height = image->height;
- bpl = image->bytes_per_line;
-
- for (yy = 0; yy < height; yy++) {
-#ifdef LITTLE
- s = (guint16 *) srow;
-#else
- s = srow;
-#endif
- o = (guint32 *) orow;
- for (xx = 0; xx < width; xx++) {
- register guint32 data;
- /* rrrrrggg gggbbbbb -> rrrrrRRR gggggGGG bbbbbBBB aaaaaaaa */
- /* little endian: aaaaaaaa bbbbbBBB gggggGGG rrrrrRRR */
-#ifdef LITTLE
- data = *s++;
- *o++ = (data & 0x7c00) >> 7 | (data & 0x7000) >> 12
- | (data & 0x3e0) << 6 | (data & 0x380) << 1
- | (data & 0x1f) << 19 | (data & 0x1c) << 14
- | 0xff000000;
-#else
- /* swap endianness first */
- data = s[0] | s[1] << 8;
- s += 2;
- *o++ = (data & 0x7c00) << 17 | (data & 0x7000) << 12
- | (data & 0x3e0) << 14 | (data & 0x380) << 9
- | (data & 0x1f) << 11 | (data & 0x1c) << 6
- | 0xff;
-#endif
- }
- srow += bpl;
- orow += rowstride;
- }
-}
-
-/*
- convert 15 bits/pixel data
- with alpha
- data in msb format
-*/
-static void
-rgb555amsb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap)
-{
- int xx, yy;
- int width, height;
- int bpl;
-
-#ifdef LITTLE
- register guint16 *s; /* read 1 pixels at once */
-#else
- register guint8 *s;
-#endif
- register guint32 *o;
-
- guint8 *srow = (guint8 *)image->data, *orow = pixels;
-
- width = image->width;
- height = image->height;
- bpl = image->bytes_per_line;
-
- for (yy = 0; yy < height; yy++) {
-#ifdef LITTLE
- s = (guint16 *) srow;
-#else
- s = srow;
-#endif
- o = (guint32 *) orow;
- for (xx = 0; xx < width; xx++) {
- register guint32 data;
- /* rrrrrggg gggbbbbb -> rrrrrRRR gggggGGG bbbbbBBB aaaaaaaa */
- /* little endian: aaaaaaaa bbbbbBBB gggggGGG rrrrrRRR */
-#ifdef LITTLE
- /* swap endianness first */
- data = s[0] | s[1] << 8;
- s += 2;
- *o++ = (data & 0x7c00) >> 7 | (data & 0x7000) >> 12
- | (data & 0x3e0) << 6 | (data & 0x380) << 1
- | (data & 0x1f) << 19 | (data & 0x1c) << 14
- | 0xff000000;
-#else
- data = *s++;
- *o++ = (data & 0x7c00) << 17 | (data & 0x7000) << 12
- | (data & 0x3e0) << 14 | (data & 0x380) << 9
- | (data & 0x1f) << 11 | (data & 0x1c) << 6
- | 0xff;
-#endif
- }
- srow += bpl;
- orow += rowstride;
- }
-}
-
-
-static void
-rgb888alsb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap)
-{
- int xx, yy;
- int width, height;
- int bpl;
-
- guint8 *s; /* for byte order swapping */
- guint8 *o;
- guint8 *srow = (guint8 *)image->data, *orow = pixels;
-
- width = image->width;
- height = image->height;
- bpl = image->bytes_per_line;
-
- d (printf ("32 bits/pixel with alpha\n"));
-
- /* lsb data */
- for (yy = 0; yy < height; yy++) {
- s = srow;
- o = orow;
- for (xx = 0; xx < width; xx++) {
- *o++ = s[2];
- *o++ = s[1];
- *o++ = s[0];
- *o++ = 0xff;
- s += 4;
- }
- srow += bpl;
- orow += rowstride;
- }
-}
-
-static void
-rgb888lsb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap)
-{
- int xx, yy;
- int width, height;
- int bpl;
-
- guint8 *srow = (guint8 *)image->data, *orow = pixels;
- guint8 *o, *s;
-
- width = image->width;
- height = image->height;
- bpl = image->bytes_per_line;
-
- d (printf ("32 bit, lsb, no alpha\n"));
-
- for (yy = 0; yy < height; yy++) {
- s = srow;
- o = orow;
- for (xx = 0; xx < width; xx++) {
- *o++ = s[2];
- *o++ = s[1];
- *o++ = s[0];
- s += 4;
- }
- srow += bpl;
- orow += rowstride;
- }
-}
-
-static void
-rgb888amsb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap)
-{
- int xx, yy;
- int width, height;
- int bpl;
-
- guint8 *srow = (guint8 *)image->data, *orow = pixels;
-#ifdef LITTLE
- guint32 *o;
- guint32 *s;
-#else
- guint8 *s; /* for byte order swapping */
- guint8 *o;
-#endif
-
- d (printf ("32 bit, msb, with alpha\n"));
-
- width = image->width;
- height = image->height;
- bpl = image->bytes_per_line;
-
- /* msb data */
- for (yy = 0; yy < height; yy++) {
-#ifdef LITTLE
- s = (guint32 *) srow;
- o = (guint32 *) orow;
-#else
- s = srow;
- o = orow;
-#endif
- for (xx = 0; xx < width; xx++) {
-#ifdef LITTLE
- *o++ = s[1];
- *o++ = s[2];
- *o++ = s[3];
- *o++ = 0xff;
- s += 4;
-#else
- *o++ = (*s << 8) | 0xff; /* untested */
- s++;
-#endif
- }
- srow += bpl;
- orow += rowstride;
- }
-}
-
-static void
-rgb888msb (XImage *image, guchar *pixels, int rowstride, xlib_colormap *colormap)
-{
- int xx, yy;
- int width, height;
- int bpl;
-
- guint8 *srow = (guint8 *)image->data, *orow = pixels;
- guint8 *s;
- guint8 *o;
-
- d (printf ("32 bit, msb, no alpha\n"));
-
- width = image->width;
- height = image->height;
- bpl = image->bytes_per_line;
-
- for (yy = 0; yy < height; yy++) {
- s = srow;
- o = orow;
- for (xx = 0; xx < width; xx++) {
- *o++ = s[1];
- *o++ = s[2];
- *o++ = s[3];
- s += 4;
- }
- srow += bpl;
- orow += rowstride;
- }
-}
-
-/*
- This should work correctly with any display/any endianness, but will probably
- run quite slow
-*/
-static void
-convert_real_slow (XImage *image, guchar *pixels, int rowstride, xlib_colormap *cmap, int alpha)
-{
- int xx, yy;
- int width, height;
- int bpl;
- guint8 *srow = (guint8 *)image->data, *orow = pixels;
- guint8 *o;
- guint32 pixel;
- Visual *v;
- guint8 component;
- int i;
- int red_shift, red_prec, green_shift, green_prec, blue_shift, blue_prec;
-
- width = image->width;
- height = image->height;
- bpl = image->bytes_per_line;
- v = cmap->visual;
-
- visual_decompose_mask (v->red_mask, &red_shift, &red_prec);
- visual_decompose_mask (v->green_mask, &green_shift, &green_prec);
- visual_decompose_mask (v->blue_mask, &blue_shift, &blue_prec);
-
- d(printf("rgb mask/shift/prec = %x:%x:%x %d:%d:%d %d:%d:%d\n",
- v->red_mask, v->green_mask, v->blue_mask,
- red_shift, green_shift, blue_shift,
- red_prec, green_prec, blue_prec));
-
- for (yy = 0; yy < height; yy++) {
- o = orow;
- for (xx = 0; xx < width; xx++) {
- pixel = XGetPixel (image, xx, yy);
- switch (v->class) {
- /* I assume this is right for static & greyscale's too? */
- case StaticGray:
- case GrayScale:
- case StaticColor:
- case PseudoColor:
- *o++ = cmap->colors[pixel].red;
- *o++ = cmap->colors[pixel].green;
- *o++ = cmap->colors[pixel].blue;
- break;
- case TrueColor:
- /* This is odd because it must sometimes shift left (otherwise
- I'd just shift >> (*_shift - 8 + *_prec + <0-7>). This logic
- should work for all bit sizes/shifts/etc. */
- component = 0;
- for (i = 24; i < 32; i += red_prec)
- component |= ((pixel & v->red_mask) << (32 - red_shift - red_prec)) >> i;
- *o++ = component;
- component = 0;
- for (i = 24; i < 32; i += green_prec)
- component |= ((pixel & v->green_mask) << (32 - green_shift - green_prec)) >> i;
- *o++ = component;
- component = 0;
- for (i = 24; i < 32; i += blue_prec)
- component |= ((pixel & v->blue_mask) << (32 - blue_shift - blue_prec)) >> i;
- *o++ = component;
- break;
- case DirectColor:
- *o++ = cmap->colors[((pixel & v->red_mask) << (32 - red_shift - red_prec)) >> 24].red;
- *o++ = cmap->colors[((pixel & v->green_mask) << (32 - green_shift - green_prec)) >> 24].green;
- *o++ = cmap->colors[((pixel & v->blue_mask) << (32 - blue_shift - blue_prec)) >> 24].blue;
- break;
- }
- if (alpha)
- *o++ = 0xff;
- }
- srow += bpl;
- orow += rowstride;
- }
-}
-
-typedef void (* cfunc) (XImage *image, guchar *pixels, int rowstride, xlib_colormap *cmap);
-
-static const cfunc convert_map[] = {
- rgb1,rgb1,rgb1a,rgb1a,
- rgb8,rgb8,rgb8a,rgb8a,
- rgb555lsb,rgb555msb,rgb555alsb,rgb555amsb,
- rgb565lsb,rgb565msb,rgb565alsb,rgb565amsb,
- rgb888lsb,rgb888msb,rgb888alsb,rgb888amsb
-};
-
-/*
- perform actual conversion
-
- If we can, try and use the optimised code versions, but as a default
- fallback, and always for direct colour, use the generic/slow but complete
- conversion function.
-*/
-static void
-rgbconvert (XImage *image, guchar *pixels, int rowstride, int alpha, xlib_colormap *cmap)
-{
- int index = (image->byte_order == MSBFirst) | (alpha != 0) << 1;
- int bank=5; /* default fallback converter */
- Visual *v = cmap->visual;
-
- d(printf("masks = %x:%x:%x\n", v->red_mask, v->green_mask, v->blue_mask));
- d(printf("image depth = %d, bpp = %d\n", image->depth, image->bits_per_pixel));
-
- switch (v->class) {
- /* I assume this is right for static & greyscale's too? */
- case StaticGray:
- case GrayScale:
- case StaticColor:
- case PseudoColor:
- switch (image->bits_per_pixel) {
- case 1:
- bank = 0;
- break;
- case 8:
- bank = 1;
- break;
- }
- break;
- case TrueColor:
- switch (image->depth) {
- case 15:
- if (v->red_mask == 0x7c00 && v->green_mask == 0x3e0 && v->blue_mask == 0x1f
- && image->bits_per_pixel == 16)
- bank = 2;
- break;
- case 16:
- if (v->red_mask == 0xf800 && v->green_mask == 0x7e0 && v->blue_mask == 0x1f
- && image->bits_per_pixel == 16)
- bank = 3;
- break;
- case 24:
- case 32:
- if (v->red_mask == 0xff0000 && v->green_mask == 0xff00 && v->blue_mask == 0xff
- && image->bits_per_pixel == 32)
- bank = 4;
- break;
- }
- break;
- case DirectColor:
- /* always use the slow version */
- break;
- }
-
- d(printf("converting using conversion function in bank %d\n", bank));
-
- if (bank==5) {
- convert_real_slow(image, pixels, rowstride, cmap, alpha);
- } else {
- index |= bank << 2;
- (* convert_map[index]) (image, pixels, rowstride, cmap);
- }
-}
-
-static gboolean
-xlib_window_is_viewable (Window w)
-{
- XWindowAttributes wa;
-
- while (w != 0) {
- Window parent, root, *children;
- guint nchildren;
-
- XGetWindowAttributes (gdk_pixbuf_dpy, w, &wa);
- if (wa.map_state != IsViewable)
- return FALSE;
-
- if (!XQueryTree (gdk_pixbuf_dpy, w, &root,
- &parent, &children, &nchildren))
- return FALSE;
-
- if (nchildren > 0)
- XFree (children);
-
- if ((parent == root) || (w == root))
- return TRUE;
-
- w = parent;
- }
-
- return FALSE;
-}
-
-static gint
-xlib_window_get_origin (Window w, gint *x, gint *y)
-{
- Window child;
- return XTranslateCoordinates (gdk_pixbuf_dpy, w,
- RootWindow (gdk_pixbuf_dpy,
- gdk_pixbuf_screen),
- 0, 0, x, y, &child);
-}
-
-/* Exported functions */
-
-/**
- * gdk_pixbuf_xlib_get_from_drawable:
- * @dest: Destination pixbuf, or NULL if a new pixbuf should be created.
- * @src: Source drawable.
- * @cmap: A colormap if @src is a pixmap. If it is a window, this argument will
- * be ignored.
- * @visual: A visual if @src is a pixmap. If it is a window, this argument will
- * be ignored.
- * @src_x: Source X coordinate within drawable.
- * @src_y: Source Y coordinate within drawable.
- * @dest_x: Destination X coordinate in pixbuf, or 0 if @dest is NULL.
- * @dest_y: Destination Y coordinate in pixbuf, or 0 if @dest is NULL.
- * @width: Width in pixels of region to get.
- * @height: Height in pixels of region to get.
- *
- * Transfers image data from a Gdk drawable and converts it to an RGB(A)
- * representation inside a GdkPixbuf.
- *
- * If the drawable @src is a pixmap, then a suitable colormap must be specified,
- * since pixmaps are just blocks of pixel data without an associated colormap.
- * If the drawable is a window, the @cmap argument will be ignored and the
- * window's own colormap will be used instead.
- *
- * If the specified destination pixbuf @dest is #NULL, then this function will
- * create an RGB pixbuf with 8 bits per channel and no alpha, with the same size
- * specified by the @width and @height arguments. In this case, the @dest_x and
- * @dest_y arguments must be specified as 0, otherwise the function will return
- * #NULL. If the specified destination pixbuf is not NULL and it contains alpha
- * information, then the filled pixels will be set to full opacity.
- *
- * If the specified drawable is a pixmap, then the requested source rectangle
- * must be completely contained within the pixmap, otherwise the function will
- * return #NULL.
- *
- * If the specified drawable is a window, then it must be viewable, i.e. all of
- * its ancestors up to the root window must be mapped. Also, the specified
- * source rectangle must be completely contained within the window and within
- * the screen. If regions of the window are obscured by noninferior windows, the
- * contents of those regions are undefined. The contents of regions obscured by
- * inferior windows of a different depth than that of the source window will also
- * be undefined.
- *
- * Return value: The same pixbuf as @dest if it was non-NULL, or a newly-created
- * pixbuf with a reference count of 1 if no destination pixbuf was specified; in
- * the latter case, NULL will be returned if not enough memory could be
- * allocated for the pixbuf to be created.
- **/
-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)
-{
- guint src_width, src_height;
- XImage *image;
- int rowstride, bpp, alpha;
- XWindowAttributes wa;
- xlib_colormap *x_cmap;
- gboolean is_pixmap;
-
- /* General sanity checks */
-
- g_return_val_if_fail (src != 0, NULL);
-
- is_pixmap = drawable_is_pixmap (src);
-
- if (is_pixmap) {
- g_return_val_if_fail (cmap != 0, NULL);
- g_return_val_if_fail (visual != NULL, NULL);
- }
- else
- g_return_val_if_fail (xlib_window_is_viewable (src), NULL);
-
- if (!dest)
- g_return_val_if_fail (dest_x == 0 && dest_y == 0, NULL);
- else {
- g_return_val_if_fail (dest->colorspace == GDK_COLORSPACE_RGB, NULL);
- g_return_val_if_fail (dest->n_channels == 3
- || dest->n_channels == 4, NULL);
- g_return_val_if_fail (dest->bits_per_sample == 8, NULL);
- }
-
- /* Coordinate sanity checks */
-
- if (!is_pixmap) {
- XGetWindowAttributes (gdk_pixbuf_dpy, src, &wa);
- src_width = wa.width;
- src_height = wa.height;
- } else {
- Window root;
- int tx, ty;
- guint bwidth, depth;
- XGetGeometry (gdk_pixbuf_dpy, src, &root, &tx, &ty,
- &src_width, &src_height, &bwidth, &depth);
- }
-
- g_return_val_if_fail (src_x >= 0 && src_y >= 0, NULL);
- g_return_val_if_fail (src_x + width <= src_width
- && src_y + height <= src_height, NULL);
-
- if (dest) {
- g_return_val_if_fail (dest_x >= 0 && dest_y >= 0, NULL);
- g_return_val_if_fail (dest_x + width <= dest->width, NULL);
- g_return_val_if_fail (dest_y + height <= dest->height, NULL);
- }
-
- if (!is_pixmap) {
- int ret;
- int src_xorigin, src_yorigin;
- int screen_width, screen_height;
- int screen_srcx, screen_srcy;
-
- ret = xlib_window_get_origin (src, &src_xorigin, &src_yorigin);
- g_return_val_if_fail (ret != FALSE, NULL);
-
- screen_width = DisplayWidth (gdk_pixbuf_dpy, gdk_pixbuf_screen);
- screen_height = DisplayHeight (gdk_pixbuf_dpy, gdk_pixbuf_screen);
-
- screen_srcx = src_xorigin + src_x;
- screen_srcy = src_yorigin + src_y;
-
- g_return_val_if_fail (screen_srcx >= 0 && screen_srcy >= 0, NULL);
- g_return_val_if_fail (screen_srcx + width <= screen_width, NULL);
- g_return_val_if_fail (screen_srcy + height <= screen_height, NULL);
- }
-
- /* Get Image in ZPixmap format (packed bits). */
- image = XGetImage (gdk_pixbuf_dpy, src, src_x, src_y,
- width, height, AllPlanes, ZPixmap);
- g_return_val_if_fail (image != NULL, NULL);
-
- /* Create the pixbuf if needed */
- if (!dest) {
- dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
- FALSE, 8, width, height);
- if (!dest) {
- XDestroyImage (image);
- return NULL;
- }
- }
-
- /* Get the colormap if needed */
- if (!is_pixmap)
- {
- cmap = wa.colormap;
- visual = wa.visual;
- }
-
- x_cmap = xlib_get_colormap (cmap, visual);
-
- alpha = dest->has_alpha;
- rowstride = dest->rowstride;
- bpp = alpha ? 4 : 3;
-
- /* we offset into the image data based on the position we are retrieving from */
- rgbconvert (image, dest->pixels +
- (dest_y * rowstride) + (dest_x * bpp),
- rowstride,
- alpha,
- x_cmap);
-
- xlib_colormap_free (x_cmap);
- XDestroyImage (image);
-
- return dest;
-}
diff --git a/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-private.h b/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-private.h
deleted file mode 100644
index 6605be5389..0000000000
--- a/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-private.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* 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
diff --git a/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-render.c b/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-render.c
deleted file mode 100644
index b70f8bfdd2..0000000000
--- a/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-render.c
+++ /dev/null
@@ -1,398 +0,0 @@
-/* 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;
- }
-}
diff --git a/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib.c b/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib.c
deleted file mode 100644
index d85943da01..0000000000
--- a/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* 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;
-}
diff --git a/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib.h b/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib.h
deleted file mode 100644
index 4ffc56039f..0000000000
--- a/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* 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>
-
-G_BEGIN_DECLS
-
-#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);
-
-G_END_DECLS
-
-#endif /* GDK_PIXBUF_XLIB_H */
diff --git a/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlibrgb.c b/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlibrgb.c
deleted file mode 100644
index 701f34a9dd..0000000000
--- a/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlibrgb.c
+++ /dev/null
@@ -1,3724 +0,0 @@
-/* -*- 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 and the copyright holders 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>
-*/
-
-#if HAVE_CONFIG_H
-# include <config.h>
-# if STDC_HEADERS
-# include <stdio.h>
-# include <stdlib.h>
-# include <string.h>
-# endif
-#else
-# include <stdio.h>
-# include <stdlib.h>
-#endif
-
-#include <math.h>
-
-#define ENABLE_GRAYSCALE
-
-/* include this before so that we can get endian definitions if
- they are there... */
-
-#include "gdk-pixbuf-xlibrgb.h"
-
-#ifndef MIN
-#define MIN(a, b) (((a) < (b)) ? (a) : (b))
-#endif
-
-#ifndef MAX
-#define MAX(a, b) (((a) > (b)) ? (a) : (b))
-#endif
-
-typedef enum {
- LSB_FIRST,
- MSB_FIRST
-} ByteOrder;
-
-
-typedef struct _XlibRgbInfo XlibRgbInfo;
-
-typedef void (*XlibRgbConvFunc) (XImage *image,
- int ax, int ay,
- int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align,
- XlibRgbCmap *cmap);
-
-/* Some of these fields should go, as they're not being used at all.
- Globals should generally migrate into here - it's very likely that
- we'll want to run more than one GdkRgbInfo context at the same time
- (i.e. some but not all windows have privately installed
- colormaps). */
-
-struct _XlibRgbInfo
-{
- Display *display;
- Screen *screen;
- int screen_num;
- XVisualInfo *x_visual_info;
- Colormap cmap;
- XColor *cmap_colors;
- Visual *default_visualid;
- Colormap default_colormap;
-
- unsigned long *color_pixels;
- unsigned long *gray_pixels;
- unsigned long *reserved_pixels;
-
- unsigned long red_shift;
- unsigned long red_prec;
- unsigned long blue_shift;
- unsigned long blue_prec;
- unsigned long green_shift;
- unsigned long green_prec;
-
- unsigned int nred_shades;
- unsigned int ngreen_shades;
- unsigned int nblue_shades;
- unsigned int ngray_shades;
- unsigned int nreserved;
-
- unsigned int bpp;
- unsigned int cmap_alloced;
- double gamma_val;
-
- /* Generally, the stage buffer is used to convert 32bit RGB, gray,
- and indexed images into 24 bit packed RGB. */
- unsigned char *stage_buf;
-
- XlibRgbCmap *gray_cmap;
-
- Bool dith_default;
-
- Bool bitmap; /* set true if in 1 bit per pixel mode */
- GC own_gc;
-
- /* Convert functions */
- XlibRgbConvFunc conv;
- XlibRgbConvFunc conv_d;
-
- XlibRgbConvFunc conv_32;
- XlibRgbConvFunc conv_32_d;
-
- XlibRgbConvFunc conv_gray;
- XlibRgbConvFunc conv_gray_d;
-
- XlibRgbConvFunc conv_indexed;
- XlibRgbConvFunc conv_indexed_d;
-};
-
-static Bool xlib_rgb_install_cmap = FALSE;
-static int xlib_rgb_min_colors = 5 * 5 * 5;
-static Bool xlib_rgb_verbose = FALSE;
-
-#define IMAGE_WIDTH 256
-#define STAGE_ROWSTRIDE (IMAGE_WIDTH * 3)
-#define IMAGE_HEIGHT 64
-#define N_IMAGES 6
-
-static XlibRgbInfo *image_info = NULL;
-static XImage *static_image[N_IMAGES];
-static int static_image_idx;
-
-static unsigned char *colorcube;
-static unsigned char *colorcube_d;
-
-static unsigned long
-xlib_get_prec_from_mask(unsigned long val)
-{
- unsigned long retval = 0;
- unsigned int cur_bit = 0;
- /* walk through the number, incrementing the value if
- the bit in question is set. */
- while (cur_bit < (sizeof(unsigned long) * 8)) {
- if ((val >> cur_bit) & 0x1) {
- retval++;
- }
- cur_bit++;
- }
- return retval;
-}
-
-static unsigned long
-xlib_get_shift_from_mask(unsigned long val)
-{
- unsigned long cur_bit = 0;
- /* walk through the number, looking for the first 1 */
- while (cur_bit < (sizeof(unsigned long) * 8)) {
- if ((val >> cur_bit) & 0x1) {
- return cur_bit;
- }
- cur_bit++;
- }
- return cur_bit;
-}
-
-
-static int
-xlib_rgb_cmap_fail (const char *msg, Colormap cmap, unsigned long *pixels)
-{
- unsigned long free_pixels[256];
- int n_free;
- int i;
-
-#ifdef VERBOSE
- printf ("%s", msg);
-#endif
- n_free = 0;
- for (i = 0; i < 256; i++)
- if (pixels[i] < 256)
- free_pixels[n_free++] = pixels[i];
-
- if (n_free)
- XFreeColors(image_info->display,
- cmap,
- free_pixels,
- n_free,
- 0);
- return 0;
-}
-
-static void
-xlib_rgb_make_colorcube (unsigned long *pixels, int nr, int ng, int nb)
-{
- unsigned char rt[16], gt[16], bt[16];
- int i;
-
- colorcube = malloc(sizeof(unsigned char) * 4096);
- memset(colorcube, 0, (sizeof(unsigned char) * 4096));
- for (i = 0; i < 16; i++)
- {
- rt[i] = ng * nb * ((i * 17 * (nr - 1) + 128) >> 8);
- gt[i] = nb * ((i * 17 * (ng - 1) + 128) >> 8);
- bt[i] = ((i * 17 * (nb - 1) + 128) >> 8);
- }
-
- for (i = 0; i < 4096; i++)
- {
- colorcube[i] = pixels[rt[i >> 8] + gt[(i >> 4) & 0x0f] + bt[i & 0x0f]];
-#ifdef VERBOSE
- printf ("%03x %02x %x %x %x\n", i, colorcube[i], rt[i >> 8], gt[(i >> 4) & 0x0f], bt[i & 0x0f]);
-#endif
- }
-}
-
-/* this is the colorcube suitable for dithering */
-static void
-xlib_rgb_make_colorcube_d (unsigned long *pixels, int nr, int ng, int nb)
-{
- int r, g, b;
- int i;
-
- colorcube_d = malloc(sizeof(unsigned char) * 512);
- memset(colorcube_d, 0, (sizeof(unsigned char) * 512));
- for (i = 0; i < 512; i++)
- {
- r = MIN (nr - 1, i >> 6);
- g = MIN (ng - 1, (i >> 3) & 7);
- b = MIN (nb - 1, i & 7);
- colorcube_d[i] = pixels[(r * ng + g) * nb + b];
- }
-}
-
-/* Try installing a color cube of the specified size.
- Make the colorcube and return TRUE on success */
-static int
-xlib_rgb_try_colormap (int nr, int ng, int nb)
-{
- int r, g, b;
- int ri, gi, bi;
- int r0, g0, b0;
- Colormap cmap;
- XVisualInfo *visual;
- XColor *colors = NULL;
- XColor color;
- unsigned long pixels[256];
- unsigned long junk[256];
- int i;
- int d2;
- unsigned int colors_needed;
- int idx;
- int best[256];
-
- if (nr * ng * nb < xlib_rgb_min_colors)
- return FALSE;
-
- if (image_info->cmap_alloced) {
- cmap = image_info->cmap;
- visual = image_info->x_visual_info;
- }
- else {
- cmap = image_info->default_colormap;
- visual = image_info->x_visual_info;
- }
- colors_needed = nr * ng * nb;
- for (i = 0; i < 256; i++)
- {
- best[i] = 192;
- pixels[i] = 256;
- }
-
-#ifndef GAMMA
- if (!xlib_rgb_install_cmap) {
- /* go out and get the colors for this colormap. */
- colors = malloc(sizeof(XColor) * visual->colormap_size);
- for (i=0; i < visual->colormap_size; i++){
- colors[i].pixel = i;
- }
- XQueryColors (image_info->display,
- cmap,
- colors, visual->colormap_size);
- /* find color cube colors that are already present */
- for (i = 0; i < MIN (256, visual->colormap_size); i++)
- {
- r = colors[i].red >> 8;
- g = colors[i].green >> 8;
- b = colors[i].blue >> 8;
- ri = (r * (nr - 1) + 128) >> 8;
- gi = (g * (ng - 1) + 128) >> 8;
- bi = (b * (nb - 1) + 128) >> 8;
- r0 = ri * 255 / (nr - 1);
- g0 = gi * 255 / (ng - 1);
- b0 = bi * 255 / (nb - 1);
- idx = ((ri * nr) + gi) * nb + bi;
- d2 = (r - r0) * (r - r0) + (g - g0) * (g - g0) + (b - b0) * (b - b0);
- if (d2 < best[idx]) {
- if (pixels[idx] < 256)
- XFreeColors(image_info->display,
- cmap,
- pixels + idx,
- 1, 0);
- else
- colors_needed--;
- color.pixel = colors[i].pixel;
- color.red = colors[i].red;
- color.green = colors[i].green;
- color.blue = colors[i].blue;
- color.flags = 0;
- if (!XAllocColor(image_info->display, cmap, &color))
- return xlib_rgb_cmap_fail ("error allocating system color\n",
- cmap, pixels);
- pixels[idx] = color.pixel; /* which is almost certainly i */
- best[idx] = d2;
- }
- }
- }
-
-#endif
-
- if (colors_needed)
- {
- if (!XAllocColorCells(image_info->display, cmap, 0, NULL, 0, junk, colors_needed))
- {
- char tmp_str[80];
-
- sprintf (tmp_str,
- "%d %d %d colormap failed (in XAllocColorCells)\n",
- nr, ng, nb);
- return xlib_rgb_cmap_fail (tmp_str, cmap, pixels);
- }
- XFreeColors(image_info->display, cmap, junk, (int)colors_needed, 0);
- }
-
- for (r = 0, i = 0; r < nr; r++)
- for (g = 0; g < ng; g++)
- for (b = 0; b < nb; b++, i++)
- {
- if (pixels[i] == 256)
- {
- color.red = r * 65535 / (nr - 1);
- color.green = g * 65535 / (ng - 1);
- color.blue = b * 65535 / (nb - 1);
-
-#ifdef GAMMA
- color.red = 65535 * pow (color.red / 65535.0, 0.5);
- color.green = 65535 * pow (color.green / 65535.0, 0.5);
- color.blue = 65535 * pow (color.blue / 65535.0, 0.5);
-#endif
-
- /* This should be a raw XAllocColor call */
- if (!XAllocColor(image_info->display, cmap, &color))
- {
- char tmp_str[80];
-
- sprintf (tmp_str, "%d %d %d colormap failed\n",
- nr, ng, nb);
- return xlib_rgb_cmap_fail (tmp_str,
- cmap, pixels);
- }
- pixels[i] = color.pixel;
- }
-#ifdef VERBOSE
- printf ("%d: %lx\n", i, pixels[i]);
-#endif
- }
-
- image_info->nred_shades = nr;
- image_info->ngreen_shades = ng;
- image_info->nblue_shades = nb;
- xlib_rgb_make_colorcube (pixels, nr, ng, nb);
- xlib_rgb_make_colorcube_d (pixels, nr, ng, nb);
- if (colors)
- free(colors);
- return TRUE;
-}
-
-/* Return TRUE on success. */
-static Bool
-xlib_rgb_do_colormaps (void)
-{
- static const int sizes[][3] = {
- /* { 6, 7, 6 }, */
- { 6, 6, 6 },
- { 6, 6, 5 },
- { 6, 6, 4 },
- { 5, 5, 5 },
- { 5, 5, 4 },
- { 4, 4, 4 },
- { 4, 4, 3 },
- { 3, 3, 3 },
- { 2, 2, 2 }
- };
- static const int n_sizes = sizeof(sizes) / (3 * sizeof(int));
- int i;
-
- for (i = 0; i < n_sizes; i++)
- if (xlib_rgb_try_colormap (sizes[i][0], sizes[i][1], sizes[i][2]))
- return TRUE;
- return FALSE;
-}
-
-/* Make a 2 x 2 x 2 colorcube */
-static void
-xlib_rgb_colorcube_222 (void)
-{
- int i;
- XColor color;
- Colormap cmap;
-
- if (image_info->cmap_alloced)
- cmap = image_info->cmap;
- else
- cmap = image_info->default_colormap;
-
- colorcube_d = malloc(sizeof(unsigned char) * 512);
-
- for (i = 0; i < 8; i++)
- {
- color.red = ((i & 4) >> 2) * 65535;
- color.green = ((i & 2) >> 1) * 65535;
- color.blue = (i & 1) * 65535;
- XAllocColor (image_info->display, cmap, &color);
- colorcube_d[((i & 4) << 4) | ((i & 2) << 2) | (i & 1)] = color.pixel;
- }
-}
-
-/**
- * xlib_rgb_set_verbose:
- * @verbose: %True to be verbose
- *
- * Enables/disables debug spew.
- **/
-void
-xlib_rgb_set_verbose (Bool verbose)
-{
- xlib_rgb_verbose = verbose;
-}
-
-/**
- * xlib_rgb_set_install:
- * @install: %True to install a colormap
- *
- * Sets whether we install an RGB colormap.
- **/
-void
-xlib_rgb_set_install (Bool install)
-{
- xlib_rgb_install_cmap = install;
-}
-
-/**
- * xlib_rgb_set_min_colors:
- * @min_colors: minimum colors to use
- *
- * Sets the minimum number of colors in the color cube.
- **/
-void
-xlib_rgb_set_min_colors (int min_colors)
-{
- xlib_rgb_min_colors = min_colors;
-}
-
-/* Return a "score" based on the following criteria (in hex):
-
- x000 is the quality - 1 is 1bpp, 2 is 4bpp,
- 4 is 8bpp,
- 7 is 15bpp truecolor, 8 is 16bpp truecolor,
- 9 is 24bpp truecolor.
- 0x00 is the speed - 1 is the normal case,
- 2 means faster than normal
- 00x0 gets a point for being the system visual
- 000x gets a point for being pseudocolor
-
- A caveat: in the 8bpp modes, being the system visual seems to be
- quite important. Thus, all of the 8bpp modes should be ranked at
- the same speed.
-*/
-
-static guint32
-xlib_rgb_score_visual (XVisualInfo *visual)
-{
- guint32 quality, speed, pseudo, sys;
- static const char * const visual_names[] =
- {
- "static gray",
- "grayscale",
- "static color",
- "pseudo color",
- "true color",
- "direct color",
- };
-
-
- quality = 0;
- speed = 1;
- sys = 0;
- if (visual->class == TrueColor ||
- visual->class == DirectColor)
- {
- if (visual->depth == 24)
- {
- quality = 9;
- /* Should test for MSB visual here, and set speed if so. */
- }
- else if (visual->depth == 16)
- quality = 8;
- else if (visual->depth == 15)
- quality = 7;
- else if (visual->depth == 8)
- quality = 4;
- }
- else if (visual->class == PseudoColor ||
- visual->class == StaticColor)
- {
- if (visual->depth == 8)
- quality = 4;
- else if (visual->depth == 4)
- quality = 2;
- else if (visual->depth == 1)
- quality = 1;
- }
- else if (visual->class == StaticGray
-#ifdef ENABLE_GRAYSCALE
- || visual->class == GrayScale
-#endif
- )
- {
- if (visual->depth == 8)
- quality = 4;
- else if (visual->depth == 4)
- quality = 2;
- else if (visual->depth == 1)
- quality = 1;
- }
-
- if (quality == 0)
- return 0;
-
- sys = (visual->visualid == image_info->default_visualid->visualid);
-
- pseudo = (visual->class == PseudoColor || visual->class == TrueColor);
-
- if (xlib_rgb_verbose)
- printf ("Visual 0x%x, type = %s, depth = %d, %ld:%ld:%ld%s; score=%x\n",
- (int)visual->visualid,
- visual_names[visual->class],
- visual->depth,
- visual->red_mask,
- visual->green_mask,
- visual->blue_mask,
- sys ? " (system)" : "",
- (quality << 12) | (speed << 8) | (sys << 4) | pseudo);
-
- return (quality << 12) | (speed << 8) | (sys << 4) | pseudo;
-}
-
-static void
-xlib_rgb_choose_visual (void)
-{
- XVisualInfo *visuals;
- XVisualInfo *visual;
- XVisualInfo *best_visual;
- XVisualInfo *final_visual;
- XVisualInfo template;
- int num_visuals;
- guint32 score, best_score;
- int cur_visual = 1;
- int i;
-
- template.screen = image_info->screen_num;
- visuals = XGetVisualInfo(image_info->display, VisualScreenMask,
- &template, &num_visuals);
-
- best_visual = visuals;
- best_score = xlib_rgb_score_visual (best_visual);
-
- for (i = cur_visual; i < num_visuals; i++)
- {
- visual = &visuals[i];
- score = xlib_rgb_score_visual (visual);
- if (score > best_score)
- {
- best_score = score;
- best_visual = visual;
- }
- }
- /* make a copy of the visual so that we can free
- the allocated visual list above. */
- final_visual = malloc(sizeof(XVisualInfo));
- memcpy(final_visual, best_visual, sizeof(XVisualInfo));
- image_info->x_visual_info = final_visual;
- XFree(visuals);
- /* set up the shift and the precision for the red, green and blue.
- this only applies to cool visuals like true color and direct color. */
- if (image_info->x_visual_info->class == TrueColor ||
- image_info->x_visual_info->class == DirectColor) {
- image_info->red_shift = xlib_get_shift_from_mask(image_info->x_visual_info->red_mask);
- image_info->red_prec = xlib_get_prec_from_mask(image_info->x_visual_info->red_mask);
- image_info->green_shift = xlib_get_shift_from_mask(image_info->x_visual_info->green_mask);
- image_info->green_prec = xlib_get_prec_from_mask(image_info->x_visual_info->green_mask);
- image_info->blue_shift = xlib_get_shift_from_mask(image_info->x_visual_info->blue_mask);
- image_info->blue_prec = xlib_get_prec_from_mask(image_info->x_visual_info->blue_mask);
- }
-}
-
-static void
-xlib_rgb_choose_visual_for_xprint (int aDepth)
-{
- XVisualInfo *visuals;
- XVisualInfo *visual;
- XVisualInfo *best_visual;
- XVisualInfo *final_visual;
- XVisualInfo template;
- int num_visuals;
- int cur_visual = 1;
- int i;
-
- XWindowAttributes win_att;
- Status ret_stat;
- Visual *root_visual;
-
- ret_stat = XGetWindowAttributes(image_info->display,
- RootWindow(image_info->display, image_info->screen_num),
- &win_att);
- root_visual = win_att.visual;
- template.screen = image_info->screen_num;
- visuals = XGetVisualInfo(image_info->display, VisualScreenMask,
- &template, &num_visuals);
-
- best_visual = visuals;
- if (best_visual->visual != root_visual) {
- for (i = cur_visual; i < num_visuals; i++) {
- visual = &visuals[i];
- if (visual->visual == root_visual) {
- best_visual = visual;
- break;
- }
- }
- }
- /* make a copy of the visual so that we can free
- the allocated visual list above. */
- final_visual = malloc(sizeof(XVisualInfo));
- memcpy(final_visual, best_visual, sizeof(XVisualInfo));
- image_info->x_visual_info = final_visual;
- XFree(visuals);
- /* set up the shift and the precision for the red, green and blue.
- this only applies to cool visuals like true color and direct color. */
- if (image_info->x_visual_info->class == TrueColor ||
- image_info->x_visual_info->class == DirectColor) {
- image_info->red_shift = xlib_get_shift_from_mask(image_info->x_visual_info->red_mask);
- image_info->red_prec = xlib_get_prec_from_mask(image_info->x_visual_info->red_mask);
- image_info->green_shift = xlib_get_shift_from_mask(image_info->x_visual_info->green_mask);
- image_info->green_prec = xlib_get_prec_from_mask(image_info->x_visual_info->green_mask);
- image_info->blue_shift = xlib_get_shift_from_mask(image_info->x_visual_info->blue_mask);
- image_info->blue_prec = xlib_get_prec_from_mask(image_info->x_visual_info->blue_mask);
- }
-}
-
-static void xlib_rgb_select_conv (XImage *image, ByteOrder byte_order);
-
-static void
-xlib_rgb_set_gray_cmap (Colormap cmap)
-{
- int i;
- XColor color;
- int status;
- unsigned long pixels[256];
- int r, g, b, gray;
-
- for (i = 0; i < 256; i++)
- {
- color.pixel = i;
- color.red = i * 257;
- color.green = i * 257;
- color.blue = i * 257;
- status = XAllocColor(image_info->display, cmap, &color);
- pixels[i] = color.pixel;
-#ifdef VERBOSE
- printf ("allocating pixel %d, %x %x %x, result %d\n",
- color.pixel, color.red, color.green, color.blue, status);
-#endif
- }
-
- /* Now, we make fake colorcubes - we ultimately just use the pseudocolor
- methods. */
-
- colorcube = malloc(sizeof(unsigned char) * 4096);
-
- for (i = 0; i < 4096; i++)
- {
- r = (i >> 4) & 0xf0;
- r = r | r >> 4;
- g = i & 0xf0;
- g = g | g >> 4;
- b = (i << 4 & 0xf0);
- b = b | b >> 4;
- gray = (g + ((r + b) >> 1)) >> 1;
- colorcube[i] = pixels[gray];
- }
-}
-
-/**
- * xlib_rgb_init:
- * @display: X Display to use.
- * @screen: Screen to use.
- *
- * Initializes the XlibRGB machinery with the default depth. If you use this
- * function XlibRGB will automatically pick the best visual available on your
- * display. This function or xlib_rgb_init_with_depth() must be called before
- * using any of the other functions in XlibRGB.
- **/
-void
-xlib_rgb_init (Display *display, Screen *screen)
-{
- int prefDepth = -1; /* let the function do the visual scoring */
- xlib_rgb_init_with_depth(display, screen, prefDepth);
-}
-
-/**
- * xlib_rgb_init_with_depth:
- * @display: X display to use.
- * @screen: Screen to use.
- * @prefDepth: Visual depth to use for color substitution tables. This must
- * be one of the supported visual depths in the specified @display.
- *
- * Initializes the XlibRGB machinery with a particular depth you specify,
- * instead of automatically picking the best depth in the display. This
- * function or xlib_rgb_init() must be called before using any of the other
- * functions in XlibRGB.
- **/
-void
-xlib_rgb_init_with_depth (Display *display, Screen *screen, int prefDepth)
-{
- int i;
- static const int byte_order[1] = { 1 };
-
- static int initialized = 0;
-
- if (initialized)
- {
- return;
- }
-
- initialized = 1;
-
- /* check endian sanity */
-#if G_BYTE_ORDER == G_BIG_ENDIAN
- if (((char *)byte_order)[0] == 1) {
- printf ("xlib_rgb_init: compiled for big endian, but this is a little endian machine.\n\n");
- exit(1);
- }
-#else
- if (((char *)byte_order)[0] != 1) {
- printf ("xlib_rgb_init: compiled for little endian, but this is a big endian machine.\n\n");
- exit(1);
- }
-#endif
-
- if (image_info == NULL)
- {
- image_info = malloc(sizeof(XlibRgbInfo));
- memset(image_info, 0, sizeof(XlibRgbInfo));
-
- image_info->display = display;
- image_info->screen = screen;
- image_info->screen_num = XScreenNumberOfScreen(screen);
- image_info->x_visual_info = NULL;
- image_info->cmap = 0;
- image_info->default_visualid = DefaultVisual(display, image_info->screen_num);
- image_info->default_colormap = DefaultColormap(display, image_info->screen_num);
-
- image_info->color_pixels = NULL;
- image_info->gray_pixels = NULL;
- image_info->reserved_pixels = NULL;
-
- image_info->nred_shades = 6;
- image_info->ngreen_shades = 6;
- image_info->nblue_shades = 4;
- image_info->ngray_shades = 24;
- image_info->nreserved = 0;
-
- image_info->bpp = 0;
- image_info->cmap_alloced = FALSE;
- image_info->gamma_val = 1.0;
-
- image_info->stage_buf = NULL;
-
- image_info->own_gc = NULL;
-
- image_info->red_shift = 0;
- image_info->red_prec = 0;
- image_info->green_shift = 0;
- image_info->green_prec = 0;
- image_info->blue_shift = 0;
- image_info->blue_prec = 0;
-
- if (prefDepth != -1)
- xlib_rgb_choose_visual_for_xprint (prefDepth);
- else
- xlib_rgb_choose_visual ();
-
- if ((image_info->x_visual_info->class == PseudoColor ||
- image_info->x_visual_info->class == StaticColor) &&
- image_info->x_visual_info->depth < 8 &&
- image_info->x_visual_info->depth >= 3)
- {
- image_info->cmap = image_info->default_colormap;
- xlib_rgb_colorcube_222 ();
- }
- else if (image_info->x_visual_info->class == PseudoColor)
- {
- if (xlib_rgb_install_cmap ||
- image_info->x_visual_info->visualid != image_info->default_visualid->visualid)
- {
- image_info->cmap = XCreateColormap(image_info->display,
- RootWindow(image_info->display, image_info->screen_num),
- image_info->x_visual_info->visual,
- AllocNone);
- image_info->cmap_alloced = TRUE;
- }
- if (!xlib_rgb_do_colormaps ())
- {
- image_info->cmap = XCreateColormap(image_info->display,
- RootWindow(image_info->display, image_info->screen_num),
- image_info->x_visual_info->visual,
- AllocNone);
- image_info->cmap_alloced = TRUE;
- xlib_rgb_do_colormaps ();
- }
- if (xlib_rgb_verbose)
- printf ("color cube: %d x %d x %d\n",
- image_info->nred_shades,
- image_info->ngreen_shades,
- image_info->nblue_shades);
-
- if (!image_info->cmap_alloced)
- image_info->cmap = image_info->default_colormap;
- }
-#ifdef ENABLE_GRAYSCALE
- else if (image_info->x_visual_info->class == GrayScale)
- {
- image_info->cmap = XCreateColormap(image_info->display,
- RootWindow(image_info->display, image_info->screen_num),
- image_info->x_visual_info->visual,
- AllocNone);
- xlib_rgb_set_gray_cmap (image_info->cmap);
- image_info->cmap_alloced = TRUE;
- }
-#endif
- else
- {
- /* Always install colormap in direct color. */
- if (image_info->x_visual_info->class != DirectColor &&
- image_info->x_visual_info->visualid == image_info->default_visualid->visualid)
- image_info->cmap = image_info->default_colormap;
- else
- {
- image_info->cmap = XCreateColormap(image_info->display,
- RootWindow(image_info->display, image_info->screen_num),
- image_info->x_visual_info->visual,
- AllocNone);
- image_info->cmap_alloced = TRUE;
- }
- }
-
- image_info->bitmap = (image_info->x_visual_info->depth == 1);
-
- for (i = 0; i < N_IMAGES; i++) {
- if (image_info->bitmap) {
- /* Use malloc() instead of g_malloc since X will free() this mem */
- static_image[i] = XCreateImage(image_info->display,
- image_info->x_visual_info->visual,
- 1,
- XYBitmap,
- 0, NULL, IMAGE_WIDTH, IMAGE_HEIGHT,
- 8,
- 0);
- static_image[i]->data = malloc(IMAGE_WIDTH * IMAGE_HEIGHT >> 3);
- static_image[i]->bitmap_bit_order = MSBFirst;
- static_image[i]->byte_order = MSBFirst;
- }
- else {
- static_image[i] = XCreateImage(image_info->display,
- image_info->x_visual_info->visual,
- (unsigned int)image_info->x_visual_info->depth,
- ZPixmap,
- 0, NULL,
- IMAGE_WIDTH,
- IMAGE_HEIGHT,
- 32, 0);
- /* remove this when we are using shared memory.. */
- static_image[i]->data = malloc((size_t)IMAGE_WIDTH * IMAGE_HEIGHT * image_info->x_visual_info->depth);
- static_image[i]->bitmap_bit_order = MSBFirst;
- static_image[i]->byte_order = MSBFirst;
- }
- }
- /* ok, so apparently, image_info->bpp is actually
- BYTES per pixel. What fun! */
- switch (static_image[0]->bits_per_pixel) {
- case 1:
- case 8:
- image_info->bpp = 1;
- break;
- case 16:
- image_info->bpp = 2;
- break;
- case 24:
- image_info->bpp = 3;
- break;
- case 32:
- image_info->bpp = 4;
- break;
- }
- xlib_rgb_select_conv (static_image[0], MSB_FIRST);
- }
-}
-
-/**
- * xlib_rgb_xpixel_from_rgb:
- * @rgb: 32-bit representation of an RGB value, specified as 0x00RRGGBB.
- *
- * Converts an RGB triplet into the closest color that XlibRGB visual can
- * handle.
- *
- * Return value: X pixel value that corresponds to the closest color in the
- * XlibRGB visual and colormap.
- **/
-unsigned long
-xlib_rgb_xpixel_from_rgb (guint32 rgb)
-{
- unsigned long pixel = 0;
-
- if (image_info->bitmap)
- {
- return ((rgb & 0xff0000) >> 16) +
- ((rgb & 0xff00) >> 7) +
- (rgb & 0xff) > 510;
- }
- else if (image_info->x_visual_info->class == PseudoColor)
- pixel = colorcube[((rgb & 0xf00000) >> 12) |
- ((rgb & 0xf000) >> 8) |
- ((rgb & 0xf0) >> 4)];
- else if (image_info->x_visual_info->depth < 8 &&
- image_info->x_visual_info->class == StaticColor)
- {
- pixel = colorcube_d[((rgb & 0x800000) >> 17) |
- ((rgb & 0x8000) >> 12) |
- ((rgb & 0x80) >> 7)];
- }
- else if (image_info->x_visual_info->class == TrueColor ||
- image_info->x_visual_info->class == DirectColor)
- {
-#ifdef VERBOSE
- printf ("shift, prec: r %d %d g %d %d b %d %d\n",
- image_info->red_shift,
- image_info->red_prec,
- image_info->green_shift,
- image_info->green_prec,
- image_info->blue_shift,
- image_info->blue_prec);
-#endif
-
- pixel = (((((rgb & 0xff0000) >> 16) >>
- (8 - image_info->red_prec)) <<
- image_info->red_shift) +
- ((((rgb & 0xff00) >> 8) >>
- (8 - image_info->green_prec)) <<
- image_info->green_shift) +
- (((rgb & 0xff) >>
- (8 - image_info->blue_prec)) <<
- image_info->blue_shift));
- }
- else if (image_info->x_visual_info->class == StaticGray ||
- image_info->x_visual_info->class == GrayScale)
- {
- int gray = ((rgb & 0xff0000) >> 16) +
- ((rgb & 0xff00) >> 7) +
- (rgb & 0xff);
-
- return gray >> (10 - image_info->x_visual_info->depth);
- }
-
- return pixel;
-}
-
-/**
- * xlib_rgb_gc_set_foreground:
- * @gc: A graphic context.
- * @rgb: 32-bit representation of an RGB value, specified as 0x00RRGGBB.
- *
- * This is a convenience function to set the foreground of a GC from an RGB
- * triplet. It calls xlib_rgb_xpixel_from_rgb() internally and uses the
- * returned pixel value to set the GC's foreground.
- **/
-void
-xlib_rgb_gc_set_foreground (GC gc, guint32 rgb)
-{
- unsigned long color;
-
- color = xlib_rgb_xpixel_from_rgb (rgb);
- XSetForeground(image_info->display, gc, color);
-}
-
-/**
- * xlib_rgb_gc_set_background:
- * @gc: A graphic context.
- * @rgb: 32-bit representation of an RGB value, specified as 0x00RRGGBB.
- *
- * This is a convenience function to set the background of a GC from an RGB
- * triplet. It calls xlib_rgb_xpixel_from_rgb() internally and uses the
- * returned pixel value to set the GC's background.
- **/
-void
-xlib_rgb_gc_set_background (GC gc, guint32 rgb)
-{
- unsigned long color;
-
- color = xlib_rgb_xpixel_from_rgb (rgb);
- XSetBackground(image_info->display, gc, color);
-}
-
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
-#define HAIRY_CONVERT_8
-#endif
-
-#ifdef HAIRY_CONVERT_8
-static void
-xlib_rgb_convert_8 (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int x, y;
- int bpl;
- unsigned char *obuf, *obptr;
- unsigned char *bptr, *bp2;
- int r, g, b;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax;
- for (y = 0; y < height; y++)
- {
- bp2 = bptr;
- obptr = obuf;
- if (((unsigned long)obuf | (unsigned long) bp2) & 3)
- {
- for (x = 0; x < width; x++)
- {
- r = *bp2++;
- g = *bp2++;
- b = *bp2++;
- obptr[0] = colorcube[((r & 0xf0) << 4) |
- (g & 0xf0) |
- (b >> 4)];
- obptr++;
- }
- }
- else
- {
- for (x = 0; x < width - 3; x += 4)
- {
- guint32 r1b0g0r0;
- guint32 g2r2b1g1;
- guint32 b3g3r3b2;
-
- r1b0g0r0 = ((guint32 *)bp2)[0];
- g2r2b1g1 = ((guint32 *)bp2)[1];
- b3g3r3b2 = ((guint32 *)bp2)[2];
- ((guint32 *)obptr)[0] =
- colorcube[((r1b0g0r0 & 0xf0) << 4) |
- ((r1b0g0r0 & 0xf000) >> 8) |
- ((r1b0g0r0 & 0xf00000) >> 20)] |
- (colorcube[((r1b0g0r0 & 0xf0000000) >> 20) |
- (g2r2b1g1 & 0xf0) |
- ((g2r2b1g1 & 0xf000) >> 12)] << 8) |
- (colorcube[((g2r2b1g1 & 0xf00000) >> 12) |
- ((g2r2b1g1 & 0xf0000000) >> 24) |
- ((b3g3r3b2 & 0xf0) >> 4)] << 16) |
- (colorcube[((b3g3r3b2 & 0xf000) >> 4) |
- ((b3g3r3b2 & 0xf00000) >> 16) |
- (b3g3r3b2 >> 28)] << 24);
- bp2 += 12;
- obptr += 4;
- }
- for (; x < width; x++)
- {
- r = *bp2++;
- g = *bp2++;
- b = *bp2++;
- obptr[0] = colorcube[((r & 0xf0) << 4) |
- (g & 0xf0) |
- (b >> 4)];
- obptr++;
- }
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-#else
-static void
-xlib_rgb_convert_8 (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int x, y;
- int bpl;
- unsigned char *obuf, *obptr;
- unsigned char *bptr, *bp2;
- int r, g, b;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax;
- for (y = 0; y < height; y++)
- {
- bp2 = bptr;
- obptr = obuf;
- for (x = 0; x < width; x++)
- {
- r = *bp2++;
- g = *bp2++;
- b = *bp2++;
- obptr[0] = colorcube[((r & 0xf0) << 4) |
- (g & 0xf0) |
- (b >> 4)];
- obptr++;
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-#endif
-
-#if 1
-
-/* This dither table was generated by Raph Levien using patented
- technology (US Patent 5,276,535). The dither table itself is in the
- public domain. */
-
-#define DM_WIDTH 128
-#define DM_WIDTH_SHIFT 7
-#define DM_HEIGHT 128
-static const unsigned char DM[128][128] =
-{
- { 0, 41, 23, 5, 17, 39, 7, 15, 62, 23, 40, 51, 31, 47, 9, 32, 52, 27, 57, 25, 6, 61, 27, 52, 37, 7, 40, 63, 18, 36, 10, 42, 25, 62, 45, 34, 20, 42, 37, 14, 35, 29, 50, 10, 61, 2, 40, 8, 37, 12, 58, 22, 5, 41, 10, 39, 0, 60, 11, 46, 2, 55, 38, 17, 36, 59, 13, 54, 37, 56, 8, 29, 16, 13, 63, 22, 41, 55, 7, 20, 49, 14, 23, 55, 37, 23, 19, 36, 15, 49, 23, 63, 30, 14, 38, 27, 53, 13, 22, 41, 19, 31, 7, 19, 50, 30, 49, 16, 3, 32, 56, 40, 29, 34, 8, 48, 19, 45, 4, 51, 12, 46, 35, 49, 16, 42, 12, 62 },
- { 30, 57, 36, 54, 47, 34, 52, 27, 43, 4, 28, 7, 17, 36, 62, 13, 44, 7, 18, 48, 33, 21, 44, 14, 30, 47, 12, 33, 5, 55, 31, 58, 13, 30, 4, 17, 52, 10, 60, 26, 46, 0, 39, 27, 42, 22, 47, 25, 60, 32, 9, 38, 48, 17, 59, 30, 49, 18, 34, 25, 51, 19, 5, 48, 21, 8, 28, 46, 1, 32, 41, 19, 54, 47, 37, 18, 28, 11, 44, 30, 39, 56, 2, 33, 8, 42, 61, 28, 58, 8, 46, 9, 41, 4, 58, 7, 21, 48, 59, 10, 52, 14, 42, 57, 12, 25, 7, 53, 42, 24, 11, 50, 17, 59, 42, 2, 36, 60, 32, 17, 63, 29, 21, 7, 59, 32, 24, 39 },
- { 22, 8, 16, 32, 3, 25, 13, 57, 18, 45, 58, 39, 55, 20, 5, 42, 23, 34, 63, 1, 51, 10, 58, 4, 60, 23, 53, 27, 44, 21, 3, 48, 8, 50, 43, 54, 27, 32, 5, 55, 21, 58, 12, 53, 6, 36, 14, 50, 17, 29, 53, 15, 24, 52, 7, 36, 13, 42, 4, 53, 9, 35, 61, 26, 56, 32, 49, 15, 62, 23, 6, 60, 2, 31, 4, 48, 58, 38, 15, 61, 5, 25, 47, 28, 50, 15, 7, 40, 3, 32, 33, 52, 25, 50, 35, 42, 61, 3, 28, 36, 23, 63, 4, 33, 46, 62, 36, 23, 60, 6, 54, 28, 4, 37, 23, 55, 25, 8, 42, 54, 14, 6, 56, 38, 19, 52, 4, 46 },
- { 48, 53, 43, 12, 45, 63, 30, 37, 9, 34, 21, 1, 25, 47, 29, 58, 3, 54, 15, 39, 29, 17, 38, 35, 20, 43, 1, 49, 15, 59, 29, 39, 22, 35, 16, 23, 1, 47, 39, 18, 8, 44, 25, 31, 57, 19, 63, 4, 45, 3, 42, 61, 1, 31, 45, 20, 57, 29, 62, 21, 32, 41, 14, 44, 3, 39, 5, 34, 10, 43, 51, 35, 23, 52, 40, 10, 21, 1, 53, 18, 51, 43, 12, 62, 18, 54, 26, 51, 20, 57, 14, 1, 62, 16, 11, 18, 32, 39, 17, 44, 1, 48, 26, 37, 18, 2, 51, 14, 28, 45, 35, 18, 57, 13, 47, 11, 51, 20, 2, 39, 31, 47, 25, 1, 50, 11, 60, 7 },
- { 18, 28, 1, 56, 21, 10, 51, 2, 46, 54, 14, 61, 11, 50, 13, 38, 19, 31, 45, 9, 55, 24, 47, 5, 54, 9, 62, 11, 35, 8, 51, 14, 57, 6, 63, 40, 58, 14, 51, 28, 62, 34, 15, 48, 1, 41, 30, 35, 55, 21, 34, 11, 49, 37, 8, 52, 4, 23, 15, 43, 1, 58, 11, 23, 53, 16, 55, 26, 58, 18, 27, 12, 45, 14, 25, 63, 42, 33, 27, 35, 9, 31, 21, 38, 1, 44, 34, 12, 48, 38, 21, 44, 29, 47, 26, 53, 1, 46, 54, 8, 59, 29, 11, 55, 22, 41, 33, 20, 39, 1, 48, 9, 44, 32, 5, 62, 29, 44, 57, 23, 10, 58, 34, 43, 15, 37, 26, 33 },
- { 51, 38, 59, 24, 35, 42, 19, 60, 5, 32, 41, 26, 43, 33, 7, 53, 48, 11, 59, 23, 42, 2, 61, 30, 16, 40, 32, 24, 56, 41, 19, 33, 37, 26, 47, 9, 31, 22, 2, 45, 9, 54, 4, 37, 21, 52, 11, 23, 7, 57, 16, 25, 55, 18, 63, 27, 46, 39, 56, 10, 50, 37, 29, 47, 19, 63, 24, 9, 46, 2, 39, 60, 9, 57, 30, 7, 49, 11, 59, 3, 45, 57, 5, 60, 29, 22, 5, 60, 30, 9, 59, 18, 40, 6, 57, 36, 30, 12, 24, 34, 15, 40, 52, 6, 49, 9, 58, 4, 63, 12, 26, 61, 22, 53, 38, 16, 35, 14, 28, 50, 42, 17, 5, 28, 62, 20, 54, 12 },
- { 26, 6, 31, 15, 49, 6, 38, 27, 22, 49, 16, 56, 2, 62, 30, 21, 0, 36, 28, 6, 49, 32, 13, 52, 26, 50, 19, 46, 3, 26, 62, 0, 53, 12, 29, 3, 53, 41, 60, 24, 38, 13, 58, 16, 43, 9, 59, 39, 46, 28, 44, 40, 2, 33, 13, 41, 16, 6, 47, 31, 26, 17, 57, 6, 38, 0, 42, 36, 29, 52, 20, 31, 48, 0, 34, 56, 20, 36, 23, 54, 14, 41, 24, 37, 10, 55, 46, 25, 16, 45, 36, 4, 55, 23, 15, 8, 50, 62, 5, 56, 44, 20, 13, 28, 59, 31, 24, 47, 31, 52, 37, 17, 40, 0, 26, 49, 3, 60, 7, 33, 0, 61, 53, 40, 8, 45, 2, 41 },
- { 16, 63, 43, 4, 61, 24, 56, 13, 53, 8, 36, 12, 24, 41, 16, 46, 60, 26, 52, 39, 14, 57, 21, 37, 0, 45, 7, 59, 38, 17, 43, 10, 45, 20, 61, 43, 19, 11, 33, 17, 50, 32, 23, 61, 28, 49, 26, 0, 18, 51, 5, 60, 22, 58, 29, 0, 59, 34, 19, 62, 3, 52, 7, 44, 30, 59, 13, 50, 15, 62, 7, 17, 38, 22, 44, 15, 40, 4, 47, 28, 33, 17, 49, 16, 51, 40, 10, 56, 0, 53, 13, 49, 28, 38, 60, 21, 43, 19, 37, 27, 3, 51, 34, 39, 0, 45, 15, 43, 10, 21, 3, 55, 8, 33, 59, 10, 41, 18, 52, 24, 46, 20, 30, 13, 58, 22, 36, 57 },
- { 50, 34, 11, 47, 29, 17, 44, 0, 33, 63, 28, 46, 52, 5, 57, 10, 42, 18, 4, 63, 20, 8, 44, 10, 56, 34, 14, 29, 5, 54, 23, 59, 32, 49, 7, 34, 49, 27, 56, 0, 42, 7, 46, 3, 40, 6, 54, 32, 62, 13, 36, 10, 47, 8, 35, 49, 24, 51, 12, 40, 22, 35, 60, 12, 22, 51, 33, 4, 40, 25, 43, 55, 5, 54, 12, 61, 26, 51, 8, 62, 0, 53, 7, 63, 2, 32, 19, 34, 42, 24, 31, 63, 2, 10, 45, 33, 0, 48, 9, 61, 22, 47, 8, 62, 18, 56, 7, 54, 27, 57, 46, 30, 50, 19, 45, 30, 56, 36, 22, 47, 11, 38, 3, 51, 32, 48, 18, 9 },
- { 0, 21, 40, 19, 52, 9, 37, 48, 20, 40, 3, 18, 27, 38, 35, 22, 31, 56, 13, 35, 46, 28, 60, 40, 27, 18, 61, 50, 41, 30, 7, 36, 2, 25, 16, 57, 5, 15, 47, 29, 55, 19, 30, 52, 15, 34, 20, 12, 43, 30, 20, 54, 25, 44, 53, 12, 38, 5, 55, 27, 48, 15, 33, 27, 45, 8, 19, 28, 56, 11, 33, 49, 18, 36, 29, 2, 45, 16, 39, 19, 31, 43, 27, 35, 20, 52, 26, 6, 61, 11, 41, 17, 29, 51, 20, 56, 25, 32, 41, 17, 53, 31, 25, 14, 42, 23, 35, 16, 38, 6, 34, 12, 15, 62, 6, 21, 13, 1, 63, 9, 55, 27, 43, 25, 14, 4, 31, 55 },
- { 44, 29, 61, 2, 35, 58, 26, 15, 60, 10, 51, 59, 14, 55, 8, 50, 2, 44, 25, 51, 1, 33, 16, 4, 48, 36, 2, 21, 12, 57, 48, 13, 51, 55, 40, 28, 37, 62, 8, 39, 12, 63, 36, 10, 59, 24, 56, 47, 9, 50, 41, 1, 32, 17, 6, 21, 61, 30, 9, 43, 1, 54, 41, 2, 54, 37, 48, 61, 1, 46, 21, 3, 58, 24, 50, 32, 60, 10, 57, 25, 46, 12, 59, 4, 45, 13, 57, 47, 27, 39, 5, 58, 47, 14, 35, 4, 52, 13, 60, 6, 36, 10, 45, 55, 4, 50, 29, 2, 61, 50, 25, 58, 44, 24, 36, 42, 54, 28, 40, 32, 16, 56, 6, 62, 46, 39, 60, 23 },
- { 7, 48, 14, 54, 23, 40, 4, 45, 30, 22, 42, 32, 1, 44, 20, 29, 58, 8, 37, 19, 41, 54, 24, 58, 9, 53, 25, 46, 34, 16, 23, 38, 27, 11, 18, 1, 52, 21, 35, 22, 48, 5, 25, 45, 18, 38, 2, 27, 35, 4, 57, 15, 62, 39, 57, 28, 42, 16, 36, 60, 24, 18, 10, 63, 20, 5, 16, 23, 37, 14, 59, 27, 41, 8, 13, 42, 21, 35, 6, 50, 3, 38, 15, 48, 30, 39, 17, 3, 49, 14, 53, 33, 24, 7, 61, 44, 11, 39, 23, 49, 19, 58, 1, 32, 36, 12, 60, 41, 20, 13, 41, 4, 39, 1, 48, 8, 18, 51, 14, 44, 5, 37, 21, 34, 1, 26, 10, 37 },
- { 53, 36, 27, 9, 50, 12, 32, 55, 2, 57, 7, 17, 48, 34, 63, 15, 40, 26, 62, 11, 49, 6, 31, 39, 22, 42, 6, 63, 1, 39, 60, 4, 42, 61, 32, 45, 24, 44, 2, 60, 16, 41, 53, 1, 33, 61, 49, 17, 63, 23, 45, 26, 33, 3, 23, 46, 2, 50, 20, 4, 45, 34, 49, 30, 39, 58, 44, 31, 53, 34, 6, 52, 30, 47, 63, 1, 53, 22, 42, 31, 58, 23, 54, 22, 61, 8, 36, 59, 22, 35, 21, 1, 55, 40, 27, 16, 30, 54, 2, 29, 43, 16, 39, 63, 21, 46, 26, 10, 48, 32, 19, 53, 30, 56, 26, 60, 33, 4, 61, 23, 49, 59, 15, 53, 19, 58, 42, 16 },
- { 20, 5, 59, 46, 25, 62, 7, 19, 43, 25, 37, 61, 11, 24, 4, 54, 12, 52, 3, 32, 17, 61, 12, 47, 15, 55, 18, 31, 53, 28, 9, 50, 21, 6, 55, 9, 58, 14, 54, 26, 33, 7, 31, 58, 13, 21, 8, 42, 29, 6, 37, 11, 48, 52, 14, 60, 11, 39, 56, 32, 14, 58, 7, 26, 17, 4, 42, 8, 11, 47, 19, 38, 10, 17, 26, 37, 9, 55, 28, 13, 18, 40, 6, 33, 1, 43, 25, 11, 51, 7, 62, 43, 18, 37, 3, 57, 45, 9, 38, 58, 5, 52, 27, 7, 17, 53, 5, 57, 37, 2, 63, 9, 22, 15, 11, 38, 25, 45, 35, 0, 28, 10, 41, 30, 50, 8, 31, 57 },
- { 49, 33, 16, 38, 1, 42, 51, 34, 53, 14, 28, 49, 30, 56, 36, 23, 43, 20, 38, 56, 22, 45, 28, 0, 62, 35, 26, 44, 11, 19, 52, 35, 44, 15, 30, 38, 10, 31, 40, 4, 46, 50, 20, 40, 27, 44, 51, 14, 56, 53, 19, 59, 7, 29, 41, 19, 35, 25, 8, 52, 22, 44, 13, 53, 50, 32, 61, 24, 56, 25, 63, 0, 45, 57, 33, 59, 16, 46, 4, 62, 50, 11, 60, 37, 52, 19, 55, 29, 37, 46, 13, 26, 48, 10, 50, 34, 21, 63, 26, 13, 42, 33, 22, 55, 35, 28, 43, 15, 24, 51, 27, 34, 46, 49, 58, 3, 52, 9, 57, 19, 48, 55, 3, 35, 12, 45, 24, 3 },
- { 41, 11, 56, 28, 18, 31, 22, 10, 37, 6, 47, 13, 3, 41, 9, 46, 0, 48, 29, 6, 34, 10, 55, 37, 20, 8, 49, 3, 41, 59, 14, 25, 0, 63, 19, 47, 27, 51, 17, 57, 23, 10, 61, 6, 54, 3, 38, 31, 0, 22, 34, 43, 20, 55, 31, 0, 49, 63, 29, 38, 3, 62, 28, 40, 0, 22, 14, 35, 2, 48, 15, 43, 23, 14, 3, 29, 49, 20, 39, 34, 0, 44, 29, 9, 15, 47, 5, 42, 0, 31, 58, 5, 31, 61, 23, 15, 0, 47, 19, 50, 24, 3, 59, 11, 44, 0, 31, 59, 6, 42, 17, 60, 0, 39, 20, 31, 43, 17, 29, 40, 12, 25, 60, 22, 52, 15, 63, 29 },
- { 20, 52, 8, 44, 62, 4, 59, 49, 17, 63, 21, 39, 60, 18, 52, 27, 33, 59, 14, 51, 59, 43, 24, 5, 51, 30, 57, 17, 32, 5, 37, 56, 48, 34, 42, 3, 60, 5, 36, 13, 43, 37, 18, 34, 25, 12, 59, 24, 47, 36, 11, 50, 3, 38, 9, 58, 16, 5, 43, 18, 47, 10, 37, 18, 59, 46, 29, 52, 40, 12, 34, 28, 56, 36, 53, 7, 43, 8, 24, 52, 26, 17, 56, 43, 24, 32, 63, 20, 57, 16, 22, 52, 36, 8, 41, 56, 29, 32, 54, 7, 35, 57, 14, 48, 20, 62, 13, 39, 53, 29, 8, 45, 13, 29, 7, 61, 14, 54, 6, 63, 38, 32, 18, 43, 2, 39, 6, 47 },
- { 0, 58, 23, 35, 13, 46, 12, 39, 0, 31, 55, 24, 5, 35, 15, 61, 17, 5, 39, 25, 18, 2, 50, 33, 41, 13, 39, 23, 62, 46, 29, 12, 22, 8, 56, 25, 20, 49, 32, 62, 0, 56, 11, 46, 63, 42, 9, 16, 55, 5, 60, 15, 62, 26, 45, 21, 36, 51, 13, 57, 31, 24, 55, 6, 35, 9, 57, 5, 20, 60, 7, 51, 5, 19, 40, 25, 61, 32, 56, 12, 36, 48, 21, 2, 58, 12, 39, 28, 9, 50, 40, 12, 44, 18, 25, 49, 6, 38, 11, 62, 18, 46, 30, 9, 40, 25, 49, 19, 10, 36, 55, 22, 33, 52, 41, 18, 37, 27, 49, 21, 2, 46, 7, 53, 33, 61, 27, 35 },
- { 41, 31, 5, 39, 51, 26, 33, 57, 27, 41, 9, 44, 54, 29, 48, 7, 44, 36, 57, 10, 31, 63, 16, 45, 11, 60, 1, 47, 7, 20, 43, 3, 58, 36, 13, 52, 39, 7, 15, 28, 22, 48, 30, 21, 1, 29, 49, 44, 27, 17, 40, 30, 24, 42, 12, 53, 33, 7, 47, 20, 1, 42, 11, 49, 25, 43, 17, 32, 45, 27, 41, 21, 31, 62, 11, 49, 2, 15, 42, 5, 63, 7, 41, 27, 49, 6, 54, 23, 46, 34, 2, 28, 54, 3, 59, 12, 46, 17, 42, 28, 40, 1, 37, 51, 5, 55, 2, 34, 47, 16, 3, 62, 47, 5, 23, 56, 1, 44, 12, 34, 51, 16, 57, 11, 25, 17, 54, 13 },
- { 60, 26, 55, 18, 3, 60, 20, 6, 52, 15, 50, 19, 32, 11, 23, 53, 26, 21, 1, 47, 42, 27, 8, 58, 21, 27, 53, 36, 26, 54, 31, 50, 17, 30, 45, 1, 29, 59, 44, 53, 41, 4, 35, 58, 51, 19, 32, 4, 52, 34, 48, 8, 51, 5, 56, 2, 25, 61, 27, 38, 54, 27, 62, 21, 51, 1, 39, 62, 10, 50, 1, 58, 13, 47, 38, 18, 35, 54, 22, 51, 30, 19, 59, 34, 14, 32, 44, 4, 60, 15, 52, 62, 20, 43, 30, 35, 21, 60, 4, 52, 12, 24, 61, 18, 30, 42, 23, 61, 25, 50, 27, 38, 11, 59, 12, 35, 50, 30, 59, 24, 8, 42, 28, 37, 48, 9, 44, 21 },
- { 10, 47, 15, 50, 30, 43, 8, 45, 29, 2, 36, 59, 1, 58, 41, 3, 63, 31, 54, 20, 13, 55, 35, 38, 4, 44, 15, 9, 61, 2, 14, 38, 61, 10, 23, 54, 18, 12, 24, 2, 14, 55, 16, 8, 38, 14, 41, 60, 10, 23, 1, 58, 32, 17, 28, 37, 41, 15, 3, 60, 15, 33, 4, 36, 16, 59, 28, 14, 23, 55, 37, 18, 44, 28, 2, 57, 30, 10, 27, 46, 14, 38, 3, 53, 21, 61, 17, 35, 10, 41, 26, 7, 33, 9, 57, 1, 53, 37, 26, 20, 56, 48, 9, 33, 58, 16, 37, 7, 45, 1, 57, 15, 32, 26, 42, 23, 7, 20, 4, 54, 31, 62, 22, 1, 59, 30, 4, 51 },
- { 36, 2, 38, 11, 24, 36, 54, 22, 62, 47, 25, 8, 28, 45, 16, 38, 12, 43, 9, 37, 49, 3, 23, 52, 18, 30, 50, 33, 19, 42, 49, 26, 6, 40, 47, 35, 63, 38, 50, 33, 60, 26, 36, 47, 24, 57, 6, 26, 39, 63, 19, 44, 14, 46, 61, 9, 50, 30, 45, 23, 10, 50, 44, 8, 31, 54, 6, 46, 36, 4, 30, 54, 8, 52, 22, 41, 4, 60, 40, 0, 58, 24, 45, 10, 37, 1, 48, 30, 56, 17, 38, 48, 24, 47, 19, 39, 14, 8, 45, 32, 2, 34, 27, 44, 4, 52, 11, 56, 31, 21, 40, 19, 44, 51, 2, 63, 46, 58, 36, 43, 14, 5, 50, 38, 14, 56, 40, 23 },
- { 61, 46, 32, 63, 54, 1, 14, 34, 12, 40, 18, 49, 37, 10, 61, 30, 51, 24, 60, 7, 29, 40, 62, 11, 46, 58, 6, 56, 24, 10, 34, 52, 21, 59, 16, 3, 27, 5, 20, 46, 9, 40, 7, 62, 2, 30, 53, 15, 48, 10, 28, 35, 54, 6, 21, 34, 18, 55, 7, 40, 57, 19, 26, 60, 41, 13, 24, 51, 19, 61, 9, 25, 34, 15, 63, 11, 45, 17, 20, 47, 33, 8, 31, 62, 43, 26, 53, 7, 24, 59, 0, 13, 55, 4, 62, 27, 51, 31, 63, 15, 58, 7, 54, 14, 46, 22, 28, 43, 12, 63, 8, 54, 5, 17, 39, 33, 15, 10, 27, 17, 47, 34, 19, 45, 27, 12, 33, 17 },
- { 5, 28, 21, 7, 17, 48, 42, 58, 23, 4, 63, 14, 55, 21, 34, 5, 19, 0, 45, 17, 52, 15, 25, 32, 0, 22, 40, 13, 45, 62, 18, 0, 43, 11, 33, 55, 30, 42, 57, 19, 51, 31, 22, 43, 18, 45, 34, 0, 43, 31, 56, 3, 23, 40, 59, 0, 44, 13, 48, 35, 2, 32, 46, 0, 21, 48, 35, 3, 40, 32, 43, 59, 0, 48, 33, 26, 53, 36, 55, 12, 51, 16, 55, 5, 18, 29, 11, 39, 51, 19, 45, 31, 42, 21, 35, 6, 22, 47, 10, 38, 23, 50, 20, 36, 0, 60, 38, 4, 50, 35, 48, 34, 24, 57, 9, 53, 28, 48, 61, 0, 56, 24, 53, 3, 63, 6, 42, 57 },
- { 13, 53, 45, 40, 58, 27, 6, 16, 38, 51, 33, 30, 43, 2, 47, 56, 40, 50, 33, 57, 27, 5, 47, 42, 60, 36, 16, 54, 28, 4, 37, 57, 28, 51, 22, 8, 45, 14, 6, 39, 0, 54, 11, 59, 28, 12, 50, 21, 61, 13, 19, 38, 49, 11, 25, 37, 58, 29, 22, 63, 14, 56, 12, 53, 30, 63, 9, 57, 26, 12, 47, 16, 23, 39, 50, 6, 31, 2, 25, 6, 28, 41, 36, 22, 50, 57, 42, 3, 34, 8, 28, 61, 11, 50, 16, 54, 41, 0, 55, 43, 5, 29, 41, 63, 25, 16, 53, 18, 26, 10, 21, 0, 61, 30, 41, 22, 3, 38, 20, 39, 29, 8, 41, 16, 36, 52, 22, 19 },
- { 55, 34, 0, 25, 10, 32, 56, 44, 28, 0, 57, 7, 26, 53, 23, 8, 13, 35, 22, 12, 36, 60, 20, 8, 14, 29, 48, 2, 41, 49, 23, 13, 39, 7, 48, 58, 25, 53, 34, 62, 28, 16, 48, 4, 37, 56, 27, 5, 36, 52, 46, 7, 62, 33, 52, 11, 17, 53, 5, 28, 41, 24, 38, 17, 5, 39, 20, 45, 15, 56, 5, 38, 60, 8, 14, 57, 21, 48, 62, 39, 59, 13, 1, 60, 9, 32, 16, 63, 44, 25, 52, 15, 36, 2, 60, 29, 12, 33, 25, 17, 59, 45, 13, 8, 49, 32, 6, 40, 59, 29, 45, 37, 13, 47, 6, 55, 30, 45, 9, 52, 13, 59, 25, 47, 32, 1, 49, 30 },
- { 9, 39, 14, 61, 49, 37, 3, 20, 50, 13, 41, 19, 46, 17, 38, 59, 28, 62, 4, 44, 54, 1, 34, 51, 55, 7, 63, 32, 21, 8, 56, 31, 62, 19, 36, 1, 41, 17, 24, 12, 42, 35, 25, 52, 20, 8, 44, 59, 25, 2, 22, 42, 16, 29, 4, 46, 20, 36, 43, 9, 51, 8, 49, 26, 58, 33, 54, 1, 37, 29, 52, 20, 27, 45, 19, 35, 42, 16, 10, 32, 20, 49, 46, 27, 40, 4, 47, 22, 13, 55, 4, 47, 26, 44, 23, 40, 58, 19, 48, 13, 31, 2, 57, 34, 42, 19, 61, 32, 14, 55, 5, 51, 26, 19, 58, 16, 49, 14, 62, 5, 33, 44, 21, 7, 60, 26, 11, 41 },
- { 62, 24, 47, 29, 8, 19, 53, 11, 60, 24, 32, 61, 4, 55, 31, 2, 49, 16, 39, 9, 31, 24, 43, 17, 26, 38, 11, 25, 58, 43, 12, 35, 3, 46, 15, 32, 63, 4, 49, 56, 2, 60, 10, 32, 63, 17, 39, 12, 55, 30, 57, 9, 48, 55, 39, 24, 60, 2, 58, 31, 19, 61, 34, 3, 42, 11, 22, 46, 7, 61, 10, 42, 3, 55, 32, 1, 58, 28, 44, 54, 4, 34, 23, 15, 56, 20, 37, 58, 6, 30, 38, 18, 63, 9, 32, 5, 51, 3, 62, 37, 52, 18, 39, 23, 3, 51, 9, 47, 1, 23, 43, 15, 60, 35, 11, 40, 1, 36, 31, 26, 57, 2, 37, 54, 18, 44, 58, 16 },
- { 5, 51, 3, 33, 43, 62, 21, 42, 35, 9, 48, 15, 36, 10, 22, 42, 20, 46, 26, 56, 50, 12, 59, 3, 48, 19, 45, 53, 1, 27, 47, 17, 52, 24, 56, 11, 51, 21, 37, 30, 20, 46, 14, 41, 1, 47, 33, 7, 41, 17, 35, 27, 20, 1, 14, 54, 26, 33, 18, 47, 1, 44, 14, 59, 16, 52, 28, 18, 49, 31, 25, 34, 63, 13, 51, 24, 9, 50, 3, 23, 38, 63, 7, 52, 29, 46, 11, 33, 50, 22, 57, 36, 1, 57, 49, 17, 39, 28, 9, 35, 6, 27, 53, 15, 55, 30, 24, 58, 36, 41, 11, 52, 32, 3, 44, 25, 62, 23, 51, 15, 42, 22, 50, 10, 39, 4, 31, 35 },
- { 46, 22, 57, 17, 12, 39, 26, 5, 31, 59, 1, 45, 27, 62, 52, 7, 58, 33, 6, 18, 39, 22, 33, 41, 57, 5, 35, 18, 40, 16, 60, 5, 29, 42, 7, 39, 27, 44, 9, 47, 8, 26, 54, 22, 51, 29, 24, 49, 15, 61, 4, 51, 31, 63, 43, 6, 50, 8, 39, 12, 53, 37, 23, 30, 40, 6, 62, 43, 14, 53, 2, 49, 7, 36, 17, 41, 61, 37, 18, 56, 11, 18, 44, 35, 2, 19, 61, 0, 41, 14, 8, 30, 43, 12, 24, 46, 14, 54, 42, 21, 44, 61, 10, 46, 37, 11, 44, 7, 18, 63, 20, 29, 7, 49, 28, 54, 8, 43, 4, 48, 18, 63, 12, 29, 48, 24, 59, 20 },
- { 13, 36, 28, 54, 35, 2, 56, 46, 16, 49, 22, 40, 11, 34, 14, 43, 29, 12, 63, 48, 2, 61, 7, 15, 28, 30, 50, 9, 61, 33, 38, 23, 54, 13, 61, 33, 3, 59, 16, 35, 58, 40, 5, 38, 13, 57, 3, 58, 37, 21, 45, 12, 39, 7, 35, 30, 13, 56, 22, 62, 27, 6, 55, 10, 48, 21, 33, 2, 38, 23, 40, 20, 44, 29, 59, 4, 26, 12, 33, 47, 28, 53, 31, 13, 59, 41, 27, 49, 26, 54, 45, 16, 53, 21, 35, 7, 59, 26, 11, 56, 1, 24, 33, 4, 28, 62, 21, 49, 31, 2, 56, 39, 24, 58, 13, 17, 37, 21, 56, 10, 38, 0, 34, 55, 15, 43, 1, 52 },
- { 42, 9, 50, 6, 25, 60, 14, 38, 10, 29, 53, 18, 57, 3, 25, 51, 0, 53, 25, 17, 29, 37, 52, 46, 0, 62, 14, 37, 4, 50, 10, 44, 0, 46, 20, 25, 50, 19, 55, 0, 23, 31, 62, 34, 11, 45, 19, 32, 0, 53, 10, 59, 23, 47, 18, 60, 42, 28, 37, 3, 50, 15, 35, 44, 0, 51, 27, 60, 9, 57, 16, 58, 11, 22, 46, 15, 53, 48, 7, 42, 0, 60, 5, 49, 24, 54, 9, 17, 39, 5, 34, 62, 3, 40, 60, 31, 0, 47, 29, 16, 49, 39, 59, 17, 50, 0, 40, 13, 53, 38, 16, 46, 0, 42, 34, 60, 2, 53, 29, 31, 58, 46, 27, 6, 61, 8, 37, 28 },
- { 0, 63, 21, 40, 45, 18, 51, 23, 63, 34, 6, 43, 28, 38, 55, 19, 40, 35, 8, 41, 54, 10, 21, 32, 39, 23, 53, 26, 55, 28, 22, 63, 30, 34, 9, 48, 6, 38, 29, 43, 49, 6, 18, 52, 27, 61, 9, 43, 28, 42, 33, 26, 56, 3, 51, 23, 0, 48, 16, 45, 32, 25, 63, 20, 57, 17, 42, 12, 35, 47, 5, 31, 39, 56, 6, 30, 34, 21, 61, 25, 14, 40, 22, 38, 15, 6, 36, 56, 20, 60, 25, 12, 51, 27, 10, 56, 42, 20, 36, 63, 32, 6, 21, 41, 12, 34, 60, 26, 5, 48, 27, 10, 62, 19, 6, 47, 39, 14, 45, 7, 24, 17, 41, 32, 23, 51, 19, 56 },
- { 45, 31, 15, 59, 4, 33, 7, 47, 0, 41, 13, 61, 4, 47, 9, 23, 60, 14, 57, 31, 4, 45, 59, 6, 58, 10, 44, 20, 8, 42, 15, 6, 55, 17, 58, 31, 53, 12, 61, 10, 15, 57, 43, 2, 23, 35, 48, 14, 54, 6, 18, 49, 15, 38, 11, 34, 62, 9, 21, 58, 11, 41, 4, 31, 38, 8, 29, 55, 19, 36, 27, 52, 0, 25, 50, 43, 1, 39, 8, 55, 35, 51, 10, 30, 45, 62, 29, 2, 46, 10, 32, 48, 18, 38, 5, 22, 33, 8, 51, 3, 14, 44, 54, 25, 57, 30, 18, 52, 33, 22, 59, 28, 36, 52, 32, 21, 26, 50, 5, 55, 35, 60, 14, 54, 4, 40, 16, 33 },
- { 27, 3, 49, 10, 30, 40, 55, 27, 57, 24, 52, 21, 32, 17, 60, 30, 5, 44, 27, 49, 19, 34, 13, 24, 43, 36, 3, 49, 31, 59, 37, 48, 26, 41, 2, 41, 14, 36, 21, 32, 40, 26, 13, 49, 55, 5, 16, 40, 25, 60, 36, 1, 63, 29, 17, 44, 25, 40, 52, 5, 29, 47, 54, 13, 46, 24, 60, 4, 51, 22, 63, 14, 45, 18, 12, 62, 17, 57, 19, 42, 3, 26, 58, 48, 1, 21, 40, 52, 23, 37, 44, 1, 29, 58, 43, 50, 15, 61, 19, 45, 58, 28, 7, 48, 2, 46, 8, 42, 3, 55, 8, 50, 12, 4, 55, 10, 63, 33, 20, 40, 11, 3, 46, 20, 48, 26, 61, 11 },
- { 44, 56, 24, 36, 53, 19, 12, 37, 16, 44, 7, 36, 49, 54, 11, 37, 48, 21, 15, 1, 62, 25, 47, 56, 16, 18, 51, 12, 40, 1, 24, 11, 52, 16, 23, 59, 28, 1, 45, 53, 4, 60, 37, 21, 39, 30, 63, 20, 52, 10, 30, 45, 8, 41, 54, 4, 57, 7, 34, 55, 36, 18, 23, 59, 2, 48, 11, 32, 44, 1, 41, 8, 33, 54, 38, 23, 30, 46, 6, 29, 62, 18, 32, 16, 55, 34, 14, 11, 61, 7, 55, 16, 53, 13, 23, 2, 55, 37, 26, 10, 33, 23, 36, 16, 38, 22, 56, 15, 24, 43, 35, 17, 44, 40, 25, 46, 16, 1, 57, 25, 49, 36, 28, 62, 9, 35, 7, 53 },
- { 17, 38, 8, 61, 1, 50, 26, 62, 3, 31, 56, 15, 1, 26, 40, 2, 34, 51, 56, 36, 42, 9, 38, 2, 29, 60, 32, 57, 19, 62, 34, 47, 4, 57, 39, 7, 44, 63, 24, 18, 46, 28, 8, 54, 1, 34, 7, 46, 3, 37, 50, 23, 57, 21, 13, 46, 31, 20, 43, 15, 1, 61, 8, 33, 37, 17, 56, 26, 15, 49, 24, 59, 28, 3, 56, 9, 52, 32, 13, 49, 10, 43, 5, 45, 8, 25, 59, 42, 28, 33, 19, 40, 8, 63, 35, 47, 25, 4, 40, 52, 1, 60, 12, 53, 63, 9, 29, 60, 37, 19, 1, 62, 31, 20, 58, 12, 41, 30, 43, 9, 18, 52, 22, 1, 39, 30, 58, 21 },
- { 13, 47, 29, 18, 43, 34, 5, 48, 20, 42, 10, 45, 30, 58, 20, 63, 24, 11, 6, 28, 54, 14, 22, 52, 41, 7, 26, 5, 45, 15, 53, 13, 35, 27, 18, 50, 12, 33, 5, 56, 10, 17, 45, 24, 59, 15, 50, 26, 56, 13, 19, 5, 32, 52, 27, 36, 2, 61, 12, 26, 49, 40, 27, 52, 13, 50, 6, 39, 61, 34, 10, 37, 48, 20, 41, 27, 2, 36, 59, 24, 54, 33, 63, 20, 38, 50, 3, 17, 52, 4, 58, 27, 45, 21, 32, 11, 48, 17, 57, 20, 46, 38, 25, 43, 4, 34, 51, 6, 13, 45, 57, 26, 6, 48, 2, 35, 53, 23, 61, 34, 59, 6, 42, 56, 13, 51, 2, 41 },
- { 32, 5, 55, 23, 58, 14, 22, 52, 29, 15, 61, 25, 51, 8, 43, 13, 53, 41, 46, 20, 3, 33, 63, 11, 48, 21, 54, 38, 28, 3, 30, 43, 21, 62, 9, 31, 55, 22, 51, 29, 37, 62, 32, 12, 42, 29, 41, 9, 33, 44, 62, 28, 43, 1, 59, 19, 48, 30, 51, 39, 24, 4, 58, 19, 42, 29, 22, 43, 3, 18, 53, 5, 13, 50, 16, 60, 45, 21, 7, 40, 15, 0, 26, 53, 13, 31, 43, 24, 47, 31, 15, 49, 2, 41, 6, 59, 29, 42, 9, 30, 14, 7, 49, 18, 31, 47, 20, 39, 49, 32, 11, 41, 54, 15, 61, 18, 7, 38, 4, 13, 44, 28, 15, 32, 45, 19, 27, 49 },
- { 63, 34, 11, 39, 2, 45, 37, 8, 59, 39, 33, 4, 36, 17, 48, 5, 29, 18, 32, 61, 39, 50, 5, 27, 35, 0, 46, 12, 22, 49, 60, 6, 54, 0, 38, 49, 2, 42, 15, 40, 0, 47, 20, 51, 3, 57, 18, 61, 22, 0, 39, 16, 55, 12, 35, 8, 41, 22, 6, 59, 16, 45, 10, 36, 0, 62, 9, 54, 30, 58, 21, 43, 63, 31, 7, 35, 12, 48, 58, 28, 47, 37, 41, 9, 57, 20, 61, 0, 36, 11, 57, 35, 23, 52, 37, 18, 0, 62, 22, 55, 35, 62, 27, 54, 0, 15, 61, 28, 2, 59, 22, 9, 37, 27, 33, 51, 29, 48, 19, 50, 25, 37, 10, 57, 5, 37, 60, 8 },
- { 20, 25, 46, 52, 31, 60, 12, 55, 0, 19, 11, 46, 62, 35, 23, 38, 57, 0, 55, 10, 16, 30, 58, 44, 17, 59, 29, 63, 42, 8, 36, 20, 33, 46, 16, 61, 25, 35, 8, 54, 26, 7, 58, 22, 34, 6, 47, 14, 53, 31, 48, 9, 37, 25, 49, 63, 16, 55, 45, 14, 34, 63, 21, 53, 25, 33, 46, 16, 35, 7, 46, 29, 0, 39, 25, 55, 22, 34, 18, 4, 56, 11, 23, 51, 28, 6, 39, 14, 62, 44, 19, 8, 60, 12, 56, 28, 50, 34, 39, 5, 51, 3, 41, 12, 57, 35, 10, 53, 25, 17, 52, 30, 47, 0, 43, 14, 5, 57, 31, 55, 0, 63, 47, 23, 54, 24, 14, 43 },
- { 0, 57, 16, 6, 26, 19, 35, 28, 49, 42, 54, 26, 21, 1, 59, 27, 9, 47, 26, 44, 50, 22, 13, 40, 8, 37, 10, 34, 17, 56, 25, 58, 13, 27, 44, 9, 20, 58, 31, 17, 60, 36, 10, 41, 53, 25, 36, 39, 4, 24, 58, 17, 60, 4, 22, 38, 10, 32, 0, 50, 31, 7, 28, 47, 12, 57, 5, 26, 52, 23, 14, 40, 57, 17, 47, 5, 53, 1, 44, 31, 19, 60, 46, 2, 35, 48, 30, 54, 22, 5, 51, 39, 25, 31, 4, 43, 14, 9, 45, 16, 24, 44, 19, 29, 40, 23, 44, 7, 38, 42, 4, 63, 12, 54, 23, 59, 22, 42, 8, 15, 40, 21, 8, 34, 3, 41, 30, 50 },
- { 39, 10, 48, 33, 41, 54, 5, 47, 23, 13, 32, 7, 52, 44, 14, 39, 58, 18, 35, 6, 37, 2, 60, 24, 55, 19, 53, 2, 51, 32, 1, 41, 51, 4, 40, 29, 47, 3, 52, 44, 13, 49, 28, 16, 1, 62, 11, 27, 52, 35, 5, 42, 29, 47, 14, 56, 28, 53, 26, 38, 9, 56, 40, 3, 38, 15, 41, 60, 1, 37, 50, 25, 11, 28, 61, 19, 42, 62, 10, 52, 39, 6, 32, 14, 58, 17, 7, 26, 42, 34, 27, 10, 54, 40, 20, 63, 26, 53, 21, 61, 32, 7, 59, 48, 3, 56, 18, 31, 58, 14, 49, 21, 36, 16, 45, 9, 36, 24, 62, 45, 27, 31, 53, 17, 49, 12, 62, 18 },
- { 28, 59, 21, 58, 2, 16, 38, 9, 62, 3, 56, 41, 10, 31, 50, 4, 32, 52, 12, 63, 23, 46, 33, 31, 4, 48, 25, 43, 14, 23, 47, 11, 22, 55, 14, 60, 23, 37, 11, 39, 23, 2, 45, 56, 31, 43, 19, 55, 16, 46, 21, 51, 11, 33, 44, 2, 41, 18, 5, 52, 23, 44, 17, 60, 27, 49, 11, 32, 44, 10, 54, 2, 56, 33, 8, 38, 13, 29, 36, 16, 24, 63, 27, 51, 21, 43, 56, 12, 49, 3, 59, 48, 1, 15, 46, 7, 36, 2, 47, 11, 50, 27, 37, 13, 33, 8, 51, 46, 1, 34, 28, 40, 3, 33, 60, 29, 47, 1, 35, 11, 59, 42, 2, 60, 26, 46, 6, 35 },
- { 4, 43, 9, 29, 36, 63, 24, 44, 20, 50, 30, 17, 60, 22, 16, 43, 25, 3, 42, 19, 51, 15, 8, 54, 42, 15, 61, 5, 39, 57, 18, 61, 31, 48, 34, 2, 50, 19, 57, 5, 63, 33, 19, 38, 13, 27, 48, 7, 32, 61, 2, 26, 58, 6, 24, 50, 13, 61, 42, 20, 62, 2, 35, 20, 51, 4, 62, 18, 23, 58, 20, 31, 43, 15, 51, 45, 26, 50, 4, 55, 45, 3, 35, 9, 38, 1, 32, 61, 20, 45, 17, 33, 24, 57, 29, 51, 22, 58, 38, 30, 15, 1, 54, 21, 63, 43, 26, 12, 24, 56, 8, 60, 50, 19, 5, 52, 13, 54, 17, 50, 4, 16, 36, 12, 32, 56, 22, 54 },
- { 51, 25, 40, 53, 12, 49, 15, 57, 34, 7, 38, 47, 2, 36, 55, 8, 61, 30, 56, 7, 28, 59, 48, 11, 27, 35, 21, 45, 28, 36, 9, 38, 6, 16, 24, 63, 10, 32, 28, 43, 21, 53, 5, 60, 8, 57, 3, 45, 11, 37, 15, 54, 40, 20, 62, 36, 27, 34, 11, 48, 30, 15, 54, 8, 30, 42, 22, 34, 48, 13, 35, 63, 4, 37, 22, 2, 59, 9, 41, 23, 13, 41, 49, 18, 59, 24, 40, 5, 37, 30, 9, 61, 44, 6, 37, 11, 33, 17, 5, 55, 41, 60, 23, 39, 17, 5, 30, 62, 41, 16, 46, 25, 11, 56, 39, 26, 20, 38, 29, 39, 22, 52, 44, 20, 48, 1, 38, 14 },
- { 15, 33, 2, 18, 44, 6, 27, 0, 32, 61, 25, 12, 58, 28, 40, 20, 47, 13, 34, 43, 38, 1, 23, 62, 40, 0, 51, 10, 63, 3, 52, 26, 44, 30, 45, 6, 41, 54, 0, 51, 12, 30, 46, 24, 49, 22, 40, 33, 63, 23, 43, 30, 9, 47, 0, 17, 54, 7, 57, 3, 37, 47, 24, 46, 13, 55, 7, 52, 2, 42, 6, 26, 49, 18, 60, 34, 16, 57, 33, 20, 61, 30, 8, 54, 14, 46, 12, 53, 16, 55, 38, 13, 22, 53, 18, 59, 46, 27, 43, 19, 32, 10, 45, 6, 49, 36, 52, 2, 20, 55, 6, 39, 32, 15, 44, 3, 58, 10, 63, 6, 56, 30, 7, 58, 9, 40, 19, 63 },
- { 10, 47, 61, 23, 55, 31, 52, 42, 17, 45, 4, 51, 27, 6, 15, 53, 0, 49, 26, 10, 56, 18, 36, 6, 20, 58, 32, 30, 13, 49, 19, 56, 0, 59, 12, 53, 27, 17, 38, 25, 48, 9, 15, 36, 14, 30, 59, 17, 0, 50, 8, 58, 18, 56, 31, 45, 21, 41, 29, 19, 60, 6, 32, 59, 0, 36, 29, 39, 19, 59, 46, 12, 55, 30, 10, 47, 24, 3, 28, 48, 0, 55, 44, 27, 33, 4, 63, 29, 49, 0, 26, 50, 34, 2, 42, 14, 0, 62, 9, 56, 3, 52, 28, 34, 58, 9, 20, 48, 37, 32, 22, 53, 0, 62, 27, 49, 34, 46, 21, 33, 41, 14, 25, 37, 53, 29, 31, 45 },
- { 56, 28, 7, 37, 11, 36, 20, 9, 54, 14, 39, 19, 34, 63, 45, 37, 24, 17, 60, 31, 21, 45, 53, 29, 47, 15, 7, 55, 40, 23, 34, 14, 42, 20, 37, 35, 15, 59, 7, 62, 34, 40, 59, 1, 51, 42, 10, 28, 54, 21, 35, 5, 38, 13, 36, 4, 59, 12, 39, 53, 15, 43, 9, 21, 39, 62, 16, 56, 25, 9, 32, 38, 0, 41, 14, 51, 40, 53, 43, 11, 37, 17, 5, 22, 57, 39, 19, 7, 42, 21, 60, 10, 31, 63, 25, 52, 30, 49, 36, 25, 48, 17, 61, 14, 22, 42, 29, 13, 60, 11, 47, 18, 35, 41, 7, 23, 4, 16, 51, 11, 0, 48, 61, 3, 17, 50, 5, 24 },
- { 0, 42, 21, 49, 60, 3, 57, 40, 29, 48, 23, 56, 42, 11, 22, 5, 59, 39, 4, 50, 3, 41, 12, 57, 25, 50, 44, 18, 4, 46, 7, 62, 33, 50, 4, 56, 21, 32, 43, 18, 3, 23, 55, 34, 20, 4, 53, 38, 12, 46, 29, 52, 25, 61, 23, 51, 26, 46, 1, 34, 25, 57, 28, 51, 26, 11, 50, 3, 44, 28, 53, 21, 57, 27, 62, 6, 31, 19, 8, 63, 26, 59, 36, 47, 15, 29, 50, 25, 35, 47, 18, 41, 4, 48, 8, 40, 12, 23, 6, 44, 13, 40, 1, 31, 55, 0, 61, 43, 4, 50, 26, 58, 9, 53, 24, 61, 42, 55, 31, 43, 57, 20, 34, 27, 43, 8, 59, 39 },
- { 18, 51, 30, 13, 26, 16, 46, 22, 2, 59, 8, 30, 1, 48, 33, 51, 29, 9, 46, 16, 62, 14, 33, 2, 38, 9, 27, 60, 37, 26, 53, 17, 28, 10, 24, 46, 2, 49, 8, 57, 29, 45, 6, 26, 62, 44, 18, 25, 61, 3, 42, 14, 49, 10, 43, 6, 17, 32, 63, 10, 49, 4, 40, 14, 45, 33, 22, 37, 12, 61, 5, 17, 43, 7, 23, 37, 15, 58, 49, 13, 39, 21, 10, 52, 1, 62, 9, 56, 12, 2, 58, 28, 36, 16, 56, 28, 56, 35, 20, 63, 24, 37, 51, 8, 45, 25, 16, 33, 27, 38, 2, 44, 13, 30, 17, 36, 12, 26, 5, 18, 28, 47, 13, 60, 23, 45, 13, 33 },
- { 55, 4, 62, 34, 52, 38, 7, 63, 32, 37, 13, 53, 25, 62, 18, 12, 55, 41, 27, 35, 24, 49, 31, 52, 17, 63, 34, 1, 56, 12, 41, 2, 48, 58, 39, 16, 61, 27, 41, 52, 13, 19, 50, 39, 11, 31, 57, 6, 32, 40, 20, 55, 1, 28, 33, 57, 48, 8, 37, 22, 44, 18, 53, 1, 61, 5, 54, 16, 47, 36, 50, 24, 55, 34, 48, 45, 1, 30, 33, 46, 2, 50, 32, 42, 25, 34, 43, 21, 38, 52, 23, 45, 14, 54, 21, 4, 44, 16, 53, 29, 10, 47, 19, 57, 12, 54, 39, 10, 51, 15, 63, 21, 57, 40, 51, 1, 48, 57, 37, 62, 2, 38, 9, 52, 1, 35, 58, 22 },
- { 36, 46, 10, 42, 1, 27, 43, 15, 50, 21, 45, 16, 41, 3, 35, 44, 20, 1, 57, 11, 55, 7, 43, 8, 22, 42, 13, 46, 21, 39, 31, 60, 22, 5, 29, 44, 11, 35, 20, 4, 36, 58, 32, 15, 47, 2, 36, 48, 16, 60, 8, 35, 44, 63, 16, 2, 40, 26, 55, 14, 58, 35, 24, 31, 19, 42, 31, 58, 1, 29, 10, 40, 2, 19, 12, 54, 22, 61, 7, 24, 56, 5, 28, 16, 54, 3, 15, 58, 6, 30, 8, 62, 1, 43, 31, 47, 7, 59, 1, 38, 58, 4, 34, 27, 38, 5, 31, 59, 7, 46, 30, 3, 34, 6, 28, 59, 20, 8, 32, 15, 53, 24, 55, 31, 19, 49, 11, 26 },
- { 2, 24, 16, 58, 19, 55, 5, 35, 10, 61, 4, 28, 57, 24, 58, 7, 31, 47, 22, 38, 19, 28, 61, 36, 54, 5, 59, 29, 6, 52, 15, 11, 43, 36, 8, 54, 52, 1, 62, 25, 47, 9, 1, 60, 28, 53, 24, 14, 46, 27, 51, 22, 12, 24, 38, 53, 20, 11, 51, 3, 29, 7, 48, 63, 8, 49, 9, 21, 52, 14, 63, 32, 46, 60, 35, 4, 41, 16, 52, 35, 18, 42, 59, 7, 36, 61, 45, 27, 33, 51, 19, 39, 34, 11, 61, 18, 33, 41, 28, 15, 54, 22, 42, 3, 49, 21, 47, 18, 36, 23, 55, 19, 48, 24, 45, 10, 33, 44, 50, 40, 7, 35, 15, 41, 63, 6, 40, 54 },
- { 62, 41, 32, 8, 47, 28, 60, 24, 44, 30, 38, 49, 9, 33, 14, 40, 50, 14, 60, 2, 54, 40, 0, 20, 25, 39, 16, 49, 24, 35, 57, 47, 19, 61, 33, 18, 23, 37, 13, 55, 31, 43, 22, 41, 17, 8, 42, 58, 0, 37, 5, 56, 31, 54, 7, 30, 60, 33, 42, 17, 59, 39, 12, 27, 38, 17, 35, 41, 27, 45, 20, 7, 25, 15, 29, 58, 27, 47, 11, 40, 14, 54, 23, 46, 19, 31, 11, 40, 13, 49, 5, 58, 24, 51, 26, 6, 50, 20, 49, 9, 32, 46, 17, 60, 14, 63, 24, 1, 57, 41, 9, 43, 14, 62, 16, 52, 3, 27, 14, 22, 61, 45, 4, 28, 9, 47, 29, 17 },
- { 5, 50, 12, 53, 38, 18, 11, 51, 0, 55, 17, 6, 47, 54, 19, 63, 5, 26, 34, 45, 13, 30, 47, 58, 10, 48, 32, 3, 62, 9, 26, 0, 25, 14, 50, 3, 47, 30, 42, 16, 6, 63, 12, 49, 33, 55, 21, 10, 34, 63, 18, 41, 3, 47, 19, 43, 0, 49, 8, 28, 46, 20, 52, 0, 56, 24, 60, 3, 59, 5, 39, 57, 48, 52, 9, 38, 3, 21, 26, 60, 0, 32, 12, 38, 4, 48, 53, 0, 60, 15, 29, 44, 18, 10, 38, 57, 13, 60, 2, 26, 62, 7, 50, 29, 35, 8, 40, 53, 28, 12, 60, 33, 38, 5, 37, 29, 60, 39, 56, 0, 30, 18, 50, 34, 59, 25, 14, 44 },
- { 20, 31, 60, 22, 3, 49, 33, 25, 40, 13, 34, 59, 22, 36, 0, 28, 37, 56, 8, 18, 51, 16, 4, 45, 27, 12, 53, 42, 18, 44, 51, 31, 55, 40, 28, 58, 7, 60, 10, 51, 27, 37, 24, 56, 5, 26, 44, 29, 50, 23, 45, 11, 34, 15, 59, 27, 13, 23, 62, 37, 4, 57, 15, 32, 42, 6, 47, 11, 30, 43, 23, 13, 0, 36, 18, 44, 63, 51, 37, 29, 49, 20, 57, 27, 62, 9, 24, 35, 23, 53, 37, 3, 42, 55, 0, 36, 23, 39, 31, 43, 17, 37, 24, 11, 52, 43, 19, 32, 5, 50, 26, 0, 56, 21, 54, 11, 19, 6, 47, 25, 59, 42, 12, 54, 21, 3, 38, 57 },
- { 48, 0, 35, 27, 44, 14, 59, 7, 57, 46, 26, 2, 42, 12, 52, 43, 10, 27, 53, 42, 32, 62, 37, 21, 34, 61, 7, 23, 36, 4, 38, 12, 41, 5, 17, 45, 22, 27, 39, 21, 59, 0, 45, 18, 39, 62, 3, 38, 14, 7, 54, 26, 61, 39, 9, 52, 45, 36, 18, 50, 10, 34, 44, 22, 50, 14, 36, 55, 17, 34, 53, 62, 33, 26, 56, 6, 31, 12, 6, 53, 9, 44, 2, 50, 20, 40, 55, 17, 47, 7, 26, 63, 22, 32, 48, 16, 46, 8, 52, 12, 57, 41, 0, 56, 25, 3, 61, 14, 45, 35, 18, 44, 12, 46, 23, 42, 32, 51, 35, 10, 17, 36, 23, 1, 45, 52, 32, 10 },
- { 37, 15, 43, 8, 63, 39, 21, 31, 16, 37, 19, 62, 30, 46, 17, 60, 21, 48, 1, 23, 6, 25, 11, 56, 1, 40, 30, 58, 15, 54, 21, 59, 9, 63, 35, 56, 11, 51, 2, 46, 34, 14, 53, 7, 30, 11, 51, 19, 60, 40, 30, 1, 24, 50, 20, 32, 3, 56, 5, 25, 31, 13, 61, 2, 29, 60, 25, 20, 51, 2, 27, 8, 18, 42, 10, 45, 21, 34, 43, 17, 62, 29, 41, 14, 34, 6, 30, 43, 2, 57, 33, 13, 45, 12, 27, 62, 4, 55, 21, 35, 5, 27, 45, 33, 16, 47, 30, 54, 22, 10, 51, 27, 63, 7, 49, 1, 58, 22, 15, 43, 53, 7, 57, 39, 27, 12, 61, 24 },
- { 56, 51, 26, 56, 19, 2, 41, 54, 5, 52, 9, 48, 6, 23, 39, 4, 32, 15, 63, 35, 59, 49, 43, 15, 52, 19, 50, 9, 46, 33, 1, 29, 48, 20, 32, 1, 38, 33, 19, 54, 9, 32, 24, 48, 58, 35, 16, 48, 4, 52, 13, 57, 33, 5, 45, 59, 15, 29, 41, 55, 47, 39, 23, 53, 9, 40, 4, 57, 10, 44, 48, 40, 50, 14, 61, 24, 55, 1, 59, 22, 33, 8, 51, 25, 58, 46, 11, 59, 20, 41, 17, 51, 6, 56, 35, 25, 42, 30, 15, 58, 48, 18, 61, 9, 58, 39, 13, 2, 37, 59, 40, 2, 31, 16, 34, 41, 8, 30, 62, 3, 29, 48, 33, 5, 63, 16, 41, 7 },
- { 22, 4, 46, 11, 33, 51, 29, 10, 62, 24, 43, 27, 15, 58, 50, 25, 54, 44, 9, 38, 18, 3, 29, 57, 32, 5, 26, 43, 17, 61, 24, 52, 8, 42, 23, 53, 15, 61, 7, 28, 57, 43, 4, 40, 20, 2, 43, 25, 32, 35, 21, 43, 17, 48, 10, 22, 38, 54, 11, 21, 1, 58, 16, 30, 48, 18, 46, 32, 38, 13, 22, 4, 59, 35, 2, 51, 30, 39, 15, 47, 4, 56, 13, 37, 1, 28, 16, 52, 32, 9, 61, 29, 38, 19, 3, 52, 10, 48, 1, 32, 11, 40, 20, 36, 6, 22, 49, 29, 55, 6, 20, 56, 36, 52, 19, 60, 26, 46, 18, 54, 40, 13, 20, 46, 35, 19, 49, 29 },
- { 61, 17, 34, 53, 23, 6, 48, 35, 20, 40, 1, 56, 36, 29, 11, 34, 7, 41, 14, 30, 55, 20, 46, 8, 24, 38, 63, 2, 37, 10, 45, 14, 34, 49, 6, 13, 44, 25, 49, 41, 21, 12, 61, 15, 54, 29, 63, 12, 56, 8, 49, 2, 62, 36, 28, 61, 0, 25, 41, 63, 35, 8, 44, 6, 37, 62, 7, 21, 63, 28, 55, 31, 16, 24, 41, 19, 9, 57, 27, 36, 18, 42, 31, 62, 22, 55, 38, 4, 27, 47, 1, 40, 14, 54, 43, 20, 60, 23, 38, 63, 25, 51, 2, 53, 26, 63, 10, 42, 17, 34, 47, 25, 13, 5, 44, 11, 55, 2, 38, 27, 6, 60, 52, 25, 9, 55, 1, 40 },
- { 8, 30, 58, 3, 42, 61, 17, 38, 13, 59, 32, 10, 54, 3, 51, 20, 61, 26, 57, 2, 46, 33, 12, 60, 41, 13, 48, 29, 55, 20, 39, 27, 57, 18, 62, 29, 55, 2, 31, 16, 37, 50, 26, 36, 6, 46, 9, 41, 27, 57, 23, 39, 26, 6, 51, 12, 31, 46, 7, 16, 27, 52, 19, 56, 26, 12, 33, 53, 1, 41, 8, 57, 46, 7, 54, 32, 47, 5, 49, 11, 60, 23, 5, 48, 10, 43, 19, 63, 35, 24, 49, 21, 59, 5, 31, 37, 14, 44, 7, 42, 6, 30, 46, 13, 44, 32, 19, 50, 4, 58, 8, 30, 62, 38, 28, 53, 21, 36, 13, 50, 21, 33, 15, 2, 44, 31, 14, 47 },
- { 37, 13, 39, 16, 28, 9, 57, 0, 25, 49, 21, 45, 18, 47, 12, 42, 0, 49, 22, 39, 16, 53, 25, 36, 0, 52, 22, 16, 6, 60, 4, 51, 0, 26, 37, 47, 10, 36, 63, 5, 57, 0, 18, 59, 23, 33, 51, 19, 0, 44, 15, 11, 54, 17, 42, 35, 53, 18, 58, 33, 49, 4, 34, 42, 0, 50, 43, 25, 16, 49, 34, 20, 37, 28, 12, 63, 16, 38, 25, 44, 0, 40, 52, 17, 35, 3, 50, 14, 8, 53, 11, 36, 25, 45, 9, 62, 0, 54, 28, 17, 50, 55, 15, 24, 57, 0, 53, 34, 23, 41, 15, 45, 0, 49, 16, 4, 48, 9, 63, 45, 0, 42, 58, 37, 61, 22, 54, 26 },
- { 0, 50, 21, 47, 54, 36, 27, 45, 52, 4, 34, 15, 63, 29, 37, 59, 17, 31, 6, 61, 28, 5, 48, 18, 59, 27, 34, 56, 44, 31, 35, 12, 41, 59, 16, 3, 40, 20, 50, 22, 30, 40, 52, 10, 45, 3, 59, 22, 37, 61, 29, 46, 31, 58, 2, 22, 9, 43, 3, 39, 14, 61, 24, 54, 15, 29, 11, 60, 39, 17, 5, 61, 0, 44, 50, 3, 31, 14, 58, 21, 54, 28, 15, 45, 60, 26, 33, 58, 44, 22, 60, 2, 57, 34, 49, 27, 18, 34, 21, 59, 29, 4, 36, 41, 8, 39, 28, 11, 62, 26, 53, 20, 35, 24, 59, 32, 29, 39, 24, 31, 57, 23, 11, 28, 5, 36, 11, 59 },
- { 44, 32, 63, 5, 20, 12, 41, 7, 30, 61, 42, 8, 39, 5, 33, 8, 24, 53, 45, 11, 37, 58, 7, 44, 10, 50, 3, 40, 8, 22, 53, 19, 46, 9, 33, 52, 24, 58, 8, 44, 13, 47, 8, 34, 38, 30, 14, 47, 7, 34, 4, 55, 9, 19, 40, 49, 56, 26, 60, 21, 30, 45, 10, 19, 40, 58, 23, 36, 3, 52, 45, 23, 54, 13, 22, 42, 53, 45, 7, 33, 10, 36, 57, 6, 29, 12, 41, 0, 30, 15, 41, 30, 17, 7, 16, 53, 40, 56, 2, 39, 12, 61, 10, 52, 31, 60, 16, 45, 1, 37, 7, 61, 40, 10, 43, 17, 58, 7, 54, 14, 4, 51, 39, 49, 18, 56, 42, 20 },
- { 14, 6, 24, 36, 56, 49, 22, 60, 18, 14, 23, 51, 26, 57, 21, 52, 41, 14, 35, 50, 19, 31, 40, 23, 33, 14, 63, 17, 32, 47, 7, 62, 23, 30, 56, 11, 42, 27, 14, 60, 35, 19, 28, 61, 17, 55, 25, 39, 53, 17, 42, 21, 38, 63, 25, 5, 14, 36, 12, 50, 1, 37, 59, 32, 2, 51, 6, 56, 27, 32, 11, 30, 38, 26, 60, 8, 26, 19, 62, 39, 50, 2, 21, 39, 53, 23, 56, 19, 49, 39, 5, 46, 55, 23, 42, 4, 31, 11, 47, 26, 45, 22, 48, 18, 21, 5, 48, 25, 57, 14, 47, 30, 3, 56, 12, 50, 1, 42, 19, 47, 35, 17, 8, 30, 45, 25, 4, 51 },
- { 28, 58, 43, 1, 31, 8, 33, 2, 44, 55, 32, 1, 60, 12, 46, 27, 4, 62, 23, 1, 56, 13, 62, 2, 54, 36, 25, 51, 1, 57, 26, 42, 3, 49, 17, 38, 1, 48, 31, 4, 54, 3, 50, 24, 1, 49, 5, 63, 13, 27, 52, 1, 48, 13, 45, 33, 52, 30, 46, 20, 55, 28, 6, 48, 24, 38, 20, 47, 14, 62, 48, 9, 58, 4, 36, 30, 56, 1, 34, 12, 18, 63, 25, 48, 4, 16, 37, 7, 62, 10, 52, 28, 13, 50, 36, 63, 24, 51, 15, 58, 8, 33, 1, 38, 56, 35, 42, 9, 33, 51, 22, 18, 48, 32, 27, 37, 23, 61, 33, 11, 59, 29, 62, 1, 53, 10, 60, 33 },
- { 12, 39, 17, 52, 26, 46, 53, 38, 25, 11, 48, 36, 16, 43, 2, 35, 55, 17, 39, 29, 43, 9, 28, 45, 20, 5, 46, 12, 42, 28, 13, 52, 36, 6, 60, 22, 54, 17, 62, 39, 25, 42, 15, 55, 44, 20, 31, 10, 35, 57, 24, 32, 29, 6, 59, 18, 7, 62, 3, 41, 10, 44, 16, 54, 13, 62, 31, 9, 41, 1, 21, 43, 18, 47, 15, 40, 11, 49, 28, 55, 46, 30, 8, 43, 32, 61, 28, 47, 25, 34, 21, 61, 32, 1, 20, 9, 46, 6, 35, 19, 41, 54, 27, 63, 14, 3, 51, 20, 62, 2, 38, 55, 8, 21, 63, 6, 46, 9, 26, 51, 3, 24, 43, 34, 16, 41, 18, 48 },
- { 62, 23, 55, 9, 15, 62, 19, 13, 58, 40, 6, 30, 54, 19, 50, 31, 10, 44, 6, 59, 21, 47, 51, 15, 60, 39, 30, 54, 21, 61, 19, 33, 14, 29, 43, 11, 34, 45, 7, 21, 10, 56, 36, 6, 38, 11, 58, 42, 2, 47, 11, 60, 50, 16, 41, 28, 38, 23, 47, 17, 35, 63, 22, 33, 42, 5, 45, 17, 53, 35, 25, 56, 33, 6, 51, 19, 60, 23, 43, 15, 5, 40, 58, 13, 51, 1, 45, 11, 54, 3, 43, 8, 37, 48, 59, 29, 39, 21, 61, 43, 3, 31, 10, 44, 24, 29, 60, 12, 28, 40, 11, 25, 43, 52, 14, 41, 16, 57, 44, 20, 40, 55, 12, 21, 57, 27, 35, 2 },
- { 37, 6, 31, 42, 40, 4, 29, 50, 0, 20, 63, 28, 9, 58, 14, 24, 63, 26, 48, 16, 34, 4, 32, 38, 23, 11, 58, 4, 37, 9, 45, 5, 63, 48, 26, 57, 2, 28, 32, 51, 46, 29, 13, 62, 27, 46, 28, 18, 50, 15, 40, 4, 19, 34, 54, 0, 53, 9, 26, 58, 28, 5, 49, 0, 57, 27, 19, 60, 29, 8, 59, 12, 37, 63, 24, 46, 3, 37, 6, 52, 26, 32, 20, 36, 9, 22, 59, 18, 35, 51, 14, 57, 17, 24, 12, 44, 56, 0, 30, 13, 59, 20, 49, 17, 54, 43, 6, 34, 46, 17, 58, 36, 0, 34, 29, 54, 25, 2, 36, 15, 60, 6, 37, 46, 4, 50, 9, 45 },
- { 19, 59, 48, 3, 24, 60, 44, 22, 34, 51, 15, 45, 41, 5, 33, 47, 0, 37, 12, 55, 25, 54, 8, 57, 0, 47, 18, 34, 49, 15, 55, 24, 40, 20, 8, 35, 53, 13, 41, 18, 0, 59, 22, 33, 4, 52, 8, 60, 24, 36, 31, 56, 45, 26, 10, 43, 15, 56, 36, 4, 51, 14, 39, 30, 12, 55, 36, 2, 39, 49, 4, 44, 17, 0, 32, 13, 53, 35, 59, 17, 62, 0, 55, 24, 52, 38, 31, 6, 42, 19, 29, 40, 4, 54, 33, 5, 16, 27, 52, 37, 23, 55, 7, 37, 0, 39, 23, 49, 4, 53, 31, 15, 59, 10, 50, 4, 60, 34, 48, 7, 31, 49, 27, 14, 62, 22, 53, 29 },
- { 46, 21, 14, 51, 36, 17, 7, 57, 10, 32, 3, 37, 22, 60, 39, 18, 56, 20, 42, 3, 36, 10, 44, 26, 41, 29, 53, 27, 2, 39, 30, 52, 0, 59, 15, 48, 23, 61, 6, 58, 37, 12, 40, 49, 16, 39, 20, 44, 0, 62, 8, 21, 3, 59, 23, 32, 49, 31, 12, 44, 22, 59, 18, 50, 24, 7, 43, 52, 15, 23, 41, 26, 51, 28, 55, 39, 21, 27, 10, 42, 12, 45, 27, 47, 3, 15, 63, 26, 55, 0, 60, 26, 45, 18, 62, 38, 58, 49, 8, 47, 4, 33, 46, 29, 57, 13, 56, 16, 59, 21, 5, 47, 23, 39, 18, 44, 13, 22, 28, 53, 19, 0, 58, 32, 41, 7, 26, 13 },
- { 0, 56, 34, 28, 11, 55, 31, 47, 26, 41, 56, 13, 53, 28, 11, 49, 7, 52, 32, 61, 50, 22, 63, 17, 13, 56, 7, 19, 43, 62, 10, 21, 37, 32, 43, 4, 38, 19, 44, 25, 31, 54, 5, 23, 61, 30, 53, 12, 35, 22, 43, 53, 37, 48, 7, 62, 20, 2, 61, 41, 8, 34, 47, 9, 63, 34, 28, 10, 55, 33, 14, 57, 7, 47, 9, 61, 4, 49, 31, 50, 21, 38, 8, 16, 57, 44, 33, 5, 49, 36, 12, 50, 7, 34, 10, 25, 2, 22, 36, 15, 26, 61, 18, 9, 22, 46, 32, 8, 27, 37, 44, 30, 55, 3, 62, 24, 38, 56, 5, 45, 38, 24, 43, 10, 19, 54, 39, 61 },
- { 41, 30, 8, 63, 43, 23, 38, 3, 62, 19, 8, 49, 25, 1, 58, 30, 23, 40, 9, 28, 18, 40, 6, 38, 49, 22, 35, 59, 8, 27, 50, 5, 56, 17, 11, 50, 30, 9, 55, 2, 51, 19, 34, 47, 9, 41, 6, 26, 48, 57, 14, 28, 17, 12, 39, 13, 37, 46, 25, 19, 54, 27, 1, 37, 16, 45, 20, 60, 1, 48, 20, 38, 31, 22, 42, 15, 19, 44, 1, 61, 6, 34, 56, 40, 29, 10, 20, 46, 13, 22, 41, 23, 59, 42, 30, 51, 45, 13, 63, 53, 42, 12, 51, 38, 62, 2, 26, 41, 50, 1, 61, 10, 19, 42, 31, 8, 49, 32, 12, 63, 9, 52, 16, 56, 36, 2, 31, 16 },
- { 52, 5, 47, 20, 1, 53, 12, 50, 16, 35, 43, 21, 33, 43, 16, 44, 3, 59, 14, 46, 1, 30, 60, 33, 2, 45, 12, 42, 31, 47, 14, 33, 46, 25, 55, 27, 60, 36, 16, 42, 14, 46, 26, 1, 55, 15, 63, 32, 2, 38, 5, 47, 33, 61, 30, 52, 4, 57, 6, 38, 11, 43, 61, 24, 52, 3, 31, 22, 42, 10, 62, 3, 59, 11, 35, 57, 33, 54, 24, 14, 29, 48, 18, 2, 60, 41, 53, 24, 32, 62, 3, 53, 15, 1, 55, 17, 32, 40, 6, 31, 1, 40, 28, 5, 35, 52, 19, 63, 13, 33, 17, 41, 52, 26, 15, 57, 1, 20, 42, 17, 35, 27, 48, 5, 25, 50, 44, 11 },
- { 35, 25, 38, 57, 33, 17, 40, 6, 59, 27, 54, 5, 61, 10, 52, 26, 36, 19, 51, 35, 57, 48, 11, 20, 54, 25, 61, 16, 1, 58, 24, 61, 3, 39, 7, 47, 1, 22, 49, 28, 63, 10, 58, 32, 17, 36, 45, 19, 51, 29, 59, 10, 50, 1, 23, 42, 18, 29, 51, 21, 56, 32, 14, 5, 40, 58, 47, 13, 54, 35, 29, 45, 18, 52, 26, 2, 38, 8, 46, 36, 58, 11, 52, 35, 17, 28, 1, 58, 9, 39, 17, 28, 37, 48, 20, 9, 57, 24, 50, 19, 58, 16, 48, 25, 43, 11, 35, 6, 45, 24, 56, 4, 36, 7, 47, 35, 52, 28, 59, 30, 2, 61, 21, 33, 63, 12, 18, 59 },
- { 3, 49, 15, 10, 27, 61, 25, 45, 30, 0, 14, 47, 31, 38, 17, 62, 7, 55, 27, 4, 15, 24, 42, 52, 10, 34, 5, 51, 36, 18, 41, 11, 35, 21, 62, 13, 33, 57, 8, 35, 5, 40, 21, 43, 52, 3, 24, 56, 11, 16, 33, 25, 41, 20, 55, 8, 60, 35, 15, 48, 2, 57, 30, 49, 18, 25, 6, 39, 17, 57, 7, 25, 43, 5, 49, 16, 62, 22, 55, 4, 25, 43, 23, 7, 50, 11, 37, 48, 14, 51, 33, 57, 7, 27, 39, 46, 4, 29, 11, 43, 34, 56, 7, 60, 20, 54, 30, 57, 22, 49, 9, 33, 54, 14, 63, 23, 6, 43, 10, 40, 50, 13, 44, 8, 38, 33, 46, 23 },
- { 55, 39, 22, 50, 44, 4, 36, 9, 52, 23, 37, 59, 21, 2, 46, 13, 31, 41, 11, 45, 62, 29, 6, 37, 19, 48, 30, 23, 44, 7, 53, 28, 54, 16, 41, 29, 44, 18, 52, 24, 60, 15, 48, 7, 27, 59, 9, 34, 42, 54, 7, 63, 4, 46, 31, 27, 45, 0, 40, 26, 34, 17, 37, 10, 53, 29, 36, 50, 2, 27, 51, 11, 61, 37, 23, 41, 30, 7, 18, 50, 39, 14, 63, 32, 45, 61, 19, 30, 25, 44, 2, 47, 23, 63, 11, 34, 59, 37, 60, 3, 22, 14, 44, 30, 15, 0, 47, 15, 3, 38, 61, 20, 27, 45, 11, 39, 51, 16, 55, 3, 22, 54, 29, 58, 1, 57, 6, 29 },
- { 9, 17, 60, 2, 34, 56, 20, 62, 39, 12, 49, 6, 29, 56, 34, 48, 0, 58, 22, 38, 18, 43, 56, 0, 63, 14, 55, 3, 59, 31, 15, 45, 0, 49, 6, 58, 3, 38, 12, 45, 0, 37, 29, 57, 13, 39, 30, 49, 0, 23, 44, 36, 16, 57, 13, 54, 11, 24, 63, 9, 53, 7, 62, 42, 0, 59, 15, 23, 63, 34, 40, 16, 32, 0, 53, 12, 48, 28, 59, 33, 0, 53, 9, 27, 3, 22, 54, 5, 56, 9, 61, 13, 42, 14, 52, 19, 0, 21, 47, 27, 53, 36, 3, 50, 39, 58, 25, 40, 53, 28, 12, 50, 0, 59, 32, 2, 21, 34, 26, 46, 37, 7, 18, 47, 24, 14, 53, 42 },
- { 61, 32, 13, 54, 29, 7, 46, 13, 28, 57, 18, 41, 53, 15, 9, 39, 24, 49, 33, 3, 53, 9, 26, 32, 40, 28, 46, 39, 25, 9, 56, 21, 63, 37, 26, 22, 51, 27, 17, 56, 31, 53, 4, 43, 22, 46, 12, 18, 60, 40, 20, 26, 50, 21, 39, 5, 49, 33, 16, 44, 22, 46, 20, 32, 24, 45, 8, 43, 12, 46, 4, 48, 56, 20, 29, 58, 3, 40, 10, 42, 31, 21, 47, 41, 56, 38, 15, 42, 36, 27, 20, 33, 55, 3, 26, 44, 31, 54, 12, 35, 9, 63, 28, 10, 21, 32, 9, 60, 17, 8, 43, 29, 40, 16, 36, 48, 60, 7, 57, 14, 62, 31, 42, 15, 36, 40, 20, 26 },
- { 0, 37, 47, 23, 41, 18, 32, 48, 1, 35, 8, 25, 4, 26, 63, 20, 54, 8, 16, 61, 35, 23, 51, 15, 58, 7, 12, 20, 50, 34, 42, 4, 38, 10, 32, 47, 8, 60, 41, 20, 9, 25, 50, 19, 62, 1, 37, 56, 28, 8, 53, 11, 3, 58, 34, 43, 19, 60, 38, 4, 58, 31, 3, 51, 11, 55, 38, 30, 21, 58, 19, 26, 9, 44, 36, 13, 46, 20, 62, 24, 13, 60, 5, 28, 12, 34, 7, 59, 0, 53, 45, 6, 38, 30, 50, 7, 62, 16, 41, 5, 46, 18, 55, 42, 51, 5, 45, 23, 34, 48, 19, 58, 5, 25, 54, 19, 13, 41, 28, 21, 0, 49, 10, 60, 4, 51, 9, 45 },
- { 19, 28, 6, 58, 10, 51, 4, 22, 55, 42, 60, 45, 34, 51, 42, 5, 30, 45, 27, 40, 13, 47, 4, 49, 21, 38, 60, 29, 2, 57, 17, 27, 52, 19, 61, 14, 30, 34, 2, 44, 63, 33, 11, 35, 16, 51, 25, 6, 14, 47, 31, 61, 37, 29, 18, 8, 52, 2, 28, 54, 13, 41, 15, 62, 35, 18, 2, 60, 6, 33, 41, 61, 31, 6, 56, 17, 34, 50, 6, 52, 44, 35, 16, 51, 59, 24, 48, 18, 31, 40, 16, 49, 21, 60, 17, 39, 10, 49, 32, 57, 24, 39, 1, 25, 18, 62, 37, 12, 56, 1, 37, 11, 52, 44, 9, 30, 47, 4, 51, 40, 55, 25, 34, 27, 56, 30, 32, 54 },
- { 63, 40, 49, 15, 43, 26, 63, 38, 16, 20, 30, 12, 57, 14, 19, 60, 36, 12, 59, 2, 57, 17, 42, 31, 1, 44, 16, 35, 47, 11, 32, 48, 13, 43, 1, 39, 51, 12, 57, 23, 6, 40, 53, 3, 55, 31, 39, 60, 35, 44, 5, 15, 45, 1, 62, 41, 26, 14, 47, 22, 36, 27, 50, 9, 26, 47, 52, 28, 54, 16, 1, 13, 51, 39, 23, 63, 1, 30, 15, 26, 2, 57, 19, 37, 1, 44, 21, 50, 13, 63, 8, 24, 56, 1, 35, 25, 58, 20, 2, 28, 14, 51, 33, 59, 13, 30, 4, 49, 31, 24, 63, 26, 33, 3, 58, 38, 62, 24, 32, 8, 17, 45, 5, 48, 18, 3, 43, 11 },
- { 21, 4, 24, 34, 59, 1, 37, 11, 53, 5, 47, 2, 22, 40, 32, 1, 24, 50, 21, 29, 38, 25, 63, 8, 55, 24, 53, 6, 62, 23, 59, 3, 54, 20, 58, 24, 5, 46, 15, 38, 48, 14, 27, 42, 23, 7, 46, 10, 17, 58, 25, 52, 23, 32, 49, 12, 55, 30, 40, 7, 59, 1, 56, 21, 39, 4, 23, 15, 37, 46, 55, 42, 21, 4, 48, 8, 45, 54, 37, 55, 32, 8, 46, 10, 30, 54, 4, 41, 25, 29, 36, 48, 11, 43, 14, 47, 5, 43, 53, 36, 61, 10, 45, 6, 41, 54, 27, 43, 16, 55, 6, 46, 18, 42, 23, 15, 1, 45, 12, 60, 37, 22, 62, 12, 39, 59, 16, 52 },
- { 47, 35, 56, 7, 19, 46, 31, 50, 33, 24, 61, 35, 50, 7, 53, 44, 55, 6, 46, 10, 52, 5, 21, 43, 36, 10, 18, 41, 26, 37, 8, 29, 40, 36, 9, 49, 34, 26, 61, 21, 7, 59, 18, 62, 29, 54, 20, 32, 51, 0, 40, 10, 55, 6, 20, 36, 9, 61, 5, 51, 44, 19, 33, 43, 13, 57, 40, 63, 8, 24, 29, 10, 60, 34, 27, 40, 25, 18, 10, 42, 21, 49, 26, 62, 38, 12, 33, 61, 5, 57, 2, 19, 54, 28, 62, 22, 38, 31, 16, 7, 22, 47, 29, 17, 35, 8, 20, 51, 2, 40, 22, 50, 13, 61, 28, 53, 35, 20, 56, 30, 2, 53, 14, 41, 23, 34, 8, 31 },
- { 12, 2, 42, 29, 52, 13, 21, 8, 55, 14, 41, 17, 28, 58, 23, 11, 17, 36, 31, 62, 17, 34, 50, 14, 28, 61, 33, 52, 2, 51, 17, 45, 7, 25, 62, 30, 18, 55, 0, 42, 30, 35, 45, 1, 12, 48, 3, 63, 21, 36, 30, 48, 19, 59, 43, 27, 46, 17, 34, 25, 12, 29, 53, 6, 48, 31, 11, 34, 49, 3, 36, 50, 19, 47, 14, 61, 11, 36, 58, 4, 60, 14, 39, 22, 6, 52, 15, 35, 17, 46, 31, 42, 9, 34, 3, 52, 12, 60, 26, 56, 40, 2, 53, 23, 57, 38, 62, 14, 36, 59, 10, 31, 39, 6, 49, 9, 41, 26, 5, 48, 43, 27, 33, 58, 1, 50, 25, 57 },
- { 61, 37, 15, 61, 3, 39, 58, 43, 26, 0, 44, 10, 47, 3, 37, 63, 28, 43, 13, 39, 3, 57, 30, 59, 0, 48, 5, 43, 13, 22, 60, 33, 55, 15, 42, 4, 52, 10, 45, 13, 54, 4, 24, 49, 37, 26, 41, 14, 42, 9, 61, 13, 38, 23, 3, 53, 0, 58, 21, 42, 63, 10, 17, 61, 25, 0, 58, 28, 17, 44, 57, 12, 27, 0, 55, 5, 52, 28, 23, 47, 29, 0, 43, 17, 58, 28, 47, 23, 55, 10, 58, 23, 51, 40, 18, 33, 45, 0, 49, 8, 32, 61, 19, 48, 0, 26, 7, 47, 29, 18, 44, 0, 56, 34, 20, 59, 15, 51, 37, 18, 10, 52, 7, 20, 46, 9, 38, 17 },
- { 6, 27, 48, 23, 45, 29, 5, 18, 38, 62, 27, 56, 20, 32, 15, 9, 48, 0, 54, 22, 45, 20, 7, 41, 23, 39, 19, 27, 58, 31, 44, 0, 12, 50, 23, 56, 20, 39, 32, 59, 16, 52, 33, 9, 57, 22, 6, 58, 28, 50, 24, 2, 56, 35, 16, 45, 32, 38, 15, 54, 2, 38, 46, 22, 35, 45, 20, 5, 52, 25, 7, 35, 59, 32, 22, 43, 38, 3, 51, 16, 34, 53, 32, 50, 3, 40, 8, 43, 0, 39, 27, 4, 14, 61, 8, 55, 15, 41, 20, 44, 27, 13, 39, 11, 46, 42, 54, 33, 4, 52, 23, 61, 14, 25, 43, 2, 33, 11, 63, 29, 61, 17, 40, 55, 22, 62, 28, 44 },
- { 20, 54, 8, 56, 35, 10, 63, 31, 52, 12, 48, 6, 59, 41, 52, 33, 19, 58, 25, 49, 11, 37, 47, 12, 54, 15, 56, 35, 7, 47, 16, 53, 28, 34, 5, 37, 28, 8, 48, 3, 28, 38, 18, 61, 16, 43, 53, 32, 4, 17, 47, 27, 44, 8, 63, 10, 25, 49, 6, 37, 24, 52, 32, 3, 50, 12, 41, 56, 38, 14, 62, 20, 40, 16, 53, 31, 18, 63, 41, 9, 59, 7, 13, 25, 57, 20, 63, 26, 53, 18, 48, 62, 30, 46, 21, 25, 58, 29, 36, 4, 55, 34, 6, 60, 31, 16, 21, 12, 58, 38, 9, 29, 47, 7, 52, 30, 57, 44, 22, 0, 35, 45, 3, 31, 14, 36, 0, 51 },
- { 42, 14, 33, 24, 16, 49, 40, 2, 22, 33, 16, 36, 25, 1, 21, 61, 38, 8, 33, 4, 62, 26, 29, 60, 6, 46, 30, 11, 63, 4, 36, 40, 19, 57, 46, 11, 41, 63, 22, 25, 58, 10, 46, 2, 34, 27, 11, 38, 56, 34, 12, 53, 18, 33, 41, 51, 13, 28, 60, 20, 47, 14, 29, 59, 16, 62, 8, 22, 32, 47, 9, 49, 2, 44, 7, 12, 45, 6, 20, 27, 45, 24, 62, 42, 36, 11, 33, 15, 37, 7, 32, 10, 37, 1, 35, 50, 6, 11, 63, 24, 52, 15, 50, 24, 3, 37, 56, 27, 34, 22, 49, 16, 36, 62, 17, 39, 4, 15, 54, 24, 50, 8, 58, 26, 49, 54, 11, 30 },
- { 4, 59, 41, 1, 53, 12, 25, 45, 59, 7, 51, 39, 54, 14, 46, 4, 27, 53, 16, 44, 18, 51, 1, 32, 25, 2, 50, 40, 20, 54, 24, 9, 62, 2, 27, 60, 1, 17, 36, 50, 6, 40, 30, 55, 41, 19, 49, 1, 21, 60, 40, 5, 62, 1, 22, 30, 57, 4, 43, 31, 1, 55, 40, 7, 27, 37, 30, 54, 1, 19, 42, 30, 56, 26, 62, 49, 24, 57, 37, 56, 2, 39, 16, 5, 30, 55, 3, 49, 60, 23, 56, 44, 17, 52, 13, 42, 28, 48, 18, 45, 9, 37, 21, 41, 58, 10, 48, 1, 63, 5, 41, 57, 2, 24, 12, 48, 27, 42, 32, 46, 13, 38, 19, 34, 5, 41, 25, 60 },
- { 39, 28, 21, 46, 32, 57, 36, 9, 19, 42, 4, 29, 11, 43, 30, 49, 13, 42, 35, 56, 9, 39, 15, 52, 36, 61, 18, 26, 45, 14, 31, 48, 21, 43, 14, 33, 49, 54, 14, 44, 21, 62, 13, 23, 8, 62, 15, 51, 44, 7, 30, 37, 20, 42, 56, 7, 39, 18, 50, 11, 61, 9, 19, 43, 57, 2, 48, 11, 39, 60, 28, 4, 37, 17, 35, 1, 33, 11, 31, 14, 48, 19, 35, 51, 46, 21, 44, 29, 12, 41, 2, 22, 58, 26, 54, 4, 59, 38, 2, 33, 57, 1, 63, 13, 28, 51, 15, 40, 18, 45, 8, 30, 43, 37, 54, 19, 8, 59, 21, 6, 60, 29, 55, 10, 63, 15, 47, 17 },
- { 3, 50, 10, 62, 18, 5, 27, 49, 60, 23, 55, 18, 62, 24, 56, 10, 59, 28, 2, 23, 34, 59, 43, 20, 10, 42, 8, 49, 1, 37, 57, 6, 51, 29, 53, 7, 23, 31, 5, 32, 51, 0, 35, 54, 45, 31, 5, 26, 36, 24, 55, 15, 48, 29, 14, 48, 26, 60, 21, 41, 36, 26, 50, 33, 14, 44, 17, 24, 52, 15, 46, 23, 54, 6, 47, 21, 60, 50, 4, 53, 29, 61, 8, 23, 1, 60, 19, 6, 53, 16, 47, 34, 6, 39, 16, 31, 12, 20, 53, 22, 30, 43, 25, 46, 35, 6, 44, 32, 53, 26, 55, 19, 11, 59, 5, 33, 51, 1, 35, 53, 25, 3, 42, 23, 44, 32, 7, 53 },
- { 22, 44, 37, 6, 26, 51, 38, 0, 34, 13, 31, 46, 3, 37, 6, 19, 40, 21, 47, 63, 12, 5, 29, 55, 22, 58, 34, 28, 60, 22, 11, 41, 17, 38, 9, 44, 59, 39, 56, 19, 11, 47, 25, 15, 3, 39, 57, 17, 61, 11, 46, 3, 58, 9, 54, 35, 2, 34, 8, 45, 15, 56, 5, 23, 53, 33, 63, 35, 4, 59, 10, 51, 13, 61, 29, 41, 15, 25, 43, 19, 40, 10, 54, 33, 41, 12, 38, 51, 31, 26, 61, 9, 30, 45, 24, 62, 49, 40, 10, 61, 14, 49, 5, 17, 54, 20, 60, 23, 3, 13, 35, 50, 32, 23, 46, 27, 38, 63, 16, 12, 39, 48, 18, 51, 1, 27, 56, 35 },
- { 63, 15, 30, 55, 43, 14, 57, 17, 53, 44, 7, 48, 26, 50, 32, 60, 0, 53, 14, 31, 50, 24, 46, 0, 38, 13, 4, 52, 16, 45, 30, 59, 0, 25, 55, 35, 16, 10, 26, 42, 58, 29, 60, 38, 50, 22, 28, 47, 0, 50, 28, 19, 33, 39, 11, 44, 16, 52, 24, 59, 3, 38, 27, 51, 0, 21, 7, 42, 26, 34, 21, 40, 33, 18, 39, 3, 54, 38, 8, 59, 0, 44, 27, 15, 58, 28, 57, 9, 43, 0, 36, 50, 20, 59, 8, 34, 0, 27, 47, 7, 36, 19, 56, 32, 0, 38, 11, 29, 62, 47, 6, 61, 0, 41, 14, 56, 10, 23, 45, 31, 57, 8, 36, 13, 58, 38, 11, 19 },
- { 0, 34, 12, 47, 21, 2, 40, 30, 11, 25, 61, 20, 40, 15, 35, 22, 45, 36, 7, 41, 17, 57, 9, 48, 32, 62, 44, 24, 35, 3, 54, 13, 33, 63, 19, 4, 48, 22, 62, 2, 37, 8, 33, 6, 20, 52, 9, 32, 43, 13, 39, 63, 25, 4, 49, 23, 62, 32, 9, 30, 48, 18, 63, 12, 46, 29, 58, 13, 48, 8, 57, 31, 0, 51, 9, 58, 12, 22, 47, 29, 35, 22, 49, 5, 46, 4, 34, 20, 63, 24, 56, 11, 41, 3, 51, 19, 56, 35, 17, 58, 28, 42, 9, 45, 59, 26, 51, 42, 17, 36, 25, 15, 53, 21, 44, 3, 30, 55, 5, 50, 21, 28, 61, 32, 6, 49, 28, 46 },
- { 58, 42, 60, 4, 31, 59, 22, 63, 35, 38, 9, 54, 1, 57, 8, 51, 16, 58, 27, 53, 3, 38, 30, 15, 27, 6, 19, 56, 10, 50, 21, 36, 47, 5, 43, 28, 51, 32, 13, 46, 18, 54, 16, 43, 63, 12, 36, 59, 22, 34, 5, 52, 17, 59, 27, 41, 0, 19, 55, 37, 13, 43, 6, 34, 41, 10, 36, 55, 19, 44, 3, 16, 58, 27, 49, 25, 32, 62, 17, 55, 13, 63, 18, 52, 25, 37, 17, 48, 13, 32, 5, 46, 28, 37, 14, 43, 25, 5, 51, 39, 3, 52, 33, 22, 8, 40, 12, 4, 57, 9, 46, 39, 28, 58, 13, 62, 17, 42, 19, 36, 0, 47, 16, 43, 24, 21, 54, 13 },
- { 25, 9, 23, 50, 36, 8, 45, 14, 3, 51, 16, 28, 44, 12, 42, 29, 4, 26, 10, 47, 22, 61, 18, 54, 51, 39, 46, 13, 41, 26, 58, 7, 18, 39, 12, 57, 15, 1, 52, 27, 41, 23, 48, 1, 27, 45, 18, 2, 57, 26, 55, 8, 43, 31, 6, 58, 14, 51, 40, 5, 61, 31, 24, 54, 17, 60, 22, 1, 39, 30, 53, 45, 36, 13, 43, 5, 45, 2, 37, 6, 34, 42, 2, 39, 10, 62, 7, 54, 40, 18, 60, 15, 52, 21, 63, 8, 55, 46, 15, 30, 23, 13, 62, 16, 50, 24, 58, 31, 48, 21, 34, 2, 49, 7, 31, 37, 26, 48, 9, 61, 40, 11, 52, 2, 60, 40, 4, 37 },
- { 52, 28, 39, 16, 54, 19, 29, 55, 42, 20, 58, 33, 24, 63, 18, 55, 39, 62, 43, 34, 12, 40, 6, 35, 2, 25, 8, 62, 34, 1, 31, 42, 61, 27, 53, 24, 40, 61, 34, 8, 59, 4, 30, 56, 40, 6, 53, 42, 10, 48, 16, 37, 12, 46, 21, 36, 47, 11, 28, 45, 22, 10, 57, 2, 49, 31, 14, 44, 61, 11, 25, 6, 23, 63, 18, 36, 28, 56, 20, 51, 11, 48, 27, 56, 32, 22, 45, 30, 2, 42, 27, 39, 1, 44, 23, 31, 38, 22, 11, 61, 43, 54, 4, 47, 35, 2, 44, 16, 28, 54, 12, 62, 18, 43, 10, 52, 1, 58, 33, 15, 29, 56, 20, 34, 9, 30, 48, 17 },
- { 46, 2, 56, 11, 41, 1, 49, 6, 27, 47, 2, 48, 5, 32, 37, 3, 13, 19, 32, 1, 55, 28, 60, 17, 43, 59, 32, 20, 49, 16, 55, 23, 14, 46, 2, 36, 6, 30, 20, 49, 12, 47, 35, 14, 21, 60, 29, 14, 35, 24, 46, 1, 56, 29, 53, 8, 33, 23, 56, 1, 35, 46, 20, 39, 26, 4, 53, 28, 17, 38, 60, 34, 48, 9, 55, 15, 46, 7, 41, 31, 60, 24, 16, 36, 1, 59, 19, 52, 35, 6, 55, 11, 59, 33, 7, 57, 4, 29, 48, 1, 19, 26, 37, 30, 18, 63, 37, 6, 59, 1, 40, 24, 56, 33, 46, 22, 35, 7, 24, 53, 39, 5, 26, 45, 55, 18, 62, 7 },
- { 20, 60, 29, 34, 20, 62, 33, 52, 10, 36, 13, 60, 41, 21, 50, 27, 56, 49, 8, 51, 21, 45, 11, 48, 8, 23, 53, 3, 29, 44, 5, 52, 9, 32, 50, 17, 43, 56, 3, 38, 24, 10, 62, 25, 51, 9, 33, 49, 61, 7, 30, 62, 22, 19, 2, 42, 63, 5, 49, 18, 60, 15, 52, 7, 43, 56, 23, 50, 5, 50, 2, 20, 41, 30, 1, 52, 22, 61, 14, 26, 3, 43, 53, 7, 47, 28, 11, 14, 23, 58, 33, 25, 47, 13, 50, 17, 40, 54, 34, 60, 41, 6, 59, 14, 50, 7, 25, 55, 20, 42, 51, 8, 27, 4, 16, 60, 28, 50, 44, 3, 22, 49, 63, 12, 33, 1, 43, 31 },
- { 36, 5, 46, 8, 44, 24, 13, 39, 25, 57, 31, 18, 8, 52, 10, 45, 6, 30, 36, 24, 63, 4, 33, 26, 57, 40, 15, 56, 37, 12, 40, 25, 37, 58, 11, 63, 21, 45, 16, 60, 31, 53, 18, 33, 3, 45, 23, 0, 20, 54, 40, 15, 50, 38, 60, 16, 25, 42, 29, 38, 7, 41, 25, 62, 18, 33, 8, 35, 42, 16, 32, 56, 12, 39, 59, 19, 34, 9, 49, 38, 57, 12, 21, 50, 14, 40, 61, 44, 50, 9, 49, 19, 3, 29, 35, 62, 12, 24, 7, 18, 52, 32, 10, 46, 21, 41, 32, 11, 36, 29, 14, 34, 60, 38, 54, 11, 41, 14, 19, 57, 32, 16, 7, 41, 51, 25, 14, 57 },
- { 53, 18, 26, 50, 15, 58, 4, 63, 17, 43, 7, 40, 61, 35, 15, 41, 23, 60, 16, 38, 14, 42, 19, 50, 0, 31, 10, 46, 27, 63, 18, 60, 0, 20, 29, 39, 8, 26, 37, 5, 42, 0, 44, 39, 57, 17, 58, 41, 28, 37, 4, 32, 9, 44, 12, 31, 54, 10, 59, 14, 27, 53, 12, 36, 0, 47, 13, 63, 21, 58, 10, 24, 50, 27, 4, 26, 44, 53, 31, 0, 18, 42, 29, 33, 57, 4, 32, 26, 0, 38, 16, 61, 41, 53, 20, 0, 42, 44, 49, 27, 10, 56, 39, 0, 57, 15, 53, 49, 3, 61, 22, 47, 17, 5, 49, 26, 2, 63, 39, 10, 47, 27, 37, 23, 4, 59, 38, 10 },
- { 23, 39, 61, 3, 37, 28, 48, 31, 0, 34, 51, 23, 2, 26, 58, 0, 53, 11, 46, 1, 57, 29, 52, 14, 37, 61, 21, 35, 2, 49, 7, 34, 47, 55, 4, 33, 54, 13, 58, 52, 19, 50, 22, 7, 13, 29, 36, 11, 51, 17, 60, 25, 55, 4, 34, 51, 0, 35, 20, 48, 32, 3, 51, 30, 59, 28, 40, 3, 46, 29, 54, 43, 7, 62, 47, 11, 39, 4, 23, 46, 55, 8, 63, 5, 25, 37, 18, 46, 21, 56, 31, 5, 36, 8, 45, 58, 26, 15, 2, 36, 47, 21, 29, 44, 25, 34, 3, 27, 43, 10, 52, 0, 45, 30, 24, 36, 43, 18, 34, 59, 0, 52, 61, 15, 44, 19, 30, 49 },
- { 0, 27, 12, 43, 54, 9, 22, 53, 21, 46, 15, 55, 29, 47, 20, 33, 39, 28, 59, 35, 9, 44, 5, 24, 47, 7, 52, 17, 56, 22, 30, 42, 14, 26, 45, 18, 49, 1, 24, 34, 11, 27, 55, 32, 61, 47, 2, 56, 6, 44, 13, 47, 36, 27, 58, 22, 16, 47, 40, 4, 57, 38, 21, 45, 16, 9, 56, 26, 11, 38, 0, 22, 36, 17, 33, 57, 16, 30, 62, 15, 35, 40, 20, 45, 59, 10, 54, 8, 63, 13, 52, 27, 22, 57, 28, 12, 32, 51, 55, 22, 63, 4, 16, 54, 12, 62, 45, 19, 58, 13, 32, 40, 20, 56, 7, 57, 9, 54, 6, 29, 42, 21, 8, 55, 35, 47, 6, 41 },
- { 56, 33, 58, 32, 19, 35, 42, 6, 59, 11, 38, 5, 49, 12, 62, 7, 52, 17, 5, 25, 54, 20, 61, 31, 54, 27, 41, 11, 44, 5, 59, 12, 36, 51, 10, 61, 28, 41, 48, 9, 43, 63, 5, 40, 20, 8, 49, 26, 34, 21, 58, 1, 18, 45, 7, 39, 61, 26, 8, 50, 23, 10, 63, 5, 55, 37, 19, 49, 52, 15, 59, 47, 13, 54, 1, 25, 42, 58, 10, 48, 3, 27, 50, 1, 17, 48, 34, 41, 16, 40, 2, 45, 10, 39, 17, 61, 5, 38, 19, 9, 41, 31, 60, 38, 5, 23, 36, 8, 30, 55, 24, 63, 12, 48, 14, 51, 31, 20, 45, 25, 12, 50, 32, 2, 28, 11, 62, 14 },
- { 44, 16, 7, 48, 1, 62, 16, 50, 27, 33, 61, 25, 17, 44, 31, 14, 22, 43, 32, 48, 18, 40, 8, 36, 3, 16, 33, 62, 23, 38, 25, 53, 2, 21, 41, 6, 22, 15, 59, 29, 16, 37, 26, 15, 52, 42, 23, 15, 54, 39, 10, 30, 53, 11, 49, 24, 2, 43, 55, 17, 34, 44, 15, 31, 24, 44, 2, 32, 7, 35, 25, 5, 40, 45, 29, 51, 6, 21, 37, 52, 24, 60, 13, 31, 53, 23, 2, 28, 49, 24, 31, 60, 20, 51, 1, 34, 48, 14, 59, 33, 50, 1, 18, 33, 48, 60, 17, 51, 39, 6, 38, 2, 35, 29, 40, 23, 1, 62, 15, 53, 37, 17, 46, 57, 40, 51, 24, 22 },
- { 5, 37, 52, 24, 45, 13, 40, 3, 45, 9, 19, 42, 56, 4, 37, 46, 56, 2, 63, 11, 51, 1, 49, 13, 59, 45, 39, 1, 48, 15, 58, 9, 46, 31, 54, 35, 57, 38, 3, 46, 56, 4, 47, 57, 1, 30, 38, 63, 3, 46, 28, 63, 41, 14, 33, 62, 19, 32, 13, 28, 61, 1, 53, 42, 11, 60, 22, 62, 27, 42, 61, 31, 19, 8, 61, 12, 32, 55, 2, 18, 33, 12, 43, 36, 9, 62, 30, 55, 6, 58, 35, 7, 43, 29, 54, 23, 43, 30, 3, 25, 11, 45, 52, 28, 7, 14, 42, 1, 22, 50, 16, 53, 19, 59, 4, 46, 33, 41, 4, 35, 58, 5, 26, 13, 20, 2, 34, 54 },
- { 30, 63, 21, 10, 26, 55, 29, 59, 23, 39, 53, 1, 36, 24, 59, 27, 10, 34, 23, 38, 30, 60, 22, 42, 28, 19, 9, 57, 30, 19, 43, 33, 13, 63, 3, 19, 11, 50, 31, 20, 14, 34, 10, 35, 17, 59, 7, 31, 19, 25, 50, 5, 20, 57, 29, 6, 52, 41, 4, 46, 20, 37, 26, 17, 49, 6, 39, 18, 53, 14, 3, 49, 57, 23, 34, 48, 14, 41, 28, 38, 56, 6, 58, 25, 39, 19, 43, 15, 37, 11, 47, 18, 53, 4, 37, 9, 62, 21, 53, 40, 57, 24, 13, 40, 56, 26, 47, 31, 59, 25, 45, 27, 10, 43, 21, 61, 13, 27, 48, 9, 23, 43, 31, 62, 38, 59, 9, 47 },
- { 25, 4, 40, 60, 34, 6, 18, 36, 8, 57, 12, 30, 49, 14, 6, 54, 41, 16, 50, 6, 43, 15, 34, 4, 53, 24, 50, 35, 4, 51, 7, 55, 28, 24, 39, 44, 60, 7, 25, 62, 42, 53, 24, 61, 28, 45, 52, 12, 48, 37, 9, 35, 43, 3, 37, 48, 12, 58, 30, 52, 9, 59, 6, 57, 33, 29, 48, 4, 37, 45, 20, 34, 10, 39, 0, 60, 22, 45, 8, 63, 21, 42, 14, 49, 3, 56, 11, 46, 21, 61, 0, 42, 25, 13, 63, 17, 36, 8, 46, 16, 6, 35, 63, 0, 21, 37, 4, 57, 9, 34, 5, 61, 48, 32, 8, 37, 54, 17, 56, 30, 60, 0, 50, 16, 7, 29, 42, 17 },
- { 32, 50, 15, 48, 2, 43, 52, 25, 47, 16, 32, 63, 21, 52, 40, 19, 0, 61, 29, 58, 20, 56, 26, 46, 12, 55, 6, 22, 62, 32, 17, 40, 0, 49, 34, 8, 27, 32, 48, 0, 21, 39, 5, 44, 12, 6, 22, 40, 0, 57, 16, 60, 23, 17, 54, 22, 36, 15, 24, 39, 19, 34, 47, 23, 0, 54, 13, 51, 24, 9, 55, 16, 52, 27, 44, 20, 4, 54, 26, 49, 0, 30, 46, 16, 29, 51, 34, 4, 52, 28, 33, 15, 57, 39, 26, 49, 0, 56, 27, 31, 48, 20, 43, 29, 53, 11, 46, 19, 41, 13, 55, 18, 0, 57, 26, 51, 2, 44, 6, 38, 14, 40, 22, 45, 36, 53, 3, 57 },
- { 44, 12, 37, 28, 22, 57, 11, 38, 0, 51, 9, 41, 4, 29, 11, 47, 33, 45, 12, 26, 3, 36, 9, 63, 31, 16, 38, 44, 14, 47, 25, 61, 20, 58, 15, 47, 17, 57, 13, 36, 9, 51, 18, 29, 50, 36, 54, 20, 61, 27, 32, 13, 53, 44, 9, 27, 0, 63, 45, 2, 56, 10, 14, 43, 41, 28, 58, 11, 35, 60, 30, 41, 6, 63, 11, 51, 37, 32, 15, 10, 35, 53, 5, 61, 22, 7, 26, 59, 23, 9, 44, 48, 21, 3, 51, 32, 24, 41, 12, 61, 2, 55, 9, 15, 35, 58, 28, 15, 62, 30, 37, 23, 42, 29, 11, 17, 35, 24, 63, 20, 52, 28, 8, 55, 11, 23, 47, 19 },
- { 0, 56, 8, 53, 14, 31, 61, 20, 55, 28, 62, 18, 35, 60, 25, 57, 7, 23, 39, 54, 47, 17, 43, 0, 40, 59, 29, 2, 56, 10, 37, 5, 43, 11, 29, 52, 1, 23, 54, 41, 59, 30, 55, 1, 62, 15, 33, 4, 43, 10, 47, 39, 1, 31, 40, 60, 49, 33, 7, 55, 26, 50, 31, 61, 8, 18, 21, 32, 44, 1, 25, 47, 18, 36, 30, 23, 59, 7, 40, 59, 27, 19, 38, 32, 44, 54, 40, 17, 38, 60, 27, 6, 35, 55, 10, 14, 44, 5, 50, 17, 38, 26, 42, 50, 18, 3, 44, 52, 2, 49, 7, 52, 15, 46, 62, 39, 55, 10, 31, 48, 3, 58, 33, 18, 61, 34, 13, 59 },
- { 39, 27, 63, 20, 35, 41, 4, 45, 26, 5, 38, 13, 44, 2, 50, 17, 37, 52, 2, 13, 28, 58, 24, 51, 21, 8, 34, 48, 27, 42, 18, 51, 31, 56, 5, 36, 38, 44, 4, 17, 26, 11, 38, 23, 42, 8, 56, 39, 24, 51, 5, 56, 21, 59, 14, 6, 18, 42, 22, 35, 16, 37, 3, 25, 39, 46, 63, 5, 50, 17, 58, 8, 55, 3, 50, 12, 43, 17, 47, 2, 51, 9, 62, 12, 1, 35, 13, 50, 1, 37, 12, 51, 19, 29, 46, 59, 22, 58, 33, 45, 22, 60, 10, 32, 61, 39, 8, 33, 25, 36, 20, 60, 38, 4, 21, 5, 28, 45, 12, 18, 42, 11, 49, 1, 27, 40, 6, 30 },
- { 24, 16, 42, 1, 50, 10, 48, 17, 33, 43, 24, 48, 21, 55, 31, 42, 10, 21, 63, 35, 49, 6, 33, 13, 41, 53, 10, 20, 60, 6, 53, 26, 12, 41, 22, 60, 14, 28, 63, 33, 49, 3, 45, 16, 48, 26, 14, 46, 18, 30, 35, 26, 8, 50, 29, 51, 25, 57, 12, 47, 53, 9, 62, 20, 54, 2, 36, 15, 40, 28, 33, 13, 38, 24, 46, 1, 29, 56, 33, 20, 44, 24, 41, 26, 57, 20, 63, 8, 30, 55, 5, 41, 62, 8, 34, 2, 37, 10, 19, 6, 37, 1, 53, 23, 5, 27, 58, 22, 43, 12, 50, 26, 9, 34, 54, 32, 49, 1, 59, 37, 22, 46, 25, 36, 51, 15, 54, 46 },
- { 52, 7, 45, 33, 26, 58, 14, 60, 7, 54, 3, 58, 8, 34, 14, 5, 59, 30, 18, 44, 8, 22, 48, 62, 3, 26, 55, 38, 23, 16, 39, 1, 62, 24, 49, 9, 53, 19, 46, 7, 19, 60, 31, 58, 2, 34, 53, 7, 59, 2, 62, 42, 46, 19, 36, 11, 44, 4, 38, 28, 1, 43, 32, 51, 12, 29, 56, 22, 52, 2, 62, 49, 22, 60, 14, 35, 63, 5, 25, 57, 14, 53, 4, 46, 18, 31, 42, 22, 47, 20, 58, 31, 16, 43, 23, 54, 30, 42, 52, 57, 29, 49, 30, 13, 45, 48, 16, 55, 6, 63, 1, 44, 14, 58, 19, 47, 15, 24, 51, 34, 6, 55, 5, 63, 20, 41, 21, 9 },
- { 30, 62, 18, 55, 5, 23, 39, 29, 49, 30, 15, 36, 28, 46, 60, 25, 39, 46, 4, 32, 61, 40, 15, 30, 36, 45, 14, 2, 49, 33, 57, 45, 18, 32, 3, 45, 30, 2, 35, 52, 40, 27, 13, 21, 38, 63, 20, 28, 37, 23, 16, 10, 13, 55, 2, 62, 21, 32, 60, 17, 58, 23, 5, 40, 16, 48, 7, 45, 10, 26, 43, 19, 6, 31, 52, 21, 39, 16, 48, 9, 37, 28, 36, 55, 7, 48, 3, 59, 15, 45, 25, 1, 53, 13, 47, 7, 62, 15, 4, 25, 12, 41, 18, 60, 38, 11, 34, 19, 39, 31, 29, 56, 23, 42, 3, 27, 60, 41, 8, 16, 61, 29, 43, 9, 32, 2, 60, 34 },
- { 3, 38, 13, 37, 52, 44, 2, 19, 12, 42, 63, 19, 40, 1, 20, 50, 12, 55, 15, 56, 27, 1, 54, 11, 57, 18, 32, 63, 44, 4, 29, 13, 37, 61, 35, 16, 42, 57, 12, 22, 6, 55, 43, 10, 50, 5, 44, 11, 48, 52, 34, 58, 28, 41, 38, 30, 7, 52, 11, 49, 30, 14, 45, 27, 59, 34, 21, 38, 32, 58, 11, 36, 56, 42, 9, 41, 3, 54, 31, 42, 0, 60, 16, 11, 39, 24, 52, 33, 6, 36, 10, 40, 32, 60, 26, 20, 39, 28, 47, 34, 63, 8, 54, 3, 24, 56, 0, 51, 13, 47, 16, 40, 7, 35, 52, 11, 36, 4, 57, 30, 39, 13, 18, 50, 58, 28, 12, 48 },
- { 57, 24, 49, 21, 10, 31, 61, 36, 56, 0, 22, 53, 11, 56, 32, 7, 36, 27, 41, 9, 46, 19, 34, 42, 25, 7, 50, 9, 28, 21, 54, 8, 50, 7, 27, 59, 10, 25, 48, 62, 37, 0, 33, 58, 25, 18, 32, 61, 0, 15, 45, 5, 50, 3, 23, 55, 47, 17, 40, 6, 60, 34, 53, 8, 41, 0, 61, 13, 54, 4, 46, 28, 0, 17, 48, 27, 58, 13, 23, 61, 33, 21, 50, 30, 62, 8, 14, 29, 56, 27, 61, 49, 17, 2, 44, 11, 51, 0, 59, 17, 40, 20, 32, 47, 36, 21, 42, 28, 60, 4, 54, 10, 59, 17, 30, 62, 21, 43, 26, 48, 0, 56, 36, 25, 8, 44, 39, 17 },
- { 10, 42, 4, 59, 27, 47, 8, 23, 51, 32, 45, 6, 37, 26, 48, 43, 62, 0, 21, 53, 38, 12, 51, 5, 60, 47, 24, 37, 59, 15, 35, 47, 22, 55, 0, 50, 21, 40, 6, 29, 15, 52, 24, 8, 41, 55, 13, 29, 40, 56, 24, 31, 19, 33, 61, 15, 0, 35, 24, 42, 21, 2, 19, 57, 24, 15, 30, 50, 20, 25, 40, 16, 57, 34, 61, 8, 29, 45, 6, 49, 11, 47, 2, 44, 19, 57, 38, 50, 12, 42, 21, 4, 35, 52, 28, 56, 23, 36, 13, 45, 4, 52, 27, 14, 6, 62, 9, 45, 21, 37, 25, 46, 33, 49, 0, 44, 7, 53, 13, 19, 53, 31, 3, 47, 15, 56, 22, 51 },
- { 35, 28, 53, 32, 1, 16, 54, 40, 9, 17, 25, 58, 14, 59, 3, 22, 16, 51, 31, 5, 23, 58, 28, 17, 35, 20, 0, 42, 11, 52, 3, 31, 41, 17, 43, 13, 32, 54, 18, 60, 32, 45, 17, 49, 2, 36, 51, 22, 7, 36, 9, 63, 48, 12, 46, 26, 43, 28, 63, 13, 48, 37, 51, 33, 5, 47, 55, 9, 42, 63, 7, 51, 24, 12, 37, 19, 55, 34, 18, 38, 15, 28, 54, 34, 5, 43, 22, 0, 48, 14, 54, 24, 58, 9, 38, 5, 32, 55, 21, 30, 49, 9, 59, 43, 30, 51, 35, 26, 7, 53, 2, 22, 14, 27, 57, 18, 38, 24, 33, 45, 10, 41, 20, 60, 37, 5, 32, 0 },
- { 63, 19, 15, 40, 62, 35, 14, 28, 46, 61, 4, 49, 35, 10, 29, 54, 33, 8, 45, 62, 37, 1, 43, 55, 10, 52, 61, 30, 19, 40, 25, 62, 11, 38, 27, 58, 36, 3, 46, 8, 39, 4, 62, 28, 47, 20, 4, 54, 47, 27, 43, 1, 21, 38, 8, 58, 10, 54, 4, 56, 9, 26, 12, 39, 60, 27, 18, 37, 1, 31, 35, 5, 45, 50, 2, 43, 26, 1, 59, 23, 56, 40, 7, 26, 58, 17, 32, 63, 25, 39, 7, 31, 45, 19, 63, 15, 48, 8, 37, 61, 16, 34, 1, 56, 18, 3, 15, 58, 49, 32, 63, 41, 55, 5, 40, 22, 50, 6, 59, 2, 63, 23, 52, 11, 26, 61, 44, 23 },
- { 11, 56, 46, 6, 22, 43, 58, 3, 34, 21, 38, 30, 18, 44, 52, 13, 41, 57, 17, 28, 14, 49, 25, 7, 33, 39, 26, 6, 56, 48, 1, 20, 56, 5, 46, 9, 19, 51, 30, 25, 56, 21, 35, 14, 57, 42, 16, 33, 10, 57, 17, 59, 41, 25, 53, 37, 20, 40, 30, 18, 31, 62, 44, 22, 3, 44, 11, 48, 23, 53, 18, 60, 29, 22, 62, 15, 53, 47, 10, 41, 3, 19, 52, 36, 13, 46, 10, 35, 3, 61, 41, 16, 1, 50, 26, 42, 18, 46, 2, 25, 54, 20, 39, 23, 47, 31, 41, 12, 38, 17, 8, 19, 31, 48, 12, 61, 9, 54, 29, 35, 15, 38, 6, 43, 34, 14, 7, 47 },
- { 39, 2, 33, 26, 53, 8, 18, 50, 41, 12, 53, 1, 63, 24, 19, 39, 2, 24, 47, 10, 60, 38, 19, 63, 48, 4, 15, 45, 32, 14, 60, 36, 29, 53, 23, 63, 34, 12, 61, 1, 43, 11, 53, 30, 1, 26, 60, 45, 23, 39, 3, 29, 12, 50, 4, 16, 51, 3, 45, 36, 50, 1, 16, 54, 35, 14, 57, 30, 58, 9, 46, 14, 41, 10, 32, 38, 4, 30, 21, 51, 32, 63, 25, 1, 60, 27, 53, 18, 51, 22, 28, 55, 34, 12, 40, 3, 60, 29, 57, 41, 6, 44, 11, 53, 8, 61, 24, 57, 1, 28, 44, 59, 36, 3, 34, 25, 41, 31, 16, 44, 22, 47, 28, 58, 1, 49, 54, 29 },
- { 58, 25, 50, 13, 38, 30, 60, 24, 6, 57, 27, 42, 9, 45, 6, 61, 30, 50, 4, 34, 29, 3, 46, 13, 22, 42, 58, 28, 9, 39, 23, 44, 7, 15, 44, 2, 40, 15, 47, 41, 23, 37, 7, 59, 38, 11, 34, 6, 62, 14, 52, 35, 55, 19, 32, 61, 33, 24, 57, 6, 22, 59, 29, 7, 49, 25, 40, 3, 17, 39, 27, 52, 0, 55, 16, 57, 24, 61, 36, 6, 29, 12, 48, 39, 20, 44, 6, 40, 33, 5, 48, 10, 57, 36, 22, 51, 33, 9, 24, 12, 62, 29, 50, 35, 14, 43, 5, 33, 47, 52, 13, 23, 10, 51, 56, 16, 46, 1, 49, 4, 61, 9, 52, 18, 31, 21, 36, 17 },
- { 19, 42, 9, 48, 2, 44, 11, 37, 48, 20, 33, 16, 55, 35, 49, 15, 37, 20, 59, 16, 53, 22, 56, 31, 50, 11, 34, 54, 16, 51, 4, 49, 33, 53, 21, 28, 56, 24, 31, 9, 52, 16, 48, 24, 44, 13, 51, 20, 31, 49, 18, 6, 34, 2, 44, 14, 47, 8, 15, 43, 13, 41, 33, 52, 20, 61, 7, 51, 34, 62, 4, 20, 36, 33, 43, 8, 46, 13, 53, 17, 45, 42, 9, 31, 52, 11, 30, 56, 13, 59, 17, 44, 27, 6, 62, 11, 43, 17, 49, 38, 26, 2, 16, 27, 58, 21, 54, 18, 26, 5, 35, 61, 43, 27, 7, 39, 14, 58, 37, 55, 20, 33, 13, 40, 62, 10, 55, 5 },
- { 51, 14, 61, 29, 59, 20, 55, 31, 0, 49, 11, 60, 3, 26, 22, 56, 0, 40, 12, 43, 41, 8, 36, 0, 17, 57, 24, 2, 46, 26, 61, 18, 0, 38, 12, 59, 6, 49, 3, 57, 19, 63, 5, 33, 18, 54, 28, 56, 0, 43, 26, 46, 63, 27, 56, 22, 27, 54, 38, 28, 63, 24, 10, 45, 0, 31, 42, 21, 12, 25, 44, 49, 59, 6, 26, 50, 3, 34, 27, 59, 0, 35, 62, 16, 4, 58, 47, 0, 43, 24, 37, 2, 54, 20, 46, 31, 0, 56, 34, 5, 55, 45, 60, 37, 0, 40, 10, 38, 63, 46, 15, 20, 0, 53, 21, 62, 30, 11, 24, 27, 40, 0, 57, 26, 3, 45, 27, 35 },
-};
-
-#else
-#define DM_WIDTH 8
-#define DM_WIDTH_SHIFT 3
-#define DM_HEIGHT 8
-static const unsigned char DM[8][8] =
-{
- { 0, 32, 8, 40, 2, 34, 10, 42 },
- { 48, 16, 56, 24, 50, 18, 58, 26 },
- { 12, 44, 4, 36, 14, 46, 6, 38 },
- { 60, 28, 52, 20, 62, 30, 54, 22 },
- { 3, 35, 11, 43, 1, 33, 9, 41 },
- { 51, 19, 59, 27, 49, 17, 57, 25 },
- { 15, 47, 7, 39, 13, 45, 5, 37 },
- { 63, 31, 55, 23, 61, 29, 53, 21 }
-};
-#endif
-
-static guint32 *DM_565 = NULL;
-
-static void
-xlib_rgb_preprocess_dm_565 (void)
-{
- int i;
- guint32 dith;
-
- if (DM_565 == NULL)
- {
- DM_565 = malloc(sizeof(guint32) * DM_WIDTH * DM_HEIGHT);
- for (i = 0; i < DM_WIDTH * DM_HEIGHT; i++)
- {
- dith = DM[0][i] >> 3;
- DM_565[i] = (dith << 20) | dith | (((7 - dith) >> 1) << 10);
-#ifdef VERBOSE
- printf ("%i %x %x\n", i, dith, DM_565[i]);
-#endif
- }
- }
-}
-
-static void
-xlib_rgb_convert_8_d666 (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int x, y;
- int bpl;
- unsigned char *obuf, *obptr;
- unsigned char *bptr, *bp2;
- int r, g, b;
- const unsigned char *dmp;
- int dith;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax;
- for (y = 0; y < height; y++)
- {
- dmp = DM[(y_align + y) & (DM_HEIGHT - 1)];
- bp2 = bptr;
- obptr = obuf;
- for (x = 0; x < width; x++)
- {
- r = *bp2++;
- g = *bp2++;
- b = *bp2++;
- dith = (dmp[(x_align + x) & (DM_WIDTH - 1)] << 2) | 7;
- r = ((r * 5) + dith) >> 8;
- g = ((g * 5) + (262 - dith)) >> 8;
- b = ((b * 5) + dith) >> 8;
- obptr[0] = colorcube_d[(r << 6) | (g << 3) | b];
- obptr++;
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-
-static void
-xlib_rgb_convert_8_d (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align,
- XlibRgbCmap *cmap)
-{
- int x, y;
- int bpl;
- unsigned char *obuf, *obptr;
- unsigned char *bptr, *bp2;
- int r, g, b;
- const unsigned char *dmp;
- int dith;
- int rs, gs, bs;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- rs = image_info->nred_shades - 1;
- gs = image_info->ngreen_shades - 1;
- bs = image_info->nblue_shades - 1;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax;
- for (y = 0; y < height; y++)
- {
- dmp = DM[(y_align + y) & (DM_HEIGHT - 1)];
- bp2 = bptr;
- obptr = obuf;
- for (x = 0; x < width; x++)
- {
- r = *bp2++;
- g = *bp2++;
- b = *bp2++;
- dith = (dmp[(x_align + x) & (DM_WIDTH - 1)] << 2) | 7;
- r = ((r * rs) + dith) >> 8;
- g = ((g * gs) + (262 - dith)) >> 8;
- b = ((b * bs) + dith) >> 8;
- obptr[0] = colorcube_d[(r << 6) | (g << 3) | b];
- obptr++;
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-
-static void
-xlib_rgb_convert_8_indexed (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int x, y;
- int bpl;
- unsigned char *obuf, *obptr;
- unsigned char *bptr, *bp2;
- unsigned char c;
- unsigned char *lut;
-
- lut = cmap->lut;
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax;
- for (y = 0; y < height; y++)
- {
- bp2 = bptr;
- obptr = obuf;
- for (x = 0; x < width; x++)
- {
- c = *bp2++;
- obptr[0] = lut[c];
- obptr++;
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-
-static void
-xlib_rgb_convert_gray8 (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int x, y;
- int bpl;
- unsigned char *obuf, *obptr;
- unsigned char *bptr, *bp2;
- int r, g, b;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax;
- for (y = 0; y < height; y++)
- {
- bp2 = bptr;
- obptr = obuf;
- for (x = 0; x < width; x++)
- {
- r = *bp2++;
- g = *bp2++;
- b = *bp2++;
- obptr[0] = (g + ((b + r) >> 1)) >> 1;
- obptr++;
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-
-static void
-xlib_rgb_convert_gray8_gray (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int y;
- int bpl;
- unsigned char *obuf;
- unsigned char *bptr;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax;
- for (y = 0; y < height; y++)
- {
- memcpy (obuf, bptr, (unsigned int)width);
- bptr += rowstride;
- obuf += bpl;
- }
-}
-
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
-#define HAIRY_CONVERT_565
-#endif
-
-#ifdef HAIRY_CONVERT_565
-/* Render a 24-bit RGB image in buf into the GdkImage, without dithering.
- This assumes native byte ordering - what should really be done is to
- check whether static_image->byte_order is consistent with the _ENDIAN
- config flag, and if not, use a different function.
-
- This one is even faster than the one below - its inner loop loads 3
- words (i.e. 4 24-bit pixels), does a lot of shifting and masking,
- then writes 2 words. */
-static void
-xlib_rgb_convert_565 (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int x, y;
- unsigned char *obuf, *obptr;
- int bpl;
- unsigned char *bptr, *bp2;
- unsigned char r, g, b;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax * 2;
- for (y = 0; y < height; y++)
- {
- bp2 = bptr;
- obptr = obuf;
- if (((unsigned long)obuf | (unsigned long) bp2) & 3)
- {
- for (x = 0; x < width; x++)
- {
- r = *bp2++;
- g = *bp2++;
- b = *bp2++;
- ((guint16 *)obptr)[0] = ((r & 0xf8) << 8) |
- ((g & 0xfc) << 3) |
- (b >> 3);
- obptr += 2;
- }
- }
- else
- {
- for (x = 0; x < width - 3; x += 4)
- {
- guint32 r1b0g0r0;
- guint32 g2r2b1g1;
- guint32 b3g3r3b2;
-
- r1b0g0r0 = ((guint32 *)bp2)[0];
- g2r2b1g1 = ((guint32 *)bp2)[1];
- b3g3r3b2 = ((guint32 *)bp2)[2];
- ((guint32 *)obptr)[0] =
- ((r1b0g0r0 & 0xf8) << 8) |
- ((r1b0g0r0 & 0xfc00) >> 5) |
- ((r1b0g0r0 & 0xf80000) >> 19) |
- (r1b0g0r0 & 0xf8000000) |
- ((g2r2b1g1 & 0xfc) << 19) |
- ((g2r2b1g1 & 0xf800) << 5);
- ((guint32 *)obptr)[1] =
- ((g2r2b1g1 & 0xf80000) >> 8) |
- ((g2r2b1g1 & 0xfc000000) >> 21) |
- ((b3g3r3b2 & 0xf8) >> 3) |
- ((b3g3r3b2 & 0xf800) << 16) |
- ((b3g3r3b2 & 0xfc0000) << 3) |
- ((b3g3r3b2 & 0xf8000000) >> 11);
- bp2 += 12;
- obptr += 8;
- }
- for (; x < width; x++)
- {
- r = *bp2++;
- g = *bp2++;
- b = *bp2++;
- ((guint16 *)obptr)[0] = ((r & 0xf8) << 8) |
- ((g & 0xfc) << 3) |
- (b >> 3);
- obptr += 2;
- }
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-#else
-/* Render a 24-bit RGB image in buf into the GdkImage, without dithering.
- This assumes native byte ordering - what should really be done is to
- check whether static_image->byte_order is consistent with the _ENDIAN
- config flag, and if not, use a different function.
-
- This routine is faster than the one included with Gtk 1.0 for a number
- of reasons:
-
- 1. Shifting instead of lookup tables (less memory traffic).
-
- 2. Much less register pressure, especially because shifts are
- in the code.
-
- 3. A memcpy is avoided (i.e. the transfer function).
-
- 4. On big-endian architectures, byte swapping is avoided.
-
- That said, it wouldn't be hard to make it even faster - just make an
- inner loop that reads 3 words (i.e. 4 24-bit pixels), does a lot of
- shifting and masking, then writes 2 words.
-*/
-static void
-xlib_rgb_convert_565 (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int x, y;
- unsigned char *obuf;
- int bpl;
- unsigned char *bptr, *bp2;
- unsigned char r, g, b;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax * 2;
- for (y = 0; y < height; y++)
- {
- bp2 = bptr;
- for (x = 0; x < width; x++)
- {
- r = *bp2++;
- g = *bp2++;
- b = *bp2++;
- ((unsigned short *)obuf)[x] = ((r & 0xf8) << 8) |
- ((g & 0xfc) << 3) |
- (b >> 3);
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-#endif
-
-#ifdef HAIRY_CONVERT_565
-static void
-xlib_rgb_convert_565_gray (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int x, y;
- unsigned char *obuf, *obptr;
- int bpl;
- unsigned char *bptr, *bp2;
- unsigned char g;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax * 2;
- for (y = 0; y < height; y++)
- {
- bp2 = bptr;
- obptr = obuf;
- if (((unsigned long)obuf | (unsigned long) bp2) & 3)
- {
- for (x = 0; x < width; x++)
- {
- g = *bp2++;
- ((guint16 *)obptr)[0] = ((g & 0xf8) << 8) |
- ((g & 0xfc) << 3) |
- (g >> 3);
- obptr += 2;
- }
- }
- else
- {
- for (x = 0; x < width - 3; x += 4)
- {
- guint32 g3g2g1g0;
-
- g3g2g1g0 = ((guint32 *)bp2)[0];
- ((guint32 *)obptr)[0] =
- ((g3g2g1g0 & 0xf8) << 8) |
- ((g3g2g1g0 & 0xfc) << 3) |
- ((g3g2g1g0 & 0xf8) >> 3) |
- (g3g2g1g0 & 0xf800) << 16 |
- ((g3g2g1g0 & 0xfc00) << 11) |
- ((g3g2g1g0 & 0xf800) << 5);
- ((guint32 *)obptr)[1] =
- ((g3g2g1g0 & 0xf80000) >> 8) |
- ((g3g2g1g0 & 0xfc0000) >> 13) |
- ((g3g2g1g0 & 0xf80000) >> 19) |
- (g3g2g1g0 & 0xf8000000) |
- ((g3g2g1g0 & 0xfc000000) >> 5) |
- ((g3g2g1g0 & 0xf8000000) >> 11);
- bp2 += 4;
- obptr += 8;
- }
- for (; x < width; x++)
- {
- g = *bp2++;
- ((guint16 *)obptr)[0] = ((g & 0xf8) << 8) |
- ((g & 0xfc) << 3) |
- (g >> 3);
- obptr += 2;
- }
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-#else
-static void
-xlib_rgb_convert_565_gray (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int x, y;
- unsigned char *obuf;
- int bpl;
- unsigned char *bptr, *bp2;
- unsigned char g;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax * 2;
- for (y = 0; y < height; y++)
- {
- bp2 = bptr;
- for (x = 0; x < width; x++)
- {
- g = *bp2++;
- ((guint16 *)obuf)[x] = ((g & 0xf8) << 8) |
- ((g & 0xfc) << 3) |
- (g >> 3);
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-#endif
-
-static void
-xlib_rgb_convert_565_br (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int x, y;
- unsigned char *obuf;
- int bpl;
- unsigned char *bptr, *bp2;
- unsigned char r, g, b;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax * 2;
- for (y = 0; y < height; y++)
- {
- bp2 = bptr;
- for (x = 0; x < width; x++)
- {
- r = *bp2++;
- g = *bp2++;
- b = *bp2++;
- /* final word is:
- g4 g3 g2 b7 b6 b5 b4 b3 r7 r6 r5 r4 r3 g7 g6 g5
- */
- ((unsigned short *)obuf)[x] = (r & 0xf8) |
- ((g & 0xe0) >> 5) |
- ((g & 0x1c) << 11) |
- ((b & 0xf8) << 5);
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-
-/* Thanks to Ray Lehtiniemi for a patch that resulted in a ~25% speedup
- in this mode. */
-#ifdef HAIRY_CONVERT_565
-static void
-xlib_rgb_convert_565_d (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- /* Now this is what I'd call some highly tuned code! */
- int x, y;
- unsigned char *obuf, *obptr;
- int bpl;
- unsigned char *bptr, *bp2;
-
- width += x_align;
- height += y_align;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax * 2;
- for (y = y_align; y < height; y++)
- {
- guint32 *dmp = DM_565 + ((y & (DM_HEIGHT - 1)) << DM_WIDTH_SHIFT);
- bp2 = bptr;
- obptr = obuf;
- if (((unsigned long)obuf | (unsigned long) bp2) & 3)
- {
- for (x = x_align; x < width; x++)
- {
- gint32 rgb = *bp2++ << 20;
- rgb += *bp2++ << 10;
- rgb += *bp2++;
- rgb += dmp[x & (DM_WIDTH - 1)];
- rgb += 0x10040100
- - ((rgb & 0x1e0001e0) >> 5)
- - ((rgb & 0x00070000) >> 6);
-
- ((unsigned short *)obptr)[0] =
- ((rgb & 0x0f800000) >> 12) |
- ((rgb & 0x0003f000) >> 7) |
- ((rgb & 0x000000f8) >> 3);
- obptr += 2;
- }
- }
- else
- {
- for (x = x_align; x < width - 3; x += 4)
- {
- guint32 r1b0g0r0;
- guint32 g2r2b1g1;
- guint32 b3g3r3b2;
- guint32 rgb02, rgb13;
-
- r1b0g0r0 = ((guint32 *)bp2)[0];
- g2r2b1g1 = ((guint32 *)bp2)[1];
- b3g3r3b2 = ((guint32 *)bp2)[2];
- rgb02 =
- ((r1b0g0r0 & 0xff) << 20) +
- ((r1b0g0r0 & 0xff00) << 2) +
- ((r1b0g0r0 & 0xff0000) >> 16) +
- dmp[x & (DM_WIDTH - 1)];
- rgb02 += 0x10040100
- - ((rgb02 & 0x1e0001e0) >> 5)
- - ((rgb02 & 0x00070000) >> 6);
- rgb13 =
- ((r1b0g0r0 & 0xff000000) >> 4) +
- ((g2r2b1g1 & 0xff) << 10) +
- ((g2r2b1g1 & 0xff00) >> 8) +
- dmp[(x + 1) & (DM_WIDTH - 1)];
- rgb13 += 0x10040100
- - ((rgb13 & 0x1e0001e0) >> 5)
- - ((rgb13 & 0x00070000) >> 6);
- ((guint32 *)obptr)[0] =
- ((rgb02 & 0x0f800000) >> 12) |
- ((rgb02 & 0x0003f000) >> 7) |
- ((rgb02 & 0x000000f8) >> 3) |
- ((rgb13 & 0x0f800000) << 4) |
- ((rgb13 & 0x0003f000) << 9) |
- ((rgb13 & 0x000000f8) << 13);
- rgb02 =
- ((g2r2b1g1 & 0xff0000) << 4) +
- ((g2r2b1g1 & 0xff000000) >> 14) +
- (b3g3r3b2 & 0xff) +
- dmp[(x + 2) & (DM_WIDTH - 1)];
- rgb02 += 0x10040100
- - ((rgb02 & 0x1e0001e0) >> 5)
- - ((rgb02 & 0x00070000) >> 6);
- rgb13 =
- ((b3g3r3b2 & 0xff00) << 12) +
- ((b3g3r3b2 & 0xff0000) >> 6) +
- ((b3g3r3b2 & 0xff000000) >> 24) +
- dmp[(x + 3) & (DM_WIDTH - 1)];
- rgb13 += 0x10040100
- - ((rgb13 & 0x1e0001e0) >> 5)
- - ((rgb13 & 0x00070000) >> 6);
- ((guint32 *)obptr)[1] =
- ((rgb02 & 0x0f800000) >> 12) |
- ((rgb02 & 0x0003f000) >> 7) |
- ((rgb02 & 0x000000f8) >> 3) |
- ((rgb13 & 0x0f800000) << 4) |
- ((rgb13 & 0x0003f000) << 9) |
- ((rgb13 & 0x000000f8) << 13);
- bp2 += 12;
- obptr += 8;
- }
- for (; x < width; x++)
- {
- gint32 rgb = *bp2++ << 20;
- rgb += *bp2++ << 10;
- rgb += *bp2++;
- rgb += dmp[x & (DM_WIDTH - 1)];
- rgb += 0x10040100
- - ((rgb & 0x1e0001e0) >> 5)
- - ((rgb & 0x00070000) >> 6);
-
- ((unsigned short *)obptr)[0] =
- ((rgb & 0x0f800000) >> 12) |
- ((rgb & 0x0003f000) >> 7) |
- ((rgb & 0x000000f8) >> 3);
- obptr += 2;
- }
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-#else
-static void
-xlib_rgb_convert_565_d (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int x, y;
- unsigned char *obuf;
- int bpl;
- unsigned char *bptr;
-
- width += x_align;
- height += y_align;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + (ax - x_align) * 2;
-
- for (y = y_align; y < height; y++)
- {
- guint32 *dmp = DM_565 + ((y & (DM_HEIGHT - 1)) << DM_WIDTH_SHIFT);
- unsigned char *bp2 = bptr;
-
- for (x = x_align; x < width; x++)
- {
- gint32 rgb = *bp2++ << 20;
- rgb += *bp2++ << 10;
- rgb += *bp2++;
- rgb += dmp[x & (DM_WIDTH - 1)];
- rgb += 0x10040100
- - ((rgb & 0x1e0001e0) >> 5)
- - ((rgb & 0x00070000) >> 6);
-
- ((unsigned short *)obuf)[x] =
- ((rgb & 0x0f800000) >> 12) |
- ((rgb & 0x0003f000) >> 7) |
- ((rgb & 0x000000f8) >> 3);
- }
-
- bptr += rowstride;
- obuf += bpl;
- }
-}
-#endif
-
-static void
-xlib_rgb_convert_555 (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int x, y;
- unsigned char *obuf;
- int bpl;
- unsigned char *bptr, *bp2;
- unsigned char r, g, b;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax * 2;
- for (y = 0; y < height; y++)
- {
- bp2 = bptr;
- for (x = 0; x < width; x++)
- {
- r = *bp2++;
- g = *bp2++;
- b = *bp2++;
- ((unsigned short *)obuf)[x] = ((r & 0xf8) << 7) |
- ((g & 0xf8) << 2) |
- (b >> 3);
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-
-static void
-xlib_rgb_convert_555_br (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int x, y;
- unsigned char *obuf;
- int bpl;
- unsigned char *bptr, *bp2;
- unsigned char r, g, b;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax * 2;
- for (y = 0; y < height; y++)
- {
- bp2 = bptr;
- for (x = 0; x < width; x++)
- {
- r = *bp2++;
- g = *bp2++;
- b = *bp2++;
- /* final word is:
- g5 g4 g3 b7 b6 b5 b4 b3 0 r7 r6 r5 r4 r3 g7 g6
- */
- ((unsigned short *)obuf)[x] = ((r & 0xf8) >> 1) |
- ((g & 0xc0) >> 6) |
- ((g & 0x18) << 10) |
- ((b & 0xf8) << 5);
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-
-static void
-xlib_rgb_convert_888_msb (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int y;
- unsigned char *obuf;
- int bpl;
- unsigned char *bptr;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax * 3;
- for (y = 0; y < height; y++)
- {
- memcpy (obuf, bptr, (unsigned int)(width + width + width));
- bptr += rowstride;
- obuf += bpl;
- }
-}
-
-/* todo: optimize this */
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
-#define HAIRY_CONVERT_888
-#endif
-
-#ifdef HAIRY_CONVERT_888
-static void
-xlib_rgb_convert_888_lsb (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int x, y;
- unsigned char *obuf, *obptr;
- int bpl;
- unsigned char *bptr, *bp2;
- int r, g, b;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax * 3;
- for (y = 0; y < height; y++)
- {
- bp2 = bptr;
- obptr = obuf;
- if (((unsigned long)obuf | (unsigned long) bp2) & 3)
- {
- for (x = 0; x < width; x++)
- {
- r = bp2[0];
- g = bp2[1];
- b = bp2[2];
- *obptr++ = b;
- *obptr++ = g;
- *obptr++ = r;
- bp2 += 3;
- }
- }
- else
- {
- for (x = 0; x < width - 3; x += 4)
- {
- guint32 r1b0g0r0;
- guint32 g2r2b1g1;
- guint32 b3g3r3b2;
-
- r1b0g0r0 = ((guint32 *)bp2)[0];
- g2r2b1g1 = ((guint32 *)bp2)[1];
- b3g3r3b2 = ((guint32 *)bp2)[2];
- ((guint32 *)obptr)[0] =
- (r1b0g0r0 & 0xff00) |
- ((r1b0g0r0 & 0xff0000) >> 16) |
- (((g2r2b1g1 & 0xff00) | (r1b0g0r0 & 0xff)) << 16);
- ((guint32 *)obptr)[1] =
- (g2r2b1g1 & 0xff0000ff) |
- ((r1b0g0r0 & 0xff000000) >> 16) |
- ((b3g3r3b2 & 0xff) << 16);
- ((guint32 *)obptr)[2] =
- (((g2r2b1g1 & 0xff0000) | (b3g3r3b2 & 0xff000000)) >> 16) |
- ((b3g3r3b2 & 0xff00) << 16) |
- ((b3g3r3b2 & 0xff0000));
- bp2 += 12;
- obptr += 12;
- }
- for (; x < width; x++)
- {
- r = bp2[0];
- g = bp2[1];
- b = bp2[2];
- *obptr++ = b;
- *obptr++ = g;
- *obptr++ = r;
- bp2 += 3;
- }
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-#else
-static void
-xlib_rgb_convert_888_lsb (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int x, y;
- unsigned char *obuf;
- int bpl;
- unsigned char *bptr, *bp2;
- int r, g, b;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax * 3;
- for (y = 0; y < height; y++)
- {
- bp2 = bptr;
- for (x = 0; x < width; x++)
- {
- r = bp2[0];
- g = bp2[1];
- b = bp2[2];
- obuf[x * 3] = b;
- obuf[x * 3 + 1] = g;
- obuf[x * 3 + 2] = r;
- bp2 += 3;
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-#endif
-
-/* convert 24-bit packed to 32-bit unpacked */
-/* todo: optimize this */
-static void
-xlib_rgb_convert_0888 (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int x, y;
- unsigned char *obuf;
- int bpl;
- unsigned char *bptr, *bp2;
- int r, g, b;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax * 4;
- for (y = 0; y < height; y++)
- {
- bp2 = bptr;
- for (x = 0; x < width; x++)
- {
- r = bp2[0];
- g = bp2[1];
- b = bp2[2];
- ((guint32 *)obuf)[x] = (r << 16) | (g << 8) | b;
- bp2 += 3;
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-
-static void
-xlib_rgb_convert_0888_br (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int x, y;
- unsigned char *obuf;
- int bpl;
- unsigned char *bptr, *bp2;
- int r, g, b;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax * 4;
- for (y = 0; y < height; y++)
- {
- bp2 = bptr;
- for (x = 0; x < width; x++)
- {
- r = bp2[0];
- g = bp2[1];
- b = bp2[2];
- ((guint32 *)obuf)[x] = (b << 24) | (g << 16) | (r << 8);
- bp2 += 3;
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-
-static void
-xlib_rgb_convert_8880_br (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int x, y;
- unsigned char *obuf;
- int bpl;
- unsigned char *bptr, *bp2;
- int r, g, b;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax * 4;
- for (y = 0; y < height; y++)
- {
- bp2 = bptr;
- for (x = 0; x < width; x++)
- {
- r = bp2[0];
- g = bp2[1];
- b = bp2[2];
- ((guint32 *)obuf)[x] = (b << 16) | (g << 8) | r;
- bp2 += 3;
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-
-/* Generic truecolor/directcolor conversion function. Slow, but these
- are oddball modes. */
-static void
-xlib_rgb_convert_truecolor_lsb (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align,
- XlibRgbCmap *cmap)
-{
- int x, y;
- unsigned char *obuf, *obptr;
- int bpl;
- unsigned char *bptr, *bp2;
- int r, g, b;
- int r_right, r_left;
- int g_right, g_left;
- int b_right, b_left;
- int bpp;
- guint32 pixel;
- int i;
-
- r_right = 8 - image_info->red_prec;
- r_left = image_info->red_shift;
- g_right = 8 - image_info->green_prec;
- g_left = image_info->green_shift;
- b_right = 8 - image_info->blue_prec;
- b_left = image_info->blue_shift;
- bpp = image_info->bpp;
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax * bpp;
- for (y = 0; y < height; y++)
- {
- obptr = obuf;
- bp2 = bptr;
- for (x = 0; x < width; x++)
- {
- r = bp2[0];
- g = bp2[1];
- b = bp2[2];
- pixel = ((r >> r_right) << r_left) |
- ((g >> g_right) << g_left) |
- ((b >> b_right) << b_left);
- for (i = 0; i < bpp; i++)
- {
- *obptr++ = pixel & 0xff;
- pixel >>= 8;
- }
- bp2 += 3;
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-
-static void
-xlib_rgb_convert_truecolor_lsb_d (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align,
- XlibRgbCmap *cmap)
-{
- int x, y;
- unsigned char *obuf, *obptr;
- int bpl;
- unsigned char *bptr, *bp2;
- int r, g, b;
- int r_right, r_left, r_prec;
- int g_right, g_left, g_prec;
- int b_right, b_left, b_prec;
- int bpp;
- guint32 pixel;
- int i;
- int dith;
- int r1, g1, b1;
- const unsigned char *dmp;
-
- r_right = 8 - image_info->red_prec;
- r_left = image_info->red_shift;
- r_prec = image_info->red_prec;
- g_right = 8 - image_info->green_prec;
- g_left = image_info->green_shift;
- g_prec = image_info->green_prec;
- b_right = 8 - image_info->blue_prec;
- b_left = image_info->blue_shift;
- b_prec = image_info->blue_prec;
- bpp = image_info->bpp;
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax * bpp;
- for (y = 0; y < height; y++)
- {
- dmp = DM[(y_align + y) & (DM_HEIGHT - 1)];
- obptr = obuf;
- bp2 = bptr;
- for (x = 0; x < width; x++)
- {
- r = bp2[0];
- g = bp2[1];
- b = bp2[2];
- dith = dmp[(x_align + x) & (DM_WIDTH - 1)] << 2;
- r1 = r + (dith >> r_prec);
- g1 = g + ((252 - dith) >> g_prec);
- b1 = b + (dith >> b_prec);
- pixel = (((r1 - (r1 >> r_prec)) >> r_right) << r_left) |
- (((g1 - (g1 >> g_prec)) >> g_right) << g_left) |
- (((b1 - (b1 >> b_prec)) >> b_right) << b_left);
- for (i = 0; i < bpp; i++)
- {
- *obptr++ = pixel & 0xff;
- pixel >>= 8;
- }
- bp2 += 3;
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-
-static void
-xlib_rgb_convert_truecolor_msb (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align,
- XlibRgbCmap *cmap)
-{
- int x, y;
- unsigned char *obuf, *obptr;
- int bpl;
- unsigned char *bptr, *bp2;
- int r, g, b;
- int r_right, r_left;
- int g_right, g_left;
- int b_right, b_left;
- int bpp;
- guint32 pixel;
- int shift, shift_init;
-
- r_right = 8 - image_info->red_prec;
- r_left = image_info->red_shift;
- g_right = 8 - image_info->green_prec;
- g_left = image_info->green_shift;
- b_right = 8 - image_info->blue_prec;
- b_left = image_info->blue_shift;
- bpp = image_info->bpp;
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax * bpp;
- shift_init = (bpp - 1) << 3;
- for (y = 0; y < height; y++)
- {
- obptr = obuf;
- bp2 = bptr;
- for (x = 0; x < width; x++)
- {
- r = bp2[0];
- g = bp2[1];
- b = bp2[2];
- pixel = ((r >> r_right) << r_left) |
- ((g >> g_right) << g_left) |
- ((b >> b_right) << b_left);
- for (shift = shift_init; shift >= 0; shift -= 8)
- {
- *obptr++ = (pixel >> shift) & 0xff;
- }
- bp2 += 3;
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-
-static void
-xlib_rgb_convert_truecolor_msb_d (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align,
- XlibRgbCmap *cmap)
-{
- int x, y;
- unsigned char *obuf, *obptr;
- int bpl;
- unsigned char *bptr, *bp2;
- int r, g, b;
- int r_right, r_left, r_prec;
- int g_right, g_left, g_prec;
- int b_right, b_left, b_prec;
- int bpp;
- guint32 pixel;
- int shift, shift_init;
- int dith;
- int r1, g1, b1;
- const unsigned char *dmp;
-
- r_right = 8 - image_info->red_prec;
- r_left = image_info->red_shift;
- r_prec = image_info->red_prec;
- g_right = 8 - image_info->green_prec;
- g_left = image_info->green_shift;
- g_prec = image_info->green_prec;
- b_right = 8 - image_info->blue_prec;
- b_left = image_info->blue_shift;
- b_prec = image_info->blue_prec;
- bpp = image_info->bpp;
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax * bpp;
- shift_init = (bpp - 1) << 3;
- for (y = 0; y < height; y++)
- {
- dmp = DM[(y_align + y) & (DM_HEIGHT - 1)];
- obptr = obuf;
- bp2 = bptr;
- for (x = 0; x < width; x++)
- {
- r = bp2[0];
- g = bp2[1];
- b = bp2[2];
- dith = dmp[(x_align + x) & (DM_WIDTH - 1)] << 2;
- r1 = r + (dith >> r_prec);
- g1 = g + ((252 - dith) >> g_prec);
- b1 = b + (dith >> b_prec);
- pixel = (((r1 - (r1 >> r_prec)) >> r_right) << r_left) |
- (((g1 - (g1 >> g_prec)) >> g_right) << g_left) |
- (((b1 - (b1 >> b_prec)) >> b_right) << b_left);
- for (shift = shift_init; shift >= 0; shift -= 8)
- {
- *obptr++ = (pixel >> shift) & 0xff;
- }
- bp2 += 3;
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-
-/* This actually works for depths from 3 to 7 */
-static void
-xlib_rgb_convert_4 (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align,
- XlibRgbCmap *cmap)
-{
- int x, y;
- int bpl;
- unsigned char *obuf, *obptr;
- unsigned char *bptr, *bp2;
- int r, g, b;
- const unsigned char *dmp;
- int dith;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax;
- for (y = 0; y < height; y++)
- {
- dmp = DM[(y_align + y) & (DM_HEIGHT - 1)];
- bp2 = bptr;
- obptr = obuf;
- for (x = 0; x < width; x += 1)
- {
- r = *bp2++;
- g = *bp2++;
- b = *bp2++;
- dith = (dmp[(x_align + x) & (DM_WIDTH - 1)] << 2) | 3;
- obptr[0] = colorcube_d[(((r + dith) & 0x100) >> 2) |
- (((g + 258 - dith) & 0x100) >> 5) |
- (((b + dith) & 0x100) >> 8)];
- obptr++;
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-
-/* This actually works for depths from 3 to 7 */
-static void
-xlib_rgb_convert_gray4 (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int x, y;
- int bpl;
- unsigned char *obuf, *obptr;
- unsigned char *bptr, *bp2;
- int r, g, b;
- int shift;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax;
- shift = 9 - image_info->x_visual_info->depth;
- for (y = 0; y < height; y++)
- {
- bp2 = bptr;
- obptr = obuf;
- for (x = 0; x < width; x++)
- {
- r = *bp2++;
- g = *bp2++;
- b = *bp2++;
- obptr[0] = (g + ((b + r) >> 1)) >> shift;
- obptr++;
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-
-static void
-xlib_rgb_convert_gray4_pack (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int x, y;
- int bpl;
- unsigned char *obuf, *obptr;
- unsigned char *bptr, *bp2;
- int r, g, b;
- int shift;
- unsigned char pix0, pix1;
- /* todo: this is hardcoded to big-endian. Make endian-agile. */
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + (ax >> 1);
- shift = 9 - image_info->x_visual_info->depth;
- for (y = 0; y < height; y++)
- {
- bp2 = bptr;
- obptr = obuf;
- for (x = 0; x < width; x += 2)
- {
- r = *bp2++;
- g = *bp2++;
- b = *bp2++;
- pix0 = (g + ((b + r) >> 1)) >> shift;
- r = *bp2++;
- g = *bp2++;
- b = *bp2++;
- pix1 = (g + ((b + r) >> 1)) >> shift;
- obptr[0] = (pix0 << 4) | pix1;
- obptr++;
- }
- if (width & 1)
- {
- r = *bp2++;
- g = *bp2++;
- b = *bp2++;
- pix0 = (g + ((b + r) >> 1)) >> shift;
- obptr[0] = (pix0 << 4);
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-
-/* This actually works for depths from 3 to 7 */
-static void
-xlib_rgb_convert_gray4_d (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int x, y;
- int bpl;
- unsigned char *obuf, *obptr;
- unsigned char *bptr, *bp2;
- int r, g, b;
- const unsigned char *dmp;
- int prec, right;
- int gray;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + ax;
- prec = image_info->x_visual_info->depth;
- right = 8 - prec;
- for (y = 0; y < height; y++)
- {
- bp2 = bptr;
- obptr = obuf;
- dmp = DM[(y_align + y) & (DM_HEIGHT - 1)];
- for (x = 0; x < width; x++)
- {
- r = *bp2++;
- g = *bp2++;
- b = *bp2++;
- gray = (g + ((b + r) >> 1)) >> 1;
- gray += (dmp[(x_align + x) & (DM_WIDTH - 1)] << 2) >> prec;
- obptr[0] = (gray - (gray >> prec)) >> right;
- obptr++;
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-
-static void
-xlib_rgb_convert_gray4_d_pack (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- int x, y;
- int bpl;
- unsigned char *obuf, *obptr;
- unsigned char *bptr, *bp2;
- int r, g, b;
- const unsigned char *dmp;
- int prec, right;
- int gray;
- unsigned char pix0, pix1;
- /* todo: this is hardcoded to big-endian. Make endian-agile. */
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + (ax >> 1);
- prec = image_info->x_visual_info->depth;
- right = 8 - prec;
- for (y = 0; y < height; y++)
- {
- bp2 = bptr;
- obptr = obuf;
- dmp = DM[(y_align + y) & (DM_HEIGHT - 1)];
- for (x = 0; x < width; x += 2)
- {
- r = *bp2++;
- g = *bp2++;
- b = *bp2++;
- gray = (g + ((b + r) >> 1)) >> 1;
- gray += (dmp[(x_align + x) & (DM_WIDTH - 1)] << 2) >> prec;
- pix0 = (gray - (gray >> prec)) >> right;
- r = *bp2++;
- g = *bp2++;
- b = *bp2++;
- gray = (g + ((b + r) >> 1)) >> 1;
- gray += (dmp[(x_align + x + 1) & (DM_WIDTH - 1)] << 2) >> prec;
- pix1 = (gray - (gray >> prec)) >> right;
- obptr[0] = (pix0 << 4) | pix1;
- obptr++;
- }
- if (width & 1)
- {
- r = *bp2++;
- g = *bp2++;
- b = *bp2++;
- gray = (g + ((b + r) >> 1)) >> 1;
- gray += (dmp[(x_align + x + 1) & (DM_WIDTH - 1)] << 2) >> prec;
- pix0 = (gray - (gray >> prec)) >> right;
- obptr[0] = (pix0 << 4);
- }
- bptr += rowstride;
- obuf += bpl;
- }
-}
-
-static void
-xlib_rgb_convert_1 (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align,
- XlibRgbCmap *cmap)
-{
- int x, y;
- int bpl;
- unsigned char *obuf, *obptr;
- unsigned char *bptr, *bp2;
- int r, g, b;
- const unsigned char *dmp;
- int dith;
- unsigned char byte;
-
- bptr = buf;
- bpl = image->bytes_per_line;
- obuf = ((unsigned char *)image->data) + ay * bpl + (ax >> 3);
- byte = 0; /* unnecessary, but it keeps gcc from complaining */
- for (y = 0; y < height; y++)
- {
- dmp = DM[(y_align + y) & (DM_HEIGHT - 1)];
- bp2 = bptr;
- obptr = obuf;
- for (x = 0; x < width; x++)
- {
- r = *bp2++;
- g = *bp2++;
- b = *bp2++;
- dith = (dmp[(x_align + x) & (DM_WIDTH - 1)] << 4) | 4;
- byte += byte + (r + g + g + b + dith > 1020);
- if ((x & 7) == 7)
- {
- obptr[0] = byte;
- obptr++;
- }
- }
- if (x & 7)
- obptr[0] = byte << (8 - (x & 7));
- bptr += rowstride;
- obuf += bpl;
- }
-}
-
-/* Returns a pointer to the stage buffer. */
-static unsigned char *
-xlib_rgb_ensure_stage (void)
-{
- if (image_info->stage_buf == NULL)
- image_info->stage_buf = malloc (IMAGE_HEIGHT * STAGE_ROWSTRIDE);
- return image_info->stage_buf;
-}
-
-/* This is slow. Speed me up, please. */
-static void
-xlib_rgb_32_to_stage (unsigned char *buf, int rowstride, int width, int height)
-{
- int x, y;
- unsigned char *pi_start, *po_start;
- unsigned char *pi, *po;
-
- pi_start = buf;
- po_start = xlib_rgb_ensure_stage ();
- for (y = 0; y < height; y++)
- {
- pi = pi_start;
- po = po_start;
- for (x = 0; x < width; x++)
- {
- *po++ = *pi++;
- *po++ = *pi++;
- *po++ = *pi++;
- pi++;
- }
- pi_start += rowstride;
- po_start += STAGE_ROWSTRIDE;
- }
-}
-
-/* Generic 32bit RGB conversion function - convert to 24bit packed, then
- go from there. */
-static void
-xlib_rgb_convert_32_generic (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- xlib_rgb_32_to_stage (buf, rowstride, width, height);
-
- (*image_info->conv) (image, ax, ay, width, height,
- image_info->stage_buf, STAGE_ROWSTRIDE,
- x_align, y_align, cmap);
-}
-
-/* Generic 32bit RGB conversion function - convert to 24bit packed, then
- go from there. */
-static void
-xlib_rgb_convert_32_generic_d (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- xlib_rgb_32_to_stage (buf, rowstride, width, height);
-
- (*image_info->conv_d) (image, ax, ay, width, height,
- image_info->stage_buf, STAGE_ROWSTRIDE,
- x_align, y_align, cmap);
-}
-
-/* This is slow. Speed me up, please. */
-static void
-xlib_rgb_gray_to_stage (unsigned char *buf, int rowstride, int width, int height)
-{
- int x, y;
- unsigned char *pi_start, *po_start;
- unsigned char *pi, *po;
- unsigned char gray;
-
- pi_start = buf;
- po_start = xlib_rgb_ensure_stage ();
- for (y = 0; y < height; y++)
- {
- pi = pi_start;
- po = po_start;
- for (x = 0; x < width; x++)
- {
- gray = *pi++;
- *po++ = gray;
- *po++ = gray;
- *po++ = gray;
- }
- pi_start += rowstride;
- po_start += STAGE_ROWSTRIDE;
- }
-}
-
-/* Generic gray conversion function - convert to 24bit packed, then go
- from there. */
-static void
-xlib_rgb_convert_gray_generic (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- xlib_rgb_gray_to_stage (buf, rowstride, width, height);
-
- (*image_info->conv) (image, ax, ay, width, height,
- image_info->stage_buf, STAGE_ROWSTRIDE,
- x_align, y_align, cmap);
-}
-
-static void
-xlib_rgb_convert_gray_generic_d (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- xlib_rgb_gray_to_stage (buf, rowstride, width, height);
-
- (*image_info->conv_d) (image, ax, ay, width, height,
- image_info->stage_buf, STAGE_ROWSTRIDE,
- x_align, y_align, cmap);
-}
-
-/* Render grayscale using indexed method. */
-static void
-xlib_rgb_convert_gray_cmap (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- (*image_info->conv_indexed) (image, ax, ay, width, height,
- buf, rowstride,
- x_align, y_align, image_info->gray_cmap);
-}
-
-#if 0
-static void
-xlib_rgb_convert_gray_cmap_d (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- (*image_info->conv_indexed_d) (image, ax, ay, width, height,
- buf, rowstride,
- x_align, y_align, image_info->gray_cmap);
-}
-#endif
-
-/* This is slow. Speed me up, please. */
-static void
-xlib_rgb_indexed_to_stage (unsigned char *buf, int rowstride, int width, int height,
- XlibRgbCmap *cmap)
-{
- int x, y;
- unsigned char *pi_start, *po_start;
- unsigned char *pi, *po;
- int rgb;
-
- pi_start = buf;
- po_start = xlib_rgb_ensure_stage ();
- for (y = 0; y < height; y++)
- {
- pi = pi_start;
- po = po_start;
- for (x = 0; x < width; x++)
- {
- rgb = cmap->colors[*pi++];
- *po++ = rgb >> 16;
- *po++ = (rgb >> 8) & 0xff;
- *po++ = rgb & 0xff;
- }
- pi_start += rowstride;
- po_start += STAGE_ROWSTRIDE;
- }
-}
-
-/* Generic gray conversion function - convert to 24bit packed, then go
- from there. */
-static void
-xlib_rgb_convert_indexed_generic (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align, XlibRgbCmap *cmap)
-{
- xlib_rgb_indexed_to_stage (buf, rowstride, width, height, cmap);
-
- (*image_info->conv) (image, ax, ay, width, height,
- image_info->stage_buf, STAGE_ROWSTRIDE,
- x_align, y_align, cmap);
-}
-
-static void
-xlib_rgb_convert_indexed_generic_d (XImage *image,
- int ax, int ay, int width, int height,
- unsigned char *buf, int rowstride,
- int x_align, int y_align,
- XlibRgbCmap *cmap)
-{
- xlib_rgb_indexed_to_stage (buf, rowstride, width, height, cmap);
-
- (*image_info->conv_d) (image, ax, ay, width, height,
- image_info->stage_buf, STAGE_ROWSTRIDE,
- x_align, y_align, cmap);
-}
-
-/* Select a conversion function based on the visual and a
- representative image. */
-static void
-xlib_rgb_select_conv (XImage *image, ByteOrder byte_order)
-{
- int depth, byterev;
- int vtype; /* visual type */
- int bpp; /* bits per pixel - from the visual */
- guint32 red_mask, green_mask, blue_mask;
- XlibRgbConvFunc conv, conv_d;
- XlibRgbConvFunc conv_32, conv_32_d;
- XlibRgbConvFunc conv_gray, conv_gray_d;
- XlibRgbConvFunc conv_indexed, conv_indexed_d;
- Bool mask_rgb, mask_bgr;
-
- depth = image_info->x_visual_info->depth;
- bpp = image->bits_per_pixel;
- if (xlib_rgb_verbose)
- printf ("Chose visual 0x%x, image bpp=%d, %s first\n",
- (int)image_info->x_visual_info->visual->visualid,
- bpp, byte_order == LSB_FIRST ? "lsb" : "msb");
-
-#if G_BYTE_ORDER == G_BIG_ENDIAN
- byterev = (byte_order == LSB_FIRST);
-#else
- byterev = (byte_order == MSB_FIRST);
-#endif
-
- vtype = image_info->x_visual_info->class;
- if (vtype == DirectColor)
- vtype = TrueColor;
-
- red_mask = image_info->x_visual_info->red_mask;
- green_mask = image_info->x_visual_info->green_mask;
- blue_mask = image_info->x_visual_info->blue_mask;
-
- mask_rgb = red_mask == 0xff0000 && green_mask == 0xff00 && blue_mask == 0xff;
- mask_bgr = red_mask == 0xff && green_mask == 0xff00 && blue_mask == 0xff0000;
-
- conv = NULL;
- conv_d = NULL;
-
- conv_32 = xlib_rgb_convert_32_generic;
- conv_32_d = xlib_rgb_convert_32_generic_d;
-
- conv_gray = xlib_rgb_convert_gray_generic;
- conv_gray_d = xlib_rgb_convert_gray_generic_d;
-
- conv_indexed = xlib_rgb_convert_indexed_generic;
- conv_indexed_d = xlib_rgb_convert_indexed_generic_d;
-
- image_info->dith_default = FALSE;
-
- if (image_info->bitmap)
- conv = xlib_rgb_convert_1;
- else if (bpp == 16 && depth == 16 && !byterev &&
- red_mask == 0xf800 && green_mask == 0x7e0 && blue_mask == 0x1f)
- {
- conv = xlib_rgb_convert_565;
- conv_d = xlib_rgb_convert_565_d;
- conv_gray = xlib_rgb_convert_565_gray;
- xlib_rgb_preprocess_dm_565 ();
- }
- else if (bpp == 16 && depth == 16 &&
- vtype == TrueColor&& byterev &&
- red_mask == 0xf800 && green_mask == 0x7e0 && blue_mask == 0x1f)
- conv = xlib_rgb_convert_565_br;
-
- else if (bpp == 16 && depth == 15 &&
- vtype == TrueColor && !byterev &&
- red_mask == 0x7c00 && green_mask == 0x3e0 && blue_mask == 0x1f)
- conv = xlib_rgb_convert_555;
-
- else if (bpp == 16 && depth == 15 &&
- vtype == TrueColor && byterev &&
- red_mask == 0x7c00 && green_mask == 0x3e0 && blue_mask == 0x1f)
- conv = xlib_rgb_convert_555_br;
-
- /* I'm not 100% sure about the 24bpp tests - but testing will show*/
- else if (bpp == 24 && depth == 24 && vtype == TrueColor &&
- ((mask_rgb && byte_order == LSB_FIRST) ||
- (mask_bgr && byte_order == MSB_FIRST)))
- conv = xlib_rgb_convert_888_lsb;
- else if (bpp == 24 && depth == 24 && vtype == TrueColor &&
- ((mask_rgb && byte_order == MSB_FIRST) ||
- (mask_bgr && byte_order == LSB_FIRST)))
- conv = xlib_rgb_convert_888_msb;
-#if G_BYTE_ORDER == G_BIG_ENDIAN
- else if (bpp == 32 && depth == 24 && vtype == TrueColor &&
- (mask_rgb && byte_order == LSB_FIRST))
- conv = xlib_rgb_convert_0888_br;
- else if (bpp == 32 && depth == 24 && vtype == TrueColor &&
- (mask_rgb && byte_order == MSB_FIRST))
- conv = xlib_rgb_convert_0888;
- else if (bpp == 32 && depth == 24 && vtype == TrueColor &&
- (mask_bgr && byte_order == MSB_FIRST))
- conv = xlib_rgb_convert_8880_br;
-#else
- else if (bpp == 32 && depth == 24 && vtype == TrueColor &&
- (mask_rgb && byte_order == MSB_FIRST))
- conv = xlib_rgb_convert_0888_br;
- else if (bpp == 32 && (depth == 32 || depth == 24) && vtype == TrueColor &&
- (mask_rgb && byte_order == LSB_FIRST))
- conv = xlib_rgb_convert_0888;
- else if (bpp == 32 && depth == 24 && vtype == TrueColor &&
- (mask_bgr && byte_order == LSB_FIRST))
- conv = xlib_rgb_convert_8880_br;
-#endif
-
- else if (vtype == TrueColor && byte_order == LSB_FIRST)
- {
- conv = xlib_rgb_convert_truecolor_lsb;
- conv_d = xlib_rgb_convert_truecolor_lsb_d;
- }
- else if (vtype == TrueColor && byte_order == MSB_FIRST)
- {
- conv = xlib_rgb_convert_truecolor_msb;
- conv_d = xlib_rgb_convert_truecolor_msb_d;
- }
- else if (bpp == 8 && depth == 8 && (vtype == PseudoColor
-#ifdef ENABLE_GRAYSCALE
- || vtype == GrayScale
-#endif
- ))
- {
- image_info->dith_default = TRUE;
- conv = xlib_rgb_convert_8;
- if (vtype != GrayScale)
- {
- if (image_info->nred_shades == 6 &&
- image_info->ngreen_shades == 6 &&
- image_info->nblue_shades == 6)
- conv_d = xlib_rgb_convert_8_d666;
- else
- conv_d = xlib_rgb_convert_8_d;
- }
- conv_indexed = xlib_rgb_convert_8_indexed;
- conv_gray = xlib_rgb_convert_gray_cmap;
- }
- else if (bpp == 8 && depth == 8 && (vtype == StaticGray
-#ifdef not_ENABLE_GRAYSCALE
- || vtype == GrayScale
-#endif
- ))
- {
- conv = xlib_rgb_convert_gray8;
- conv_gray = xlib_rgb_convert_gray8_gray;
- }
- else if (bpp == 8 && depth < 8 && depth >= 2 &&
- (vtype == StaticGray
- || vtype == GrayScale))
- {
- conv = xlib_rgb_convert_gray4;
- conv_d = xlib_rgb_convert_gray4_d;
- }
- else if (bpp == 8 && depth < 8 && depth >= 3)
- {
- conv = xlib_rgb_convert_4;
- }
- else if (bpp == 4 && depth <= 4 && depth >= 2 &&
- (vtype == StaticGray
- || vtype == GrayScale))
- {
- conv = xlib_rgb_convert_gray4_pack;
- conv_d = xlib_rgb_convert_gray4_d_pack;
- }
-
- if (conv_d == NULL)
- conv_d = conv;
-
- image_info->conv = conv;
- image_info->conv_d = conv_d;
-
- image_info->conv_32 = conv_32;
- image_info->conv_32_d = conv_32_d;
-
- image_info->conv_gray = conv_gray;
- image_info->conv_gray_d = conv_gray_d;
-
- image_info->conv_indexed = conv_indexed;
- image_info->conv_indexed_d = conv_indexed_d;
-}
-
-static int horiz_idx;
-static int horiz_y = IMAGE_HEIGHT;
-static int vert_idx;
-static int vert_x = IMAGE_WIDTH;
-static int tile_idx;
-static int tile_x = IMAGE_WIDTH;
-static int tile_y1 = IMAGE_HEIGHT;
-static int tile_y2 = IMAGE_HEIGHT;
-
-#ifdef VERBOSE
-static int sincelast;
-#endif
-
-/* Defining NO_FLUSH can cause inconsistent screen updates, but is useful
- for performance evaluation. */
-
-#undef NO_FLUSH
-
-static int
-xlib_rgb_alloc_scratch_image (void)
-{
- if (static_image_idx == N_IMAGES)
- {
-#ifndef NO_FLUSH
- XFlush(image_info->display);
-#endif
-#ifdef VERBOSE
- printf ("flush, %d puts since last flush\n", sincelast);
- sincelast = 0;
-#endif
- static_image_idx = 0;
- horiz_y = IMAGE_HEIGHT;
- vert_x = IMAGE_WIDTH;
- tile_x = IMAGE_WIDTH;
- tile_y1 = tile_y2 = IMAGE_HEIGHT;
- }
- return static_image_idx++;
-}
-
-static XImage *
-xlib_rgb_alloc_scratch (int width, int height, int *ax, int *ay)
-{
- XImage *image;
- int idx;
-
- if (width >= (IMAGE_WIDTH >> 1))
- {
- if (height >= (IMAGE_HEIGHT >> 1))
- {
- idx = xlib_rgb_alloc_scratch_image ();
- *ax = 0;
- *ay = 0;
- }
- else
- {
- if (height + horiz_y > IMAGE_HEIGHT)
- {
- horiz_idx = xlib_rgb_alloc_scratch_image ();
- horiz_y = 0;
- }
- idx = horiz_idx;
- *ax = 0;
- *ay = horiz_y;
- horiz_y += height;
- }
- }
- else
- {
- if (height >= (IMAGE_HEIGHT >> 1))
- {
- if (width + vert_x > IMAGE_WIDTH)
- {
- vert_idx = xlib_rgb_alloc_scratch_image ();
- vert_x = 0;
- }
- idx = vert_idx;
- *ax = vert_x;
- *ay = 0;
- /* using 3 and -4 would be slightly more efficient on 32-bit machines
- with > 1bpp displays */
- vert_x += (width + 7) & -8;
- }
- else
- {
- if (width + tile_x > IMAGE_WIDTH)
- {
- tile_y1 = tile_y2;
- tile_x = 0;
- }
- if (height + tile_y1 > IMAGE_HEIGHT)
- {
- tile_idx = xlib_rgb_alloc_scratch_image ();
- tile_x = 0;
- tile_y1 = 0;
- tile_y2 = 0;
- }
- if (height + tile_y1 > tile_y2)
- tile_y2 = height + tile_y1;
- idx = tile_idx;
- *ax = tile_x;
- *ay = tile_y1;
- tile_x += (width + 7) & -8;
- }
- }
- image = static_image[idx];
-#ifdef VERBOSE
- printf ("index %d, x %d, y %d (%d x %d)\n", idx, *ax, *ay, width, height);
- sincelast++;
-#endif
- return image;
-}
-
-static void
-xlib_draw_rgb_image_core (Drawable drawable,
- GC gc,
- int x,
- int y,
- int width,
- int height,
- unsigned char *buf,
- int pixstride,
- int rowstride,
- XlibRgbConvFunc conv,
- XlibRgbCmap *cmap,
- int xdith,
- int ydith)
-{
- int ay, ax;
- int xs0, ys0;
- XImage *image;
- int width1, height1;
- unsigned char *buf_ptr;
-
- if (image_info->bitmap)
- {
- if (image_info->own_gc == 0)
- {
- XColor color;
-
- image_info->own_gc = XCreateGC(image_info->display,
- drawable,
- 0, NULL);
- color.pixel = WhitePixel(image_info->display,
- image_info->screen_num);
- XSetForeground(image_info->display, image_info->own_gc, color.pixel);
- color.pixel = BlackPixel(image_info->display,
- image_info->screen_num);
- XSetBackground(image_info->display, image_info->own_gc, color.pixel);
- }
- gc = image_info->own_gc;
- }
- for (ay = 0; ay < height; ay += IMAGE_HEIGHT)
- {
- height1 = MIN (height - ay, IMAGE_HEIGHT);
- for (ax = 0; ax < width; ax += IMAGE_WIDTH)
- {
- width1 = MIN (width - ax, IMAGE_WIDTH);
- buf_ptr = buf + ay * rowstride + ax * pixstride;
-
- image = xlib_rgb_alloc_scratch (width1, height1, &xs0, &ys0);
-
- conv (image, xs0, ys0, width1, height1, buf_ptr, rowstride,
- x + ax + xdith, y + ay + ydith, cmap);
-
-#ifndef DONT_ACTUALLY_DRAW
- XPutImage(image_info->display, drawable, gc, image,
- xs0, ys0, x + ax, y + ay, (unsigned int)width1, (unsigned int)height1);
-#endif
- }
- }
-}
-
-
-/**
- * xlib_draw_rgb_image:
- * @drawable: Destination drawable.
- * @gc: A graphic context.
- * @x: Leftmost coordinate of the destination rectangle.
- * @y: Upper coordinate of the destination rectangle.
- * @width: Width of the destination rectangle, in pixels.
- * @height: Height of the destination rectangle, in pixels.
- * @dith: Dithering method to use.
- * @rgb_buf: Pointer to the pixel in the RGB buffer that corresponds to the
- * upper-left corner of the rectangular region to render.
- * @rowstride: Offset between pixel rows in the RGB buffer, in bytes.
- *
- * Renders an RGB buffer to a drawable. Pixels are specified as RGB triplets
- * with 8 bits per channel. An image will thus look like an RGBRGBRGBRGB
- * sequence of 8-bit values. This function does not let you specify dither
- * offsets; applications that need to render partial regions of a buffer to
- * build the final image should use xlib_draw_rgb_image_dithalign() instead.
- **/
-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)
-{
- if (dith == XLIB_RGB_DITHER_NONE || (dith == XLIB_RGB_DITHER_NORMAL &&
- !image_info->dith_default))
- xlib_draw_rgb_image_core (drawable, gc, x, y, width, height,
- rgb_buf, 3, rowstride, image_info->conv, NULL,
- 0, 0);
- else
- xlib_draw_rgb_image_core (drawable, gc, x, y, width, height,
- rgb_buf, 3, rowstride, image_info->conv_d, NULL,
- 0, 0);
-}
-
-/**
- * xlib_draw_rgb_image_dithalign:
- * @drawable: Destination drawable.
- * @gc: A graphic context.
- * @x: Leftmost coordinate of the destination rectangle.
- * @y: Upper coordinate of the destination rectangle.
- * @width: Width of the destination rectangle, in pixels.
- * @height: Height of the destination rectangle, in pixels.
- * @dith: Dithering method to use.
- * @rgb_buf: Pointer to the pixel in the RGB buffer that corresponds to the
- * upper-left corner of the rectangular region to render.
- * @rowstride: Offset between pixel rows in the RGB buffer, in bytes.
- * @xdith: X offset for the dither mask.
- * @ydith: Y offset for the dither mask.
- *
- * Renders an RGB buffer to a drawable. Pixels are specified as RGB triplets
- * with 8 bits per channel. An image will thus look like an RGBRGBRGBRGB
- * sequence of 8-bit values. This function lets you specify a pair of dither
- * offsets. It should be used when you need to render regions of an RGB buffer
- * separately to form the final image; the dither offsets let you align the
- * dither mask appropriately.
- **/
-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)
-{
- if (dith == XLIB_RGB_DITHER_NONE || (dith == XLIB_RGB_DITHER_NORMAL &&
- !image_info->dith_default))
- xlib_draw_rgb_image_core (drawable, gc, x, y, width, height,
- rgb_buf, 3, rowstride, image_info->conv, NULL,
- xdith, ydith);
- else
- xlib_draw_rgb_image_core (drawable, gc, x, y, width, height,
- rgb_buf, 3, rowstride, image_info->conv_d, NULL,
- xdith, ydith);
-}
-
-/**
- * xlib_draw_rgb_32_image:
- * @drawable: Destination drawable.
- * @gc: A graphic context.
- * @x: Leftmost coordinate of the destination rectangle.
- * @y: Upper coordinate of the destination rectangle.
- * @width: Width of the destination rectangle, in pixels.
- * @height: Height of the destination rectangle, in pixels.
- * @dith: Dithering method to use.
- * @buf: Pointer to the pixel in the RGB buffer that corresponds to the
- * upper-left corner of the rectangular region to render.
- * @rowstride: Offset between pixel rows in the RGB buffer, in bytes.
- *
- * This function is analogous to xlib_draw_rgb_image(), but it lets you use
- * 32-bit RGB buffers with pixels specified as 0xRRGGBB00. The
- * least-significant 8 bits are actually discarded. This function can lead to
- * faster results than xlib_draw_rgb_image() since the pixels are aligned on
- * 32-bit boundaries.
- **/
-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)
-{
- if (dith == XLIB_RGB_DITHER_NONE || (dith == XLIB_RGB_DITHER_NORMAL &&
- !image_info->dith_default))
- xlib_draw_rgb_image_core (drawable, gc, x, y, width, height,
- buf, 4, rowstride,
- image_info->conv_32, NULL, 0, 0);
- else
- xlib_draw_rgb_image_core (drawable, gc, x, y, width, height,
- buf, 4, rowstride,
- image_info->conv_32_d, NULL, 0, 0);
-}
-
-static void
-xlib_rgb_make_gray_cmap (XlibRgbInfo *info)
-{
- guint32 rgb[256];
- int i;
-
- for (i = 0; i < 256; i++)
- rgb[i] = (i << 16) | (i << 8) | i;
- info->gray_cmap = xlib_rgb_cmap_new (rgb, 256);
-}
-
-/**
- * xlib_draw_gray_image:
- * @drawable: Destination drawable.
- * @gc: A graphic context.
- * @x: Leftmost coordinate of the destination rectangle.
- * @y: Upper coordinate of the destination rectangle.
- * @width: Width of the destination rectangle, in pixels.
- * @height: Height of thd destination rectangle, in pixels.
- * @dith: Dithering method to use.
- * @buf: Pointer to the pixel in the grayscale buffer that corresponds to the
- * upper-left corner of the rectangular region to render.
- * @rowstride: Offset between pixel rows in the grayscale buffer, in pixels.
- *
- * Renders a grayscale buffer to a drawable. Pixels are specified as 8-bit
- * intensity values. An image will thus look as a GGGGGG sequence of 8-bit
- * values.
- **/
-void
-xlib_draw_gray_image (Drawable drawable,
- GC gc,
- int x,
- int y,
- int width,
- int height,
- XlibRgbDither dith,
- unsigned char *buf,
- int rowstride)
-{
- if (image_info->bpp == 1 &&
- image_info->gray_cmap == NULL &&
- (image_info->x_visual_info->class == PseudoColor ||
- image_info->x_visual_info->class == GrayScale))
- xlib_rgb_make_gray_cmap (image_info);
-
- if (dith == XLIB_RGB_DITHER_NONE || (dith == XLIB_RGB_DITHER_NORMAL &&
- !image_info->dith_default))
- xlib_draw_rgb_image_core (drawable, gc, x, y, width, height,
- buf, 1, rowstride,
- image_info->conv_gray, NULL, 0, 0);
- else
- xlib_draw_rgb_image_core (drawable, gc, x, y, width, height,
- buf, 1, rowstride,
- image_info->conv_gray_d, NULL, 0, 0);
-}
-
-/**
- * xlib_rgb_cmap_new:
- * @colors: FIXME
- * @n_colors: FIXME
- *
- * FIXME
- *
- * Return value: FIXME
- **/
-XlibRgbCmap *
-xlib_rgb_cmap_new (guint32 *colors, int n_colors)
-{
- XlibRgbCmap *cmap;
- int i, j;
- guint32 rgb;
-
- if (n_colors < 0)
- return NULL;
- if (n_colors > 256)
- return NULL;
- cmap = malloc(sizeof(XlibRgbCmap));
- memcpy (cmap->colors, colors, n_colors * sizeof(guint32));
- if (image_info->bpp == 1 &&
- (image_info->x_visual_info->class == PseudoColor ||
- image_info->x_visual_info->class == GrayScale))
- for (i = 0; i < n_colors; i++)
- {
- rgb = colors[i];
- j = ((rgb & 0xf00000) >> 12) |
- ((rgb & 0xf000) >> 8) |
- ((rgb & 0xf0) >> 4);
-#ifdef VERBOSE
- printf ("%d %x %x %d\n", i, j, colorcube[j]);
-#endif
- cmap->lut[i] = colorcube[j];
- }
- return cmap;
-}
-
-/**
- * xlib_rgb_cmap_free:
- * @cmap: An XlibRGB colormap.
- *
- * Frees an XlibRGB colormap.
- **/
-void
-xlib_rgb_cmap_free (XlibRgbCmap *cmap)
-{
- free (cmap);
-}
-
-/**
- * xlib_draw_indexed_image:
- * @drawable: FIXME
- * @gc: FIXME
- * @x: FIXME
- * @y: FIXME
- * @width: FIXME
- * @height: FIXME
- * @dith: FIXME
- * @buf: FIXME
- * @rowstride: FIXME
- * @cmap: FIXME
- *
- * FIXME
- **/
-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)
-{
- if (dith == XLIB_RGB_DITHER_NONE || (dith == XLIB_RGB_DITHER_NORMAL &&
- !image_info->dith_default))
- xlib_draw_rgb_image_core (drawable, gc, x, y, width, height,
- buf, 1, rowstride,
- image_info->conv_indexed, cmap, 0, 0);
- else
- xlib_draw_rgb_image_core (drawable, gc, x, y, width, height,
- buf, 1, rowstride,
- image_info->conv_indexed_d, cmap, 0, 0);
-}
-
-/**
- * xlib_rgb_ditherable:
- *
- * Queries whether XlibRGB supports dithering for its chosen visual.
- *
- * Return value: TRUE if dithering can be performed for the visual that XlibRGB
- * is using, FALSE otherwise.
- **/
-Bool
-xlib_rgb_ditherable (void)
-{
- return (image_info->conv != image_info->conv_d);
-}
-
-/**
- * xlib_rgb_get_cmap:
- *
- * Queries the X colormap that XlibRGB is using.
- *
- * Return value: An X colormap.
- **/
-Colormap
-xlib_rgb_get_cmap (void)
-{
- /* xlib_rgb_init (); */
- if (image_info)
- return image_info->cmap;
- else
- return 0;
-}
-
-/**
- * xlib_rgb_get_visual:
- *
- * Queries the visual that XlibRGB is using.
- *
- * Return value: An X visual.
- **/
-Visual *
-xlib_rgb_get_visual (void)
-{
- /* xlib_rgb_init (); */
- if (image_info)
- return image_info->x_visual_info->visual;
- else
- return NULL;
-}
-
-/**
- * xlib_rgb_get_visual_info:
- *
- * Queries the visual info structure for the visual that XlibRGB is using.
- *
- * Return value: An XVisualInfo structure.
- **/
-XVisualInfo *
-xlib_rgb_get_visual_info (void)
-{
- /* xlib_rgb_init (); */
- if (image_info)
- return image_info->x_visual_info;
- else
- return NULL;
-}
-
-/**
- * xlib_rgb_get_depth:
- *
- * Queries the depth of the visual that XlibRGB is using.
- *
- * Return value: Bit depth.
- **/
-int
-xlib_rgb_get_depth (void)
-{
- XVisualInfo * v = xlib_rgb_get_visual_info();
-
- if (v)
- {
- return v->depth;
- }
-
- return 0;
-}
-
-/**
- * xlib_rgb_get_display:
- *
- * Queries the X display that XlibRGB is using.
- *
- * Return value: An X display.
- **/
-Display *
-xlib_rgb_get_display (void)
-{
- if (image_info)
- return image_info->display;
-
- return NULL;
-}
-
-/**
- * xlib_rgb_get_screen:
- *
- * Queries the screen that XlibRGB is using.
- *
- * Return value: An X screen.
- **/
-Screen *
-xlib_rgb_get_screen (void)
-{
- if (image_info)
- return image_info->screen;
-
- return NULL;
-}
diff --git a/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlibrgb.h b/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlibrgb.h
deleted file mode 100644
index 9433aeaccf..0000000000
--- a/contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlibrgb.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/* -*- 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__
-
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.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);
-
-G_END_DECLS
-
-#endif /* __XLIB_RGB_H__ */
diff --git a/demos/Makefile.am b/demos/Makefile.am
index e51ed908e2..75fcbe5d79 100644
--- a/demos/Makefile.am
+++ b/demos/Makefile.am
@@ -12,12 +12,10 @@ INCLUDES = \
$(GTK_DEP_CFLAGS)
DEPS = \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
$(top_builddir)/gdk/$(gdktargetlib) \
$(top_builddir)/gtk/$(gtktargetlib)
LDADDS = \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
$(top_builddir)/gdk/$(gdktargetlib) \
$(top_builddir)/gtk/$(gtktargetlib) \
$(GTK_DEP_LIBS) \
@@ -32,21 +30,11 @@ noinst_PROGRAMS = \
pixbuf-demo
# Need to build test-inline-pixbufs.h for testpixbuf
-if HAVE_PNG
noinst_PROGRAMS += testpixbuf
BUILT_SOURCES = test-inline-pixbufs.h
-endif
-if CROSS_COMPILING
-pixbuf_csource=$(GDK_PIXBUF_CSOURCE)
-pixbuf_csource_deps=
-else
-pixbuf_csource=GDK_PIXBUF_MODULE_FILE=$(top_builddir)/gdk-pixbuf/loaders.cache $(top_builddir)/gdk-pixbuf/gdk-pixbuf-csource-3.0
-pixbuf_csource_deps=$(top_builddir)/gdk-pixbuf/gdk-pixbuf-csource-3.0 $(top_builddir)/gdk-pixbuf/loaders.cache
-endif
-
-test-inline-pixbufs.h: $(pixbuf_csource_deps) apple-red.png gnome-foot.png
- $(pixbuf_csource) --raw --build-list \
+test-inline-pixbufs.h: apple-red.png gnome-foot.png
+ $(GDK_PIXBUF_CSOURCE) --raw --build-list \
apple_red $(srcdir)/apple-red.png \
gnome_foot $(srcdir)/gnome-foot.png \
> test-inline-pixbufs.h \
diff --git a/demos/gtk-demo/Makefile.am b/demos/gtk-demo/Makefile.am
index ccd70f7033..43b706e7ed 100644
--- a/demos/gtk-demo/Makefile.am
+++ b/demos/gtk-demo/Makefile.am
@@ -55,15 +55,14 @@ INCLUDES = \
$(GTK_DEP_CFLAGS)
DEPS = \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
$(top_builddir)/gdk/$(gdktargetlib) \
$(top_builddir)/gtk/$(gtktargetlib)
LDADDS = \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
$(top_builddir)/gdk/$(gdktargetlib) \
$(top_builddir)/gtk/$(gtktargetlib) \
- $(GTK_DEP_LIBS)
+ $(GTK_DEP_LIBS) \
+ -lm
bin_PROGRAMS = gtk3-demo
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am
index f780c4f162..a2f772e660 100644
--- a/docs/reference/Makefile.am
+++ b/docs/reference/Makefile.am
@@ -1,7 +1,7 @@
## Process this file with automake to produce Makefile.in
include $(top_srcdir)/Makefile.decl
-SUBDIRS = gdk-pixbuf gdk gtk libgail-util
+SUBDIRS = gdk gtk libgail-util
GITIGNOREFILES = */*.1
diff --git a/docs/reference/gdk-pixbuf/Makefile.am b/docs/reference/gdk-pixbuf/Makefile.am
deleted file mode 100644
index eb06b58fc6..0000000000
--- a/docs/reference/gdk-pixbuf/Makefile.am
+++ /dev/null
@@ -1,116 +0,0 @@
-## Process this file with automake to produce Makefile.in
-include $(top_srcdir)/Makefile.decl
-
-AUTOMAKE_OPTIONS = 1.6
-
-# The name of the module.
-DOC_MODULE=gdk-pixbuf3
-
-# The top-level SGML file.
-DOC_MAIN_SGML_FILE=gdk-pixbuf.sgml
-
-# Extra options to supply to gtkdoc-scan
-SCAN_OPTIONS=--source-dir=../../../contrib/gdk-pixbuf-xlib --deprecated-guards="GDK_PIXBUF_ENABLE_BROKEN|GDK_PIXBUF_DISABLE_DEPRECATED"
-
-# The directory containing the source code. Relative to $(srcdir)
-DOC_SOURCE_DIR=../../../gdk-pixbuf
-
-# Used for dependencies
-HFILE_GLOB=$(top_srcdir)/gdk-pixbuf/*.h $(top_srcdir)/contrib/gdk-pixbuf-xlib/*.h
-CFILE_GLOB=$(top_srcdir)/gdk-pixbuf/*.c $(top_srcdir)/contrib/gdk-pixbuf-xlib/*.c
-
-# Header files to ignore when scanning
-IGNORE_HFILES= \
- pixops \
- gdk-pixbuf-alias.h \
- gdk-pixbuf-marshal.h \
- gdk-pixbuf-xlib-private.h \
- gdk-pixbuf-i18n.h \
- gdk-pixbuf-private.h \
- io-gif-animation.h \
- io-ani-animation.h \
- xpm-color-table.h \
- test-images.h
-
-INCLUDES = \
- -I$(top_srcdir) \
- -I$(top_builddir) \
- -I$(top_builddir)/gdk \
- $(GTK_DEBUG_FLAGS) \
- $(GTK_DEP_CFLAGS)
-
-GTKDOC_LIBS = \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
- $(top_builddir)/gdk/$(gdktargetlib) \
- $(top_builddir)/gtk/$(gtktargetlib) \
- $(GTK_DEP_LIBS)
-
-
-# Extra options to supply to gtkdoc-mkdb
-MKDB_OPTIONS=--main-sgml-file=$(DOC_MAIN_SGML_FILE) --sgml-mode --source-dir=../../../contrib/gdk-pixbuf-xlib --output-format=xml --name-space=gdk_pixbuf
-
-# Extra SGML files that are included by DOC_MAIN_SGML_FILE
-content_files = \
- version.xml \
- gdk-pixbuf-from-drawables.sgml \
- gdk-pixbuf-rendering.sgml \
- gdk-pixbuf.sgml \
- porting-from-imlib.sgml \
- gdk-pixbuf-csource-3.0.xml \
- gdk-pixbuf-query-loaders-3.0.xml
-
-# Images to copy into HTML directory
-HTML_IMAGES = composite.png
-
-# Extra options to supply to gtkdoc-fixref
-FIXXREF_OPTIONS= --extra-dir=$(GLIB_PREFIX)/share/gtk-doc/html/gobject \
- --extra-dir=$(GLIB_PREFIX)/share/gtk-doc/html/glib
-
-
-include $(top_srcdir)/gtk-doc.make
-
-# Other files to distribute
-EXTRA_DIST += version.xml.in \
- composite.png \
- composite.dia \
- apple-red-1a.png \
- apple-red-2c.png \
- gnome-gmush-1.png
-
-########################################################################
-
-man_MANS = \
- gdk-pixbuf-csource-3.0.1 \
- gdk-pixbuf-query-loaders-3.0.1
-
-if ENABLE_MAN
-
-.xml.1:
- @XSLTPROC@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
-
-dist-local-check-mans-enabled:
- if grep "Man generation disabled" $(man_MANS) >/dev/null; then $(RM) $(man_MANS); fi
-
-else
-
-$(man_MANS):
- echo Man generation disabled. Creating dummy $@. Configure with --enable-man to enable it.
- echo Man generation disabled. Remove this file, configure with --enable-man, and rebuild > $@
-
-
-dist-local-check-mans-enabled:
- echo "*** --enable-man must be used in order to make dist"
- false
-
-endif
-
-MAINTAINERCLEANFILES = $(man_MANS) $(BUILT_SOURCES)
-
-EXTRA_DIST += $(man_MANS)
-
-dist-hook-local: dist-local-check-mans-enabled gtk-docs-clean all-local
-
-gtk-docs-clean: clean
- cd $(srcdir) && rm -rf xml html
-
--include $(top_srcdir)/git.mk
diff --git a/docs/reference/gdk-pixbuf/apple-red-1a.png b/docs/reference/gdk-pixbuf/apple-red-1a.png
deleted file mode 100644
index 40f1be2b04..0000000000
--- a/docs/reference/gdk-pixbuf/apple-red-1a.png
+++ /dev/null
Binary files differ
diff --git a/docs/reference/gdk-pixbuf/apple-red-2c.png b/docs/reference/gdk-pixbuf/apple-red-2c.png
deleted file mode 100644
index 5c96576bb4..0000000000
--- a/docs/reference/gdk-pixbuf/apple-red-2c.png
+++ /dev/null
Binary files differ
diff --git a/docs/reference/gdk-pixbuf/composite.dia b/docs/reference/gdk-pixbuf/composite.dia
deleted file mode 100644
index ad0c5a21ff..0000000000
--- a/docs/reference/gdk-pixbuf/composite.dia
+++ /dev/null
Binary files differ
diff --git a/docs/reference/gdk-pixbuf/composite.png b/docs/reference/gdk-pixbuf/composite.png
deleted file mode 100644
index 1c9485c040..0000000000
--- a/docs/reference/gdk-pixbuf/composite.png
+++ /dev/null
Binary files differ
diff --git a/docs/reference/gdk-pixbuf/gdk-pixbuf-csource-3.0.xml b/docs/reference/gdk-pixbuf/gdk-pixbuf-csource-3.0.xml
deleted file mode 100644
index e353f3a0a1..0000000000
--- a/docs/reference/gdk-pixbuf/gdk-pixbuf-csource-3.0.xml
+++ /dev/null
@@ -1,177 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
-]>
-<refentry id="gdk-pixbuf-csource">
-
-<refmeta>
-<refentrytitle>gdk-pixbuf-csource-3.0</refentrytitle>
-<manvolnum>1</manvolnum>
-</refmeta>
-
-<refnamediv>
-<refname>gdk-pixbuf-csource-3.0</refname>
-<refpurpose>C code generation utility for GdkPixbuf images</refpurpose>
-</refnamediv>
-
-<refsynopsisdiv>
-<cmdsynopsis>
-<command>gdk-pixbuf-csource-3.0</command>
-<arg choice="opt">options</arg>
-<arg choice="opt">image</arg>
-</cmdsynopsis>
-<cmdsynopsis>
-<command>gdk-pixbuf-csource-3.0</command>
-<arg choice="opt">options</arg>
-<arg choice="plain">--build-list</arg>
-<arg rep="repeat">
- <arg>name</arg>
- <arg>image</arg>
-</arg>
-</cmdsynopsis>
-</refsynopsisdiv>
-
-<refsect1><title>Description</title>
-<para>
-<command>gdk-pixbuf-csource-3.0</command> is a small utility that generates
-C code containing images, useful for compiling images directly into programs.
-</para>
-</refsect1>
-
-<refsect1><title>Invocation</title>
-<para>
-<command>gdk-pixbuf-csource-3.0</command> either takes as input one image file
-name to generate code for, or, using the <option>--build-list</option> option,
-a list of (<replaceable>name</replaceable>, <replaceable>image</replaceable>)
-pairs to generate code for a list of images into named variables.
-</para>
-<refsect2><title>Options</title>
-<variablelist>
-
-<varlistentry>
-<term><option>--stream</option></term>
-<listitem><para>
-Generate pixbuf data stream (a single string containing a serialized
-<structname>GdkPixdata</structname> structure in network byte order).
-</para></listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--struct</option></term>
-<listitem><para>
-Generate GdkPixdata structure (needs the <structname>GdkPixdata</structname>
-structure definition from <filename>gdk-pixdata.h</filename>).
-</para></listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--macros</option></term>
-<listitem><para>
-Generate *_ROWSTRIDE, *_WIDTH, *_HEIGHT, *_BYTES_PER_PIXEL and
-*_RLE_PIXEL_DATA or *_PIXEL_DATA macro definitions for the image.
-</para></listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--rle</option></term>
-<listitem><para>
-Enables run-length encoding for the generated pixel data (default).
-</para></listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--raw</option></term>
-<listitem><para>
-Disables run-length encoding for the generated pixel data.
-</para></listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--extern</option></term>
-<listitem><para>
-Generate extern symbols.
-</para></listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--static</option></term>
-<listitem><para>
-Generate static symbols (default).
-</para></listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--decoder</option></term>
-<listitem><para>
-Provide a *_RUN_LENGTH_DECODE(image_buf, rle_data, size, bpp) macro definition
-to decode run-length encoded image data.
-</para></listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--name=identifier</option></term>
-<listitem><para>
-Specifies the identifier name (prefix) for the generated variables or
-macros (useful only if <option>--build-list</option> was not specified).
-</para></listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--build-list</option></term>
-<listitem><para>
-Enables (<replaceable>name</replaceable>, <replaceable>image</replaceable>)
-pair parsing mode.
-</para></listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>-h</option>, <option>--help</option></term>
-<listitem><para>
-Print brief help and exit.
-</para></listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>-v</option>, <option>--version</option></term>
-<listitem><para>
-Print version and exit.
-</para></listitem>
-</varlistentry>
-
-<varlistentry>
-<term><option>--g-fatal-warnings</option></term>
-<listitem><para>
-Make warnings fatal (causes the program to abort).
-</para></listitem>
-</varlistentry>
-
-</variablelist>
-</refsect2>
-</refsect1>
-
-<refsect1><title>See also</title>
-<para>
-The <structname>GdkPixbuf</structname> documentation, shipped with the
-Gtk+ distribution, available from <ulink url="http://www.gtk.org">www.gtk.org</ulink>.
-</para>
-</refsect1>
-
-<refsect1><title>Bugs</title>
-<para>
-The runlength encoder gets out of sync with the pixel boundaries, since
-it includes the rowstride padding in the encoded stream. Furthermore, it
-generates pixbufs with suboptimal rowstride in some cases.
-</para>
-</refsect1>
-
-<refsect1><title>Author</title>
-<para>
-<command>gdk-pixbuf-csource-3.0</command> was written by Tim Janik
-<email>timj@gtk.org</email>.
-</para>
-<para>
-This manual page was provided by Tim Janik <email>timj@gtk.org</email>.
-</para>
-</refsect1>
-</refentry>
-
diff --git a/docs/reference/gdk-pixbuf/gdk-pixbuf-from-drawables.sgml b/docs/reference/gdk-pixbuf/gdk-pixbuf-from-drawables.sgml
deleted file mode 100644
index 2d9f43ae55..0000000000
--- a/docs/reference/gdk-pixbuf/gdk-pixbuf-from-drawables.sgml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
-]>
-<refentry id="gdk-pixbuf-gdk-pixbuf-from-drawables">
-<refmeta>
-<refentrytitle>Drawables to Pixbufs</refentrytitle>
-<manvolnum>3</manvolnum>
-<refmiscinfo>GDK-PIXBUF Library</refmiscinfo>
-</refmeta>
-
-<refnamediv>
-<refname>Drawables to Pixbufs</refname><refpurpose>Getting parts of a GDK drawable's image data into a pixbuf.</refpurpose>
-</refnamediv>
-
-<refsect1>
-<title>Description</title>
- <para>
- The functions to take the image data from a GDK drawable and dump it
- into a pixbuf are contained in GDK, see the
- <link linkend="gdk-Pixbufs">Pixbufs</link> section of the GDK
- documentation.
- </para>
-</refsect1>
-
-
-
-
-</refentry>
diff --git a/docs/reference/gdk-pixbuf/gdk-pixbuf-query-loaders-3.0.xml b/docs/reference/gdk-pixbuf/gdk-pixbuf-query-loaders-3.0.xml
deleted file mode 100644
index 3aac8af294..0000000000
--- a/docs/reference/gdk-pixbuf/gdk-pixbuf-query-loaders-3.0.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
-]>
-<refentry id="gdk-pixbuf-query-loaders">
-
-<refmeta>
-<refentrytitle>gdk-pixbuf-query-loaders-3.0</refentrytitle>
-<manvolnum>1</manvolnum>
-</refmeta>
-
-<refnamediv>
-<refname>gdk-pixbuf-query-loaders-3.0</refname>
-<refpurpose>GdkPixbuf loader registration utility</refpurpose>
-</refnamediv>
-
-<refsynopsisdiv>
-<cmdsynopsis>
-<command>gdk-pixbuf-query-loaders-3.0</command>
-<arg choice="opt">--update-cache</arg>
-<arg choice="opt" rep="repeat">module</arg>
-</cmdsynopsis>
-</refsynopsisdiv>
-
-<refsect1><title>Description</title>
-<para>
-<command>gdk-pixbuf-query-loaders-3.0</command> collects information about
-loadable modules for <application>gdk-pixbuf</application> and writes it to
-the default cache file location, or to <filename>stdout</filename>.
-</para>
-<para>
-If called without arguments, it looks for modules in the
-<application>gdk-pixbuf</application> loader directory.
-</para>
-<para>
-If called with arguments, it looks for the specified modules. The arguments
-may be absolute or relative paths.
-</para>
-<para>
-Normally, the output of <command>gdk-pixbuf-queryloaders-3.0</command> is written
-to <filename><replaceable>libdir</replaceable>gtk-3.0/3.0.0/loaders.cache</filename>, where <application>gdk-pixbuf</application> looks for it by default. If it is written to some other
-location, the environment variable <link linkend="GDK_PIXBUF_MODULE_FILE"><envar>GDK_PIXBUF_MODULE_FILE</envar></link>
-can be set to point <application>gdk-pixbuf</application> at the file.
-</para>
-</refsect1>
-
-<refsect1><title>Options</title>
-<variablelist>
- <varlistentry>
- <term>--update-cache</term>
- <listitem><para>Write the output to the default cache location instead of
- <filename>stdout</filename></para></listitem>
- </varlistentry>
-</variablelist>
-</refsect1>
-
-<refsect1><title>Environment</title>
-<para>
-The environment variable <envar>GDK_PIXBUF_MODULEDIR</envar> can be used
-to specify a different loader directory. The default
-<application>gdk-pixbuf</application> loader
-directory is <filename><replaceable>libdir</replaceable>/gtk-3.0/<replaceable>version</replaceable>/loaders</filename>.
-</para>
-</refsect1>
-
-<refsect1><title>Bugs</title>
-<para>
-None known yet.
-</para>
-</refsect1>
-
-</refentry>
-
-
diff --git a/docs/reference/gdk-pixbuf/gdk-pixbuf-rendering.sgml b/docs/reference/gdk-pixbuf/gdk-pixbuf-rendering.sgml
deleted file mode 100644
index 336004c864..0000000000
--- a/docs/reference/gdk-pixbuf/gdk-pixbuf-rendering.sgml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
-]>
-<refentry id="gdk-pixbuf-gdk-pixbuf-rendering">
-<refmeta>
-<refentrytitle>Rendering</refentrytitle>
-<manvolnum>3</manvolnum>
-<refmiscinfo>GDK-PIXBUF Library</refmiscinfo>
-</refmeta>
-
-<refnamediv>
-<refname>Rendering</refname><refpurpose>Rendering a pixbuf to a GDK drawable.</refpurpose>
-</refnamediv>
-
-
-<refsect1>
-<title>Description</title>
- <para>
- The functions to render pixbufs to GDK drawables are contained in
- GDK, see the <link linkend="gdk-Pixbufs">Pixbufs</link> section
- of the GDK documentation.
- </para>
-</refsect1>
-
-
-
-
-</refentry>
-
-
-
diff --git a/docs/reference/gdk-pixbuf/gdk-pixbuf.sgml b/docs/reference/gdk-pixbuf/gdk-pixbuf.sgml
deleted file mode 100644
index 4b8fc9e47f..0000000000
--- a/docs/reference/gdk-pixbuf/gdk-pixbuf.sgml
+++ /dev/null
@@ -1,192 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
-<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
-<!ENTITY version SYSTEM "version.xml">
-
-<!ENTITY gdk-pixbuf "<application>gdk-pixbuf</application>">
-<!ENTITY Imlib "<application>Imlib</application>">
-]>
-<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
- <bookinfo>
- <title>GDK-PixBuf Reference Manual</title>
- <releaseinfo>
- Version &version;
- The latest version of this documentation can be found on-line at
- <ulink role="online-location" url="http://library.gnome.org/devel/gdk-pixbuf/unstable/">http://library.gnome.org/devel/gdk-pixbuf/unstable/</ulink>.
- </releaseinfo>
- <authorgroup>
- <author>
- <firstname>Federico</firstname>
- <surname>Mena Quintero</surname>
- <affiliation>
- <address>
- <email>federico@gimp.org</email>
- </address>
- </affiliation>
- </author>
- </authorgroup>
-
- <copyright>
- <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>
- <title>API Reference</title>
-
- <partintro>
- <para>
- This part presents the class and function reference for the
- &gdk-pixbuf; library. Classes are described together with
- their methods; individual functions are grouped by functional
- group.
- </para>
- </partintro>
-
- <xi:include href="xml/initialization_versions.xml" />
-
- <xi:include href="xml/gdk-pixbuf.xml" />
- <xi:include href="xml/refcounting.xml" />
- <xi:include href="xml/file-loading.xml" />
- <xi:include href="xml/file-saving.xml" />
- <xi:include href="xml/creating.xml" />
- <xi:include href="xml/inline.xml" />
- <xi:include href="xml/scaling.xml" />
- <xi:include href="gdk-pixbuf-rendering.sgml" />
- <xi:include href="gdk-pixbuf-from-drawables.sgml" />
- <xi:include href="xml/util.xml" />
- <xi:include href="xml/animation.xml" />
-
- <xi:include href="xml/gdk-pixbuf-loader.xml" />
- <xi:include href="xml/module_interface.xml" />
-
- <xi:include href="xml/gdk-pixbuf-xlib-init.xml" />
- <xi:include href="xml/gdk-pixbuf-xlib-rendering.xml" />
- <xi:include href="xml/gdk-pixbuf-xlib-from-drawables.xml" />
- <xi:include href="xml/gdk-pixbuf-xlib-rgb.xml" />
- </reference>
-
- <reference>
- <title>Tools Reference</title>
-
- <partintro>
- <para>
- This part presents the tools which are shipped with the
- &gdk-pixbuf; library.
- </para>
- </partintro>
-
- <xi:include href="gdk-pixbuf-csource-3.0.xml" />
- <xi:include href="gdk-pixbuf-query-loaders-3.0.xml" />
- </reference>
-
- <index id="api-index-full">
- <title>Index of all symbols</title>
- <xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
- </index>
- <index id="api-index-deprecated" role="deprecated">
- <title>Index of deprecated symbols</title>
- <xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
- </index>
- <index id="api-index-2-2" role="2.2">
- <title>Index of new symbols in 2.2</title>
- <xi:include href="xml/api-index-2.2.xml"><xi:fallback /></xi:include>
- </index>
- <index id="api-index-2-4" role="2.4">
- <title>Index of new symbols in 2.4</title>
- <xi:include href="xml/api-index-2.4.xml"><xi:fallback /></xi:include>
- </index>
- <index id="api-index-2-6" role="2.6">
- <title>Index of new symbols in 2.6</title>
- <xi:include href="xml/api-index-2.6.xml"><xi:fallback /></xi:include>
- </index>
- <index id="api-index-2-8" role="2.8">
- <title>Index of new symbols in 2.8</title>
- <xi:include href="xml/api-index-2.8.xml"><xi:fallback /></xi:include>
- </index>
- <index id="api-index-2-10" role="2.10">
- <title>Index of new symbols in 2.10</title>
- <xi:include href="xml/api-index-2.10.xml"><xi:fallback /></xi:include>
- </index>
- <index id="api-index-2-12" role="2.12">
- <title>Index of new symbols in 2.12</title>
- <xi:include href="xml/api-index-2.12.xml"><xi:fallback /></xi:include>
- </index>
- <index id="api-index-2-14" role="2.14">
- <title>Index of new symbols in 2.14</title>
- <xi:include href="xml/api-index-2.14.xml"><xi:fallback /></xi:include>
- </index>
-
- <xi:include href="porting-from-imlib.sgml" />
-
- <!-- 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>
-
- <xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
-
-</book>
diff --git a/docs/reference/gdk-pixbuf/gdk-pixbuf3-sections.txt b/docs/reference/gdk-pixbuf/gdk-pixbuf3-sections.txt
deleted file mode 100644
index 61792baacb..0000000000
--- a/docs/reference/gdk-pixbuf/gdk-pixbuf3-sections.txt
+++ /dev/null
@@ -1,298 +0,0 @@
-<INCLUDE>gdk-pixbuf/gdk-pixbuf.h</INCLUDE>
-
-<SECTION>
-<TITLE>Versioning</TITLE>
-<FILE>initialization_versions</FILE>
-
-<SUBSECTION>
-gdk_pixbuf_version
-gdk_pixbuf_major_version
-gdk_pixbuf_minor_version
-gdk_pixbuf_micro_version
-GDK_PIXBUF_VERSION
-GDK_PIXBUF_MAJOR
-GDK_PIXBUF_MINOR
-GDK_PIXBUF_MICRO
-
-<SUBSECTION Private>
-GDK_PIXBUF_VAR
-</SECTION>
-
-<SECTION>
-<FILE>gdk-pixbuf</FILE>
-GdkPixbufError
-GDK_PIXBUF_ERROR
-GdkColorspace
-GdkPixbufAlphaMode
-GdkPixbuf
-gdk_pixbuf_get_colorspace
-gdk_pixbuf_get_n_channels
-gdk_pixbuf_get_has_alpha
-gdk_pixbuf_get_bits_per_sample
-gdk_pixbuf_get_pixels
-gdk_pixbuf_get_width
-gdk_pixbuf_get_height
-gdk_pixbuf_get_rowstride
-gdk_pixbuf_get_option
-
-<SUBSECTION Standard>
-GDK_TYPE_PIXBUF_ERROR
-GDK_TYPE_COLORSPACE
-GDK_TYPE_PIXBUF_ALPHA_MODE
-GDK_PIXBUF
-GDK_TYPE_PIXBUF
-GDK_IS_PIXBUF
-
-
-<SUBSECTION Private>
-gdk_pixbuf_get_type
-gdk_pixbuf_error_quark
-gdk_colorspace_get_type
-gdk_pixbuf_alpha_mode_get_type
-gdk_pixbuf_error_get_type
-</SECTION>
-
-<SECTION>
-<FILE>refcounting</FILE>
-GdkPixbufDestroyNotify
-</SECTION>
-
-<SECTION>
-<FILE>file-loading</FILE>
-gdk_pixbuf_new_from_file
-gdk_pixbuf_new_from_file_at_size
-gdk_pixbuf_new_from_file_at_scale
-gdk_pixbuf_get_file_info
-gdk_pixbuf_new_from_stream
-gdk_pixbuf_new_from_stream_at_scale
-</SECTION>
-
-<SECTION>
-<FILE>file-saving</FILE>
-gdk_pixbuf_savev
-gdk_pixbuf_save
-GdkPixbufSaveFunc
-gdk_pixbuf_save_to_callback
-gdk_pixbuf_save_to_callbackv
-gdk_pixbuf_save_to_buffer
-gdk_pixbuf_save_to_bufferv
-gdk_pixbuf_save_to_stream
-</SECTION>
-
-<SECTION>
-<FILE>creating</FILE>
-gdk_pixbuf_new
-gdk_pixbuf_new_from_data
-gdk_pixbuf_new_from_xpm_data
-gdk_pixbuf_new_from_inline
-gdk_pixbuf_new_subpixbuf
-gdk_pixbuf_copy
-</SECTION>
-
-<SECTION>
-<INCLUDE>gdk-pixbuf/gdk-pixdata.h</INCLUDE>
-<FILE>inline</FILE>
-GdkPixdata
-GdkPixdataType
-GdkPixdataDumpType
-GDK_PIXBUF_MAGIC_NUMBER
-GDK_PIXDATA_HEADER_LENGTH
-gdk_pixdata_from_pixbuf
-gdk_pixbuf_from_pixdata
-gdk_pixdata_serialize
-gdk_pixdata_deserialize
-gdk_pixdata_to_csource
-</SECTION>
-
-<SECTION>
-<FILE>util</FILE>
-gdk_pixbuf_add_alpha
-gdk_pixbuf_copy_area
-gdk_pixbuf_saturate_and_pixelate
-gdk_pixbuf_apply_embedded_orientation
-gdk_pixbuf_fill
-</SECTION>
-
-<SECTION>
-<FILE>animation</FILE>
-GdkPixbufAnimation
-GdkPixbufAnimationIter
-gdk_pixbuf_animation_new_from_file
-gdk_pixbuf_animation_get_width
-gdk_pixbuf_animation_get_height
-gdk_pixbuf_animation_get_iter
-gdk_pixbuf_animation_is_static_image
-gdk_pixbuf_animation_get_static_image
-gdk_pixbuf_animation_iter_advance
-gdk_pixbuf_animation_iter_get_delay_time
-gdk_pixbuf_animation_iter_on_currently_loading_frame
-gdk_pixbuf_animation_iter_get_pixbuf
-
-<SUBSECTION>
-GdkPixbufSimpleAnim
-gdk_pixbuf_simple_anim_new
-gdk_pixbuf_simple_anim_add_frame
-gdk_pixbuf_simple_anim_set_loop
-gdk_pixbuf_simple_anim_get_loop
-
-<SUBSECTION Standard>
-GDK_PIXBUF_ANIMATION
-GDK_TYPE_PIXBUF_ANIMATION
-GDK_IS_PIXBUF_ANIMATION
-GDK_IS_PIXBUF_ANIMATION_ITER
-GDK_PIXBUF_ANIMATION_ITER
-GDK_TYPE_PIXBUF_ANIMATION_ITER
-
-GDK_PIXBUF_SIMPLE_ANIM_GET_CLASS
-GDK_IS_PIXBUF_SIMPLE_ANIM
-GDK_PIXBUF_SIMPLE_ANIM_CLASS
-GDK_IS_PIXBUF_SIMPLE_ANIM_CLASS
-GDK_TYPE_PIXBUF_SIMPLE_ANIM
-GDK_PIXBUF_SIMPLE_ANIM
-GDK_TYPE_PIXBUF_SCALED_ANIM
-GDK_TYPE_PIXBUF_SCALED_ANIM_ITER
-<SUBSECTION Private>
-gdk_pixbuf_non_anim_new
-
-gdk_pixbuf_animation_get_type
-gdk_pixbuf_animation_iter_get_type
-
-gdk_pixbuf_simple_anim_get_type
-gdk_pixbuf_simple_anim_iter_get_type
-GdkPixbufSimpleAnimClass
-gdk_pixbuf_scaled_anim_get_type
-gdk_pixbuf_scaled_anim_iter_get_type
-GdkPixbufScaledAnimClass
-GdkPixbufScaledAnim
-</SECTION>
-
-<SECTION>
-<FILE>scaling</FILE>
-GdkInterpType
-gdk_pixbuf_scale_simple
-gdk_pixbuf_scale
-gdk_pixbuf_composite_color_simple
-gdk_pixbuf_composite
-gdk_pixbuf_composite_color
-GdkPixbufRotation
-gdk_pixbuf_rotate_simple
-gdk_pixbuf_flip
-
-<SUBSECTION Standard>
-GDK_TYPE_INTERP_TYPE
-GDK_TYPE_PIXBUF_ROTATION
-
-<SUBSECTION Private>
-gdk_interp_type_get_type
-gdk_pixbuf_rotation_get_type
-</SECTION>
-
-<SECTION>
-<FILE>gdk-pixbuf-loader</FILE>
-<TITLE>GdkPixbufLoader</TITLE>
-GdkPixbufLoader
-gdk_pixbuf_loader_new
-gdk_pixbuf_loader_new_with_type
-gdk_pixbuf_loader_new_with_mime_type
-gdk_pixbuf_loader_get_format
-gdk_pixbuf_loader_write
-gdk_pixbuf_loader_set_size
-gdk_pixbuf_loader_get_pixbuf
-gdk_pixbuf_loader_get_animation
-gdk_pixbuf_loader_close
-<SUBSECTION Standard>
-GDK_PIXBUF_LOADER
-GDK_PIXBUF_LOADER_GET_CLASS
-GDK_TYPE_PIXBUF_LOADER
-GDK_IS_PIXBUF_LOADER
-GDK_PIXBUF_LOADER_CLASS
-GDK_IS_PIXBUF_LOADER_CLASS
-<SUBSECTION Private>
-GdkPixbufLoaderClass
-gdk_pixbuf_loader_get_type
-</SECTION>
-
-<SECTION>
-<TITLE>Module Interface</TITLE>
-<FILE>module_interface</FILE>
-gdk_pixbuf_set_option
-gdk_pixbuf_get_formats
-gdk_pixbuf_format_get_name
-gdk_pixbuf_format_get_description
-gdk_pixbuf_format_get_mime_types
-gdk_pixbuf_format_get_extensions
-gdk_pixbuf_format_is_writable
-gdk_pixbuf_format_is_scalable
-gdk_pixbuf_format_is_disabled
-gdk_pixbuf_format_set_disabled
-gdk_pixbuf_format_get_license
-GdkPixbufFormat
-GdkPixbufFormatFlags
-GdkPixbufModulePattern
-GdkPixbufModuleFillVtableFunc
-GdkPixbufModuleFillInfoFunc
-GdkPixbufModuleSizeFunc
-GdkPixbufModulePreparedFunc
-GdkPixbufModuleUpdatedFunc
-GdkPixbufModule
-
-<SUBSECTION Animation>
-GdkPixbufAnimationClass
-GdkPixbufAnimationIterClass
-
-<SUBSECTION Standard>
-GDK_PIXBUF_ANIMATION_GET_CLASS
-GDK_IS_PIXBUF_ANIMATION_ITER_CLASS
-GDK_PIXBUF_ANIMATION_ITER_CLASS
-GDK_IS_PIXBUF_ANIMATION_CLASS
-GDK_PIXBUF_ANIMATION_ITER_GET_CLASS
-GDK_PIXBUF_ANIMATION_CLASS
-</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_xpixel_from_rgb
-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-pixbuf3.types b/docs/reference/gdk-pixbuf/gdk-pixbuf3.types
deleted file mode 100644
index 6169c7b36c..0000000000
--- a/docs/reference/gdk-pixbuf/gdk-pixbuf3.types
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-gdk_pixbuf_get_type
-gdk_pixbuf_loader_get_type
-gdk_pixbuf_animation_get_type
-gdk_pixbuf_animation_iter_get_type
-gdk_pixbuf_simple_anim_get_type
-
diff --git a/docs/reference/gdk-pixbuf/gnome-gmush-1.png b/docs/reference/gdk-pixbuf/gnome-gmush-1.png
deleted file mode 100644
index 9e6d829c0d..0000000000
--- a/docs/reference/gdk-pixbuf/gnome-gmush-1.png
+++ /dev/null
Binary files differ
diff --git a/docs/reference/gdk-pixbuf/porting-from-imlib.sgml b/docs/reference/gdk-pixbuf/porting-from-imlib.sgml
deleted file mode 100644
index 003815e678..0000000000
--- a/docs/reference/gdk-pixbuf/porting-from-imlib.sgml
+++ /dev/null
@@ -1,358 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
- "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
-<!ENTITY gdk-pixbuf "<application>gdk-pixbuf</application>">
-<!ENTITY Imlib "<application>Imlib</application>">
-]>
- <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.
- </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 <function>g_object_ref()</function>;
- 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
- <function>g_object_unref()</function>; 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>g_object_ref()</function> when they want to keep
- an extra reference to a pixbuf, and then
- <function>g_object_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>g_object_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_draw_pixbuf()</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
deleted file mode 100644
index d569f8af95..0000000000
--- a/docs/reference/gdk-pixbuf/tmpl/animation.sgml
+++ /dev/null
@@ -1,183 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-Animations
-
-<!-- ##### SECTION Short_Description ##### -->
-Animated images.
-
-<!-- ##### SECTION Long_Description ##### -->
- <para>
- The &gdk-pixbuf; library provides a simple mechanism to load and represent
- animations. An animation is conceptually a series of frames to be displayed
- over time. Each frame is the same size. The animation may not be represented
- as a series of frames internally; for example, it may be stored as a
- sprite and instructions for moving the sprite around a background. To display
- an animation you don't need to understand its representation, however; you just
- ask &gdk-pixbuf; what should be displayed at a given point in time.
- </para>
-
-<!-- ##### SECTION See_Also ##### -->
- <para>
- #GdkPixbufLoader
- </para>
-
-<!-- ##### SECTION Stability_Level ##### -->
-
-
-<!-- ##### SECTION Image ##### -->
-
-
-<!-- ##### STRUCT GdkPixbufAnimation ##### -->
-<para>
-An opaque struct representing an animation.
-</para>
-
-
-<!-- ##### STRUCT GdkPixbufAnimationIter ##### -->
-<para>
-An opaque struct representing an iterator which points to a
-certain position in an animation.
-</para>
-
-
-<!-- ##### FUNCTION gdk_pixbuf_animation_new_from_file ##### -->
-<para>
-
-</para>
-
-@filename:
-@error:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_animation_get_width ##### -->
-<para>
-
-</para>
-
-@animation:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_animation_get_height ##### -->
-<para>
-
-</para>
-
-@animation:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_animation_get_iter ##### -->
-<para>
-
-</para>
-
-@animation:
-@start_time:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_animation_is_static_image ##### -->
-<para>
-
-</para>
-
-@animation:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_animation_get_static_image ##### -->
-<para>
-
-</para>
-
-@animation:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_animation_iter_advance ##### -->
-<para>
-
-</para>
-
-@iter:
-@current_time:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_animation_iter_get_delay_time ##### -->
-<para>
-
-</para>
-
-@iter:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_animation_iter_on_currently_loading_frame ##### -->
-<para>
-
-</para>
-
-@iter:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_animation_iter_get_pixbuf ##### -->
-<para>
-
-</para>
-
-@iter:
-@Returns:
-
-
-<!-- ##### STRUCT GdkPixbufSimpleAnim ##### -->
-<para>
-An opaque struct representing a simple animation.
-</para>
-
-
-<!-- ##### ARG GdkPixbufSimpleAnim:loop ##### -->
-<para>
-
-</para>
-
-<!-- ##### FUNCTION gdk_pixbuf_simple_anim_new ##### -->
-<para>
-
-</para>
-
-@width:
-@height:
-@rate:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_simple_anim_add_frame ##### -->
-<para>
-
-</para>
-
-@animation:
-@pixbuf:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_simple_anim_set_loop ##### -->
-<para>
-
-</para>
-
-@animation:
-@loop:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_simple_anim_get_loop ##### -->
-<para>
-
-</para>
-
-@animation:
-@Returns:
-
-
diff --git a/docs/reference/gdk-pixbuf/tmpl/creating.sgml b/docs/reference/gdk-pixbuf/tmpl/creating.sgml
deleted file mode 100644
index ffd7bd12ac..0000000000
--- a/docs/reference/gdk-pixbuf/tmpl/creating.sgml
+++ /dev/null
@@ -1,129 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-Image Data in Memory
-
-<!-- ##### SECTION Short_Description ##### -->
-Creating a pixbuf from image data that is already in memory.
-
-<!-- ##### SECTION Long_Description ##### -->
- <para>
- The most basic way to create a pixbuf is to wrap an existing pixel
- buffer with a #GdkPixbuf structure. You can use the
- gdk_pixbuf_new_from_data() function to do this You need to specify
- the destroy notification function that will be called when the
- data buffer needs to be freed; this will happen when a #GdkPixbuf
- is finalized by the reference counting functions If you have a
- chunk of static data compiled into your application, you can pass
- in %NULL as the destroy notification function so that the data
- will not be freed.
- </para>
-
- <para>
- The gdk_pixbuf_new() function can be used as a convenience to
- create a pixbuf with an empty buffer. This is equivalent to
- allocating a data buffer using <function>malloc()</function> and
- then wrapping it with gdk_pixbuf_new_from_data(). The gdk_pixbuf_new()
- function will compute an optimal rowstride so that rendering can be
- performed with an efficient algorithm.
- </para>
-
- <para>
- As a special case, you can use the gdk_pixbuf_new_from_xpm_data()
- function to create a pixbuf from inline XPM image data.
- </para>
-
- <para>
- You can also copy an existing pixbuf with the gdk_pixbuf_copy()
- function. This is not the same as just doing a g_object_ref()
- on the old pixbuf; the copy function will actually duplicate the
- pixel data in memory and create a new #GdkPixbuf structure for it.
- </para>
-
-<!-- ##### SECTION See_Also ##### -->
- <para>
- gdk_pixbuf_finalize().
- </para>
-
-<!-- ##### SECTION Stability_Level ##### -->
-
-
-<!-- ##### SECTION Image ##### -->
-
-
-<!-- ##### FUNCTION gdk_pixbuf_new ##### -->
-<para>
-
-</para>
-
-@colorspace:
-@has_alpha:
-@bits_per_sample:
-@width:
-@height:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_new_from_data ##### -->
-<para>
-
-</para>
-
-@data:
-@colorspace:
-@has_alpha:
-@bits_per_sample:
-@width:
-@height:
-@rowstride:
-@destroy_fn:
-@destroy_fn_data:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_new_from_xpm_data ##### -->
-<para>
-
-</para>
-
-@data:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_new_from_inline ##### -->
-<para>
-
-</para>
-
-@data_length:
-@data:
-@copy_pixels:
-@error:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_new_subpixbuf ##### -->
-<para>
-
-</para>
-
-@src_pixbuf:
-@src_x:
-@src_y:
-@width:
-@height:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_copy ##### -->
-<para>
-
-</para>
-
-@pixbuf:
-@Returns: <!--
-Local variables:
-mode: sgml
-sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
-End:
--->
-
-
diff --git a/docs/reference/gdk-pixbuf/tmpl/file-loading.sgml b/docs/reference/gdk-pixbuf/tmpl/file-loading.sgml
deleted file mode 100644
index 84a461c8cb..0000000000
--- a/docs/reference/gdk-pixbuf/tmpl/file-loading.sgml
+++ /dev/null
@@ -1,109 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-File Loading
-
-<!-- ##### SECTION Short_Description ##### -->
-Loading a pixbuf from a file.
-
-<!-- ##### SECTION Long_Description ##### -->
- <para>
- 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>
- This interface can be used by applications in which blocking is
- acceptable while an image is being loaded. It can also be used to
- load small images in general. Applications that need progressive
- loading can use the #GdkPixbufLoader functionality instead.
- </para>
-
-<!-- ##### SECTION See_Also ##### -->
- <para>
- #GdkPixbufLoader.
- </para>
-
-<!-- ##### SECTION Stability_Level ##### -->
-
-
-<!-- ##### SECTION Image ##### -->
-
-
-<!-- ##### FUNCTION gdk_pixbuf_new_from_file ##### -->
-<para>
-
-</para>
-
-@filename:
-@error:
-@Returns: <!--
-Local variables:
-mode: sgml
-sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
-End:
--->
-
-
-<!-- ##### FUNCTION gdk_pixbuf_new_from_file_at_size ##### -->
-<para>
-
-</para>
-
-@filename:
-@width:
-@height:
-@error:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_new_from_file_at_scale ##### -->
-<para>
-
-</para>
-
-@filename:
-@width:
-@height:
-@preserve_aspect_ratio:
-@error:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_get_file_info ##### -->
-<para>
-
-</para>
-
-@filename:
-@width:
-@height:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_new_from_stream ##### -->
-<para>
-
-</para>
-
-@stream:
-@cancellable:
-@error:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_new_from_stream_at_scale ##### -->
-<para>
-
-</para>
-
-@stream:
-@width:
-@height:
-@preserve_aspect_ratio:
-@cancellable:
-@error:
-@Returns:
-
-
diff --git a/docs/reference/gdk-pixbuf/tmpl/file-saving.sgml b/docs/reference/gdk-pixbuf/tmpl/file-saving.sgml
deleted file mode 100644
index d81557a9c4..0000000000
--- a/docs/reference/gdk-pixbuf/tmpl/file-saving.sgml
+++ /dev/null
@@ -1,143 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-File saving
-
-<!-- ##### SECTION Short_Description ##### -->
-Saving a pixbuf to a file.
-
-<!-- ##### SECTION Long_Description ##### -->
-<para>
-These functions allow to save a #GdkPixbuf in a number of
-file formats. The formatted data can be written to a file
-or to a memory buffer. &gdk-pixbuf; can also call a user-defined
-callback on the data, which allows to e.g. write the image
-to a socket or store it in a database.
-</para>
-
-<!-- ##### SECTION See_Also ##### -->
-<para>
-
-</para>
-
-<!-- ##### SECTION Stability_Level ##### -->
-
-
-<!-- ##### SECTION Image ##### -->
-
-
-<!-- ##### FUNCTION gdk_pixbuf_savev ##### -->
-<para>
-
-</para>
-
-@pixbuf:
-@filename:
-@type:
-@option_keys:
-@option_values:
-@error:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_save ##### -->
-<para>
-
-</para>
-
-@pixbuf:
-@filename:
-@type:
-@error:
-@Varargs:
-@Returns:
-
-
-<!-- ##### USER_FUNCTION GdkPixbufSaveFunc ##### -->
-<para>
-Specifies the type of the function passed to
-gdk_pixbuf_save_to_callback(). It is called once for each block of
-bytes that is "written" by gdk_pixbuf_save_to_callback(). If
-successful it should return %TRUE. If an error occurs it should set
-@error and return %FALSE, in which case gdk_pixbuf_save_to_callback()
-will fail with the same error.
-</para>
-
-@buf: bytes to be written.
-@count: number of bytes in @buf.
-@error: A location to return an error.
-@data: user data passed to gdk_pixbuf_save_to_callback().
-@Returns: %TRUE if successful, %FALSE (with @error set) if failed.
-@Since: 2.4
-
-
-<!-- ##### FUNCTION gdk_pixbuf_save_to_callback ##### -->
-<para>
-
-</para>
-
-@pixbuf:
-@save_func:
-@user_data:
-@type:
-@error:
-@Varargs:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_save_to_callbackv ##### -->
-<para>
-
-</para>
-
-@pixbuf:
-@save_func:
-@user_data:
-@type:
-@option_keys:
-@option_values:
-@error:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_save_to_buffer ##### -->
-<para>
-
-</para>
-
-@pixbuf:
-@buffer:
-@buffer_size:
-@type:
-@error:
-@Varargs:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_save_to_bufferv ##### -->
-<para>
-
-</para>
-
-@pixbuf:
-@buffer:
-@buffer_size:
-@type:
-@option_keys:
-@option_values:
-@error:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_save_to_stream ##### -->
-<para>
-
-</para>
-
-@pixbuf:
-@stream:
-@type:
-@cancellable:
-@error:
-@Varargs:
-@Returns:
-
-
diff --git a/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-loader.sgml b/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-loader.sgml
deleted file mode 100644
index 3892e84ccb..0000000000
--- a/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-loader.sgml
+++ /dev/null
@@ -1,209 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-GdkPixbufLoader
-
-<!-- ##### SECTION Short_Description ##### -->
-Application-driven progressive image loading.
-
-<!-- ##### SECTION Long_Description ##### -->
- <para>
- #GdkPixbufLoader provides a way for applications to drive the
- process of loading an image, by letting them send the image data
- directly to the loader instead of having the loader read the data
- from a file. Applications can use this functionality instead of
- gdk_pixbuf_new_from_file() or gdk_pixbuf_animation_new_from_file()
- when they need to parse image data in
- small chunks. For example, it should be used when reading an
- image from a (potentially) slow network connection, or when
- loading an extremely large file.
- </para>
-
- <para>
- To use #GdkPixbufLoader to load an image, just create a new one,
- and call gdk_pixbuf_loader_write() to send the data to it. When
- done, gdk_pixbuf_loader_close() should be called to end the stream
- and finalize everything. The loader will emit three important
- signals throughout the process. The first, "<link
- linkend="GdkPixbufLoader-size-prepared">size_prepared</link>",
- will be called as soon as the image has enough information to
- determine the size of the image to be used. If you want to scale
- the image while loading it, you can call gdk_pixbuf_loader_set_size()
- in response to this signal.
- </para>
-
- <para>The second signal, "<link
- linkend="GdkPixbufLoader-area-prepared">area_prepared</link>",
- will be called as soon as the pixbuf of the desired has been
- allocated. You can obtain it by calling gdk_pixbuf_loader_get_pixbuf().
- If you want to use it, simply ref it.
- In addition, no actual information will be passed in yet, so the
- pixbuf can be safely filled with any temporary graphics (or an
- initial color) as needed. You can also call
- gdk_pixbuf_loader_get_pixbuf() later and get the same pixbuf.
- </para>
-
- <para>
- The last signal, "<link
- linkend="GdkPixbufLoader-area-updated">area_updated</link>" gets
- called every time a region is updated. This way you can update a
- partially completed image. Note that you do not know anything
- about the completeness of an image from the area updated. For
- example, in an interlaced image, you need to make several passes
- before the image is done loading.
- </para>
-
- <refsect2>
- <title>Loading an animation</title>
-
- <para>
- Loading an animation is almost as easy as loading an
- image. Once the first "<link
- linkend="GdkPixbufLoader-area-prepared">area_prepared</link>" signal
- has been emitted, you can call gdk_pixbuf_loader_get_animation()
- to get the #GdkPixbufAnimation struct and gdk_pixbuf_animation_get_iter()
- to get an #GdkPixbufAnimationIter for displaying it.
- </para>
- </refsect2>
-
-<!-- ##### SECTION See_Also ##### -->
- <para>
- gdk_pixbuf_new_from_file(), gdk_pixbuf_animation_new_from_file()
- </para>
-
-<!-- ##### SECTION Stability_Level ##### -->
-
-
-<!-- ##### SECTION Image ##### -->
-
-
-<!-- ##### STRUCT GdkPixbufLoader ##### -->
-<para>
-The <structname>GdkPixbufLoader</structname> struct contains only private
-fields.
-</para>
-
-
-<!-- ##### SIGNAL GdkPixbufLoader::area-prepared ##### -->
- <para>
- </para>
-
-@gdkpixbufloader:
-
-<!-- ##### SIGNAL GdkPixbufLoader::area-updated ##### -->
- <para>
- </para>
-
-@gdkpixbufloader:
-@arg1:
-@arg2:
-@arg3:
-@arg4:
-
-<!-- ##### SIGNAL GdkPixbufLoader::closed ##### -->
- <para>
- </para>
-
-@gdkpixbufloader:
-
-<!-- ##### SIGNAL GdkPixbufLoader::size-prepared ##### -->
- <para>
- </para>
-
-@gdkpixbufloader:
-@arg1:
-@arg2:
-
-<!-- ##### FUNCTION gdk_pixbuf_loader_new ##### -->
-<para>
-
-</para>
-
-@void:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_loader_new_with_type ##### -->
-<para>
-
-</para>
-
-@image_type:
-@error:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_loader_new_with_mime_type ##### -->
-<para>
-
-</para>
-
-@mime_type:
-@error:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_loader_get_format ##### -->
-<para>
-
-</para>
-
-@loader:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_loader_write ##### -->
-<para>
-
-</para>
-
-@loader:
-@buf:
-@count:
-@error:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_loader_set_size ##### -->
-<para>
-
-</para>
-
-@loader:
-@width:
-@height:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_loader_get_pixbuf ##### -->
-<para>
-
-</para>
-
-@loader:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_loader_get_animation ##### -->
-<para>
-
-</para>
-
-@loader:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_loader_close ##### -->
-<para>
-
-</para>
-
-@loader:
-@error:
-@Returns:
-
-<!--
-Local variables:
-mode: sgml
-sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
-End:
--->
-
-
diff --git a/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-unused.sgml b/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-unused.sgml
deleted file mode 100644
index 89af1484c0..0000000000
--- a/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-unused.sgml
+++ /dev/null
@@ -1,585 +0,0 @@
-<!-- ##### SECTION ./tmpl/from-drawables.sgml:Long_Description ##### -->
- <para>
- The functions in this section allow you to take the image data
- from a GDK 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>
-
-
-<!-- ##### SECTION ./tmpl/from-drawables.sgml:Short_Description ##### -->
-Getting parts of a drawable's image data into a pixbuf.
-
-
-<!-- ##### SECTION ./tmpl/from-drawables.sgml:Title ##### -->
-Drawables to Pixbufs
-
-
-<!-- ##### 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/gnome-canvas-pixbuf.sgml:See_Also ##### -->
- <para>
- #GnomeCanvas, #GdkPixbuf
- </para>
-
-
-<!-- ##### SECTION ./tmpl/gnome-canvas-pixbuf.sgml:Short_Description ##### -->
-Canvas item to display #GdkPixbuf images.
-
-
-<!-- ##### SECTION ./tmpl/gnome-canvas-pixbuf.sgml:Title ##### -->
-GnomeCanvasPixbuf
-
-
-<!-- ##### SECTION ./tmpl/rendering.sgml:Long_Description ##### -->
- <para>
- 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
- &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>
-
-
-<!-- ##### SECTION ./tmpl/rendering.sgml:See_Also ##### -->
- <para>
- GdkRGB
- </para>
-
-
-<!-- ##### SECTION ./tmpl/rendering.sgml:Short_Description ##### -->
-Rendering a pixbuf to a GDK drawable.
-
-
-<!-- ##### SECTION ./tmpl/rendering.sgml:Title ##### -->
-Rendering
-
-
-<!-- ##### 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>
-
-
-<!-- ##### SECTION ./tmpl/xlib-from-drawables.sgml:See_Also ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### SECTION ./tmpl/xlib-from-drawables.sgml:Short_Description ##### -->
-Getting parts of an X drawable's image data into a pixbuf.
-
-
-<!-- ##### SECTION ./tmpl/xlib-from-drawables.sgml:Title ##### -->
-X Drawables to Pixbufs
-
-
-<!-- ##### 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>
-
-
-<!-- ##### SECTION ./tmpl/xlib-init.sgml:See_Also ##### -->
- <para>
- XlibRGB
- </para>
-
-
-<!-- ##### SECTION ./tmpl/xlib-init.sgml:Short_Description ##### -->
-Initializing the &gdk-pixbuf; Xlib library.
-
-
-<!-- ##### SECTION ./tmpl/xlib-init.sgml:Title ##### -->
-&gdk-pixbuf; Xlib initialization
-
-
-<!-- ##### 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/xlib-rendering.sgml:See_Also ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### SECTION ./tmpl/xlib-rendering.sgml:Short_Description ##### -->
-Rendering a pixbuf to an X drawable.
-
-
-<!-- ##### SECTION ./tmpl/xlib-rendering.sgml:Title ##### -->
-Xlib Rendering
-
-
-<!-- ##### 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:See_Also ##### -->
- <para>
- GdkRGB
- </para>
-
-
-<!-- ##### SECTION ./tmpl/xlib-rgb.sgml:Short_Description ##### -->
-Functions for rendering RGB buffers to X drawables.
-
-
-<!-- ##### SECTION ./tmpl/xlib-rgb.sgml:Title ##### -->
-XlibRGB
-
-
-<!-- ##### MACRO GDK_PIXBUF_LOADER ##### -->
- <para>
- Casts a #GtkObject to a #GdkPixbufLoader.
- </para>
-
-@obj: A GTK+ object.
-
-<!-- ##### MACRO GNOME_CANVAS_PIXBUF ##### -->
- <para>
- Casts a #GtkOjbect to a #GnomeCanvasPixbuf.
- </para>
-
-@obj: A GTK+ object.
-
-<!-- ##### STRUCT GdkPixbufFrame ##### -->
-<para>
- This object describes an individual frame of an animation.
-</para>
-
-
-<!-- ##### ENUM GdkPixbufFrameAction ##### -->
-<para>
-
-</para>
-
-@GDK_PIXBUF_FRAME_RETAIN:
-@GDK_PIXBUF_FRAME_DISPOSE:
-@GDK_PIXBUF_FRAME_REVERT:
-
-<!-- ##### USER_FUNCTION GdkPixbufLastUnref ##### -->
- <para>
- A function of this type can be used to override the default
- operation when a pixbuf loses its last reference, i.e. when
- gdk_pixbuf_unref() is called on a #GdkPixbuf structure that has a
- reference count of 1. This function should determine whether to
- finalize the pixbuf by calling gdk_pixbuf_finalize(), or whether
- to just resume normal execution. The last unref handler for a
- #GdkPixbuf can be set using the
- gdk_pixbuf_set_last_unref_handler() function. By default, pixbufs
- will be finalized automatically if no last unref handler has been
- defined.
- </para>
-
-@pixbuf: The pixbuf that is losing its last reference.
-@data: User closure data.
-
-<!-- ##### 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>
-
-
-<!-- ##### ARG GnomeCanvasPixbuf:height-in-pixels ##### -->
- <para>
- Works in the same way as the <link
- linkend="GnomeCanvasPixbuf--width-in-pixels">width_in_pixels</link>
- argument. The default is %FALSE.
- </para>
-
-
-<!-- ##### ARG GnomeCanvasPixbuf:height-pixels ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### 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>
-
-
-<!-- ##### 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: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>
-
-
-<!-- ##### ARG GnomeCanvasPixbuf:width-in-pixels ##### -->
- <para>
- If this argument is %TRUE, then the width of the pixbuf will be
- considered to be in pixels, that is, it will not be visually
- scaled even if the item's affine transformation changes. If this
- is %FALSE, then the width of the pixbuf will be considered to be
- in canvas units, and so will be scaled normally by affine
- transformations. The default is %FALSE.
- </para>
-
-
-<!-- ##### ARG GnomeCanvasPixbuf:width-pixels ##### -->
-<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>
-
-
-<!-- ##### 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: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>
-
-
-<!-- ##### ARG GnomeCanvasPixbuf:x-pixels ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### ARG GnomeCanvasPixbuf:x-set ##### -->
- <para>
- Determines whether the <link
- linkend="GnomeCanvasPixbuf--x">x</link> argument is used to
- translate the pixbuf from its logical origin in item-relative
- coordinates.
- </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>
-
-
-<!-- ##### 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:
--->
-
-
-<!-- ##### ARG GnomeCanvasPixbuf:y-pixels ##### -->
-<para>
-
-</para>
-
-
-<!-- ##### ARG GnomeCanvasPixbuf:y-set ##### -->
- <para>
- Determines whether the <link
- linkend="GnomeCanvasPixbuf--y">y</link> argument is used to
- translate the pixbuf from its logical origin in item-relative
- coordinates. Works in the same way as the <link
- linkend="GnomeCanvasPixbuf--x-set">x_set</link> argument. The
- default is %FALSE.
- </para>
-
-
-<!-- ##### FUNCTION gdk_pixbuf_animation_ref ##### -->
-<para>
-
-</para>
-
-@animation:
-@Returns:
-
-<!-- ##### FUNCTION gdk_pixbuf_animation_unref ##### -->
-<para>
-
-</para>
-
-@animation:
-
-<!-- ##### FUNCTION gdk_pixbuf_ref ##### -->
- <para>
-
- </para>
-
-@pixbuf:
-@Returns:
-
-<!-- ##### FUNCTION gdk_pixbuf_unref ##### -->
-<para>
-
-</para>
-
-@pixbuf:
-
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
deleted file mode 100644
index aaedfecea8..0000000000
--- a/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-xlib-from-drawables.sgml
+++ /dev/null
@@ -1,54 +0,0 @@
-<!-- ##### 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>
-
-<!-- ##### SECTION Stability_Level ##### -->
-
-
-<!-- ##### SECTION Image ##### -->
-
-
-<!-- ##### 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
deleted file mode 100644
index d9607801a4..0000000000
--- a/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-xlib-init.sgml
+++ /dev/null
@@ -1,52 +0,0 @@
-<!-- ##### 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
- of the program or before calling any of the other &gdk-pixbuf;
- Xlib functions.
- </para>
-
-<!-- ##### SECTION See_Also ##### -->
- <para>
- XlibRGB
- </para>
-
-<!-- ##### SECTION Stability_Level ##### -->
-
-
-<!-- ##### SECTION Image ##### -->
-
-
-<!-- ##### 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
deleted file mode 100644
index f16665c581..0000000000
--- a/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-xlib-rendering.sgml
+++ /dev/null
@@ -1,100 +0,0 @@
-<!-- ##### 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>
-
-<!-- ##### SECTION Stability_Level ##### -->
-
-
-<!-- ##### SECTION Image ##### -->
-
-
-<!-- ##### 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:
-Kode: 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
deleted file mode 100644
index 5763f89b89..0000000000
--- a/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-xlib-rgb.sgml
+++ /dev/null
@@ -1,290 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-XlibRGB
-
-<!-- ##### SECTION Short_Description ##### -->
-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>
-
-<!-- ##### SECTION Stability_Level ##### -->
-
-
-<!-- ##### SECTION Image ##### -->
-
-
-<!-- ##### 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_xpixel_from_rgb ##### -->
-<para>
-
-</para>
-
-@rgb:
-@Returns:
-
-
-<!-- ##### 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>
-
-@void:
-@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>
-
-@void:
-@Returns:
-
-
-<!-- ##### FUNCTION xlib_rgb_get_visual ##### -->
-<para>
-
-</para>
-
-@void:
-@Returns:
-
-
-<!-- ##### FUNCTION xlib_rgb_get_visual_info ##### -->
-<para>
-
-</para>
-
-@void:
-@Returns:
-
-
-<!-- ##### FUNCTION xlib_rgb_get_depth ##### -->
-<para>
-
-</para>
-
-@void:
-@Returns:
-
-
-<!-- ##### FUNCTION xlib_rgb_get_display ##### -->
-<para>
-
-</para>
-
-@void:
-@Returns:
-
-
-<!-- ##### FUNCTION xlib_rgb_get_screen ##### -->
-<para>
-
-</para>
-
-@void:
-@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
deleted file mode 100644
index 10eeb614d7..0000000000
--- a/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf.sgml
+++ /dev/null
@@ -1,292 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-The GdkPixbuf Structure
-
-<!-- ##### SECTION Short_Description ##### -->
-Information that describes an image.
-
-<!-- ##### SECTION Long_Description ##### -->
-
- <para>
- The <structname>GdkPixbuf</structname> structure contains
- information that describes an image in memory.
- </para>
-
- <section id="image-data">
- <title>Image Data</title>
-
- <para>
- Image data in a pixbuf is stored in memory in uncompressed,
- packed format. Rows in the image are stored top to bottom, and
- in each row pixels are stored from left to right. There may be
- padding at the end of a row. The "rowstride" value of a pixbuf,
- as returned by gdk_pixbuf_get_rowstride(), indicates the number
- of bytes between rows.
- </para>
-
- <example id="put-pixel">
- <title>put_pixel(<!-- -->) example</title>
-
- <para>
- The following code illustrates a simple put_pixel(<!-- -->)
- function for RGB pixbufs with 8 bits per channel with an alpha
- channel. It is not included in the gdk-pixbuf library for
- performance reasons; rather than making several function calls
- for each pixel, your own code can take shortcuts.
- </para>
-
- <programlisting>
-static void
-put_pixel (GdkPixbuf *pixbuf, int x, int y, guchar red, guchar green, guchar blue, guchar alpha)
-{
- int width, height, rowstride, n_channels;
- guchar *pixels, *p;
-
- n_channels = gdk_pixbuf_get_n_channels (pixbuf);
-
- g_assert (gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB);
- g_assert (gdk_pixbuf_get_bits_per_sample (pixbuf) == 8);
- g_assert (gdk_pixbuf_get_has_alpha (pixbuf));
- g_assert (n_channels == 4);
-
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
-
- g_assert (x &gt;= 0 &amp;&amp; x &lt; width);
- g_assert (y &gt;= 0 &amp;&amp; y &lt; height);
-
- rowstride = gdk_pixbuf_get_rowstride (pixbuf);
- pixels = gdk_pixbuf_get_pixels (pixbuf);
-
- p = pixels + y * rowstride + x * n_channels;
- p[0] = red;
- p[1] = green;
- p[2] = blue;
- p[3] = alpha;
-}
- </programlisting>
-
- <para>
- This function will not work for pixbufs with images that are
- other than 8 bits per sample or channel, but it will work for
- most of the pixbufs that GTK+ uses.
- </para>
- </example>
-
- <note>
- <para>
- If you are doing memcpy() of raw pixbuf data, note that the
- last row in the pixbuf may not be as wide as the full
- rowstride, but rather just as wide as the pixel data needs to
- be. That is, it is unsafe to do <literal>memcpy (dest,
- pixels, rowstride * height)</literal> to copy a whole pixbuf.
- Use gdk_pixbuf_copy() instead, or compute the width in bytes
- of the last row as <literal>width * ((n_channels *
- bits_per_sample + 7) / 8)</literal>.
- </para>
- </note>
- </section>
-
-<!-- ##### SECTION See_Also ##### -->
- <para>
- </para>
-
-<!-- ##### SECTION Stability_Level ##### -->
-
-
-<!-- ##### SECTION Image ##### -->
-
-
-<!-- ##### ENUM GdkPixbufError ##### -->
-<para>
-An error code in the #GDK_PIXBUF_ERROR domain. Many &gdk-pixbuf;
-operations can cause errors in this domain, or in the #G_FILE_ERROR
-domain.
-</para>
-
-@GDK_PIXBUF_ERROR_CORRUPT_IMAGE: An image file was broken somehow.
-@GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY: Not enough memory.
-@GDK_PIXBUF_ERROR_BAD_OPTION: A bad option was passed to a pixbuf save module.
-@GDK_PIXBUF_ERROR_UNKNOWN_TYPE: Unknown image type.
-@GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION: Don't know how to perform the
-given operation on the type of image at hand.
-@GDK_PIXBUF_ERROR_FAILED: Generic failure code, something went wrong.
-
-<!-- ##### MACRO GDK_PIXBUF_ERROR ##### -->
-<para>
-Error domain used for pixbuf operations. Indicates that the error code
-will be in the #GdkPixbufError enumeration. See #GError for
-information on error domains and error codes.
-</para>
-
-
-
-<!-- ##### ENUM GdkColorspace ##### -->
- <para>
- This enumeration defines the color spaces that are supported by
- the &gdk-pixbuf; library. Currently only RGB is supported.
- </para>
-
-@GDK_COLORSPACE_RGB: Indicates a red/green/blue additive color space.
-
-<!-- ##### ENUM GdkPixbufAlphaMode ##### -->
- <para>
- This function can create a
- bilevel clipping mask (black and white) and use it while painting
- the image. In the future, when the X Window System gets an alpha
- channel extension, it will be possible to do full alpha
- compositing onto arbitrary drawables. For now both cases fall
- back to a bilevel clipping mask.
- </para>
-
-@GDK_PIXBUF_ALPHA_BILEVEL: A bilevel clipping mask (black and white)
-will be created and used to draw the image. Pixels below 0.5 opacity
-will be considered fully transparent, and all others will be
-considered fully opaque.
-@GDK_PIXBUF_ALPHA_FULL: For now falls back to #GDK_PIXBUF_ALPHA_BILEVEL.
-In the future it will do full alpha compositing.
-
-<!-- ##### STRUCT GdkPixbuf ##### -->
- <para>
- 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 (the number of bytes between the start of
- one row and the start of the next).
- </para>
-
-
-<!-- ##### ARG GdkPixbuf:bits-per-sample ##### -->
-<para>
-
-</para>
-
-<!-- ##### ARG GdkPixbuf:colorspace ##### -->
-<para>
-
-</para>
-
-<!-- ##### ARG GdkPixbuf:has-alpha ##### -->
-<para>
-
-</para>
-
-<!-- ##### ARG GdkPixbuf:height ##### -->
-<para>
-
-</para>
-
-<!-- ##### ARG GdkPixbuf:n-channels ##### -->
-<para>
-
-</para>
-
-<!-- ##### ARG GdkPixbuf:pixels ##### -->
-<para>
-
-</para>
-
-<!-- ##### ARG GdkPixbuf:rowstride ##### -->
-<para>
-
-</para>
-
-<!-- ##### ARG GdkPixbuf:width ##### -->
-<para>
-
-</para>
-
-<!-- ##### FUNCTION gdk_pixbuf_get_colorspace ##### -->
-<para>
-
-</para>
-
-@pixbuf:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_get_n_channels ##### -->
-<para>
-
-</para>
-
-@pixbuf:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_get_has_alpha ##### -->
-<para>
-
-</para>
-
-@pixbuf:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_get_bits_per_sample ##### -->
-<para>
-
-</para>
-
-@pixbuf:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_get_pixels ##### -->
-<para>
-
-</para>
-
-@pixbuf:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_get_width ##### -->
-<para>
-
-</para>
-
-@pixbuf:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_get_height ##### -->
-<para>
-
-</para>
-
-@pixbuf:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_get_rowstride ##### -->
-<para>
-
-</para>
-
-@pixbuf:
-@Returns: <!--
-Local variables:
-mode: sgml
-sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
-End:
--->
-
-
-<!-- ##### FUNCTION gdk_pixbuf_get_option ##### -->
-<para>
-
-</para>
-
-@pixbuf:
-@key:
-@Returns:
-
-
-<!--
-Local variables:
-mode: sgml
-sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2")
-End:
--->
-
-
diff --git a/docs/reference/gdk-pixbuf/tmpl/initialization_versions.sgml b/docs/reference/gdk-pixbuf/tmpl/initialization_versions.sgml
deleted file mode 100644
index b3cce4122b..0000000000
--- a/docs/reference/gdk-pixbuf/tmpl/initialization_versions.sgml
+++ /dev/null
@@ -1,106 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-Initialization and Versions
-
-<!-- ##### SECTION Short_Description ##### -->
-
-Library version numbers.
-
-<!-- ##### SECTION Long_Description ##### -->
-<para>
-These macros and variables let you check the version of &gdk-pixbuf;
-you're linking against.
-</para>
-
-<!-- ##### SECTION See_Also ##### -->
-<para>
-
-</para>
-
-<!-- ##### SECTION Stability_Level ##### -->
-
-
-<!-- ##### SECTION Image ##### -->
-
-
-<!-- ##### VARIABLE gdk_pixbuf_version ##### -->
-<para>
-Contains the full version of the &gdk-pixbuf; library as a string.
-This is the version currently in use by a running program.
-</para>
-
-
-<!-- ##### VARIABLE gdk_pixbuf_major_version ##### -->
-<para>
-The major version number of the &gdk-pixbuf; library. (e.g. in
-&gdk-pixbuf; version 1.2.5 this is 1.)
-</para>
-
-<para>
-This variable is in the library, so represents the
-&gdk-pixbuf; library you have linked against. Contrast with the
-#GDK_PIXBUF_MAJOR macro, which represents the major version of the
-&gdk-pixbuf; headers you have included.
-</para>
-
-
-<!-- ##### VARIABLE gdk_pixbuf_minor_version ##### -->
-<para>
-The minor version number of the &gdk-pixbuf; library. (e.g. in
-&gdk-pixbuf; version 1.2.5 this is 2.)
-</para>
-
-<para>
-This variable is in the library, so represents the
-&gdk-pixbuf; library you have linked against. Contrast with the
-#GDK_PIXBUF_MINOR macro, which represents the minor version of the
-&gdk-pixbuf; headers you have included.
-</para>
-
-
-<!-- ##### VARIABLE gdk_pixbuf_micro_version ##### -->
-<para>
-The micro version number of the &gdk-pixbuf; library. (e.g. in
-&gdk-pixbuf; version 1.2.5 this is 5.)
-</para>
-
-<para>
-This variable is in the library, so represents the
-&gdk-pixbuf; library you have linked against. Contrast with the
-#GDK_PIXBUF_MICRO macro, which represents the micro version of the
-&gdk-pixbuf; headers you have included.
-</para>
-
-
-<!-- ##### MACRO GDK_PIXBUF_VERSION ##### -->
-<para>
-Contains the full version of the &gdk-pixbuf; header as a string.
-This is the version being compiled against; contrast with
-#gdk_pixbuf_version.
-</para>
-
-
-
-<!-- ##### MACRO GDK_PIXBUF_MAJOR ##### -->
-<para>
-Major version of &gdk-pixbuf; library, that is the first "0" in
-"0.8.0" for example.
-</para>
-
-
-
-<!-- ##### MACRO GDK_PIXBUF_MINOR ##### -->
-<para>
-Minor version of &gdk-pixbuf; library, that is the "8" in
-"0.8.0" for example.
-</para>
-
-
-
-<!-- ##### MACRO GDK_PIXBUF_MICRO ##### -->
-<para>
-Micro version of &gdk-pixbuf; library, that is the last "0" in
-"0.8.0" for example.
-</para>
-
-
-
diff --git a/docs/reference/gdk-pixbuf/tmpl/inline.sgml b/docs/reference/gdk-pixbuf/tmpl/inline.sgml
deleted file mode 100644
index 0b8da2cfc0..0000000000
--- a/docs/reference/gdk-pixbuf/tmpl/inline.sgml
+++ /dev/null
@@ -1,137 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-Inline data
-
-<!-- ##### SECTION Short_Description ##### -->
-Functions for inlined pixbuf handling.
-
-<!-- ##### SECTION Long_Description ##### -->
-<para>
-Using #GdkPixdata, images can be compiled into an application,
-making it unnecessary to refer to external image files at runtime.
-&gdk-pixbuf; includes a utility named gdk-pixbuf-csource, which
-can be used to convert image files into #GdkPixdata structures suitable
-for inclusion in C sources. To convert the #GdkPixdata structures back
-into #GdkPixbuf<!-- -->s, use gdk_pixbuf_from_pixdata.
-</para>
-
-<!-- ##### SECTION See_Also ##### -->
- <para>
-
- </para>
-
-<!-- ##### SECTION Stability_Level ##### -->
-
-
-<!-- ##### SECTION Image ##### -->
-
-
-<!-- ##### STRUCT GdkPixdata ##### -->
- <para>
-
- </para>
-
-@magic:
-@length:
-@pixdata_type:
-@rowstride:
-@width:
-@height:
-@pixel_data:
-
-<!-- ##### ENUM GdkPixdataType ##### -->
- <para>
-
- </para>
-
-@GDK_PIXDATA_COLOR_TYPE_RGB:
-@GDK_PIXDATA_COLOR_TYPE_RGBA:
-@GDK_PIXDATA_COLOR_TYPE_MASK:
-@GDK_PIXDATA_SAMPLE_WIDTH_8:
-@GDK_PIXDATA_SAMPLE_WIDTH_MASK:
-@GDK_PIXDATA_ENCODING_RAW:
-@GDK_PIXDATA_ENCODING_RLE:
-@GDK_PIXDATA_ENCODING_MASK:
-
-<!-- ##### ENUM GdkPixdataDumpType ##### -->
- <para>
-
- </para>
-
-@GDK_PIXDATA_DUMP_PIXDATA_STREAM:
-@GDK_PIXDATA_DUMP_PIXDATA_STRUCT:
-@GDK_PIXDATA_DUMP_MACROS:
-@GDK_PIXDATA_DUMP_GTYPES:
-@GDK_PIXDATA_DUMP_CTYPES:
-@GDK_PIXDATA_DUMP_STATIC:
-@GDK_PIXDATA_DUMP_CONST:
-@GDK_PIXDATA_DUMP_RLE_DECODER:
-
-<!-- ##### MACRO GDK_PIXBUF_MAGIC_NUMBER ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### MACRO GDK_PIXDATA_HEADER_LENGTH ##### -->
-<para>
-
-</para>
-
-
-
-<!-- ##### FUNCTION gdk_pixdata_from_pixbuf ##### -->
-<para>
-
-</para>
-
-@pixdata:
-@pixbuf:
-@use_rle:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_from_pixdata ##### -->
-<para>
-
-</para>
-
-@pixdata:
-@copy_pixels:
-@error:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixdata_serialize ##### -->
-<para>
-
-</para>
-
-@pixdata:
-@stream_length_p:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixdata_deserialize ##### -->
-<para>
-
-</para>
-
-@pixdata:
-@stream_length:
-@stream:
-@error:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixdata_to_csource ##### -->
-<para>
-
-</para>
-
-@pixdata:
-@name:
-@dump_type:
-@Returns:
-
-
diff --git a/docs/reference/gdk-pixbuf/tmpl/module_interface.sgml b/docs/reference/gdk-pixbuf/tmpl/module_interface.sgml
deleted file mode 100644
index 61cfc9919e..0000000000
--- a/docs/reference/gdk-pixbuf/tmpl/module_interface.sgml
+++ /dev/null
@@ -1,382 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-Module Interface
-
-<!-- ##### SECTION Short_Description ##### -->
-Extending &gdk-pixbuf;
-
-<!-- ##### SECTION Long_Description ##### -->
-<para>
-If &gdk-pixbuf; has been compiled with GModule support, it can be extended by
-modules which can load (and perhaps also save) new image and animation
-formats. Each loadable module must export a
-#GdkPixbufModuleFillInfoFunc function named <function>fill_info</function> and
-a #GdkPixbufModuleFillVtableFunc function named
-<function>fill_vtable</function>.
-</para>
-
-<para>
-In order to make format-checking work before actually loading the modules
-(which may require dlopening image libraries), modules export their
-signatures (and other information) via the <function>fill_info</function>
-function. An external utility, <command>gdk-pixbuf-query-loaders-3.0</command>,
-uses this to create a text file containing a list of all available loaders and
-their signatures. This file is then read at runtime by &gdk-pixbuf; to obtain
-the list of available loaders and their signatures.
-</para>
-
-<para>
-Modules may only implement a subset of the functionality available via
-#GdkPixbufModule. If a particular functionality is not implemented, the
-<function>fill_vtable</function> function will simply not set the corresponding
-function pointers of the #GdkPixbufModule structure. If a module supports
-incremental loading (i.e. provides #begin_load, #stop_load and
-#load_increment), it doesn't have to implement #load, since &gdk-pixbuf; can
-supply a generic #load implementation wrapping the incremental loading.
-</para>
-
-<para>
-Installing a module is a two-step process:
-<itemizedlist>
-<listitem><para>copy the module file(s) to the loader directory (normally
-<filename><replaceable>libdir</replaceable>/gtk-3.0/<replaceable>version</replaceable>/loaders</filename>,
-unless overridden by the environment variable
-<envar>GDK_PIXBUF_MODULEDIR</envar>)
-</para></listitem>
-<listitem><para>call <command>gdk-pixbuf-query-loaders-3.0</command> to update the
-module file (normally
-<filename><replaceable>libdir</replaceable>/gtk-3.0/<replaceable>version</replaceable>/loaders.cache</filename>,
-unless overridden by the environment variable
-<envar>GDK_PIXBUF_MODULE_FILE</envar>)
-</para></listitem>
-</itemizedlist>
-</para>
-
-<para>
-The &gdk-pixbuf; interfaces needed for implementing modules are contained in
-<filename>gdk-pixbuf-io.h</filename> (and
-<filename>gdk-pixbuf-animation.h</filename> if the module supports animations).
-They are not covered by the same stability guarantees as the regular
-&gdk-pixbuf; API. To underline this fact, they are protected by
-<literal>#ifdef GDK_PIXBUF_ENABLE_BACKEND</literal>.
-</para>
-
-<!-- ##### SECTION See_Also ##### -->
-<para>
-
-</para>
-
-<!-- ##### SECTION Stability_Level ##### -->
-
-
-<!-- ##### SECTION Image ##### -->
-
-
-<!-- ##### FUNCTION gdk_pixbuf_set_option ##### -->
-<para>
-
-</para>
-
-@pixbuf:
-@key:
-@value:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_get_formats ##### -->
-<para>
-
-</para>
-
-@void:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_format_get_name ##### -->
-<para>
-
-</para>
-
-@format:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_format_get_description ##### -->
-<para>
-
-</para>
-
-@format:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_format_get_mime_types ##### -->
-<para>
-
-</para>
-
-@format:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_format_get_extensions ##### -->
-<para>
-
-</para>
-
-@format:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_format_is_writable ##### -->
-<para>
-
-</para>
-
-@format:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_format_is_scalable ##### -->
-<para>
-
-</para>
-
-@format:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_format_is_disabled ##### -->
-<para>
-
-</para>
-
-@format:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_format_set_disabled ##### -->
-<para>
-
-</para>
-
-@format:
-@disabled:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_format_get_license ##### -->
-<para>
-
-</para>
-
-@format:
-@Returns:
-
-
-<!-- ##### STRUCT GdkPixbufFormat ##### -->
-<para>
-A #GdkPixbufFormat contains information about the image format accepted by a
-module. Only modules should access the fields directly, applications should
-use the <function>gdk_pixbuf_format_*</function> functions.
-</para>
-
-@name: the name of the image format.
-@signature: the signature of the module.
-@domain: the message domain for the @description.
-@description: a description of the image format.
-@mime_types: a %NULL-terminated array of MIME types for the image format.
-@extensions: a %NULL-terminated array of typical filename extensions for the
-image format.
-@flags: a combination of #GdkPixbufFormatFlags.
-@disabled: a boolean determining whether the loader is disabled.
-@license: a string containing license information, typically set to
- shorthands like "GPL", "LGPL", etc.
-@Since: 2.2
-
-<!-- ##### ENUM GdkPixbufFormatFlags ##### -->
-<para>
-Flags which allow a module to specify further details about the supported
-operations.
-</para>
-
-@GDK_PIXBUF_FORMAT_WRITABLE: the module can write out images in the format.
-@GDK_PIXBUF_FORMAT_SCALABLE: the image format is scalable
-@GDK_PIXBUF_FORMAT_THREADSAFE: the module is threadsafe. If this flag is not
- set, &gdk-pixbuf; will use a lock to prevent multiple threads from using
- this module at the same time. (Since 2.6)
-@Since: 2.2
-
-<!-- ##### STRUCT GdkPixbufModulePattern ##### -->
-<para>
-The signature of a module is a set of prefixes. Prefixes are encoded as
-pairs of ordinary strings, where the second string, called the mask, if
-not %NULL, must be of the same length as the first one and may contain
-' ', '!', 'x', 'z', and 'n' to indicate bytes that must be matched,
-not matched, "don't-care"-bytes, zeros and non-zeros.
-Each prefix has an associated integer that describes the relevance of
-the prefix, with 0 meaning a mismatch and 100 a "perfect match".
-</para>
-<para>
-Starting with &gdk-pixbuf; 2.8, the first byte of the mask may be '*',
-indicating an unanchored pattern that matches not only at the beginning,
-but also in the middle. Versions prior to 2.8 will interpret the '*'
-like an 'x'.
-</para>
-<para>
-The signature of a module is stored as an array of
-#GdkPixbufModulePattern<!-- -->s. The array is terminated by a pattern
-where the @prefix is %NULL.
-</para>
-
-<informalexample><programlisting>
-GdkPixbufModulePattern *signature[] = {
- { "abcdx", " !x z", 100 },
- { "bla", NULL, 90 },
- { NULL, NULL, 0 }
-};
-</programlisting>
-The example matches e.g. "auud\0" with relevance 100, and "blau" with
-relevance 90.</informalexample>
-
-@prefix: the prefix for this pattern
-@mask: mask containing bytes which modify how the prefix is matched against
- test data
-@relevance: relevance of this pattern
-@Since: 2.2
-
-<!-- ##### USER_FUNCTION GdkPixbufModuleFillVtableFunc ##### -->
-<para>
-Defines the type of the function used to set the vtable of a
-#GdkPixbufModule when it is loaded.
-</para>
-
-@module: a #GdkPixbufModule.
-@Since: 2.2
-
-
-<!-- ##### USER_FUNCTION GdkPixbufModuleFillInfoFunc ##### -->
-<para>
-Defines the type of the function used to fill a
-#GdkPixbufFormat structure with information about a module.
-</para>
-
-@info: a #GdkPixbufFormat.
-@Since: 2.2
-
-
-<!-- ##### USER_FUNCTION GdkPixbufModuleSizeFunc ##### -->
-<para>
-Defines the type of the function that gets called once the size
-of the loaded image is known.
-</para>
-<para>
-The function is expected to set @width and @height to the desired
-size to which the image should be scaled. If a module has no efficient
-way to achieve the desired scaling during the loading of the image, it may
-either ignore the size request, or only approximate it -- &gdk-pixbuf; will
-then perform the required scaling on the completely loaded image.
-</para>
-<para>
-If the function sets @width or @height to zero, the module should interpret
-this as a hint that it will be closed soon and shouldn't allocate further
-resources. This convention is used to implement gdk_pixbuf_get_file_info()
-efficiently.
-</para>
-
-@width: pointer to a location containing the current image width
-@height: pointer to a location containing the current image height
-@user_data: the loader.
-@Since: 2.2
-
-
-<!-- ##### USER_FUNCTION GdkPixbufModulePreparedFunc ##### -->
-<para>
-Defines the type of the function that gets called once the initial
-setup of @pixbuf is done.
-</para>
-<para>
-#GdkPixbufLoader uses a function of this type to emit the
-"<link linkend="GdkPixbufLoader-area-prepared">area_prepared</link>"
-signal.
-</para>
-
-@pixbuf: the #GdkPixbuf that is currently being loaded.
-@anim: if an animation is being loaded, the #GdkPixbufAnimation, else %NULL.
-@user_data: the loader.
-@Since: 2.2
-
-
-<!-- ##### USER_FUNCTION GdkPixbufModuleUpdatedFunc ##### -->
-<para>
-Defines the type of the function that gets called every time a region
-of @pixbuf is updated.
-</para>
-<para>
-#GdkPixbufLoader uses a function of this type to emit the
-"<link linkend="GdkPixbufLoader-area-updated">area_updated</link>"
-signal.
-</para>
-
-@pixbuf: the #GdkPixbuf that is currently being loaded.
-@x: the X origin of the updated area.
-@y: the Y origin of the updated area.
-@width: the width of the updated area.
-@height: the height of the updated area.
-@user_data: the loader.
-@Since: 2.2
-
-
-<!-- ##### STRUCT GdkPixbufModule ##### -->
-<para>
-A #GdkPixbufModule contains the necessary functions to load and save
-images in a certain file format.
-</para>
-<para>
-A #GdkPixbufModule can be loaded dynamically from a #GModule.
-Each loadable module must contain a #GdkPixbufModuleFillVtableFunc function
-named <function>fill_vtable</function>, which will get called when the module
-is loaded and must set the function pointers of the #GdkPixbufModule.
-</para>
-
-@module_name: the name of the module, usually the same as the
- usual file extension for images of this type, eg. "xpm", "jpeg" or "png".
-@module_path: the path from which the module is loaded.
-@module: the loaded #GModule.
-@info: a #GdkPixbufFormat holding information about the module.
-@load: loads an image from a file.
-@load_xpm_data: loads an image from data in memory.
-@begin_load: begins an incremental load.
-@stop_load: stops an incremental load.
-@load_increment: continues an incremental load.
-@load_animation: loads an animation from a file.
-@save: saves a #GdkPixbuf to a file.
-@save_to_callback: saves a #GdkPixbuf by calling the given #GdkPixbufSaveFunc.
-
-<!-- ##### STRUCT GdkPixbufAnimationClass ##### -->
-<para>
-Modules supporting animations must derive a type from
-#GdkPixbufAnimation, providing suitable implementations of the
-virtual functions.
-</para>
-
-@parent_class: the parent class
-@is_static_image: returns whether the given animation is just a static image.
-@get_static_image: returns a static image representing the given animation.
-@get_size: fills @width and @height with the frame size of the animation.
-@get_iter: returns an iterator for the given animation.
-
-<!-- ##### STRUCT GdkPixbufAnimationIterClass ##### -->
-<para>
-Modules supporting animations must derive a type from
-#GdkPixbufAnimationIter, providing suitable implementations of the
-virtual functions.
-</para>
-
-@parent_class: the parent class
-@get_delay_time: returns the time in milliseconds that the current frame
- should be shown.
-@get_pixbuf: returns the current frame.
-@on_currently_loading_frame: returns whether the current frame of @iter is
-being loaded.
-@advance: advances the iterator to @current_time, possibly changing the
-current frame.
-
diff --git a/docs/reference/gdk-pixbuf/tmpl/refcounting.sgml b/docs/reference/gdk-pixbuf/tmpl/refcounting.sgml
deleted file mode 100644
index d4367150d9..0000000000
--- a/docs/reference/gdk-pixbuf/tmpl/refcounting.sgml
+++ /dev/null
@@ -1,67 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-Reference Counting and Memory Mangement
-
-<!-- ##### SECTION Short_Description ##### -->
-
-Functions for reference counting and memory management on pixbufs.
-
-<!-- ##### SECTION Long_Description ##### -->
- <para>
- #GdkPixbuf structures are reference counted. This means that an
- application can share a single pixbuf among many parts of the
- code. When a piece of the program needs to keep a pointer to a
- pixbuf, it should add a reference to it by calling g_object_ref().
- When it no longer needs the pixbuf, it should subtract a reference
- by calling g_object_unref(). The pixbuf will be destroyed when
- its reference count drops to zero. Newly-created #GdkPixbuf
- structures start with a reference count of one.
- </para>
-
- <note>
- <para>
- As #GdkPixbuf is derived from #GObject now, gdk_pixbuf_ref() and
- gdk_pixbuf_unref() are deprecated in favour of g_object_ref()
- and g_object_unref () resp.
- </para>
- </note>
-
- <para>
- <emphasis>Finalizing</emphasis> a pixbuf means to free its pixel
- data and to free the #GdkPixbuf structure itself. Most of the
- library functions that create #GdkPixbuf structures create the
- pixel data by themselves and define the way it should be freed;
- you do not need to worry about those. The only function that lets
- you specify how to free the pixel data is
- gdk_pixbuf_new_from_data(). Since you pass it a pre-allocated
- pixel buffer, you must also specify a way to free that data. This
- is done with a function of type #GdkPixbufDestroyNotify. When a
- pixbuf created with gdk_pixbuf_new_from_data() is finalized, your
- destroy notification function will be called, and it is its
- responsibility to free the pixel array.
- </para>
-
-<!-- ##### SECTION See_Also ##### -->
- <para>
- #GdkPixbuf, gdk_pixbuf_new_from_data().
- </para>
-
-<!-- ##### SECTION Stability_Level ##### -->
-
-
-<!-- ##### SECTION Image ##### -->
-
-
-<!-- ##### USER_FUNCTION GdkPixbufDestroyNotify ##### -->
- <para>
- A function of this type is responsible for freeing the pixel array
- of a pixbuf. The gdk_pixbuf_new_from_data() function lets you
- pass in a pre-allocated pixel array so that a pixbuf can be
- created from it; in this case you will need to pass in a function
- of #GdkPixbufDestroyNotify so that the pixel data can be freed
- when the pixbuf is finalized.
- </para>
-
-@pixels: The pixel array of the pixbuf that is being finalized.
-@data: User closure data.
-
-
diff --git a/docs/reference/gdk-pixbuf/tmpl/scaling.sgml b/docs/reference/gdk-pixbuf/tmpl/scaling.sgml
deleted file mode 100644
index 6550cd59a6..0000000000
--- a/docs/reference/gdk-pixbuf/tmpl/scaling.sgml
+++ /dev/null
@@ -1,246 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-Scaling
-
-<!-- ##### SECTION Short_Description ##### -->
-Scaling pixbufs and scaling and compositing pixbufs
-
-<!-- ##### SECTION Long_Description ##### -->
- <para>
- 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>
- Since the full-featured functions (gdk_pixbuf_scale(),
- gdk_pixbuf_composite(), and gdk_pixbuf_composite_color()) are
- rather complex to use and have many arguments, two simple
- convenience functions are provided, gdk_pixbuf_scale_simple() and
- gdk_pixbuf_composite_color_simple() which create a new pixbuf of a
- given size, scale an original image to fit, and then return the
- new pixbuf.
- </para>
-
- <para>
- Scaling and compositing functions take advantage of MMX hardware
- acceleration on systems where MMX is supported. If gdk-pixbuf is built
- with the Sun mediaLib library, these functions are instead accelerated
- using mediaLib, which provides hardware acceleration on Intel, AMD,
- and Sparc chipsets. If desired, mediaLib support can be turned off by
- setting the GDK_DISABLE_MEDIALIB environment variable.
- </para>
-
- <para>
- The following example demonstrates handling an expose event by
- rendering the appropriate area of a source image (which is scaled
- to fit the widget) onto the widget's window. The source image is
- rendered against a checkerboard, which provides a visual
- representation of the alpha channel if the image has one. If the
- image doesn't have an alpha channel, calling
- gdk_pixbuf_composite_color() function has exactly the same effect
- as calling gdk_pixbuf_scale().
- </para>
-
- <example>
- <title>Handling an expose event.</title>
- <programlisting>
-gboolean
-expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
-{
- GdkPixbuf *dest;
-
- dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, event->area.width, event->area.height);
-
- gdk_pixbuf_composite_color (pixbuf, dest,
- 0, 0, event->area.width, event->area.height,
- -event->area.x, -event->area.y,
- (double) widget->allocation.width / gdk_pixbuf_get_width (pixbuf),
- (double) widget->allocation.height / gdk_pixbuf_get_height (pixbuf),
- GDK_INTERP_BILINEAR, 255,
- event->area.x, event->area.y, 16, 0xaaaaaa, 0x555555);
-
- gdk_draw_pixbuf (widget->window, widget->style->fg_gc[GTK_STATE_NORMAL], dest,
- 0, 0, event->area.x, event->area.y,
- event->area.width, event->area.height,
- GDK_RGB_DITHER_NORMAL, event->area.x, event->area.y);
-
- gdk_pixbuf_unref (dest);
-
- return TRUE;
-}
- </programlisting>
- </example>
-
-<!-- ##### SECTION See_Also ##### -->
- <para>
- <link linkend="gdk-GdkRGB">GdkRGB</link>.
- </para>
-
-<!-- ##### SECTION Stability_Level ##### -->
-
-
-<!-- ##### SECTION Image ##### -->
-
-
-<!-- ##### ENUM GdkInterpType ##### -->
- <para>
- This enumeration describes the different interpolation modes that
- can be used with the scaling functions. @GDK_INTERP_NEAREST is
- the fastest scaling method, but has horrible quality when
- scaling down. @GDK_INTERP_BILINEAR is the best choice if you
- aren't sure what to choose, it has a good speed/quality balance.
-
- <note>
- <para>
- Cubic filtering is missing from the list; hyperbolic
- interpolation is just as fast and results in higher quality.
- </para>
- </note>
- </para>
-
-@GDK_INTERP_NEAREST: Nearest neighbor sampling; this is the fastest
-and lowest quality mode. Quality is normally unacceptable when scaling
-down, but may be OK when scaling up.
-@GDK_INTERP_TILES: This is an accurate simulation of the PostScript
-image operator without any interpolation enabled. Each pixel is
-rendered as a tiny parallelogram of solid color, the edges of which
-are implemented with antialiasing. It resembles nearest neighbor for
-enlargement, and bilinear for reduction.
-@GDK_INTERP_BILINEAR: Best quality/speed balance; use this mode by
-default. Bilinear interpolation. For enlargement, it is
-equivalent to point-sampling the ideal bilinear-interpolated image.
-For reduction, it is equivalent to laying down small tiles and
-integrating over the coverage area.
-@GDK_INTERP_HYPER: This is the slowest and highest quality
-reconstruction function. It is derived from the hyperbolic filters in
-Wolberg's "Digital Image Warping", and is formally defined as the
-hyperbolic-filter sampling the ideal hyperbolic-filter interpolated
-image (the filter is designed to be idempotent for 1:1 pixel mapping).
-
-<!-- ##### FUNCTION gdk_pixbuf_scale_simple ##### -->
-<para>
-
-</para>
-
-@src:
-@dest_width:
-@dest_height:
-@interp_type:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_scale ##### -->
-<para>
-
-</para>
-
-@src:
-@dest:
-@dest_x:
-@dest_y:
-@dest_width:
-@dest_height:
-@offset_x:
-@offset_y:
-@scale_x:
-@scale_y:
-@interp_type:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_composite_color_simple ##### -->
-<para>
-
-</para>
-
-@src:
-@dest_width:
-@dest_height:
-@interp_type:
-@overall_alpha:
-@check_size:
-@color1:
-@color2:
-@Returns: <!--
-Local variables:
-mode: sgml
-sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
-End:
--->
-
-
-<!-- ##### FUNCTION gdk_pixbuf_composite ##### -->
-<para>
-
-</para>
-
-@src:
-@dest:
-@dest_x:
-@dest_y:
-@dest_width:
-@dest_height:
-@offset_x:
-@offset_y:
-@scale_x:
-@scale_y:
-@interp_type:
-@overall_alpha:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_composite_color ##### -->
-<para>
-
-</para>
-
-@src:
-@dest:
-@dest_x:
-@dest_y:
-@dest_width:
-@dest_height:
-@offset_x:
-@offset_y:
-@scale_x:
-@scale_y:
-@interp_type:
-@overall_alpha:
-@check_x:
-@check_y:
-@check_size:
-@color1:
-@color2:
-
-
-<!-- ##### ENUM GdkPixbufRotation ##### -->
-<para>
-The possible rotations which can be passed to gdk_pixbuf_rotate_simple().
-To make them easier to use, their numerical values are the actual degrees.
-</para>
-
-@GDK_PIXBUF_ROTATE_NONE: No rotation.
-@GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE: Rotate by 90 degrees.
-@GDK_PIXBUF_ROTATE_UPSIDEDOWN: Rotate by 180 degrees.
-@GDK_PIXBUF_ROTATE_CLOCKWISE: Rotate by 270 degrees.
-
-<!-- ##### FUNCTION gdk_pixbuf_rotate_simple ##### -->
-<para>
-
-</para>
-
-@src:
-@angle:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_flip ##### -->
-<para>
-
-</para>
-
-@src:
-@horizontal:
-@Returns:
-
-
diff --git a/docs/reference/gdk-pixbuf/tmpl/util.sgml b/docs/reference/gdk-pixbuf/tmpl/util.sgml
deleted file mode 100644
index fd54648882..0000000000
--- a/docs/reference/gdk-pixbuf/tmpl/util.sgml
+++ /dev/null
@@ -1,87 +0,0 @@
-<!-- ##### SECTION Title ##### -->
-Utilities
-
-<!-- ##### SECTION Short_Description ##### -->
-Utility and miscellaneous convenience functions.
-
-<!-- ##### SECTION Long_Description ##### -->
- <para>
- These functions provide miscellaneous utilities for manipulating
- pixbufs. The pixel data in pixbufs may of course be manipulated
- directly by applications, but several common operations can be
- performed by these functions instead.
- </para>
-
-<!-- ##### SECTION See_Also ##### -->
- <para>
- #GdkPixbuf
- </para>
-
-<!-- ##### SECTION Stability_Level ##### -->
-
-
-<!-- ##### SECTION Image ##### -->
-
-
-<!-- ##### FUNCTION gdk_pixbuf_add_alpha ##### -->
-<para>
-
-</para>
-
-@pixbuf:
-@substitute_color:
-@r:
-@g:
-@b:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_copy_area ##### -->
-<para>
-
-</para>
-
-@src_pixbuf:
-@src_x:
-@src_y:
-@width:
-@height:
-@dest_pixbuf:
-@dest_x:
-@dest_y: <!--
-Local variables:
-mode: sgml
-sgml-parent-document: ("../gdk-pixbuf.sgml" "book" "refsect2" "")
-End:
--->
-
-
-<!-- ##### FUNCTION gdk_pixbuf_saturate_and_pixelate ##### -->
-<para>
-
-</para>
-
-@src:
-@dest:
-@saturation:
-@pixelate:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_apply_embedded_orientation ##### -->
-<para>
-
-</para>
-
-@src:
-@Returns:
-
-
-<!-- ##### FUNCTION gdk_pixbuf_fill ##### -->
-<para>
-
-</para>
-
-@pixbuf:
-@pixel:
-
-
diff --git a/docs/reference/gdk-pixbuf/version.xml.in b/docs/reference/gdk-pixbuf/version.xml.in
deleted file mode 100644
index 3bb59ac105..0000000000
--- a/docs/reference/gdk-pixbuf/version.xml.in
+++ /dev/null
@@ -1 +0,0 @@
-@GTK_VERSION@
diff --git a/docs/reference/gdk/Makefile.am b/docs/reference/gdk/Makefile.am
index 75ccec6172..1ac562c1b8 100644
--- a/docs/reference/gdk/Makefile.am
+++ b/docs/reference/gdk/Makefile.am
@@ -142,7 +142,7 @@ HTML_IMAGES = \
images/xterm.png
# Extra options to supply to gtkdoc-fixref
-FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html \
+FIXXREF_OPTIONS= \
--extra-dir=$(GLIB_PREFIX)/share/gtk-doc/html/gobject \
--extra-dir=$(GLIB_PREFIX)/share/gtk-doc/html/glib \
--extra-dir=$(CAIRO_PREFIX)/share/gtk-doc/html/cairo
diff --git a/docs/reference/gtk/Makefile.am b/docs/reference/gtk/Makefile.am
index 35515743bc..88b25983b1 100644
--- a/docs/reference/gtk/Makefile.am
+++ b/docs/reference/gtk/Makefile.am
@@ -23,7 +23,6 @@ CFILE_GLOB=$(top_srcdir)/gtk/*.c
IGNORE_HFILES= \
gtkalias.h \
fnmatch.h \
- gdk-pixbuf-loader.h \
gtkdebug.h \
gtkbuilderprivate.h \
gtkdndcursors.h \
@@ -107,7 +106,6 @@ CPPFLAGS += \
-UGTK_DISABLE_SINGLE_INCLUDES
GTKDOC_LIBS = \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
$(top_builddir)/gdk/$(gdktargetlib) \
$(top_builddir)/gtk/$(gtktargetlib)
@@ -323,7 +321,7 @@ HTML_IMAGES = \
$(srcdir)/images/layout-tbrl.png
# Extra options to supply to gtkdoc-fixref
-FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html \
+FIXXREF_OPTIONS=--extra-dir=../gdk/html \
--extra-dir=$(GLIB_PREFIX)/share/gtk-doc/html/gobject \
--extra-dir=$(GLIB_PREFIX)/share/gtk-doc/html/glib \
--extra-dir=$(ATK_PREFIX)/share/gtk-doc/html/atk \
diff --git a/docs/reference/gtk/building.sgml b/docs/reference/gtk/building.sgml
index 87a182492f..1c30dc4660 100644
--- a/docs/reference/gtk/building.sgml
+++ b/docs/reference/gtk/building.sgml
@@ -160,9 +160,9 @@ How to compile GTK+ itself
</listitem>
</itemizedlist>
<para>
- Three of the libraries that GTK+ depends on are maintained by
- by the GTK+ team: GLib, Pango, and ATK. Other libraries are
- maintained separately.
+ Some of the libraries that GTK+ depends on are maintained by
+ by the GTK+ team: GLib, GdkPixbuf, Pango, and ATK. Other libraries
+ are maintained separately.
</para>
<itemizedlist>
<listitem>
@@ -324,9 +324,6 @@ How to compile GTK+ itself
<arg>--enable-modules</arg>
</group>
<group>
- <arg>--with-included-loaders==LOADER1,LOADER2,...</arg>
- </group>
- <group>
<arg>--with-included-immodules=MODULE1,MODULE2,...</arg>
</group>
<group>
@@ -385,8 +382,8 @@ How to compile GTK+ itself
<systemitem>--enable-modules</systemitem></title>
<para>
- Normally GTK+ will try to build the GdkPixbuf image file
- format loaders as little shared libraries that are loaded on
+ Normally GTK+ will try to build the input method modules
+ 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 GTK+ library instead. This is useful for
@@ -399,16 +396,6 @@ How to compile GTK+ itself
</formalpara>
<formalpara>
- <title><systemitem>--with-included-loaders</systemitem></title>
-
- <para>
- This option allows you to specify which image loaders you
- want to include; for example, you might include only the PNG
- loader to create a smaller GdkPixbuf binary.
- </para>
- </formalpara>
-
- <formalpara>
<title><systemitem>--with-included-immodules</systemitem></title>
<para>
diff --git a/docs/tools/Makefile.am b/docs/tools/Makefile.am
index 66ba8b5064..def51f2eef 100644
--- a/docs/tools/Makefile.am
+++ b/docs/tools/Makefile.am
@@ -1,7 +1,7 @@
include $(top_srcdir)/Makefile.decl
INCLUDES = \
- -I$(top_srcdir) \
+ -I$(top_srcdir) \
-I$(top_builddir)/gdk \
-I$(top_srcdir)/gdk \
-I$(top_srcdir)/gdk/x11 \
@@ -9,16 +9,15 @@ INCLUDES = \
$(GTK_DEP_CFLAGS)
DEPS = \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
- $(top_builddir)/gdk/$(gdktargetlib) \
+ $(top_builddir)/gdk/$(gdktargetlib) \
$(top_builddir)/gtk/$(gtktargetlib)
LDADDS = \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
- $(top_builddir)/gdk/$(gdktargetlib) \
+ $(top_builddir)/gdk/$(gdktargetlib) \
$(top_builddir)/gtk/$(gtktargetlib) \
- $(GTK_DEP_LIBS) \
- $(GDK_DEP_LIBS)
+ $(GTK_DEP_LIBS) \
+ $(GDK_DEP_LIBS) \
+ -lm
if USE_X11
noinst_PROGRAMS = \
diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog
deleted file mode 100644
index d8431db13a..0000000000
--- a/gdk-pixbuf/ChangeLog
+++ /dev/null
@@ -1,6289 +0,0 @@
-=== ChangeLog discontinued ===
-
- With the move to git, GTK+ is switching from a ChangeLog file
- to relying on commit messages to provide change history. Please
- see README.commits for guidance on the expected message format.
-
-2009-03-13 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.16.0 ===
-
-2009-03-02 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.15.5 ===
-
-2009-03-01 Matthias Clasen <mclasen@redhat.com>
-
- Bug 569671 – gdk_pixbuf_new_from_file() can't open
- image/x-portable-pixmap
-
- * gdk-pixbuf-io.c (_gdk_pixbuf_get_module): If pure sniffing
- yields uncertain results, try again with the filename.
- Patch by Tyler Lawson
-
-2009-02-17 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.15.4 ===
-
-2009-02-02 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.15.3 ===
-
-2009-01-27 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.15.2 ===
-
-2009-01-23 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.15.1 ===
-
-2009-01-19 Tor Lillqvist <tml@iki.fi>
-
- Bug 568305 - gdk-pixbuf mishandles BI_BITFIELDS bmps
-
- * io-bmp.c (OneLine32): Use unsigned variables so that we can
- right-shift them without risk of sign extension. Don't "reverse"
- the alpha value, actually storing 0xFF-alpha, but use it as such.
-
-2009-01-12 Tor Lillqvist <tml@iki.fi>
-
- Bug 164002 - query scripts don't work uninstalled on windows
-
- * queryloaders.c (main): Use the configure-time PIXBUF_LIBDIR if
- the exe is located in a .libs folder, i.e. run in the build
- directory through a libtool wrapper script or wrapper executable,
- or in the source folder itself. Otherwise continue to infer the
- runtime prefix from the exe's location.
-
-2009-01-12 Tor Lillqvist <tml@iki.fi>
-
- * queryloaders.c (main): Remove the Win9x code path. It had been
- left by mistake. Win9x code is gone from the rest of GTK+ since
- 2.12.
-
-2009-01-07 Matthias Clasen <mclasen@redhat.com>
-
- Bug 566862 – pixbuf_new_from_file does not autodetect format
-
- * gdk-pixbuf-io.c (_gdk_pixbuf_get_module): Go back to sniffing
- without looking at the filename, to avoid breaking expected
- functionality.
-
-2009-01-01 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.15.0 ===
-
-2008-11-30 Christian Dywan <christian@imendio.com>
-
- Bug 561186 – GdkPixbuf API type checking needs cleanup
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_write),
- (gdk_pixbuf_loader_get_pixbuf), (gdk_pixbuf_loader_get_animation),
- (gdk_pixbuf_loader_close), (gdk_pixbuf_loader_get_format):
- * gdk-pixbuf-scale.c (gdk_pixbuf_scale), (gdk_pixbuf_composite),
- (gdk_pixbuf_composite_color), (gdk_pixbuf_scale_simple),
- (gdk_pixbuf_composite_color_simple):
- * gdk-pixbuf-simple-anim.c (gdk_pixbuf_simple_anim_add_frame):
- * gdk-pixbuf-util.c (gdk_pixbuf_add_alpha),
- (gdk_pixbuf_apply_embedded_orientation):
- Improve type checking in pixbuf API
-
-2008-10-13 Matthias Clasen <mclasen@redhat.com>
-
- Bug 555791 – Natuilus Crashes when opening USB MP3 Player Contents
-
- * io-tga.c (gdk_pixbuf__tga_stop_load): Don't segfault on
- short files.
- Problem reported by Pedro Villavicencio
-
-2008-10-01 Tor Lillqvist <tml@novell.com>
-
- * io-icns.c: Don't #define _GNU_SOURCE on Windows as it confuses
- newest mingw headers.
-
-2008-09-23 13:28:23 Tim Janik <timj@imendio.com>
-
- * gdk-pixdata.c: prevent RLE encoding of 1x1 pixel images, since the
- encoder comparison operator requires at least 2 pixels, fixes #553374:
- Bug 553374 - gdk_pixdata_from_pixbuf fails for some images with use_rle set to TRUE
-
-2008-09-19 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-io.c: Don't call fill_info if we've already filled
- the info from the module file, fixes a small memory leak.
-
-2008-09-18 Dominic Lachowicz <domlachowicz@gmail.com>
-
- * io-gdip-utils.c: Fix 2 cases where we leaked a GpImage (#552545)
-
-2008-09-17 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.14.2 ===
-
-2008-09-13 Tor Lillqvist <tml@novell.com>
-
- * gdk-pixbuf-io.c: Don't use the deprectated
- g_win32_get_package_installation_subdirectory(). Use
- g_win32_get_package_installation_directory_of_module()
- instead. Also, don't use the deprecated silly
- G_WIN32_DLLMAIN_FOR_DLL_NAME() macro, but an explicit minimal
- DllMain() that just saves the DLL handle.
-
-2008-09-07 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-io.c (gdk_pixbuf_io_init): Plug a small memory
- leak in an error path.
-
-2008-09-06 Matthias Clasen <mclasen@redhat.com>
-
- Bug 517233 – Calling gdk_pixbuf_loader_close causes "GError set over
- the top of a previous GError" warning
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_close): Don't overwrite
- errors. Reported by Andrey Tsyvarev
-
-2008-09-05 Sebastien Bacher <seb128@ubuntu.com>
-
- * gdk-pixbuf-io.c: (gdk_pixbuf_load_module_unlocked):
- bug 550969 - fix a typo which breaks the static build
-
-2008-09-04 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.14.1 ===
-
-2008-09-04 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-io.c: Fix a deadlock introduced in the previous
- commit.
-
- * gdk-pixbuf-loader.c: Fix the race condition here, too.
-
-2008-09-04 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.14.0 ===
-
-2008-09-03 Matthias Clasen <mclasen@redhat.com>
-
- Bug 549711 – Race condition when loading gdk-pixbuf image modules
-
- * gdk-pixbuf-io.c: Fix a race condition in module loading,
- spotted by Chris Lord.
-
-2008-08-27 Matthias Clasen <mclasen@redhat.com>
-
- Bug 549322 – Typo in gdk_pixbuf_save_to_buffer docs
-
- * gdk-pixbuf-io.c (gdk_pixbuf_save_to_buffer): Fix the docs.
- Spotted by Cosimo Cecchi.
-
-2008-08-18 Matthias Clasen <mclasen@redhat.com>
-
- * ==== Released 2.13.7 ===
-
-2008-08-13 Matthias Clasen <mclasen@redhat.com>
-
- Bug 532644 – TIFF loader need to exclude CR2 files
-
- * io-tiff.c: Add a pattern to exclude CR2 files.
- Noticed by Hubert Figuire
-
-2008-08-13 Michael Natterer <mitch@imendio.com>
-
- * gdk-pixbuf-marshal.list: reorder marshalers for no reason apart
- from forcing a rebuild of the header after yesterday's Makefile.am
- change.
-
-2008-08-08 Sven Herzberg <sven@imendio.com>
-
- Bug 546549 : Better Type Checking
- reviewed by: mitch
-
- * gdk-pixbuf-animation.c: check if a vfunc is implemented before
- trying to call into it
-
-2008-08-06 Sven Herzberg <sven@imendio.com>
-
- Bug 546549 : Better Type Checking
- reviewed by mitch
-
- * gdk-pixbuf.c (gdk_pixbuf_copy), (gdk_pixbuf_get_colorspace),
- (gdk_pixbuf_get_n_channels), (gdk_pixbuf_get_has_alpha),
- (gdk_pixbuf_get_bits_per_sample), (gdk_pixbuf_get_pixels),
- (gdk_pixbuf_get_width), (gdk_pixbuf_get_height),
- (gdk_pixbuf_get_rowstride): use GDK_IS_PIXBUF() and not pixbuf != NULL
- in g_return_*() statements
-
-2008-08-05 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.13.6 ===
-
-2008-08-04 Tor Lillqvist <tml@novell.com>
-
- * Makefile.am: Pass appropriate -machine flag to lib.exe.
-
-2008-07-23 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-io.c (_gdk_pixbuf_get_module): Compare two content
- types, not content type and mime type.
-
-2008-07-21 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.13.5 ===
-
-2008-07-18 Federico Mena Quintero <federico@novell.com>
-
- * queryloaders.c (query_module): Don't do funny casts to avoid
- compiler warnings.
-
-2008-07-15 Matthias Clasen <mclasen@redhat.com>
-
- Bug 543085 – gdk_pixbuf_saturate_and_pixelate may corrupt memory
-
- * gdk-pixbuf-utils.c (gdk_pixbuf_saturate_and_pixelate):
- Use gdk_pixbuf_copy_area() to copy between pixbufs.
- Reported by Andrey Tsyvarev
-
-2008-07-15 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-io.c: Move the check for wheter to use
- GIO for sniffing to configure.
-
-2008-07-14 Matthias Clasen <mclasen@redhat.com>
-
- Bug 401985 – Documentation improvement for the
- gdk_pixbuf_new_from_file_at_scale() function
-
- * gdk-pixbuf-io.c: Improve docs for gdk_pixbuf_new_from_file_at_scale().
- Proposed by Juan Manuel Palacios
-
-2008-07-11 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-io.c: Use GIO for sniffing image types, except
- on Win32, where GIO doesn't do any sniffing.
-
-2008-07-05 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.13.4 ===
-
-2008-06-18 Matthias Clasen <mclasen@redhat.com>
-
- * io-ico.c: Add image/x-win-bitmap to the supported mimetypes,
- since that is what shared-mime-info uses for .cur
-
-2008-06-13 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.13.3 ===
-
-2008-06-13 Hans Breuer <hans@breuer.org>
-
- * makefile.msc : updated to allow simple switch between gdiplus- and
- former fileformat backends
- * io-tiff.c : use g_snprintf
-
-2008-06-13 Matthias Clasen <mclasen@redhat.com>
-
- Bug 531960 – crash in eog-image.c:1154: (priv->image != NULL)
-
- * io-ico.c: Check headers more thorougly.
- Patch by Felix Riemann
-
-2008-06-03 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.13.2 ===
-
-2008-06-02 Behdad Esfahbod <behdad@gnome.org>
-
- * Makefile.am: Add gdk-pixbuf-features.h to BUILT_SOURCES.
-
-2008-05-29 Matthias Clasen <mclasen@redhat.com>
-
- * io-jasper.c:
- * io-ico.c:
- * io-icns.c: Use the correct INCLUDE_ macros.
-
-2008-05-29 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.13.1 ===
-
-2008-05-29 Matthias Clasen <mclasen@redhat.com>
-
- Bug 535453 - gdk_pixbuf_format_get_license returns NULL for
- any of the loaders
-
- * queryloaders.c (write_loader_info): Add the license info
- after the description.
-
- * gdk-pixbuf-io.c (gdk_pixbuf_io_init): Read the license info
- from the module file. Reported by Andrey Tsyvarev.
-
-2008-05-28 Michael Natterer <mitch@imendio.com>
-
- * gdk-pixbuf.h: define GDK_PIXBUF_H_INSIDE around including all
- other headers.
-
- * gdk-pixbuf-animation.h
- * gdk-pixbuf-core.h
- * gdk-pixbuf-enum-types.h.template
- * gdk-pixbuf-features.h.in
- * gdk-pixbuf-io.h
- * gdk-pixbuf-loader.h
- * gdk-pixbuf-simple-anim.h
- * gdk-pixbuf-transform.h: add single-include guards that #error
- out if GDK_PIXBUF_DISABLE_SINGLE_INCLUDES is defined and any of
- these files is included individually.
-
- * gdk-pixbuf-private.h: don't incude "gdk-pixbuf-io.h".
-
- * gdk-pixbuf-csource.c: #define __GTK_H_INSIDE__ around including
- "../gtk/gtkversion.h". Ugly but needed in this special case.
-
-2008-05-27 Tor Lillqvist <tml@novell.com>
-
- * io-*.c: Use explicit G_MODULE_EXPORT decoration when building
- the loader in question as a module.
-
- * gdk-pixbuf-io.c: Enable included build of the icns and jasper
- loaders.
-
-2008-05-27 Michael Natterer <mitch@imendio.com>
-
- * gdk-pixbuf.c: put back the #define, but call it
- GDK_PIXBUF_C_COMPILATION.
-
- * gdk-pixbuf-features.h.in: make variable export depend on that
- define instead of GDK_PIXBUF_COMPILATION.
-
-2008-05-27 Michael Natterer <mitch@imendio.com>
-
- Fix and simplify definition of GDK_PIXBUF_VAR:
-
- * Makefile.am: add -DGDK_PIXBUF_COMPILATION to INCLUDES.
-
- * gdk-pixbuf.c: don't #define it here. Remove GDK_PIXBUF_VAR from
- the definition of the version variables.
-
- * gdk-pixbuf-features.h.in: in the !G_PLATFORM_WIN32 case, always
- define GDK_PIXBUF_VAR to "extern". Remove redundant #ifndef
- GDK_PIXBUF_VAR around the whole block, the header itself already
- has include guards.
-
-2008-05-12 Tor Lillqvist <tml@novell.com>
-
- Bug 532558 - Cannot build dll when using separate builddir
-
- * Makefile.am: .def file belongs in $(srcdir). Patch by Marko
- Lindqvist.
-
-2008-05-02 Michael Natterer <mitch@imendio.com>
-
- * Makefile.am (stamp-gdk-pixbuf-marshal.h): deprecate the entire
- gdk-pixbuf-marshal.h since it's installed by accident only and
- shouldn't be used by anybody.
-
-2008-03-21 Tor Lillqvist <tml@novell.com>
-
- Import the GDI+ gdk-pixbuf loaders for Windows by Dominic
- Lachowicz and Alberto Ruiz into the GTK+ tree, from the
- gdip-pixbuf-loader module.
-
- * Makefile.am: Add the bits and pieces for the GDI+ loaders. When
- building GDI+ loaders don't build the traditional ones for the
- same formats. Always build the traditional PNG loader, though, as
- it isn't possible to read and write PNG tEXt chunks through GDI+,
- and GIMP at least needs that functionality in the gdk-pixbuf PNG
- loader.
-
- Either build all the GDI+ loaders (except the PNG one) into
- libgdk-pixbuf, or build them all as DLLs. I don't see any reason
- to enable cherry-picking among them whether to build in or not.
-
- * io-gdip-animation.c
- * io-gdip-animation.h
- * io-gdip-bmp.c
- * io-gdip-emf.c
- * io-gdip-gif.c
- * io-gdip-ico.c
- * io-gdip-jpeg.c
- * io-gdip-native.h
- * io-gdip-png.c
- * io-gdip-propertytags.h
- * io-gdip-tiff.c
- * io-gdip-utils.c
- * io-gdip-utils.h
- * io-gdip-wmf.c: New files. Note that io-gdip-png.c is not
- currently used.
-
- * gdk-pixbuf-io.c: Add the bits and pieces for built-in GDI+
- loaders.
-
- == ChangeLog from gdip-pixbuf-loaders follows: ==
-
-2008-03-19 Tor Lillqvist <tml@novell.com>
-
- * src/io-gdip-utils.c: Drop misleading old comment.
-
- * src/io-gdip-native.h: Fix typo: s/WINGDIAPI/WINGDIPAPI/.
-
-2008-03-17 Tor Lillqvist <tml@novell.com>
-
- * src/io-gdip-utils.h (MODULE_ENTRY): Use the more descriptive
- INCLUDE_gdiplus instead of INCLUDE_gdi. (Will be used when this is
- moved to GTK+ and the gdip loaders are built-in in libgdk-pixbuf.)
- Use G_MODULE_EXPORT so that only fill_info and fill_vtable get
- exported in the separate loader DLLs case.
-
- * src/io-gdip-emf.c
- * src/io-gdip-ico.c
- * src/io-gdip-wmf.c: Use unique type parameters to MODULE_ENTRY so
- that we won't get clashes when building all the gdip loaders in to
- libgdk-pixbuf.
-
-2008-03-17 Tor Lillqvist <tml@novell.com>
-
- * src/Makefile.am: Remove libpixbufloader-gdip.la, and add missing
- loaders to loader_LTLIBRARIES. Set loaderdir to use proper GTK+
- binary version using pkg-config. Add final newline.
-
-2008-03-15 Dominic Lachowicz <domlachowicz@gmail.com>
-
- * io-gdip.c: Remove
- * io-gdip-ico.c:
- * io-gdip-wmf.c:
- * io-gdip-emf.c: Separate these into their own loaders, so that existing
- code that calls "gdk_pixbuf_loader_for_type()" and friends continues
- to work as expected.
- * Makefile.test:
- * Makefile.am: Reflect the above changes
- * io-gdip-native.h:
- * io-gdip-utils.c: Better error reporting; handle metafiles properly
- (loading them as bitmaps doesn't work; you have to load them as a
- generic image or metafile and then draw them onto a bitmap)
-
-2008-03-06 Alberto Ruiz <aruiz@gnome.org>
-
- * configure.ac: Use the .exe version of the gdk query loaders if the build
- is for a windows target.
-
-2008-03-04 Dominic Lachowicz <domlachowicz@gmail.com>
-
- * src/io-gdip-utils.c: More informative error codes, taken from the COM HRESULT
-
-2008-03-03 Dominic Lachowicz <domlachowicz@gmail.com>
-
- * src/io-gdip-native.h:
- * src/io-gdip-jpeg.c: Support setting the JPEG's quality, just like GdkPixbuf's
- built-in JPEG encoder
- * src/io-gdip-png.c: Support setting the PNG's compression level, just like
- GdkPixbuf's built-in PNG encoder
-
-2008-02-25 Tor Lillqvist <tml@novell.com>
-
- * configure.ac: Move AC_DISABLE_STATIC before AC_PROG_LIBTOOL so
- that it works better.
-
-2008-02-24 Dom Lachowicz <domlachowicz@gmail.com>
-
- * src/io-gdip-animation.[ch]: Animation class and interator
- * src/io-gdip-utils.c: Use animation iter. GDI+ animations now work.
-
-2008-02-24 Dom Lachowicz <domlachowicz@gmail.com>
-
- * src/io-gdip-utils.c: Simple animation working; need to use a more sophisticated
- animation class
-
-2008-02-24 Dom Lachowicz <domlachowicz@gmail.com>
-
- * src/*.c: Change to GTK+-style indentation; stub out some stuff
- for animation support
-
-2008-02-22 Dom Lachowicz <domlachowicz@gmail.com>
-
- * src/Makefile.am: Build those other libraries using automake too;
- track dependencies properly
-
-2008-02-22 Dom Lachowicz <domlachowicz@gmail.com>
-
- * src/*.[ch]: Separate out formats that are writable into their
- own plugins. The GDI+ loader can now save as BMP, GIF, JPEG, PNG,
- or TIFF. Also, some tweaks so that the format plugins can be
- statically compiled into GTK+ if we choose to do so.
-
-2008-02-22 Dom Lachowicz <domlachowicz@gmail.com>
-
- * src/io-gdip-utils.c (GetEncoderClsid): Add support for BMP,
- JPEG, GIF, and TIFF
-
-2008-02-22 Dom Lachowicz <domlachowicz@gmail.com>
-
- * src/*.[ch]: Saving images to PNG now works. Conditionally compiled
- until I get GdkPixbuf's saving architecture straightened out.
-
-2008-02-21 Dom Lachowicz <domlachowicz@gmail.com>
-
- * src/io-gdip-utils.c (io_gdip_init): Make this idempotent
- * src/io-gdip.c: Function that fills the GdkPixbufIO vtable. To be used across
- various GDI+-based plugins
-
-2008-02-21 Dom Lachowicz <domlachowicz@gmail.com>
-
- * src/*.[ch]: If you #define GDIP_TEST_SAVING, you should be able
- to save a pixbuf to a PNG via GDI+. WARNING: UNTESTED CODE
-
-2008-02-21 Dom Lachowicz <domlachowicz@gmail.com>
-
- * src/*.[ch]: Infrastructure for saving GdkPixbufs to GdkPixbufSaveFunc callbacks.
- Should be trivial to write a PNG or JPEG saver now.
-
-2008-02-20 Tor Lillqvist <tml@novell.com>
-
- * src/io-gdip-utils.c: Drop the wrapper functions that each call
- GetProcAddress(). Instead just use a bunch of function pointers
- and initialise them at the same time in io_gdip_init().
-
-2008-02-19 Dom Lachowicz <domlachowicz@gmail.com>
-
- * src/*.[ch]: ARGB isn't pre-multiplied; first stab @ metadata
-
-2008-02-19 Tor Lillqvist <tml@novell.com>
-
- * src/io-gdip.c
- * src/io-gdip-utils.c
- * src/test.c: Use spaces instead of tabs. Use 2-column indentation
- offset which was the original intent. Remove trailing whitespace.
-
-2008-02-19 Tor Lillqvist <tml@novell.com>
-
- * configure.ac: Use AC_DISABLE_STATIC. It makes no sense to build
- a static library of this.
-
- * autogen.sh: Take ACLOCAL_FLAGS into consideration.
-
-2008-02-18 Dominic Lachowicz <domlachowicz@gmail.com>
-
- * src/*.[ch]: Fix image size (don't need to add + 1); framework
- for supporting animations or multi- paged TIFFs
-
-2008-02-18 Dominic Lachowicz <domlachowicz@gmail.com>
-
- * src/*.[ch]: If the source image doesn't have alpha, don't create
- an opaque alpha channel in the pixbuf
-
-2008-02-18 Dominic Lachowicz <domlachowicz@gmail.com>
-
- * src/*.c: Whitespace fixes
-
-2008-02-18 Dominic Lachowicz <domlachowicz@gmail.com>
-
- * src/io-gdip.c: Support pixbuf scaling
-
-2008-02-18 Dominic Lachowicz <domlachowicz@gmail.com>
-
- * src/io-gdip.c: Fill pixbuf properly; propegate errors. Plugin
- now works for non-animations
-
-2008-02-18 Dominic Lachowicz <domlachowicz@gmail.com>
-
- * src/io-gdip.c: Move initialization to fill_vtable
- * src/io-gdip-utils.c: GDI+ functions return Status, not HRESULT,
- so we can't use SUCCEEDED() to test if they worked or not
-
-2008-02-18 Dominic Lachowicz <domlachowicz@gmail.com>
-
- * src/io-gdip.c (gdk_pixbuf__gdip_image_stop_load): Un-premultiply alpha
-
-2008-02-18 Dominic Lachowicz <domlachowicz@gmail.com>
-
- * src/io-gdip.c (gdk_pixbuf__gdip_image_stop_load): Destroy the
- context
- * src/io-gdip.c (fill_info): Add support for PNG, GIF, WMF, EMF, TIFF
-
-2008-02-18 Dominic Lachowicz <domlachowicz@gmail.com>
-
- * src/io-gdip-utils.c (io_gdip_buffer_to_bitmap): Release the IStream
- * src/io-gdip.c: Move the init() call to fill_vtable, so that it's
- only called once
-
-2008-02-18 Dominic Lachowicz <domlachowicz@gmail.com>
-
- * src/io-gdip-utils.c: Make GDI+ function pointers static so that
- we only load them once
-
-2008-02-18 Dominic Lachowicz <domlachowicz@gmail.com>
-
- * src/test.c: Dispose of the bitmap
- * src/io-gdip-utils.[ch]: Add bitmap dispose function
-
-2008-02-18 Dominic Lachowicz <domlachowicz@gmail.com>
-
- * src/io-gdip-native.h: The GpImage and GpBitmap structs should be anonymous
-
- == End of ChangeLog from gdip-pixbuf-loaders ==
-
-2008-03-11 Claudio Saavedra <csaavedra@alumnos.utalca.cl>
-
- * io-bmp.c: (gdk_pixbuf__bmp_image_stop_load): Set a
- GDK_ERROR_CORRUPT_IMAGE error if the loader is closed while
- still reading the headers. (#505085)
-
-2008-03-11 Claudio Saavedra <csaavedra@alumnos.utalca.cl>
-
- * io-bmp.c: (DecodeHeader): Check for the BMP header magic numbers
- before decoding it. (#505085)
-
-2008-02-16 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.13.0 ===
-
-2008-02-15 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-animation.h:
- * gdk-pixbuf.symbols: Fix up export of gdk_pixbuf_non_anim_get_type.
-
-2008-02-12 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-io.c (at_scale_size_prepared_cb): Don't let
- the width or height go below 1. (#516024, Christian Persch)
-
-2008-02-10 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-scaled-anim.c: Try harder to return pixbufs
- of the requested size. (#494515, Mike Morrison)
-
-2008-01-15 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-io.c (save_to_stream): Handle partial writes.
-
-2008-01-16 Michael Natterer <mitch@imendio.com>
-
- * gdk-pixbuf-io.c (save_to_stream): fix signature of this function
- and propagate errors from g_output_stream_write(). Return error
- also on incomplete writes (which don't generate an error by
- themselves).
-
- Unrelated:
-
- (gdk_pixbuf_io_init): initialize "builtin_module" on a separate
- line to avoid compiler warning in the common case of no built-in
- modules.
-
-2008-01-16 Michael Natterer <mitch@imendio.com>
-
- * Makefile.am (LDADDS): use $GDK_PIXBUF_DEP_LIBS instead of
- $GLIB_LIBS so gio gets pulled in.
-
-2008-01-15 Matthias Clasen <mclasne@redhat.com>
-
- * gdk-pixbuf.symbols:
- * gdk-pixbuf-core.h:
- * gdk-pixbuf-io.c (gdk_pixbuf_new_from_stream):
- (gdk_pixbuf_new_from_stream_at_scale):
- (gdk_pixbuf_save_to_stream): New stream i/o functions.
-
-2008-01-14 Michael Natterer <mitch@imendio.com>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_prepare): cast the return
- value of _gdk_pixbuf_scaled_anim_new() to fix incompatible pointer
- warning.
-
-2007-12-09 Matthias Clasen <mclasen@redhat.com>
-
- * io-jpeg.c: Fix the spinguard logic for big buffers.
- (#494667, Ed Catmur)
-
-2007-11-25 Tor Lillqvist <tml@novell.com>
-
- * Makefile.am: Fix static build of the icns loader.
-
-2007-11-25 Bastien Nocera <hadess@hadess.net>
-
- * Makefile.am:
- * io-jasper.c: Add the libjasper JPEG2000 loader
- (Closes: #469901)
-
-2007-11-20 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-animation.c: Use G_DEFINE_TYPE (#469341,
- Björn Lindqvist)
-
-2007-11-20 Bastien Nocera <hadess@hadess.net>
-
- * io-icns.c: (load_resources): Add support for 512x512 Leopard
- icons, using the ic09 iconType
-
-2007-11-20 Bastien Nocera <hadess@hadess.net>
-
- * Makefile.am:
- * io-icns.c: Add icns (MacOS X icons) loader, based on work by
- Lyonel Vincent <lyonel@ezix.org> (Closes: #395738)
-
-2007-11-10 Matthias Clasen <mclasen@redhat.com>
-
- * io-jpeg.c: Avoid unaligned accesses that cause
- problems on some architectures. (patch by David Miller)
-
-2007-10-16 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.12.1 ===
-
-2007-10-16 Matthias Clasen <mclasen@redhat.com>
-
- * io-wbmp.c: Use better magic. (#339877, Bastien Nocera)
-
-2007-09-13 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.12.0 ===
-
-2007-09-13 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-scaled-anim.c (get_scaled_pixbuf): Don't leak
- options.
-
-2007-09-08 Matthias Clasen <mclasen@redhat.com>
-
- * io-ani.c: Fix some possible crashes. (#468832, Michal Luczaj)
-
-2007-09-07 Matthias Clasen <mclasen@redhat.com>
-
- * io-tga.c (gdk_pixbuf__tga_stop_load): Handle pbuf
- being NULL. (#468801, Sebastien Bacher)
-
-2007-07-21 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.11.6 ===
-
-Sat Jul 7 17:34:33 2007 Tim Janik <timj@gtk.org>
-
- * gdk-pixbuf-scale.c: docu fixes from Guillaume Cottenceau, #454596.
-
-2007-07-06 Michael J. Chudobiak <mjc@cvs.gnome.org>
-
- * io-tiff.c: (tiff_image_parse): Added a comment to explain
- the signal used to stop parsing early.
-
-2007-07-05 Matthias Clasen <mclasen@redhat.com>
-
- * io-tiff.c: Revert the last change, it was wrong
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_close): Redo the last
- change in a different way.
-
-2007-07-04 Tor Lillqvist <tml@novell.com>
-
- * pixops/Makefile.am (timescale_LDADD): Use GDK_PIXBUF_DEP_LIBS
- instead of GDK_PIXBUF_EXTRA_LIBS here, too.
-
-2007-07-03 Matthias Clasen <mclasen@redhat.com>
-
- * io-tiff.c (tiff_image_parse): Always set an error
- when returning NULL. (453365, Michael Chudobiak)
-
-2007-07-03 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_close): Be
- more careful when calling g_propagate_error(). (#453365,
- Michael Chudobiak)
-
-2007-07-02 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.11.5 ===
-
-2007-07-02 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf.c (gdk_pixbuf_get_option): Document the
- "orientation" option.
-
- * gdk-pixbuf.symbols:
- * gdk-pixbuf-core.h:
- * gdk-pixbuf-util.c (gdk_pixbuf_apply_embedded_orientation):
- New function to handle Exif orientation information in
- tiff and jpeg images. (#439567, Michael Chudobiak)
-
-2007-06-19 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.11.4 ===
-
-2007-06-15 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.11.3 ===
-
-2007-06-15 Hans Breuer <hans@breuer.org>
-
- * makefile.msc : updated
- * io-jpeg.c : use g_snprintf
-
-2007-06-12 Behdad Esfahbod <behdad@gnome.org>
-
- * io-pnm.c (explode_bitmap_into_buf): Fix out-of-bound access.
- (#440918, Matthias Kilian)
-
-2007-06-06 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.11.2 ===
-
-2007-06-04 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.11.1 ===
-
-2007-05-30 Chris Wilson <chris@chris-wilson.co.uk>
-
- * io-jpeg.c (gdk_pixbuf__jpeg_image_stop_load):
- Supply the current GError for fatal_error_handler(). (#441443)
-
-2007-05-24 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.11.0 ===
-
-2007-05-23 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf.symbols: Add missing scaled-anim entries.
-
-2007-05-18 Michael J. Chudobiak <mjc@cvs.gnome.org>
-
- * gdk-pixbuf-scaled-anim.c: (get_scaled_pixbuf):
- Preserve pixbuf options when generating a new scaled pixbuf.
-
- * io-jpeg.c: (get_orientation), (gdk_pixbuf__jpeg_image_load),
- (gdk_pixbuf__jpeg_image_load_increment): Read the exif
- orientation tag and associate it with the "orientation" pixbuf
- option. Renders libexif unnecessary in some applications.
-
- * io-tiff.c: (tiff_image_parse): Read the tiff orientation tag,
- compensate for the partial rotations performed by libtiff,
- and generate an "orientation" option for the pixbuf.
-
-2007-04-29 Matthias Clasen <mclasen@redhat.com>
-
- * io-jpeg.c: Remove a pointless check from the previous
- commit that added a new string.
-
-2007-04-28 Matthias Clasen <mclasen@redhat.com>
-
- * io-png.c:
- * io-jpeg.c: Accept unknown parameters with a warning
- when saving. (#405539, Daniel Atallah)
-
-2007-04-25 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-simple-anim.c (gdk_pixbuf_simple_anim_add_frame):
- Don't double the delay time of the first frame. (#431997,
- Bj?rn Lindqvist)
-
-2007-04-25 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-scaled-anim.c (gdk_pixbuf_scaled_anim_iter_finalize):
- Chain up. (#433125, Christian Persch)
-
-Wed Mar 28 15:27:35 2007 Tim Janik <timj@imendio.com>
-
- * io-jpeg.c: applied JPEG loader fix from maemo. this fix makes sure
- stop_load() doesn't forget about its return value, and it pulls the
- check for infinite looping out of an else branch in load_increment()
- so it runs unconditionally, fixes #397643.
-
-2007-03-08 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-scaled-anim.[hc]: Implement an animation
- wrapper for scaling animations.
-
- * gdk-pixbuf-loader.c: Use GdkPixbufScaledAnim to scale
- animations. (#335752, Mike Morrison)
-
- * Makefile.am: Glue.
-
-2007-03-06 Tor Lillqvist <tml@novell.com>
-
- * Makefile.am: Further fixes for building on Win32 outside
- srcdir. (#413492, Mathias Hasselmann)
-
-2007-03-05 Matthias Clasen <mclasen@redhat.com>
-
- * io-tga.c: (gdk_pixbuf__tga_stop_load): Flip rle-encoded
- images even if they haven't been completely loaded. (#347106)
-
-2007-02-27 Felix Riemann <friemann@svn.gnome.org>
-
- * io-ico.c: (fill_info): Add image/x-ico to supported mime types.
- Fixes bug #393599.
-
-2007-02-16 Matthias Clasen <mclasen@redhat.com>
-
- * io-png.c: Don't leak in the error path. (#405539, Daniel Atallah)
-
-2007-02-07 Chris Wilson <chris@chris-wilson.co.uk>
-
- * io-jpeg.c: (gdk_pixbuf__jpeg_image_load),
- (gdk_pixbuf__jpeg_image_load_increment): Set the GError
- if the image is zero length. (#405327)
-
-2007-02-06 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_close): Protect
- against stop_load begin broken. (#403255, Lucas Mazzardo Veloso)
-
-2007-01-21 Matthias Clasen <mclasen@redhat.com>
-
- * io-gif.c (gdk_pixbuf__gif_image_stop_load): Return an
- error if we didn't successfully load a frame. (#394190,
- Felix Riemann)
-
-2007-01-17 Michael Natterer <mitch@imendio.com>
-
- Patch taken from maemo-gtk:
-
- * io-png.c (png_text_to_pixbuf_option): don't call g_convert() on
- ASCII strings.
-
- (png_info_callback): set an error when the size_func would scale
- the pixbuf away completely.
-
-2007-01-16 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_write): Just
- call gdk_pixbuf_loader_close to close the loader in
- the error case. Fixes memory leaks in the error case,
- pointed out by David Necas.
-
-2007-01-04 Matthias Clasen <mclasen@redhat.com>
-
- * io-bmp.c (OneLine32): Fix a warning
-
-2006-12-22 Matthias Clasen <mclasen@redhat.com>
-
- * io-bmp.c (decode_bitmasks): Handle bmps
- with more than 8 bits per channel. (#172584,
- David Costanzo)
-
- * io-bmp.c: Handle offsets more carefully. (#172188,
- David Costanzo)
-
- * io-bmp.c: Handle v5 and OS/2 v2 bmps.
-
- * io-bmp.c: Handle alpha masks in v4 and v5 bmps.
-
-2006-12-21 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_write): Emit
- the closed signal when closing the loader, pointed out
- by David Necas.
-
-2006-12-21 Matthias Clasen <mclasen@redhat.com>
-
- * io-gif.c (gif_get_lzw): Handle invalid gif animations
- a little bit more robustly. (#357974, Vassilis Pandis,
- patch by Felix Riemann)
-
- * gdk-pixbuf-data.c (gdk_pixbuf_new_from_data):
- * gdk-pixbuf.c (gdk_pixbuf_new): Remove redundant size
- checks, and document that width, height must be > 0.
- (#343330, Felix Riemann)
-
- * Makefile.am: Link against GLib. (#341158, Alexey Rusakov)
-
-2006-12-19 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_close): Don't
- spew a warning if the printer is already closed.
-
-2006-12-09 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_write): Behave as
- documented and close the loader when returning FALSE.
-
-2006-10-29 Tor Lillqvist <tml@novell.com>
-
- * pixbufloader_*.def
- * Makefile.am (EXTRA_DIST): Remove pixbufloader_*.def, they are
- not used. (#365388) They were all identical, and exported just two
- symbols, so if somebody needs them for a MSVC build that doesn't
- use built-in modules it's trivial to hack makefile.msc to produce
- a common .def file for the loaders. The two symbols that need to
- be exported are fill_info and fill_vtable.
-
-2006-10-11 Tor Lillqvist <tml@novell.com>
-
- Enable having some loaders built-in even if loading the others
- dynamically. Have loaders in the same order as in configure.in in
- all places where they are handled/listed.
-
- * Makefile.am: Define the STATIC_FOO_LIB and FOO_LIB macros
- conditionally depending on whether said loader is built-in or
- not. Use the names libstatic-pixbufloader-foo.la instead of
- libpixbufloader-static-foo.la for the built-in ones so that the
- "echo libpixbufloader-*.la" won't match them.
-
- * gdk-pixbuf-io.c: Reorganize code as to plumb the built-in
- loaders also if USE_GMODULE. Don't warn about a missing
- gdk-pixbuf.loaders file if we have at least one included loader.
-
- * gdk-pixbuf-private.h
- * io-*.c: Don't define a generic MODULE_ENTRY, as we can't use it
- in the loaders anyway. Each loader needs to check if INCLUDE_foo
- is defined.
-
-2006-10-08 Matthias Clasen <mclasen@redhat.com>
-
- * Apply a cleanup patch by Kjartan Maraas (#341812)
-
-2006-09-06 Matthias Clasen <mclasen@redhat.com>
-
- * io-pnm.c: Simplify and fix reading of ASCII images.
-
-2006-08-17 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.10.2 ===
-
-2006-08-16 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file_at_scale):
- Stop loading an animation if the first frame is complete.
- (#350911, Christian Neumair)
-
-2006-07-23 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.10.1 ===
-
-2006-07-16 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_load_module)
- (gdk_pixbuf_loader_write, gdk_pixbuf_loader_close)
- (gdk_pixbuf_loader_ensure_error): Put the code to protect
- against broken loaders that forget to set error in an
- auxiliary function and call it in more places. (#346428,
- Catmur)
-
- * io-xbm.c: Fix incremental loading of
- xbms. (#346427, Ed Catmur)
- Also make the xbm loader accept const variations.
-
-2006-07-02 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.10.0 ===
-
-2006-06-21 Matthias Clasen <mclasen@redhat.com>
-
- * pixops/*.S: NetBSD portability fixes. (#346374,
- Thomas Klausner)
-
- * === Released 2.9.4 ===
-
-2006-06-12 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.9.3 ===
-
-2006-06-05 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.9.2 ===
-
-2006-05-16 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.9.1 ====
-
-2006-05-04 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.9.0 ===
-
-2006-04-04 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-loader.c:
- * gdk-pixbuf.c: Use G_DEFINE_TYPE.
-
- * gdk-pixbuf.c: No point in making the error path fast by
- caching quarks.
-
-2006-03-24 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_write): Remove a
- pointless check, pointed out by Kjartan Maraas.
-
-2006-03-22 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-loader.c: Add some documentation about
- supported image formats, and how to find out about them.
- (#335536, Murray Cumming)
-
-2006-03-20 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-animation.c:
- * gdk-pixbuf-io.c:
- * io-xpm.c:
- * io-xbm.c:
- * io-gif.c: Always save errno to a temporary before making
- other calls. (#335179, Morten Welinder)
-
-2006-03-14 Matthias Clasen <mclasen@redhat.com>
-
- * io-gif.c (gdk_pixbuf__gif_image_load): Add a shortcut
- to stop the gif mainloop after the first frame, if that
- is all we are interested in. (#334538)
-
-2006-03-03 Matthias Clasen <mclasen@redhat.com>
-
- * io-pnm.c: Support pnm files with maxval > 255.
- (#327560, Matthijs Douze)
-
-2006-03-03 Matthias Clasen <mclasen@redhat.com>
-
- * io-pcx.c (pcx_load_palette_8): Fix incremental loading
- of 8-bit pcx files. (#148518, Magnus Bergmann)
-
-2006-02-28 Anders Carlsson <andersca@imendio.com>
-
- * gdk-pixbuf-io.c:
- Update documentation now that tiff supports saving.
-
- * io-tiff.c:
- (tiff_load_read):
- (tiff_load_write):
- (tiff_load_seek):
- (tiff_load_close):
- (tiff_load_size):
- (tiff_load_map_file):
- (tiff_load_unmap_file):
- (gdk_pixbuf__tiff_image_stop_load):
- Rename callback functions that are used during loading.
-
- (tiff_save_read):
- (tiff_save_write):
- (tiff_save_seek):
- (tiff_save_close):
- (tiff_save_size):
- (create_save_context):
- (free_save_context):
- New callback functions which operate on a memory buffer.
-
- (gdk_pixbuf__tiff_image_save_to_callback):
- Implement saving of pixbufs to tiffs.
-
- (save_to_file_cb):
- (gdk_pixbuf__tiff_image_save):
- New function that saves a pixbuf to a FILE handle. Uses
- save_to_callback.
-
- (fill_vtable):
- Add new functions.
-
- (fill_info):
- Change flags since this module supports writing now.
-
-2006-02-10 Matthias Clasen <mclasen@redhat.com>
-
- * io-jpeg.c:
- * io-png.c:
- * io-pnm.c:
- * io-tiff.c:
- * io-xbm.c:
- * io-xpm.c: Always check for NULL when using callbacks.
- (#330563, Benjamin Otte)
-
-2006-01-18 Matthias Clasen <mclasen@redhat.com>
-
- * io-gif.c (gdk_pixbuf__gif_image_load_increment): Don't cast
- the results of g_new(). (#327423, Morten Welinder)
-
-2006-01-12 Federico Mena Quintero <federico@ximian.com>
-
- * gdk-pixbuf-util.c (gdk_pixbuf_saturate_and_pixelate): Clarify
- the docs ("darkened/brightened" is not "saturation").
-
-Fri Dec 30 00:59:21 2005 Jonathan Blandford <jrb@redhat.com>
-
- * gdk-pixbuf-io.c (gdk_pixbuf_format_get_license): minor doc edit.
-
-2005-12-16 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-io.c (_gdk_pixbuf_load_module_unlocked): Use
- G_MODULE_BIND_LOCAL when opening modules.
-
-2005-12-14 Michael Natterer <mitch@imendio.com>
-
- * io-jpeg.c (gdk_pixbuf__jpeg_image_load_lines): new utility
- function which factors out massive code duplication from the
- commit below.
-
-2005-12-14 Michael Natterer <mitch@imendio.com>
-
- * io-jpeg.c: applied patch from maemo-gtk which avoids the
- allocation of an intermediate buffer for non-progressive
- jpegs. Fixed bug #305894.
-
-2005-11-15 Matthias Clasen <mclasen@redhat.com>
-
- * io-xpm.c: Fix several integer overflows which have been
- reported as CVE-2005-3186 and CVE-2005-2975.
-
-2005-10-12 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_write): Only call
- gdk_pixbuf_loader_eat_header_write() when count > 0. (#318589,
- Bogdan Nicula)
-
-2005-10-03 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file):
- * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file):
- * gdk-pixbuf-loader.c: Use a 1k buffer for sniffing image formats,
- instead of 128 or 256 bytes. (#317225, Sebastien Bacher,
- Dom Lachowicz)
-
-2005-09-05 Matthias Clasen <mclasen@redhat.com>
-
- * io-tga.c (parse_rle_data): Remove unused variable
- pbuf_count. (#315282, Kjartan Maraas)
-
-2005-08-31 Matthias Clasen <mclasen@redhat.com>
-
- * Makefile.am (gdk-pixbuf-enum-types.c): Intern type
- names in code generated by glib-mkenums, too.
-
- * io-ani-animation.c (gdk_pixbuf_ani_anim_iter_get_type)
- (gdk_pixbuf_ani_anim_get_type):
- * io-gif-animation.c (gdk_pixbuf_gif_anim_get_type)
- (gdk_pixbuf_gif_anim_iter_get_type):
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_get_type):
- * gdk-pixbuf.c (gdk_pixbuf_get_type):
- * gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_type):
- Intern type names before registering the type to avoid
- unnecessary copies.
-
-2005-08-30 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-io.c (format_check): Make this work again.
-
- * io-png.c (png_save_to_callback_write_func): Add a cast
- to avoid compiler warnings.
-
- * pixops/timescale.c (main): Declare src_buf, dest_buf as
- unsigned to avoid compiler warnings.
-
- * gdk-pixbuf-io.h: Declare the prefix and mask members of
- GdkPixbufModulePattern as char*, to avoid compiler warnings.
-
- * io-ani.c (ani_load_chunk): Use g_try_new() in some places.
-
-2005-08-24 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.8.2 ===
-
- * === Released 2.8.1 ===
-
-2005-08-18 Matthias Clasen <mclasen@redhat.com>
-
- * io-ico.c (DecodeHeader): Check for overflow in one more
- place. (#313818, Tommi Komulainen)
-
-2005-08-15 Matthias Clasen <mclasen@redhat.com>
-
- * io-jpeg.c (fatal_error_handler): Pay attention to the
- libjpeg error code and report OOM errors as such. (#312674,
- Tommi Komulainen)
-
-2005-08-13 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.8.0 ===
-
-2005-08-07 Matthias Clasen <mclasen@redhat.com>
-
- * abicheck.sh: Also check exported variables.
-
-2005-08-02 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.7.5 ===
-
-2005-07-22 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.7.4 ===
-
-2005-07-22 Matthias Clasen <mclasen@redhat.com>
-
- * queryloaders.c: Accept '*' in masks. (pointed out
- by William Jon McCann)
-
- * gdk-pixbuf-io.c (format_check): Make anchored patterns work
- as they did before. (#311011, William Jon McCann)
-
-2005-07-22 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-io.c (format_check): Interpret patterns where
- the first byte of the mask is '*' as unanchored. (#311011)
- (gdk_pixbuf_new_from_file): Use the first 256 bytes for
- sniffing the file format.
-
-2005-07-15 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.7.3 ===
-
-2005-07-12 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-i18n.h:
- * pixops/*: Add copyright and license information.
-
-2005-07-09 Tor Lillqvist <tml@novell.com>
-
- * Makefile.am: Don't use the scripts in build/win32 to compile the
- rc file into a resource object file. (This means we lose the
- build number increment magic, but I doubt it was that useful
- anyway.) Instead use windres directly. To pass the normal .o file
- produced by windres through libtool, which would want a .lo file,
- pass it directly to the linker using a -Wl option.
-
- * gdk_pixbuf.rc.in: Replace BUILDNUMBER with 0.
-
-2005-07-08 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.7.2 ===
-
-2005-07-01 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.7.1 ===
-
-2005-07-01 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file_at_scale): Allow
- -1 for width/height and interpret them as "not constrained".
- (#309258, Mark McLoughlin)
-
-2005-06-26 Tor Lillqvist <tml@novell.com>
-
- * Makefile.am: Current GNU tools do understand the PRIVATE
- keyword, so no need to remove those entries from the import
- library. libtool installs the .dll.a import library itself, so no
- need to do it here. Do install the .def file.
-
-2005-06-22 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-i18n.h: Use glib-i18n.h
-
-2005-06-20 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.7.0 ===
-
-2005-06-15 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf.symbols:
- * gdk-pixbuf-simple-anim.h: Add
- gdk_pixbuf_simple_anim_iter_get_type()
-
-2005-06-08 Matthias Clasen <mclasen@redhat.com>
-
- * io-pnm.c (pnm_read_next_value): Check for overflow.
- (#306394, Morten Welinder)
-
-2005-05-27 Matthias Clasen <mclasen@redhat.com>
-
- * io-bmp.c: Accept the 108 byte header of BMP v4. (#168799)
-
-2005-05-25 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf.symbols:
- * gdk-pixbuf-simple-anim.[hc]: No need to expose the iter
- subclass at all in the headers.
-
- * Makefile.am: Add new files.
-
- * gdk-pixbuf.symbols: Add new api.
-
- * gdk-pixbuf.h: Include gdk-pixbuf-simple-anim.h here.
-
- * gdk-pixbuf-simple-anim.[hc]: Add a way to construct
- simple animations out of pixbufs. (#135161, Dom Lachowicz)
-
-2005-05-24 Sven Neumann <sven@gimp.org>
-
- * io-png.c: allow to specify the PNG compression level by passing
- a "compression" parameter to the PNG save function (bug #305337).
-
- * gdk-pixbuf-io.c (gdk_pixbuf_save): document the new parameter.
-
-2005-04-09 Matthias Clasen <mclasen@redhat.com>
-
- * Makefile.am: Use $(NM), not nm directly. (#301299,
- Nguyen Thai Ngoc Duy)
-
- * io-bmp.c (gdk_pixbuf__bmp_image_save_to_callback):
- Don't overflow the stack. (Jakub Jelinek, Arjan van de Ven)
-
-2005-04-08 Matthias Clasen <mclasen@redhat.com>
-
- * io-pcx.c: No debugging output, please. (#173107,
- John Ellis)
-
-2005-04-07 Matthias Clasen <mclasen@redhat.com>
-
- * io-bmp.c (DecodeColormap): Initialize the colormap to
- zero. (#171762, David Costanzo)
-
-2005-03-30 Matthias Clasen <mclasen@redhat.com>
-
- * io-bmp.c: Avoid bus errors due to unaligned access. (#168173,
- Morten Welinder, Ivan Wong)
-
-2005-03-29 Matthias Clasen <mclasen@redhat.com>
-
- * io-tga.c (parse_rle_data): Fix the update areas for incremental
- loading of compressed tgas. (#171883, David Costanzo)
-
-2005-03-27 Matthias Clasen <mclasen@redhat.com>
-
- * io-bmp.c (DoCompressed): Use the correct update regions for
- compressed bmps. (#150664, Owen Taylor, test images provided
- by David Costanzo)
-
-Sun Mar 27 19:59:52 2005 Manish Singh <yosh@gimp.org>
-
- * io-bmp.c (grow_buffer): reject 0-sized buffers as corrupt header
- data. Fixes bug #171707.
-
-2005-03-25 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Use canonical
- property names.
-
-2005-03-21 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf.c (gdk_pixbuf_class_init): Mark param spec strings
- as static.
-
-2005-03-14 Matthias Clasen <mclasen@redhat.com>
-
- Make PLT-reduction work with gcc4, and don't include
- everything in gdk-pixbuf-alias.h:
-
- * gdk-pixbuf.symbols: Group symbols by header and source file.
- * /makegdkpixbufalias.pl: Protect definitions by the same
- preprocessor symbols used to guard the headers. Move
- the alias declarations to a separate file which is
- produced when calling makegdkpixbufalias.pl -def
- * Makefile.am (gdk-pixbuf-aliasdef.c): Add a rule to generate
- this file.
- * *.c: Include gdk-pixbuf-alias.h after the other headers,
- include gdk-pixbuf-aliasdef.c at the bottom.
-
-2005-03-10 Tor Lillqvist <tml@novell.com>
-
- * gdk-pixbuf-core.h
- * gdk-pixbuf-io.c
- * gdk-pixbuf.symbols: Implement DLL ABI stablility for
- gdk_pixbuf_save() and gdk_pixbuf_savev(). (#167973)
-
-2005-03-09 Matthias Clasen <mclasen@redhat.com>
-
- * io-gif-animation.c (gdk_pixbuf_gif_anim_frame_composite): Fix
- a C99ism. (#169741, Morten Welinder)
-
-2005-03-08 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf.c (gdk_pixbuf_class_init): Use canonical
- form of the name when registering properties.
-
- * gdk-pixbuf.symbols: Add the new attributes here, too.
-
- * gdk-pixbuf-core.h: Use G_GNUC_NULL_TERMINATED where
- appropriate. (#165682, Marc Meissner)
-
-2005-03-07 Matthias Clasen <mclasen@redhat.com>
-
- * io-xpm.c: Use a generated table of offsets
- into a big const string to avoid relocations
- in the rgb color table. (#168901, Tommi Komulainen)
-
- * gen-color-table.pl: Script to generate the table,
- copied from Owen Taylors script by the same name
- in Pango.
-
- * xpm-color-table.h: The generated table.
-
-2005-03-03 Matthias Clasen <mclasen@redhat.com>
-
- * io-xpm.c (pixbuf_create_from_xpm): Check the number
- of scanned items. (#168906, Morten Welinder)
-
- Make the gif loader handle oom when loading
- animations. (#168857, Tommi Komulainen)
-
- * io-gif-animation.c (gdk_pixbuf_gif_anim_frame_composite):
- Handle oom by returning NULL.
-
- * io-gif.c (gif_get_lzw): Return an error if composite
- returns NULL.
-
-2005-02-28 Matthias Clasen <mclasen@redhat.com>
-
- * pixops/*.S: Add .note.GNU-stack sections to Mark these as not
- requiring an executable stack.
-
-2005-02-23 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-io.c: Document BMP saving support.
-
- * io-bmp.c: Support saving as BMP. (168173, Ivan Wong)
-
- * io-ico.c: Fix a typo. (#168173, Ivan Wong)
-
-2005-02-15 Matthias Clasen <mclasen@redhat.com>
-
- * io-pnm.c (pnm_skip_whitespace): Don't read over the end of
- the buffer if '#' appears at the very end. (#167141, Doug Morgan)
-
-2005-02-05 Hans Breuer <hans@breuer.org>
-
- * makefile.msc : rule for gdk_pixbuf.def
-
-2005-02-07 Matthias Clasen <mclasen@redhat.com>
-
- * io-pnm.c (pnm_read_next_value): Pass in the max number
- of bytes to read.
- (pnm_read_ascii_scanline): And use it here to enable
- parsing of pbm images without whitespace between the
- pixels. (#165803, Samuel Hym)
-
-2005-01-22 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_new_with_type)
- (gdk_pixbuf_loader_new_with_mime_type): Close the loader
- before unreffing it in the error case. (#164915, Crispin
- Flowerday)
-
-2005-01-12 Owen Taylor <otaylor@redhat.com>
-
- * Makefile.am: Use grep | head -n 1 instead of grep -m 1
- which doesn't work
- with slightly older versions of GNU grep in
- install-libtool-import-lib rule.
-
-2005-01-08 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.6.1 ===
-
-2005-01-04 Matthias Clasen <mclasen@redhat.com>
-
- * io-bmp.c (DecodeHeader): Error on compressed images with
- negative height. Also make uncompressed images with data_offset
- != header_size work. (#150664, Owen Taylor)
-
-2005-01-02 Matthias Clasen <mclasen@redhat.com>
-
- * pixops/pixops.c (bilinear_box_make_weights): Really fix the
- math to make the vectors sum up to 1, making GDK_INTERP_HYPER
- work again. (#162703, Dennis Nezic)
-
-2004-12-27 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file)
- Avoid deadlock. Pointed out by Callum McKenzie.
-
-Wed Dec 22 01:17:44 2004 Jonathan Blandford <jrb@redhat.com>
-
- * queryloaders.c (main): print out the version and binary name in
- the header comment. Problem reported by Seth Nickell.
-
-2004-12-16 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.6.0 ===
-
-Fri Dec 10 13:57:44 2004 Manish Singh <yosh@gimp.org>
-
- * abicheck.sh: filter out PRIVATE.
-
-2004-12-05 Tor Lillqvist <tml@iki.fi>
-
- * gdk-pixbuf-animation.c
- * gdk-pixbuf-io.c
- * io-xbm.c
- * io-xpm.c
- * make-inline-pixbuf.c
- * queryloaders.c: Use gstdio wrappers. Document that file names
- are in the GLib file name encoding.
-
- * gdk-pixbuf-csource.c
- * queryloaders.c: On Windows, convert command line arguments and
- environment variable values from locale encoding to UTF-8.
-
- * queryloaders.c: On Windows, use wide character API when
- available.
-
- * Makefile.am
- * gdk-pixbuf-core.h
- * gdk-pixbuf-io.c
- * gdk-pixbuf-animation.h
- * gdk-pixbuf-animation.c: Like in GLib, for DLL ABI stability on
- Windows, add binary compatibility versions of functions that take
- file names as arguments. They use the system codepage, not GLib
- file name encoding (which is UTF-8 on Windows). Use #defines to
- make newly compiled code use the "real" functions that use the
- GLib file name encoding scheme.
-
-2004-12-02 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.5.6 ===
-
-2004-11-30 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-animation.c (gdk_pixbuf_animation_iter_get_pixbuf):
- Fix a typo in the docs. (#159955, Masao Mutoh)
-
-2004-11-29 Matthias Clasen <mclasen@redhat.com>
-
- * Makefile.am (gdk-pixbuf-alias.h): Use the perl found by
- configure. (#149826, Morten Welinder)
-
-Sun Nov 28 12:11:21 2004 Manish Singh <yosh@gimp.org>
-
- * makegdkpixbufalias.pl: Typo fix, so attributes are really
- propagated.
-
-2004-11-28 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf.symbols:
- * Makefile.am: Mark get_type() functions generated by glib-mkenums
- as const.
-
-Thu Nov 25 14:21:37 2004 Manish Singh <yosh@gi,p.org>
-
- * abicheck.sh: filter out G_GNUC stuff when doing the compare.
-
-2004-11-23 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-core.h: Don't mark gdk_pixbuf_error_quark() as const,
- to be consistent with all the other error_quark functions.
- (technically they are const, but since these are called only
- in error paths, giving the compiler better optimization
- opportunities doesn't matter much)
-
- * gdk-pixbuf.symbols: Add attribute annotations.
- * makegdkpixbufalias.pl: Keep attribute annotations, but strip PRIVATE.
- * Makefile.am (gdk_pixbuf.def): Strip attribute annotations, but keep
- PRIVATE.
-
-Mon Nov 15 18:58:22 2004 Manish Singh <yosh@gimp.org>
-
- * gdk-pixbuf-private.h: _gdk_pixbuf_lock now returns a gboolean.
-
- * abicheck.sh: don't hardcode lengths for cut, instead split on
- the third field.
-
-2004-11-15 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-animation.c:
- * gdk-pixbuf-loader.c:
- * gdk-pixbuf-io.c: Be extra careful when locking and handle
- the case that the module may initialize the thread system.
-
- * gdk-pixbuf-io.[hc] (_gdk_pixbuf_lock): Return whether the
- lock was actually taken.
-
- * queryloaders.c (query_module): Set vtable->module before
- calling fill_vtable(), since gdk-pixbuf-io.c does does the
- same and modules may rely on it. (#158177, Dan Winship)
-
-2004-11-12 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-io.c (gdk_pixbuf_io_init): Don't use
- _gdk_pixbuf_load_module_unlocked() in the !USE_GMODULE case.
-
- * === Released 2.5.5 ===
-
-2004-11-12 Matthias Clasen <mclasen@redhat.com>
-
- Changes to make gdk-pixbuf threadsafe (#157310, #157306,
- Colin Walters):
-
- * gdk-pixbuf-io.h (enum GdkPixbufFormatFlags): Add
- GDK_PIXBUF_FORMAT_THREADSAFE to indicate that an image loader
- is threadsafe.
-
- * gdk-pixbuf-io.c (get_file_formats, _gdk_pixbuf_load_module):
- Use a lock to make initialization of global data structures
- threadsafe.
- * gdk-pixbuf-private.h:
- * gdk-pixbuf-io.c (_gdk_pixbuf_lock, _gdk_pixbuf_unlock):
- Auxiliary functions which use another lock to protect
- threadunsafe image loaders.
-
- * gdk-pixbuf-io.c (gdk_pixbuf_real_save):
- (save_to_callback_with_tmp_file):
- (gdk_pixbuf_real_save_to_callback):
- (gdk_pixbuf_new_from_xpm_data):
- (_gdk_pixbuf_generic_image_load):
- * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file):
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_load_module):
- (gdk_pixbuf_loader_close):
- (gdk_pixbuf_loader_finalize):
- Use _gdk_pixbuf_lock() and _gdk_pixbuf_unlock().
-
- * io-ani.c, io-bmp.c, io-gif.c, io-ico.c:
- * io-jpeg.c, io-pcx.c, io-png.c, io-pnm.c:
- * io-ras.c, io-tga.c, io-wbmp.c, io-xbm.c:
- * io-xpm.c: Mark as threadsafe.
-
- * io-tiff.c: Remove pointless locking, mark as
- threadunsafe.
-
-2004-11-10 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-animation.c:
- * gdk-pixbuf-io.c: Use g_filename_display_name() instead of
- g_filename_to_utf8() when putting filenames in error messages.
-
-2004-11-04 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf.c (gdk_pixbuf_class_init): Document current
- restrictions for property values. (#157409, Matthew H. Plough)
-
-2004-11-01 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-features.h.in: Break the declaration of the three
- version variables, so that gtk-doc can grok it.
-
-2004-10-29 Hans Breuer <hans@breuer.org>
-
- * makefile.msc : updated
-
-2004-10-27 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.5.4 ===
-
-2004-10-27 Matthias Clasen <mclasen@redhat.com>
-
- * Makefile.am (gdk-pixbuf-alias.h): Fix srcdir != builddir
- builds.
-
-2004-09-19 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.5.3 ===
-
-2004-09-15 Matthias Clasen <mclasen@redhat.com>
-
- * io-ico.c:
- * io-xpm.c: Fix some security issues discovered by Chris Evans.
-
-Mon Sep 13 19:31:34 2004 Matthias Clasen <maclas@gmx.de>
-
- * io-jpeg.c (real_save_jpeg): Drop the alpha channel
- when saving 4-channel pixbufs. (#152450, Emmanuel Pacaud)
-
-2004-09-09 Matthias Clasen <mclasen@redhat.com>
-
- * makegdkpixbufalias.pl: Use the short prefix "IA__" for
- aliases instead of the long suffix "__internal_alias".
-
-2004-09-01 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-core.h: Align argument names with source.
-
-Thu Aug 26 01:23:16 2004 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-core.h:
- * gdk-pixbuf.symbols:
- * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file_at_scale):
- Add gdk_pixbuf_new_from_file_at_scale(), which is just
- like gdk_pixbuf_new_from_file_at_size(), but optionally
- ignores the aspect ratio. (#136395, Dom Lachowicz)
-
-Wed Aug 25 17:23:23 2004 Manish Singh <yosh@gimp.org>
-
- * io-gif.c: remove unused set_need_recomposite() function.
-
-2004-08-25 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.5.2 ===
-
- * abicheck.sh: Make work in make distcheck.
-
-2004-08-25 Matthias Clasen <mclasen@redhat.com>
-
- * Makefile.am: Use the same prefix when creating
- gdk-pixbuf-marshal.c and gdk-pixbuf-marshal.h
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init): _-prefix
- the marshalers.
-
-2004-08-24 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_new_with_mime_type): Use
- the correct index and compare correctly, reported by Tommi Komulainen.
- (gdk_pixbuf_loader_new_with_mime_type):
-
- * gdk-pixdata.c (gdk_pixdata_from_pixbuf): Work around bugs in
- the runlength encoder by forcing rowstride * height to be
- divisible by bpp. (#150882)
-
-Sun Aug 22 03:20:56 2004 Matthias Clasen <maclas@gmx.de>
-
- * pixops/pixops.c (pixops_scale_nearest): Fix a mixup in the handling
- of dest_channels. (#111922, Christophe Fergeau)
-
-Fri Aug 20 11:59:10 2004 Owen Taylor <otaylor@redhat.com>
-
- * io-bmp.c: Fix infinite loop that can occur for bad
- image data (#150601, Chris Evans, Manish Singh)
-
-2004-08-17 Matthias Clasen <mclasen@redhat.com>
-
- * abicheck.sh: No need for INCLUDE_INTERNAL_SYMBOLS any more.
-
- * Makefile.am (gdk-pixbuf-alias.h): Don't use cpp to filter the symbols.
-
- * makegdkpixbufalias.pl: Move the #ifdef processing into the perl script,
- and keep the #ifdefs which differentiate between platforms.
-
- * gdk-pixbuf.symbols: Remove the marshalers.
-
- * Makefile.am (stamp-gdk-pixbuf-marshal.h): _-prefix the marshalers.
-
-Thu Aug 12 22:19:12 2004 Matthias Clasen <maclas@gmx.de>
-
- * io-bmp.c (DecodeHeader): Properly determine the number of
- colors in an OS/2 BMP file. (#150003, Jon-Kare Hellan)
-
-2004-08-12 Matthias Clasen <mclasen@redhat.com>
-
- * pixops/pixops.c: Remove C99-isms. (#149967, Vincent Noel)
-
-Wed Aug 11 22:56:55 2004 Matthias Clasen <maclas@gmx.de>
-
- * abicheck.sh: Check all symbols.
-
-2004-08-11 Matthias Clasen <mclasen@redhat.com>
-
- * pixops/pixops.c: Make scaling and compositing functions handle
- edge pixels consistently. (#111922, Brian Cameron)
-
- * pixops/pixops-internal.h:
- * pixops/pixops.c:
- * pixops/*.S: underscore prefix the mmx implementations, in order
- to not export them.
-
- * gdk-pixbuf.symbols: Remove the mmx pixops implementations.
-
- * abicheck.sh: No need to define INCLUDE_MMX_SYMBOLS any more.
-
-Tue Aug 10 23:53:59 2004 Matthias Clasen <maclas@gmx.de>
-
- Add hidden aliases for exported symbols which are
- used internally in order to get rid of many PLT
- entries. (#145519, Arjan van de Ven)
-
- * gdk/Makefile.am: Add rules to generate gdk_pixbuf.def and
- gdk-pixbuf-alias.h from gdk-pixbuf.symbols, and make make
- check check the abi with abicheck.sh.
-
- * gdk/gdk-pixbuf.symbols: New file. Definition of the gdk-pixbuf
- ABI. The file can be processed by cpp to filter out certain
- subsets of symbols.
-
- * gdk/abicheck.sh: New file. Script to check the actually
- symbols exported from libgdk_pibuf.2.0.so against the symbols
- found in gdk-pixbuf.symbols.
-
- * gdk/makegdkpixbufalias.pl: New file. Perl script to generate the
- header containing the alias definitions for internally used
- exported symbols from a list of symbols.
-
- * *.c: Include gdk-pixbuf-alias.h
-
-2004-08-06 Hans Breuer <hans@breuer.org>
-
- * gdk_pixbuf.def makefile.msc : updated
-
-Sun Aug 1 23:57:06 2004 Matthias Clasen <maclas@gmx.de>
-
- * io-pcx.c (pcx_increment_load_data_1): Fix progressive
- loading of 8bit pcx files. (#148518, Magnus Bergman)
-
-2004-08-01 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.5.1 ===
-
-Tue Jul 20 22:23:26 2004 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-io.h: Remove trailing commas from
- enumerations. (#148035)
-
-Sun Jul 18 20:17:41 2004 Soeren Sandmann <sandmann@daimi.au.dk>
-
- * === released 2.5.0 ==
-
-Thu Jul 15 19:19:21 2004 Matthias Clasen <maclas@gmx.de>
-
- * io-png.c (real_save_png):
- * gdk-pixbuf-io.c (gdk_pixbuf_io_init): Use 'cannot' instead
- of 'can not' in messages. (#144226, Morten Welinder)
-
-Fri Jul 9 15:38:06 2004 Manish Singh <yosh@gimp.org>
-
- * gdk-pixbuf-io.c (gdk_pixbuf_format_set_disabled): function doesn't
- return a value, so don't use g_return_val_if_fail()
-
- * gdk-pixbuf-scale.c (gdk_pixbuf_rotate_simple): initialize dest in
- the can't happen case, to quiet gcc.
-
- * io-tiff.c (tifflibversion): enclose in #if TIFFLIB_VERSION >=
- 20031226.
-
-Wed Jul 7 23:53:58 2004 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-io.h:
- * gdk-pixbuf-io.c (gdk_pixbuf_format_is_disabled):
- * gdk-pixbuf-io.c (gdk_pixbuf_format_set_disabled):
- * gdk-pixbuf-io.c (gdk_pixbuf_format_get_license):
- New functions to disable/enable individual loaders and to
- obtain license information about loaders.
-
- * gdk-pixbuf-io.h (GdkPixbufFormat): Add disabled and
- license fields.
-
- * gdk-pixbuf-io.c (_gdk_pixbuf_get_module):
- * gdk-pixbuf-io.c (_gdk_pixbuf_get_named_module): Skip
- disabled loaders.
-
- * io-*.c: Add license information in the fill_info
- functions.
-
-2004-07-07 Matthias Clasen <mclasen@redhat.com>
-
- * gdk-pixbuf-features.h.in: Fix the build.
-
-2004-07-06 Tor Lillqvist <tml@iki.fi>
-
- * gdk-pixbuf-features.h.in
- * gdk-pixbuf.c: Mark the version variables for proper import and
- export from Windows DLLs. Thanks to Laurent Sansonetti for
- reporting the problem.
-
-Sat Jul 3 00:41:44 2004 Matthias Clasen <maclas@gmx.de>
-
- * pixops/pixops.c (bilinear_box_make_weights): Correct the
- math to calculate bilinear weights. (#112412, Brian Cameron)
-
-Mon Jun 21 00:44:51 2004 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-transform.h:
- * gdk-pixbuf-scale.c (gdk_pixbuf_rotate_simple):
- * gdk-pixbuf-scale.c (gdk_pixbuf_flip): New functions to
- rotate pixbufs by multiples of 90 degrees and to flip them
- horizontally or vertically.
-
-Sun Jun 20 01:06:48 2004 Matthias Clasen <maclas@gmx.de>
-
- Header reorganization. (#51999, Jeff Franks, reorganization
- proposed by Havoc Pennington)
-
- * gdk-pixbuf.h: This is now an include-only header, and the only
- one which applications should directly use.
-
- * gdk-pixbuf-animation.h: Add animation api from gdk-pixbuf.h.
- * gdk-pixbuf-io.h: Add io api from gdk-pixbuf.h.
- * gdk-pixbuf-loader.h: Add loader api from gdk-pixbuf.h.
- * gdk-pixbuf-transform.h: New header.
- * gdk-pixbuf-core.h: New header.
-
-Sat Jun 19 01:44:12 2004 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-scale.c (gdk_pixbuf_composite): Add a figure which
- explains pixbuf compositing.
-
-2004-06-16 Matthias Clasen <mclasen@redhat.com>
-
- * io-tiff.c: Make the tiff loader work with both
- libtiff 3.5.7 and libtiff 3.6.1. (#135541, Marco Ghirlanda)
-
-Fri Jun 11 22:02:56 2004 Matthias Clasen <maclas@gmx.de>
-
- * io-gif.c, io-pnm.c, io-tga.c, io-xpm.c: Don't use
- contractions like "don't" or "isn't" in error messages.
- It isn't nice to use them in log entries either...
- (#137774, Morten Welinder, patch by Alexander Winston)
-
-Sat Jun 5 00:59:12 2004 Matthias Clasen <maclas@gmx.de>
-
- Merged from 2.4
-
- * gdk-pixbuf-animation.c:
- * gdk-pixbuf-io.c: Convert filenames to UTF-8 when embedding
- them in error messages. (#143654, Sven Neumann)
-
-Sun May 16 22:53:47 2004 Matthias Clasen <maclas@gmx.de>
-
- Merged from 2.4
-
- * io-pnm.c (pnm_read_next_value): Don't read integers
- partially. (#142584, Kouichirou Hiratsuka)
-
-2004-05-10 Matthias Clasen <mclasen@redhat.com>
-
- Merged from 2.4:
-
- * pixops/timescale.c:
- * pixops/pixops.c:
- * pixops/pixops.h:
- * gdk-pixbuf-scale.c: _-prefix the nonstatic pixops_...
- functions. (#142233, Morten Welinder)
-
-Wed May 5 23:09:48 2004 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-io.h (GdkPixbufFormatFlags): New format flag
- GDK_PIXBUF_FORMAT_SCALABLE to mark scalable formats.
-
- * gdk-pixbuf.h:
- * gdk-pixbuf-io.c (gdk_pixbuf_format_is_scalable): New function.
- (#137995, Dom Lachowicz)
-
-2004-04-30 Matthias Clasen <mclasen@redhat.com>
-
- * === Released 2.4.1 ===
-
-2004-04-13 Matthias Clasen <mclasen@redhat.com>
-
- * io-ani.c (gdk_pixbuf__ani_image_load_animation):
- * gdk-pixbuf-io.c (gdk_pixbuf_get_file_info)
- (_gdk_pixbuf_generic_image_load)
- (gdk_pixbuf_new_from_file_at_size): When calling fread()
- in a loop, check for ferror() as well as for feof() to
- avoid infinite loops on directories. (#137804, Alex Converse)
-
-Mon Mar 15 15:01:59 2004 Owen Taylor <otaylor@redhat.com>
-
- * === Released 2.4.0 ===
-
-2004-03-15 Tor Lillqvist <tml@iki.fi>
-
- * queryloaders.c (main): [Win32] Look up installation prefix at
- run-time, replace prefix in PIXBUF_LIBDIR with that. (#106141)
-
- Merges from stable branch that had been left out. (#136282, J. Ali
- Harlow):
-
- Changes for run-time lookup of installation location on Win32:
-
- * Makefile.am (INCLUDES): Define GTK_PREFIX as $(prefix).
-
- * gdk-pixbuf-io.c (get_sysconfdir): New function, look up
- installation location at runtime and deduce GTK_SYSCONFDIR
- from it.
- (get_toplevel): Similar, for the top-level installation directory.
- (correct_prefix): Replace compile-time prefix with run-time
- prefix.
- (get_libdir): Remove, not used any longer.
- (gdk_pixbuf_io_init): Call correct_prefix() on Win32.
-
- * queryloaders.c (query_module): [Win32] Change backslahses into
- slashes in path.
-
-Tue Mar 9 09:33:28 2004 Owen Taylor <otaylor@redhat.com>
-
- * === Released 2.3.6 ===
-
-2004-03-05 Tor Lillqvist <tml@iki.fi>
-
- * gdk_pixbuf.def: Add missing entries. Thanks to J. Ali Harlow.
-
-Fri Mar 5 22:22:25 2004 Matthias Clasen <maclas@gmx.de>
-
- * io-bmp.c (OneLine32): Don't try to load an alpha channel
- from the BMP, since there is no evidence that even 32bit
- BMPs have an alpha channel. (#135502)
-
-Mon Mar 1 19:47:48 2004 Owen Taylor <otaylor@redhat.com>
-
- * === Released 2.3.5 ====
-
-2004-02-28 Hans Breuer <hans@breuer.org>
-
- * io-tiff.c : include <io.h> for lseek()
- * io-xbm.c : use HAVE_UNISTD_H
-
-Tue Feb 24 14:45:03 2004 Owen Taylor <otaylor@redhat.com>
-
- * === Released 2.3.3 ===
-
-Sun Feb 22 01:09:55 2004 Matthias Clasen <maclas@gmx.de>
-
- * io-bmp.c (gdk_pixbuf__bmp_image_begin_load): Remove debugging
- code.
-
-Fri Feb 20 22:25:32 2004 Matthias Clasen <maclas@gmx.de>
-
- * io-bmp.c (DecodeHeader): Store and sanity-check the clrUsed field
- from the header for use in DecodeColormap.
- * io-bmp.c (DecodeColormap): Don't read more colormap entries than
- the header says are there. (#134235, Kazuho Okui)
-
-Sun Feb 8 01:07:20 2004 Manish Singh <yosh@gimp.org>
-
- * gdk-pixbuf-io.c: removed unnecessary G_OBJECT() cast checks.
-
- * io-jpeg.c: make the return type for to_callback_empty_output_buffer
- "boolean", which should be defined by the jpeg headers. The right
- return type for this function depends on how the jpeg library
- was built (one wonders what happens if different compilers are used).
-
-2004-01-28 Hans Breuer <hans@breuer.org>
-
- * gdk_pixbuf.def : updated externals
-
-Sat Jan 17 23:02:55 2004 Matthias Clasen <maclas@gmx.de>
-
- The second part of the fix for #114351 (see also
- ../Changelog)
-
- * gdk-pixbuf-i18n.h (P_): Use translation domain gtk20-properties.
-
-Sat Jan 17 00:01:51 2004 Matthias Clasen <maclas@gmx.de>
-
- The first part of the fix for #114351 (see also
- ../ChangeLog):
-
- * gdk-pixbuf-i18n.h: Define P_() for property blurbs and nicks.
-
- * gdk-pixbuf.c: Mark property blurbs and nicks with P_().
-
-Thu Jan 8 22:01:14 2004 Matthias Clasen <maclas@gmx.de>
-
- * queryloaders.c (loader_sanity_check): Don't use bitwise operators
- on booleans. (#130923, reported by Telsa Gwynne, fix by Dave Jones)
-
-2004-01-06 Federico Mena Quintero <federico@ximian.com>
-
- * gdk-pixbuf-io.c (gdk_pixbuf_save): Escape an ampersand in the
- documentation comment, and hack around an empty line in the code
- example so that gtk-doc won't put a <para> due to it.
-
- * gdk-pixbuf.c (gdk_pixbuf_get_pixels): Link to the documentation
- section on image data.
-
-2004-01-06 Federico Mena Quintero <federico@ximian.com>
-
- * gdk-pixdata.c (gdk_pixbuf_new_from_inline): Fix example in
- documentation comment. Fixes #130701.
-
-Wed Jan 7 02:41:14 2004 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-io.c (gdk_pixbuf_save_to_bufferv):
- * gdk-pixbuf-io.c (gdk_pixbuf_save_to_buffer):
- * gdk-pixbuf-io.c (gdk_pixbuf_save_to_callbackv):
- * gdk-pixbuf-io.c (gdk_pixbuf_save_to_callback): New public API
- to save pixbufs to non-file locations. (#82203, Tim Evans)
-
- * gdk-pixbuf.h:
- * gdk-pixbuf.def: Declare the new public API.
-
- * gdk-pixbuf-io.h: Add save_to_callback to the module interface.
-
- * io-jpeg.c:
- * io-png.c: Implement save_to_callback.
-
- * gdk-pixbuf-io.c (gdk_pixbuf_savev):
- * gdk-pixbuf-io.c (gdk_pixbuf_save): Update documentation.
-
- * gdk-pixbuf-io.c (gdk_pixbuf_real_save): Support saving via
- image_module->save_to_callback.
-
- * gdk-pixbuf-io.c (gdk_pixbuf_real_save_to_callback): New generic
- save_to_callback function which falls back to image_module->save
- on a temp file.
-
-Wed Jan 7 01:17:36 2004 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_size_func):
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_set_size):
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_init): Make it possible
- to call gdk_pixbuf_loader_set_size (loader, 0, 0) by changing
- the initial values of priv->width/height to -1.
-
- * io-tiff.c (tiff_image_parse):
- * io-ras.c (RAS2State):
- * io-pnm.c (gdk_pixbuf__pnm_image_load_increment):
- * io-pcx.c (gdk_pixbuf__pcx_load_increment):
- * io-jpeg.c (gdk_pixbuf__jpeg_image_load_increment):
- * io-png.c (png_info_callback):
- * io-ico.c (DecodeHeader):
- * io-bmp.c (DecodeHeader): Call size_func once the size is known,
- even if the module can't make use of the scaling information. If
- size_func returns 0, don't allocate a pixbuf and return, if
- necessary with an error.
-
- * gdk-pixbuf.h:
- * gdk-pixbuf-io.c (gdk_pixbuf_get_file_info): A new function
- to determine the type and size of an image file without loading
- it completely. (#53725)
-
-Sun Jan 4 00:44:57 2004 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf.c (gdk_pixbuf_class_init): Turn the pixbuf
- attributes into (construct-only, but always readable)
- properties. (#130196)
-
- * gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Set properties
- in g_object_new().
-
-Mon Dec 22 01:35:36 2003 Matthias Clasen <maclas@gmx.de>
-
- * Makefile.am (gdk-pixbuf.loaders): Fix building with
- --disable-modules --with-included-loaders, create an
- empty gdk-pixbuf.loaders file. (#124496, Arno Charlet, fix
- proposed by Owen Taylor)
-
-Thu Dec 11 01:57:05 2003 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init): Move
- the documentation for signals inline, to get proper parameter
- documentation. (#128977)
-
-Sat Nov 15 00:26:19 2003 Matthias Clasen <maclas@gmx.de>
-
- * queryloaders.c (loader_sanity_check): Check that the mask
- is NULL or a string of the same length consisting entirely of
- ' ', '!', 'x', 'z', 'n'.
-
-Mon Nov 10 00:17:52 2003 Matthias Clasen <maclas@gmx.de>
-
- * Makefile.am (install-data-local): Typo fix in warning.
-
-Sun Nov 9 23:07:05 2003 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-io.c (_gdk_pixbuf_generic_image_load): If neither
- load nor begin_load are available fall back to load_animation
- and use gdk_pixbuf_animation_get_static_image() to obtain a
- pixbuf. Inefficient, but at least doesn't crash.
-
-Sun Nov 9 21:56:20 2003 Matthias Clasen <maclas@gmx.de>
-
- * queryloaders.c (write_loader_info): New function to write
- out the information for a single loader, factored out of
- query_module().
- (loader_sanity_check): New function to perform
- sanity checks on a loader.
- (query_module): Use the new functions.
-
-Thu Nov 6 00:27:27 2003 Matthias Clasen <maclas@gmx.de>
-
- * io-pcx.c (gdk_pixbuf__pcx_load_increment): Fold two similar
- strings into on. (#126204, Danilo Segan)
-
-2003-09-19 Matthias Clasen <maclas@gmx.de>
-
- * io-tga.c (try_preload): Remove a pointless check.
- (#122710, Kjartan Maraas)
-
-Mon Aug 18 10:25:29 2003 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixdata.c (gdk_pixdata_to_csource): Add the correct
- alignment magic for Sun compiler and for GCC to get
- the strings aligned. (Patch from Brian Cameron, #117217)
-
-2003-08-14 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixdata.c (gdk_pixdata_to_csource): Improve doc comment
- wording. (#119754, Doug Quale)
-
-2003-08-03 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf.c (gdk_pixbuf_get_rowstride):
- * gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Clarify misleading
- explanation of rowstride. (#119000)
-
-2003-07-24 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file_at_size): Preserve the
- aspect ratio. (#118145, Owen Taylor)
-
-2003-07-23 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file_at_size): Close loader
- before unref'ing it. (#118146, Owen Taylor)
-
-2003-03-01 Hans Breuer <hans@breuer.org>
-
- * makefile.msc : updated
-
- * gdk_pixbuf.def : export a bunch of new functions
-
-2003-07-18 Matthias Clasen <maclas@gmx.de>
-
- * pixops/pixops.c (correct_total): Split correction into multiple
- pieces if no single weight is large enough to apply the unsplit
- correction. (#117431, problem reported by Tomas ?gren)
-
-2003-07-13 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf.h:
- * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file_at_size): New function
- to load an image from a file at a specified size. (#105326, Dom
- Lachowicz)
-
-2003-07-11 Matthias Clasen <maclas@gmx.de>
-
- * queryloaders.c (query_module): Handle absolute filenames
- properly. (#117170, Jens Elkner)
-
- * gdk-pixbuf-io.c: Mention that NULL-terminated arrays returned by
- gdk_pixbuf_format_get_mime_types() and
- gdk_pixbuf_format_get_extensions() must be freed with g_strfreev().
-
-2003-07-04 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-io.c: Document ICO save parameters.
-
- * io-ico.c: Support saving of ICOs and CURs. Currently, only
- single-image ICOs are produced, but the code for multi-image ICOs
- is already in place. The saver understands the options "depth"
- (can be "32", "24" or "16") and "x_hot"/"y_hot" for hotspot
- coordinates of CURs.
-
-2003-06-28 Matthias Clasen <maclas@gmx.de>
-
- * io-ico.c (DecodeHeader): Stop discriminating against 32bpp ICOs
- a): Use the byte size of the image as a heuristic when selecting
- the bitmap to load - this lets us select 32bpp bitmaps which come
- after a 8bpp bitmap.
- (OneLineTransp): Stop discriminating against 32bpp ICOs b): Don't
- overwrite the alpha channel of 32bpp ICOs.
- (gdk_pixbuf__ico_image_load_increment): Stop decoding the header
- unnecessarily.
-
-Fri Jun 27 03:56:59 2003 Soeren Sandmann <sandmann@daimi.au.dk>
-
- * io-gif-animation.c (gdk_pixbuf_gif_anim_frame_composite): Make
- it compile with C89 compilers.
-
-2003-06-23 Matthias Clasen <maclas@gmx.de>
-
- * io-gif.c (gif_get_frame_info): Remove the pointless refusal to
- load images with dubious disposal mode on the first frame. Just
- ignore it, as everybody else does.
-
-2003-06-22 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-loader.[hc] (gdk_pixbuf_loader_new_with_mime_type):
- New function to obtain a loader for a specific mime type.
- (#105324, Dom Lachowicz)
-
- * io-gif.c (gif_get_extension): Reset block_count to 0 for all
- application extensions, otherwise the data blocks of unknown
- extensions are not propertly skipped.
-
- Second half of the fix for #106962, handle frames extending beyond
- the logical screen:
-
- * io-gif.c (clip_frame): New helper function to clip a rectangle
- to the logical screen size of the gif.
- (maybe_update): New helper function to call update_func only if
- the rectangle is not completely off-bounds.
- (gif_get_lzw): Read frames extending outside the logical screen
- size, but be careful clip to the logical screen size
- when operating on the composite pixbuf and when calling update_func.
- (gif_init): Set the animation size to the logical screen size.
- (gif_get_frame_info): Don't refuse to load images with frames
- extending beyond the logical screen size.
-
- * io-gif-animation.c (gdk_pixbuf_gif_anim_frame_composite): Be
- careful to clip all rectangles to the logical screen size, also
- handle the fact that frames may be completely off-bounds.
-
-2003-06-21 Matthias Clasen <maclas@gmx.de>
-
- * io-gif.c: Merge from 2.2: Fix update_func() arguments and accept
- empty frames. (#106962)
-
-2003-06-17 Matthias Clasen <maclas@gmx.de>
-
- * Makefile.am (man_MANS): Removed, man pages are now installed
- from docs/reference/gdk-pixbuf.
-
-2003-06-03 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixdata.c (gdk_pixbuf_new_from_inline): Document
- data_length == -1, add an example. (#97290)
-
-2003-06-01 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixdata.h (struct _GdkPixdata): Fix misleading documentation
- of rowstride. (#113924, Noah Levitt)
-
-2003-05-27 Matthias Clasen <maclas@gmx.de>
-
- * io-wbmp.c: Remove dubious bitfields of
- unspecified signedness. (#112919, Morten Welinder)gdk-p
-
- * gdk-pixdata.c (gdk_pixdata_to_csource): Replace all occurances
- of g_string_new ("") by g_string_new (NULL). (#106975, Morten
- Welinder)
-
-2003-05-21 Matthias Clasen <maclas@gmx.de>
-
- * pixbufloader_pcx.def:
- * io-pcx.c: A loader for PCX files. (#113035, Josh Beam)
-
- * gdk-pixbuf-io.c:
- * Makefile.am: Add PCX loader.
-
-2003-05-19 Matthias Clasen <maclas@gmx.de>
-
- Improve progressive loading from slow sources: (#107368)
-
- * io-gif-animation.c (gdk_pixbuf_gif_anim_get_iter): Initialize
- first_loop_slowness.
- (gdk_pixbuf_gif_anim_iter_advance): Don't wrap during loading if
- the datasource falls behind the speed of the display.
-
- * io-gif-animation.h: Add a loading flag to GdkPixbufGifAnim and
- first_loop_slowness to GdkPixbufGifAnimIter.
-
-Wed May 14 18:24:50 2003 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixdata.c (gdk_pixdata_deserialize): Add a
- (gint32 *) => (guint32 *) cast. (#108615, Rick Jones)
-
-2003-04-24 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_write):
- (gdk_pixbuf_loader_new_with_type):
- (gdk_pixbuf_loader_close):
- * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file):
- (gdk_pixbuf_save):
- (gdk_pixbuf_savev):
- * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file):
- Add sanity checks for GError handling. (#108345)
-
-Tue Apr 1 15:33:51 2003 Owen Taylor <otaylor@redhat.com>
-
- * pixops/pixops.c (make_weights): Exploit the fact that all
- our filters are separable to simplify the calculation of
- the weight tables. (Based on a patch from Brian Cameron.)
-
- * pixops/Makefile.am pixbuf-transform-math.ltx:
- Add a short article describing how the math in pixops.c
- works.
-
-2003-03-21 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-animation.c (gdk_pixbuf_non_anim_get_type): Add
- missing static. (#108614)
-
- * io-jpeg.c (gdk_pixbuf__jpeg_image_begin_load):
- * io-ico.c (gdk_pixbuf__ico_image_stop_load): Add missing static
- qualifiers apparently causing problems on some platforms. (#108617)
-
-2003-03-11 Matthias Clasen <maclas@gmx.de>
-
- * io-ico.c (DecodeHeader): Calculate LineWidth for 16bpp from
- width, like for the other depths. (noticed by Marijn Ros)
-
-2003-03-08 Matthias Clasen <maclas@gmx.de>
-
- Bug #107664 continued:
-
- * io-xpm.c (find_color): Fix 0/FALSE confusion
- * gdk-pixbuf.c (gdk_pixbuf_get_has_alpha): Fix -1/gboolean
- confusion.
-
-2003-03-06 Matthias Clasen <maclas@gmx.de>
-
- * io-gif.c (gif_read): Fix 0/FALSE confusion (#107664, Morten
- Welinder)
-
-2003-02-20 Matthias Clasen <maclas@gmx.de>
-
- * io-gif-animation.c (gdk_pixbuf_gif_anim_frame_composite):
- Always clear the initial frame and "disposed" areas with
- transparent pixels, no matter whether the frame has transparency
- or not. (#55502)
-
-2003-02-18 Matthias Clasen <maclas@gmx.de>
-
- * io-tga.c (pixbuf_flip_row):
- (pixbuf_flip_vertically): Auxiliary functions used to implement
- support for arbitrary origins.
- (parse_data_for_row_pseudocolor):
- (parse_data_for_row_truecolor):
- (parse_data_for_row_grayscale):
- (parse_data_for_row):
- (fill_in_context): Remove the check for upper-left origin.
- (parse_rle_data): Support arbitrary origins. (#105912)
-
- * io-tga.c (fread_check):
- (fseek_check):
- (get_header_from_file):
- (get_colormap_from_file):
- (get_image_pseudocolor):
- (swap_channels_pixbuf):
- (get_image_truecolor):
- (get_image_grayscale):
- (gdk_pixbuf__tga_load): Remove the non-incremental load
- implementation, since we have generic_image_load () now.
-
- (gdk_pixbuf__tga_stop_load): Fix a potential crash discovered by
- pixbuf-lowmem.
-
-2003-02-14 Matthias Clasen <maclas@gmx.de>
-
- * io-tga.c (try_preload):
- (gdk_pixbuf__tga_load): Actually reject images with origin
- not in the upper-left corner. (#105912)
-
-2003-02-06 Matthias Clasen <maclas@gmx.de>
-
- * queryloaders.c (query_module): Better error message if
- module_open() fails. (#105349, Tim Mooney)
-
-Mon Jan 27 17:10:30 2003 Owen Taylor <otaylor@redhat.com>
-
- * Makefile.am (gdk-pixbuf.loaders): Rewrite to run
- on the .la files rather than looking for .so files.
- (#102142, Martin Gansser)
-
- * Makefile.am: Don't build gdk-pixbuf.loaders when
- cross-compiling.
-
-2003-01-05 Tor Lillqvist <tml@iki.fi>
-
- * Makefile.am (gdk-pixbuf.loaders): Use @SOEXT@ in the find command.
-
- * gdk_pixbuf.def: Add gdk_pixbuf_loader_set_size.
-
-2003-01-03 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-io.c (gdk_pixbuf_new_from_xpm_data): Don't crash if
- gdk-pixbuf.loaders file is missing. (#102222)
-
-2002-12-08 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-animation.h:
- * gdk-pixbuf-io.h: Add /*< public|private >*/ markers.
-
-Sat Dec 7 10:14:05 2002 Owen Taylor <otaylor@redhat.com>
-
- * Makefile.am (gdk-pixbuf.loaders): Make gdk-pixbuf.loaders
- also depend gdk-pixbuf-query-loaders. (#97096, Daniel Elstner)
-
-2002-12-05 Matthias Clasen <maclas@gmx.de>
-
- * io-ico.c: Remove leftover debug output. (#100357, Owen Taylor)
-
-2002-12-04 Bastien Nocera <hadess@hadess.net>
-
- * io-tiff.c: (tiff_image_parse): use G_BIG_ENDIAN instead of
- WORDS_BIGENDIAN which isn't set by configure.in
-
-2002-11-29 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-animation.c:
- * gdk-pixbuf.c: Add deprecation docs.
-
-2002-11-28 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf/gdk-pixbuf-io.c:
- * gdk-pixbuf/gdk-pixbuf-loader.c:
- * gdk-pixbuf/gdk-pixbuf.c: Document 2.2 API additions. I'm not
- going to list all individual functions here; if you want to see
- the list, grep for "Since: 2.2".
-
-Fri Nov 8 19:06:07 2002 Owen Taylor <otaylor@redhat.com>
-
- * Makefile.am (gdk-pixbuf.loaders): Make gdk-pixbuf.loaders
- file depend on the loaders (#97096, Jeff Waugh)
-
-Wed Nov 6 15:19:53 2002 Owen Taylor <otaylor@redhat.com>
-
- * io-gif.c (CHECK_LZW_SP): Fix trailing semicolon on macro,
- clean up a bit.
-
-2002-11-05 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-loader.c: Reindent to follow the gdk-pixbuf indentation.
-
-Tue Nov 5 14:16:17 2002 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_close): Fix
- leaked pixbuf reference (#96823, Morten Welinder)
-
-2002-10-23 Matthias Clasen <maclas@gmx.de>
-
- * io-gif.c (lzw_read_byte): Check for stack overflow throughout.
- (#91808, Elliot Lee)
-
-2002-10-21 Matthias Clasen <maclas@gmx.de>
-
- Support the Netscape application extension for gif animations
- (#95060):
-
- * io-gif-animation.h:
- * io-gif-animation.c (gdk_pixbuf_gif_anim_iter_advance):
- Add loop count to GdkPixbufGifAnim and use it in the advance
- method of GdkPixbufGifAnimIter.
-
- * io-gif.c (gif_get_extension): Parse Netscape application
- extension block and set the animation loop count.
-
-2002-10-11 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_get_format): Remove
- unused variable.
-
- * gdk-pixbuf-io.h: Remove unused typedef
- GdkPixbufModuleGetSignatureFunc.
-
-2002-10-04 jacob berkman <jacob@ximian.com>
-
- * queryloaders.c (query_module): make legal C
-
-2002-10-04 Matthias Clasen <maclas@gmx.de>
-
- * Makefile.am gdk-pixbuf-animation.c gdk-pixbuf-data.c
- gdk-pixbuf-io.c gdk-pixbuf-io.h gdk-pixbuf-loader.c
- gdk-pixbuf-loader.h gdk-pixbuf-private.h gdk-pixbuf.h
- gdk-pixdata.c io-ani-animation.h io-ani.c io-bmp.c
- io-gif-animation.c io-gif-animation.h io-gif.c io-ico.c
- io-jpeg.c io-png.c io-pnm.c io-ras.c io-tga.c io-tiff.c
- io-wbmp.c io-xbm.c io-xpm.c pixbufloader_ani.def
- pixbufloader_bmp.def pixbufloader_gif.def pixbufloader_ico.def
- pixbufloader_jpeg.def pixbufloader_png.def
- pixbufloader_pnm.def pixbufloader_ras.def pixbufloader_tga.def
- pixbufloader_tiff.def pixbufloader_wbmp.def
- pixbufloader_xbm.def pixbufloader_xpm.def test-gdk-pixbuf.c
- gdk-pixbuf-animation.h queryloaders.c: Support for separately
- installed loaders. (#77486)
-
-Thu Oct 3 18:25:57 2002 Owen Taylor <otaylor@redhat.com>
-
- * io-jpeg.c (gdk_pixbuf__jpeg_image_save):
- Fix memory leak. (#94399)
-
-Tue Oct 1 17:35:43 2002 Owen Taylor <otaylor@redhat.com>
-
- * gdkpixdata.c: Patch from Andy Wingo to always
- escape ? to avoid accidentally generating trigraphs
- in the output (#94631)
-
-2002-09-28 Tor Lillqvist <tml@iki.fi>
-
- * pixops/*.S: Don't use .type on Cygwin, either (#91597, Masahiro
- Sakai).
-
-2002-09-27 Federico Mena Quintero <federico@ximian.com>
-
- * io-ico.c (gdk_pixbuf__ico_image_begin_load): Free the context if
- we cannot allocate the HeaderBuf.
-
-2002-09-27 Federico Mena Quintero <federico@ximian.com>
-
- * io-bmp.c (OneLine): Fix the update region notification to handle
- top-to-bottom and bottom-to-top BMPs correctly.
-
-2002-09-19 Matthias Clasen <maclas@gmx.de>
-
- * Revert the previous change; the symbols need to be exported
- to be usable from dlopened modules.
-
-2002-09-18 Matthias Clasen <maclas@gmx.de>
-
- * io-xpm.c, io-xbm.c, io-ico.c, io-ani.c, io-png.c,
- gdk-pixbuf.c, gdk-pixbuf-animation.c, gdk-pixbuf-loader.c,
- gdk-pixbuf-private.h: _-prefix gdk_pixbuf_non_anim_new and
- gdk_pixbuf_set_option. Adjust all callers.
-
-2002-09-14 Hans Breuer <hans@breuer.org>
-
- * pixops/Makefile.am : added makefile.msc to EXTRA_DIST
-
-2002-09-12 Matthias Clasen <maclas@gmx.de>
-
- * io-gif-animation.h:
- * gdk-pixbuf.h: Move GdkPixbufFrame from the public header to
- the gif-animation-specific private header. (#91929)
-
-2002-09-12 Federico Mena Quintero <federico@ximian.com>
-
- * io-jpeg.c (gdk_pixbuf__jpeg_image_load): Unref the pixbuf if we
- hit an unsupported colorspace.
-
-2002-09-06 Matthias Clasen <maclas@gmx.de>
-
- * io-ani.c, io-ani-animation.h, io-ani-animation.c,
- pixbufloader_ani.def, Makefile.am, gdk-pixbuf-io.c: New loader,
- for .ANI animations.
-
- * io-xpm.c (pixbuf_create_from_xpm):
- * io-xbm.c (gdk_pixbuf__xbm_image_load_real):
- * io-ico.c (DecodeHeader): Attach hotspot coordinates to the
- pixbuf as options "x_hot" and "y_hot".
-
-2002-09-04 Matthias Clasen <maclas@gmx.de>
-
- * io-tga.c (io_buffer_append):
- * io-ico.c (DecodeHeader):
- * io-bmp.c (grow_buffer): Don't leak memory if g_try_realloc fails.
-
- * gdk-pixbuf-io.c (pixbuf_check_ico): Fix loading of .CUR files.
- (#91826)
-
-2002-08-25 Tor Lillqvist <tml@iki.fi>
-
- * Makefile.am (libgdk_pixbuf_2_0_la_DEPENDENCIES): Add
- gdk_pixbuf_win32res_lo. (#87101, J. Ali Harlow)
-
-2002-08-22 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-io.h:
- gdk-pixbuf-io.c (_gdk_pixbuf_generic_image_load): No longer
- static, thus _gdk_pixbuf-prefixed.
-
- * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file):
- Keep this logic in sync with gdk_pixbuf_new_from_file(). (Based
- on a patch by Anders Carlsson)
-
- * io-png.c (gdk_pixbuf__png_image_save): Plug a memory
- leak. (#91422, Sven Neumann)
-
-2002-07-31 Sven Neumann <sven@gimp.org>
-
- * gdk-pixdata.c (gdk_pixdata_to_csource): free the result of
- gdk_pixdata_serialize() (bug #89411).
-
-Mon Jul 29 23:06:10 2002 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixbuf-scale.c: Fix some warnings by adding
- casts to PixopsInterpType. (#85839, David L. Cooper, II.)
-
-2002-07-16 Matthias Clasen <maclas@gmx.de>
-
- * io-ras.c (DoCompressed): Avoid unnecessary casting.
-
-2002-07-07 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-io.c (generic_image_load): New function for loading
- an image from a file either via module->load or incrementally.
- (prepared_notify): ModulePreparedNotifyFunc for generic_image_load.
- (gdk_pixbuf_new_from_file): Use generic_image_load.
- * io-bmp.c, io-ico.c, io-ras.c, io-wbmp.c: Remove trivial
- implementations of module->load. (#71266)
-
- * io-ico.c (DecodeHeader): Correct computation of image height.
- (OneLine): Correct update notification.
-
- Load-at-size functionality (#53726):
-
- * gdk-pixbuf-io.h (ModuleSizeFunc): New.
- (_GdkPixbufModule): Prepend a ModuleSizeFunc to the
- begin_load arguments. Adjust all modules.
- * gdk-pixbuf-loader.c (struct GdkPixbufLoaderPrivate): Add
- fields width, height, size_fixed, need_scale.
- (gdk_pixbuf_loader_class_init): Add size_prepared signal.
- (gdk_pixbuf_loader_set_size): New function.
- (gdk_pixbuf_loader_size_func): ModuleSizeFunc which gets
- passed to the module, emits size_prepared.
- (gdk_pixbuf_loader_prepare): Call gdk_pixbuf_loader_size_func
- if necessary, only emit area_prepared if no separate scaling
- is required.
- (gdk_pixbuf_loader_update): Only emit area_updated if no
- separate scaling is required.
- (gdk_pixbuf_loader_load_module): Add size_func as first argument.
- (gdk_pixbuf_loader_close): If necessary scale the image
- to the desired size and emit area_prepared and area_updated.
- * gdk-pixbuf-loader.h (struct _GdkPixbufLoaderClass): Add
- size_prepared signal.
- (gdk_pixbuf_loader_set_size) New API.
- * gdk-pixbuf-marshal.list: Add VOID:INT,INT.
- * io-jpeg.c: User cinfo->output_width/height instead of
- cinfo->image_width/height throughout when adressing the pixbuf.
- (gdk_pixbuf__jpeg_image_load_increment): Call size_func, and
- find the nearest possible output size which libjpeg can produce
- that is still larger than the desired size.
-
-2002-07-06 Matthias Clasen <maclas@gmx.de>
-
- * io-tiff.c (tiff_set_error): Handle global_error == NULL
- better.
- (tiff_image_parse): Don't trust TIFFRGBAImageBegin to set
- the "put" routine. (Fixes #87384)
- (gdk_pixbuf__tiff_image_stop_load): Don't call TIFFClose too
- early.
-
-2002-07-02 Matthias Clasen <maclas@gmx.de>
-
- Miscellaneous bmp loader fixes (#85448, #86286, #86287):
-
- * io-bmp.c (grow_buffer): New function to avoid crashes
- on unchecked reallocs.
- (DecodeHeader, DecodeColormap, decode_bitmasks,
- DoCompressed): Use grow_buffer instead of g_realloc
- throughout. Change signatures where necessary to pass the
- errors up.
- (OneLine16): Fix loading of 16bpp BI_RGB bmps.
- (DoCompressed): Rewritten to properly support BI_RLE4 and
- skips and jumps.
-
- Support for compressed ras images (#84994):
-
- * io-ras.c (RAS2State): Error on unsupported ras variations.
- (OneLine8): Fix colormap indexing.
- (OneLine): Call updated_func with proper region.
- (DoCompressed): New function, handles compressed ras data.
- (gdk_pixbuf__ras_image_load_increment): Handle compressed ras
- images.
-
- Better colorspace support for the jpeg loader (#61211):
-
- * io-jpeg.c (convert_cmyk_to_rgb): New function.
- (gdk_pixbuf__jpeg_image_load,
- gdk_pixbuf__jpeg_image_load_increment): Allocate a pixbuf with
- alpha for 4-channel jpegs and call convert_cmyk_to_rgb for these.
-
- All of this needs to be merged to GNOME 1.4 gdk-pixbuf.
-
-2002-06-28 Sven Neumann <sven@gimp.org>
-
- * gdk-pixbuf-csource.c (print_blurb): converted a Tab to spaces.
-
-Thu Jun 13 18:11:11 2002 Owen Taylor <otaylor@redhat.com>
-
- * pixops/pixops.c: Fix problem where when no alpha was
- involved, we scaled rather than composited, but then
- went ahead and composited anyways. (#76958, Patch
- from Matthias Clasen). Needs to be merged to GNOME
- 1.4 gdk-pixbuf.
-
-2002-06-13 Matthias Clasen <maclas@gmx.de>
-
- * io-jpeg.c: Use libjpeg in buffered-image mode in order to
- incrementally display incrementally loaded progressive jpegs.
-
-2002-06-07 Federico Mena Quintero <federico@ximian.com>
-
- * io-bmp.c (lsb_32):
- (lsb_16): New functions to fetch 32 or 16-bit little-endian values
- starting at a specific memory location. We do this instead of
- GINT32_FROM_LE() as the latter is simply dereferences a cast,
- which doesn't work on platforms with alignment requirements.
- Fixes #84083.
-
-2002-06-01 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-io.c (pixbuf_check_xbm): Accept xbms starting
- with a C comment - those seem to be not uncommon, e.g. the Gimp
- produces them. (#82706)
-
- * io-xbm.c (read_bitmap_file_data): Don't leak memory on certain
- invalid inputs.
- (gdk_pixbuf__xbm_image_load_real): Don't leak memory on valid inputs.
-
-2002-05-22 Tor Lillqvist <tml@iki.fi>
-
- * gdk-pixbuf-io.c (get_libdir): Use GTK_BINARY_VERSION (and not
- GTK_VERSION) in the path to the loaders on Win32, too.
-
- * Makefile.am: Pass GTK_BINARY_VERSION.
-
-2002-05-22 Federico Mena Quintero <federico@ximian.com>
-
- * io-xpm.c (pixbuf_create_from_xpm): Ahem, take the rowstride into
- account!!! Fixes #82515.
-
- [This bug is not present in the GNOME 1.4 branch as its XPM loader
- does not use gdk_pixbuf_new(); rather it malloc()s a buffer with
- no row padding and then uses gdk_pixbuf_new_from_data() on it.]
-
- [IMPORTANT: The comment above is to make my life easier when
- merging stuff across branches. If you make changes to gdk-pixbuf
- in either branch, please include a comment in the ChangeLog that
- indicates whether this should be merged into the other branch.
- Thanks!]
-
-2002-05-18 Matthias Clasen <maclas@gmx.de>
-
- * io-tiff.c (tiff_image_parse): fix packing order on bigendian
- systems. (#81702)
-
-Thu May 16 15:17:30 2002 Owen Taylor <otaylor@redhat.com>
-
- * pixops/pixops.c: Patch from Matthias Clasen to fix some typos
- (#77246)
-
-Thu May 16 15:02:46 2002 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixdata.c (gdk_pixdata_to_csource): Fix 64-bit warning.
- (#78258)
-
-2002-05-07 Michael Natterer <mitch@gimp.org>
-
- * gdk-pixbuf/Makefile.am: build the static pixbuf loaders
- conditionally like the dynamic ones so --without-lib<foo> is
- honored when building with --disable-modules. (#66867)
-
-Sun May 5 02:27:01 2002 Soeren Sandmann <sandmann@daimi.au.dk>
-
- * Makefile.am (noinst_PROGRAMS): remove test-loaders (moved to
- gtk+/tests/)
- * test-loaders.c, test-images.h: remove
-
-2002-04-24 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-io.c (gdk_pixbuf_save): Remove the ISO8859-1
- restriction from the description of png tEXt parameters.
-
- * io-png.c (png_text_to_pixbuf_option):
- (gdk_pixbuf__png_image_save): If libpng supports it,
- store and retrieve non-ISO8859-1 text as UTF-8. (#76172)
-
-2002-04-11 Matthias Clasen <maclas@gmx.de>
-
- More fixes for #77807:
-
- * io-tga.c (get_contiguous_pixbuf): Helper function to create
- a pixbuf with a contiguous pixel array while being careful about
- overflow.
-
- * io-tga.c (fill_in_context, get_image_pseudocolor,
- get_image_truecolor, get_image_grayscale): Use
- get_contiguous_pixbuf instead of manually allocating image
- storage.
-
- * io-xpm.c (pixbuf_create_from_xpm):
- * io-pnm.c (gdk_pixbuf__pnm_image_load):
- * io-jpeg.c (gdk_pixbuf__jpeg_image_load): Use gdk_pixbuf_new
- instead of manually allocating image storage.
-
-2002-04-09 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_load_module): Use
- priv->image_module->module_name instead of image_type which may
- be NULL.
-
-2002-04-06 Matthias Clasen <maclas@gmx.de>
-
- * io-png.c (gdk_pixbuf__png_image_load): Restructured to use
- gdk_pixbuf_new instead of manually allocating image storage. This
- gives us a good rowstride and overflow checks. (#77807)
-
-2002-04-05 Matthias Clasen <maclas@gmx.de>
-
- * io-tiff.c (tiff_image_parse): Avoid allocating an extra copy of
- the image by using a TIFFRGBAImage{Begin,Get,End} with suitable
- put functions instead of TIFFRGBAImage. And check image dimensions
- for overflow.
-
-2002-04-03 Matthias Clasen <maclas@gmx.de>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_get_type): Fix a doc typo.
-
-2002-03-29 Matthias Clasen <maclas@gmx.de>
-
- * io-png.c (png_simple_error_callback): libpng error handlers must
- not return to their callers, thus longjmp out. This prevents
- annoying stderr output from the default error handler.
-
-2002-03-27 Matthias Clasen <maclas@gmx.de>
-
- * io-png.c (gdk_pixbuf__png_image_stop_load): Don't leak info_ptr.
-
- * io-png.c (gdk_pixbuf__png_image_load): Get rid of unused
- end_info. Also call png_read_end to check proper ending of the png
- file and catch text chunks after the image data.
-
-2002-03-27 Matthias Clasen <maclas@gmx.de>
-
- * io-png.c (gdk_pixbuf__png_image_load,
- gdk_pixbuf__png_image_begin_load): Make libpng use g_malloc
- instead of system malloc.
-
-2002-03-26 Matthias Clasen <maclas@gmx.de>
-
- * io-tiff.c (tiff_image_parse): Don't leak pixbuf on error.
-
- * io-gif.c (gdk_pixbuf__gif_image_load_increment): Don't leak
- context->buf on error.
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_close): Make sure to call
- stop_load even for short images to prevent memleaks.
-
-2002-03-25 Matthias Clasen <maclas@gmx.de>
-
- * io-png.c (setup_png_transformations): Changed signature to
- return success and set a GError parameter, adjusted all callers.
- Also work around a possible FPE in libpng and always check that
- the new info is sane.
-
-2002-03-23 Matthias Clasen <maclas@gmx.de>
-
- * io-wbmp.c (gdk_pixbuf__wbmp_image_load_increment):
- context->updated_func is NULL during a nonincremental load.
- (gdk_pixbuf__wbmp_image_load): Stop reading after the first error.
-
-2002-03-18 Matthias Clasen <maclas@gmx.de>
-
- * io-tga.c: Fix assumptions on rowstride by manually allocating a
- contiguous pixel buffer. Catch buffer overruns in RLE-modi.
- Support grayscale + alpha (which can be written, but not read (!)
- by the Gimp).
-
-2002-03-15 Matthias Clasen <maclas@gmx.de>
-
- * io-gif.c (gif_get_frame_info): Catch invalid frame dimensions.
-
-2002-03-13 Matthias Clasen <maclas@gmx.de>
-
- * test-images.h: Add valid_ras_test and invalid_bmp_1.
-
- * test-loaders.c (main): Add random tests for ras and pnm and an
- invalid bmp which was a crasher until my 2002-03-12 commit.
-
- * io-pnm.c (gdk_pixbuf__pnm_image_load_increment): Don't unref the
- pixbuf on errors.
-
- * io-ras.c: Handle some errors.
-
-2002-03-12 Sven Neumann <sven@gimp.org>
-
- * gdk-pixbuf.c (gdk_pixbuf_fill): use sequential writes instead of
- calling memcpy(). Simpler and potentially faster. (#70332)
-
-2002-03-12 Matthias Clasen <maclas@gmx.de>
-
- * io-bmp.c (DecodeHeader): Replace a g_assert_not_reached ()
- which could actually be reached by a proper error status return.
-
-2002-03-05 Matthias Clasen <maclas@gmx.de>
-
- * test-loaders.c, test-images.h: More random tests.
-
- * io-bmp.c (DecodeHeader): Fail gracefully on OOM here.
-
-Tue Mar 5 10:39:03 2002 Owen Taylor <otaylor@redhat.com>
-
- * Makefile.am (loaderdir): Put the modules into the
- GTK_BINARY_VERSION directory for consistency with
- immodules and theme engines.
-
-Sat Mar 2 22:11:10 2002 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixbuf-io.c (_gdk_pixbuf_load_module): If we
- can't load the module using the g_module_build_path()
- filename, try loading it as a .la file.
-
- * test-loaders.c: Look for modules in current directory
- rather than .libs, so we find the right .la files.
-
- * test-loaders.c: Back out some accidental commits.
-
-Sat Mar 2 21:28:03 2002 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixbuf.c (gdk_pixbuf_new): Bullet-proof against integer
- overflow.
-
-2002-03-03 Tor Lillqvist <tml@iki.fi>
-
- * gtk-pixbuf.rc.in: Remove.
-
- * gdk_pixbuf.rc.in: Name like this instead (wrong name used by
- mistake by Hans).
-
- * makefile.msc: Corresponding changes.
-
- * Makefile.am: Use gdk_pixbuf.rc on Win32. Distribute it.
-
-2002-02-28 Matthias Clasen <maclas@gmx.de>
-
- * pixops/pixops.c (tile_make_weights): Move the call to
- correct_total() to the right spot. (#72732)
-
-Wed Feb 27 18:33:04 2002 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixdata.c (gdk_pixdata_to_csource): Use {} not
- () to group around string assigned to char[]. (#72767,
- Tomas ?gren)
-
-2002-02-21 Havoc Pennington <hp@pobox.com>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_load_module): remove
- C++-commented debug spew, reported by David L. Cooper
-
-2002-02-15 Matthias Clasen <maclas@gmx.de>
-
- * pixops/pixops.c (correct_total): New function to make sure
- that the weights sum up to the correct total without introducing
- negative weights.
- (tile_make_weights, bilinear_make_fast_weights,
- bilinear_make_weights): Use correct_total.
-
-2002-02-10 Matthias Clasen <maclas@gmx.de>
-
- * test-images.h (tiff1_test_3), test-loaders.c (main): Add a
- (#ifdef 0'ed) test provoking a segfault in TIFFReadDirectory().
-
- * io-ico.c (DecodeHeader): Check that pixbuf could be allocated.
-
- * test-images.h (ico_test_2), test-loaders.c (main): Test the
- previous change.
-
- * io-wbmp.c (gdk_pixbuf__wbmp_image_load_increment): Don't write
- beyond the end of buffer if width % 8 != 0.
-
- * io-tga.c (try_preload): Enforce that ctx->hdr->type is one of
- the supported types, otherwise parse_data_for_row () will not make
- any progress, leading to an infinite loop.
-
-Mon Feb 11 14:31:53 2002 Owen Taylor <otaylor@redhat.com>
-
- * pixops/pixops.c (bilinear_make_weights): Fix handing of
- overall alpha.
-
-2002-02-10 Matthias Clasen <maclas@gmx.de>
-
- * test-loaders.c (main): Enable some tests which should work
- now.
-
- * io-wbmp.c (gdk_pixbuf__wbmp_image_load_increment): Detect
- invalid image dimensions and insufficient memory.
-
- * io-tga.c (try_preload): Detect invalid image dimensions.
- (gdk_pixbuf__tga_stop_load): Don't try to unref NULL pointers.
-
- * io-ico.c (DecodeHeader): Detect some invalid headers and
- don't segfault.
-
-Fri Feb 8 23:11:15 2002 Owen Taylor <otaylor@redhat.com>
-
- * pixops/pixops.c: Force all weight arrays to sum exactly
- to 65535. (Fixes #70971, reported by Federico Mena Quintero)
-
- * Makefile.am (libgdk_pixbuf_1_3_la_DEPENDENCIES): Add
- libpixops.la.
-
-2002-02-08 Federico Mena Quintero <federico@ximian.com>
-
- * pixops/pixops.h: Fix comment; PixopsInterpType -> GdkInterpType.
-
-2002-02-08 Darin Adler <darin@bentspoon.com>
-
- * io-xbm.c: (next_int): Wean this from <ctype.h>.
-
-2002-02-01 Matthias Clasen <matthiasc@poet.de>
-
- * Makefile.am: Build the tga loader as a static library. (#70157)
-
- * io-ico.c: Merge 16- and 32-bit ico support from the stable
- branch. (#61179)
-
- * io-gif.c: Recomposite all images if the animation size changes
- while loading. (#70055)
-
- * gdk-pixbuf.c (gdk-pixbuf-fill): Make it work for subpixbufs.
- (#70055)
-
-Sat Jan 19 20:49:20 2002 Manish Singh <yosh@gimp.org>
-
- * io-jpeg.c, io-png.c: Made sure all the error cases involving
- jpeg or png load/saves clean themselves up properly. Marked some
- variables needed for cleanup volatile so they aren't clobbered by
- setjmp.
-
-Fri Jan 11 18:05:07 2002 Owen Taylor <otaylor@redhat.com>
-
- * pixops/pixops.c: Fix integer overflow for the values
- passed to the pixel functions. (#55148, fix from Michael Hore)
-
-Fri Jan 11 17:53:58 2002 Owen Taylor <otaylor@redhat.com>
-
- * pixops/pixops.c (pixops_scale_nearest): Remove meaningless
- FIXME.
-
- * pixops/pixops.c (pixops_process): Comment the computation
- of run_end_index and fix some edge cases.
-
- * pixops/{scale_line_22_33_mmx.S, composite_line_22_4a4_mmx.S:
- composite_line_color_22_4a4_mmx.S}: Handle the case where
- dest <= dest_end properly. (#52001, fix from Michael Hore)
-
-Thu Jan 10 16:48:30 2002 Owen Taylor <otaylor@redhat.com>
-
- * pixops/pixops.c: Replace some hardcoded values with the
- SUBSAMPLE constant used elsewhere. (#51033)
-
-Wed Jan 9 11:29:44 2002 Owen Taylor <otaylor@redhat.com>
-
- * Makefile.am (s-enum-types-h): Include glib-object.h,
- Add G_BEGIN_DECLS/END_DECLS to gdk-pixbuf-enum-types.h. (#68325,
- Mikael Hermansson)
-
- * *.h: G_BEGIN_DECLS cleanups.
-
-Tue Jan 8 10:58:04 2002 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixbuf-util.c (gdk_pixbuf_saturate_and_pixelate):
- - Massive cleanup, make actually legible.
- - Fix some clamp-to-range bugs found by Jim Cape (#68231).
- - Add a g_return_if_fail() if src and dest alpha don't match.
- - Allow for src_rowstride != dest_rowstride.
-
-2002-01-04 Hans Breuer <hans@breuer.org>
-
- * gdk_pixbuf.def : don't export functions prefixed
- with underscore
-
- * makefile.msc : use -FImsvc_recommende_pragmas.h
-
-Thu Jan 3 19:31:58 2002 Owen Taylor <otaylor@redhat.com>
-
- * pixops/pixops.c (scale_line_22_33): Fix and uncomment
- non-MMX version.
-
- * pixops/pixops.c (pixops_composite_nearest): Remove a
- division.
-
- * pixops/pixops.c (pixops_composite): Add some docs
- about the parameters.
-
- * pixops/README: Add notes about the correct algorithms
- for alpha compositing and how to implement them quickly.
-
-2001-12-29 Tor Lillqvist <tml@iki.fi>
-
- * Makefile.am (EXTRA_DIST): Add makefile.msc.
-
-Sat Dec 22 15:31:20 2001 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixdata.h: Fix trailing "," in enumeration.
-
-2001-12-17 Matthias Clasen <matthiasc@poet.de>
-
- * gdk-pixbuf.c, gdk-pixbuf-io.c, gdk-pixbuf-animation.c,
- gdk-pixbuf-data.c, gdk-pixbuf-loader.c, gdk-pixbuf-scale.c,
- gdk-pixbuf-util.c, gdk-pixdata.c: Markup fixes.
-
-2001-12-16 Havoc Pennington <hp@pobox.com>
-
- * gdk-pixbuf-scale.c: docs enhancements
-
-2001-12-14 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
-
- * io-xpm.c: Use g_ascii_strcasecmp() instead of g_strcasecmp().
-
-2001-12-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
-
- * gdk-pixbuf-animation.c, gdk-pixbuf-loader.c, gdk-pixpuf.c,
- io-gif-animation.c, io-gif.c, io-tiff.c, test-loaders.c: Remove
- assorted G_OBJECT casts where unnecessary.
-
- * gdk-pixbuf-loader.c: Call g_object_ref and g_object_unref
- instead of gdk_pixbuf_animation_ref and gdk_pixbuf_animation_unref
- resp.
-
- * gdk-pixbuf-csource.c, io-bmp.c, io-gif-animation.c, io-ico.c,
- io-jpeg.c, io-png.c, io-pnm.c, io-ras.c, io-tga.c, io-wbmp.c,
- io-xbm.c, io-xpm.c, test-gdk-pixbuf.c: Dito for gdk_pixbuf_ref and
- gdk_pixbuf_unref.
-
- * Makefile.am, pixops/Makefile.am: Compile everything with
- -DG_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED
-
- * gdk-pixdata.c: Use g_ascii_strup() instead of g_strup().
-
- * io-xpm.c: Use g_ascii_strcasecmp() instead of g_strcasecmp().
-
-2001-12-12 Matthias Clasen <matthiasc@poet.de>
-
- * gdk-pixbuf-io.c: Markup fixes.
-
-2001-12-12 Matthias Clasen <matthiasc@poet.de>
-
- * Makefile.am (INCLUDES): Define G_LOG_DOMAIN. (#66412)
-
- * gdk-pixbuf-loader.c, gdk-pixbuf-util.c: Markup fixes.
-
-2001-12-11 Michael Natterer <mitch@gimp.org>
-
- * io-png.c: gdk_pixbuf__png_image_save: removed wrong endian
- conversion stuff; don't copy RGB pixbufs' lines around before
- saving them.
-
-2001-12-05 Matthias Clasen <matthiasc@poet.de>
-
- * gdk-pixbuf.h (gdk_pixbuf_ref, gdk_pixbuf_unref,
- gdk_pixbuf_animation_ref, gdk_pixbuf_animation_unref):
- Deprecate. (#66208)
-
-Tue Dec 4 11:45:45 2001 Owen Taylor <otaylor@redhat.com>
-
- * io-xpm.c (pixbuf_create_from_xpm): Fill in color
- fields to black for transparent colors since we'll
- later initialize pixels from them. (Fixes purify
- errors, #66093, HideToshi Tajima)
-
-2001-11-30 Tor Lillqvist <tml@iki.fi>
-
- * gdk_pixbuf.def: Add gdk_pixbuf_get_option.
-
-Fri Nov 30 15:55:34 2001 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixdata.c (gdk_pixdata_deserialize): Fix
- alignment problem in deserialization, (#65785,
- reported by Hidetoshi Tajima)
-
-2001-11-28 Manish Singh <yosh@gimp.org>
-
- * gdk-pixbuf/io-bmp.c (gdk_pixbuf__bmp_image_load_increment): Fill
- in missing error parameters to DecodeHeader and DecodeColormap.
-
-2001-11-21 Federico Mena Quintero <federico@ximian.com>
-
- Fix Ximian bug #12125; merged from gdk-pixbuf stable.
-
- * gdk-pixbuf/io-bmp.c (gdk_pixbuf__bmp_image_load_increment): Use
- a simple state machine instead of a scary if/else chain.
- (DecodeHeader): Set the reading state.
- (DecodeColormap): Set the reading state.
- (decode_bitmasks): New function, decodes the bitmasks for
- BI_BITFIELDS coding.
- (OneLine32): Handle BI_BITFIELDS coding.
- (OneLine16): Likewise.
-
-2001-11-18 Hans Breuer <hans@breuer.org>
-
- * io-xpm.c : use g_strcasecmp(), some poor platforms
- don't have strcasecmp()
-
- * makefile.msc : do INCLUDE_png etc. definition here to avoid
- my temporary 'gdk-pixbuf-io-include.h' hack
-
-Sun Nov 18 07:54:22 2001 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixbuf-loader.c: Remove include of gobject/signal.h.
-
-2001-11-03 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
-
- * gdk-pixbuf-loader.c, gdk-pixbuf-scale.c: Documentation fixes.
-
-2001-10-29 Tor Lillqvist <tml@iki.fi>
-
- * Makefile.am: Use -no-undefined on Win32. Make
- libgdk_pixbuf_1_3_la_OBJECTS depend on
- gdk-pixbuf-marshal.c. Install import libraries.
-
- * gdk_pixbuf.def: Update.
-
- * gdk-pixbuf-io.c: (Win32) Use G_WIN32_DLLMAIN_FOR_DLL_NAME, saves
- the actual DLL name of libgdk_pixbuf.
- (get_libdir): Use it instead of guessing.
-
- * io-xbm.c (gdk_pixbuf__xbm_image_begin_load): Use
- g_file_open_tmp() insread of mkstemp().
-
-2001-10-18 Matthias Clasen <matthiasc@poet.de>
-
- * io-xbm.c (gdk_pixbuf__xbm_image_load_real): Don't dereference
- context when it may be NULL. (#62344)
-
-2001-10-16 Matthias Clasen <matthiasc@poet.de>
-
- * gdk-pixdata.c, gdk-pixdata.h: Documentation.
-
- * gdk-pixbuf-csource.1: Spelling fixes.
-
-Wed Oct 10 11:52:17 2001 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixdata.c gdk-pixbuf.h: Get rid of
- GDK_PIXBUF_ERROR_HEADER/PIXEL_CORRUPT and use CORRUPT_IMAGE.
- Get rid fo GD_PIXBUF_ERROR_UNKNOWN_FORMAT and use the
- existing UKNOWN_TYPE error. (#58308)
-
- * gdk-pixbuf.h, gdk-pixdata.c: Rename gdk_pixbuf_new_from_stream()
- back to gdk_pixbuf_new_from_inline(). Rework docs to try
- and be helpful for the common case. (#58308)
-
-2001-10-05 Sven Neumann <sven@gimp.org>
-
- * gdk-pixbuf/gdk-pixbuf-io.c
- * gdk-pixbuf/gdk-pixbuf-private.h
- * gdk-pixbuf/gdk-pixbuf.c
- * gdk-pixbuf/gdk-pixbuf.h
- * gdk-pixbuf/io-jpeg.c
- * gdk-pixbuf/io-png.c: changed GDK_PIXBUF_ERROR_BAD_OPTION_VALUE to
- GDK_PIXBUF_ERROR_BAD_OPTION to we can use it for bad keys too. Added
- new public API gdk_pixbuf_get_option() to retrieve key/value pairs
- set by an image loader. Added support for saving and reading PNG tEXt
- chunks in PNG images.
-
-Tue Oct 2 11:29:50 2001 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixdata.c (gdk_pixdata_to_csource): Fix indentation
- use a macro to make code a bit more readable.
-
-2001-10-02 Sven Neumann <sven@gimp.org>
-
- * gdk-pixdata.c: g_string_printfa => g_string_append_printf.
-
-Wed Sep 26 18:08:19 2001 Owen Taylor <otaylor@redhat.com>
-
- * Makefile.am (s-enum-types-h): Fix a typo in the include
- guards. (#61254, Skip Montaro)
-
-2001-09-21 Matthias Clasen <matthiasc@poet.de>
-
- * io-xpm.c (xpm_extract_color): Rewritten to handle
- xpm colormap entries more thoroughly. (#59939)
-
-2001-09-21 Hans Breuer <hans@breuer.org>
-
- * gdk-pixbuf.def : updated externals
-
- * makefile.msc : generate gdk-pixbuf-enum-types.[hc]
-
-Thu Sep 20 17:22:48 2001 Owen Taylor <otaylor@redhat.com>
-
- * io-tiff.c (gdk_pixbuf__tiff_image_load): On OSF, apparently fseek()
- works in some on-demand way, so the fseek
- gdk_pixbuf_new_from_file() doesn't work here since we are using
- the raw file descriptor. So, we call lseek() on the fileno(f)
- before using it. (#60840).
-
-2001-09-20 James Henstridge <james@daa.com.au>
-
- * Makefile.am (gdk-pixbuf-enum-types.c): same change as in pango,
- so that flags types are registered as flags rather than enums (not
- that there are any flags here at the moment).
-
-Wed Sep 19 00:28:24 2001 Owen Taylor <otaylor@redhat.com>
-
- * Makefile.am (gdk_pixbuf_headers): Don't include
- gkd-pixbuf-features.h here since is in builddir
- and confuses autogen rules.
-
- * Makefile.am: Don't += variables before they have values,
- automake-1.5 doesn't like it.
-
- * Makefile.am: Fix srcdir != builddir for gdk-pixbuf-enum-types.c.
-
- * Makefile.am: The whitespace strikes back.
-
-2001-09-17 Matt Wilson <msw@redhat.com>
-
- * Makefile.am (libpixbufloader_xbm_la_LDFLAGS): removed duplicate
- LDFLAGS definition, use the -avoid-version one.
- (libpixbufloader_tga_la_LDFLAGS): likewise
-
-Mon Sep 17 11:49:02 2001 Owen Taylor <otaylor@redhat.com>
-
- * pixops/*: Mirror GdkInterpType to PixopsInterpType
- to avoid including gdk-pixbuf headers.
-
-2001-09-16 James Henstridge <james@daa.com.au>
-
- * .cvsignore: add generated files to ignore list.
-
- * gdk-pixbuf.h: include gdk-pixbuf-enum-types.h
-
- * Makefile.am: add rules to build gdk-pixbuf-enum-types.[ch]
-
-Fri Sep 14 23:22:12 2001 Matthias Clasen <matthiasc@poet.de>
-
- * io-pnm.c (pnm_read_header): Use GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- not GDK_PIXBUF_ERROR_HEADER_CORRUPT. (#58308)
-
-Fri Sep 14 22:53:45 2001 Matthias Clasen <matthiasc@poet.de>
-
- * io-jpeg.c (gdk_pixbuf__jpeg_image_begin_load): Handle
- out-of-memory situation better.
-
- * io-pnm.c: Robustness fixes for pnm loader
-
- * io-gif.c: Make gif loader survive TEST_RANDOMLY_MODIFY
-
- * io-xpm.c (parse_color): detect very long color strings
-
- All of the above from Matthias Clasen <matthiasc@poet.de>,
- the remaining from Soeren Sandmann <sandmann@daimi.au.dk>.
-
- * test-images.h: add tests:
- - four valid ppm's, eight invalid (matthiasc@poet.de)
- - one invalid xpm (matthiasc@poet.de)
- - one valid tga, one invalid (sandmann@daimi.au.dk)
- - one invalid tiff (sandmann@daimi.au.dk
-
- * test-loaders.c: enable tests for ppm, png, gif, tga, tiff, xpm
-
- * io-tiff.c (gdk_pixbuf__tiff_image_stop_load): TIFFClientOpen can
- fail - detect it when it happens
-
- * io-tga.c (gdk_pixbuf__tga_load_increment): Fail if there is too
- much data in file
-
- * gdk-pixbuf-io.c: moved wbmb check after ico check to avoid false
- positives
-
-Fri Sep 14 00:30:48 2001 Tim Janik <timj@gtk.org>
-
- * Makefile.am: don't used BUILT_SOURCES to build marshal
- files, as in conjunction with stamp files, this can
- lead to endless rebuilding loops.
-
-Tue Sep 4 00:22:07 2001 Owen Taylor <otaylor@redhat.com>
-
- * Makefile.am: Fix EXTRA_DIST for gdk-pixbuf-csource.1
-
-Tue Sep 4 03:09:52 2001 Tim Janik <timj@gtk.org>
-
- * gdk-pixbuf-csource.1: new file, manual page for
- the publically installed gdk-pixbuf-csource utility.
-
-Thu Aug 30 08:30:03 2001 Matthias Clasen <matthiasc@poet.de>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_close): Propagate
- errors from gdk_pixbuf_loader_load_module.
-
-Thu Aug 30 08:27:37 2001 Matthias Clasen <matthiasc@poet.de>
-
- * io-png.c (png_row_callback): Check that row_num is valid.
-
-Tue Aug 28 21:05:26 2001 Matthias Clasen <matthiasc@poet.de>
-
- * io-bmp.c (OneLine): Emit area_updated signal with proper
- area information. (#52002)
-
-Tue Aug 28 20:03:43 2001 Matthias Clasen <matthiasc@poet.de>
-
- * test-loaders.c (test_loader): Catch errors at close time.
- * test-loaders.c (main): Remove C++ comments.
-
-2001-08-21 Matthias Clasen <matthiasc@poet.de>
-
- * Makefile.am, gdk-pixbuf-io.c, pixbufloader_tga.def,
- io-tga.c: Add tga loader, patch by Nicola Girardi. (#56067)
-
-2001-08-20 Matthias Clasen <matthiasc@poet.de>
-
- * test-images.h, test-loaders.c: Add ico and wbmp tests.
- * io-jpeg.c (gdk_pixbuf__jpeg_image_save): Fail with a suitable
- error if buffer allocation fails.
- * io-ico.c: Make .ICO loader more robust.
- All of these are due to sandmann@daimi.au.dk (#50187)
-
-2001-08-19 Sven Neumann <sven@gimp.org>
-
- * pixops/pixops.c: applied some simple but effective optimizations
- to pixops_composite_nearest() and pixops_composite_color_nearest().
-
-2001-08-07 Sven Neumann <sven@gimp.org>
-
- * gdk-pixbuf.c (gdk_pixbuf_fill): a comment asked to optimize this
- function, so that's what I did.
-
-2001-08-06 Kjartan Maraas <kmaraas@gnome.org>
-
- * gdk-pixdata.c: Fix a typo.
-
-2001-07-30 Hans Breuer <hans@breuer.org>
-
- * pixops/makefile.msc : new file
- * makefile.msc : use it to complete the build
-
-2001-07-20 Hans Breuer <hans@breuer.org>
-
- * gdk-pixdata.c : don't 'g_tohl (*istream++)', but move
- pointer increment out of the macro, because at least one
- compiler (msvc 5.0) gets confused otherwise (applies the
- wrong increment).
-
- * gdk_pixbuf.def : updated exports
-
- * makefile.msc : reflect gdk-pixbuf-csource changes
-
-2001-07-17 Darin Adler <darin@bentspoon.com>
-
- * gdk-pixbuf-csource.c: Add missing <stdlib.h> include.
- * io-png.c: (setup_png_transformations): Add ifdef so we compile
- without warnings with G_DISABLE_CHECKS on.
- * io-pnm.c: (gdk_pixbuf__pnm_image_load_increment): Add a missing
- const.
- * io-wbmp.c: (getin), (get_mbi): Add a missing const.
- * io-xbm.c: (gdk_pixbuf__xbm_image_load_real): Get rid of some
- unused locals and add an initial value to quiet the compiler's
- unintialized variable warning.
- * pixops/pixops.c: Put an ifdef around some dead code.
-
-Thu Jul 5 10:17:15 2001 Owen Taylor <otaylor@redhat.com>
-
- * pixops/Makefile.am (noinst_LTLIBRARIES): Switch
- over to the new include flags AC_SUBST(). (Problem
- pointed out by Mikael Hermansson.)
-
-2001-06-29 Havoc Pennington <hp@redhat.com>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init): fix for
- G_DISABLE_COMPAT
-
-Thu Jun 28 21:54:19 2001 Owen Taylor <otaylor@redhat.com>
-
- * make-inline-pixbuf.c test-gdk-pixbuf.c test-loaders.c
- gdk-pixbuf-csource.c: Fix args to g_type_init ().
-
-2001-06-28 Havoc Pennington <hp@pobox.com>
-
- * gdk-pixdata.c: <string.h>
-
- * gdk-pixbuf-io.c (get_libdir): fix typo in dll name (aren't we
- also leaking memory here from g_strdup_printf?)
-
-Tue Jun 26 09:48:02 2001 Tim Janik <timj@gtk.org>
-
- * Makefile.am (noinst_PROGRAMS): get rid of make-inline-pixbuf
-
- * gdk-pixbuf-data.[hc]: provide gdk_pixbuf_new_from_stream()
- instead from gdk_pixbuf_new_from_inline().
-
- * gdk-pixdata.[hc]: auxillary GdkPixdata structure, public
- installed API for applications that need to serialize/deserialize
- on their own (gimp, BEAST).
-
- * gdk-pixbuf/gdk-pixbuf-csource.c: provide publically installed
- program that can dump images in CSource format and Pixbuf
- stream format. supports RLE encoding, MACRO formatting etc...
- invoke with --help.
-
-Mon Jun 25 00:28:11 2001 Owen Taylor <otaylor@redhat.com>
-
- * Makefile.am: Actually update timestamps, so rules don't
- constantly run.
-
-2001-06-11 Havoc Pennington <hp@redhat.com>
-
- * Makefile.am (stamp-gdk-pixbuf-marshal.c): glib_genmarshal
- already includes top_builddir
-
-2001-06-08 Havoc Pennington <hp@redhat.com>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_load_module): remove
- bogus g_return_if_fail
-
- * io-gif.c (gif_get_lzw): if delay time is 0 or smaller than
- likely timeout resolution, set it to an arbitrarily-chosen short
- delay.
- Fixes bug #55953 from warmenhoven@yahoo.com
-
-2001-06-07 Havoc Pennington <hp@redhat.com>
-
- * Makefile.am: use Owen's new way of doing stampfiles/generated
- sources
-
-2001-06-07 Havoc Pennington <hp@redhat.com>
-
- * Makefile.am (gdk-pixbuf-marshal.c): fix up the glib-genmarshal path
-
-2001-06-05 Havoc Pennington <hp@redhat.com>
-
- * test-loaders.c (main): use putenv not setenv, reported by
- Armin Theissen
-
-2001-05-08 Havoc Pennington <hp@redhat.com>
-
- * gdk-pixbuf-util.c (gdk_pixbuf_add_alpha): docs fixup,
- and fix behavior to still subst color if the original image
- had alpha
-
-2001-06-04 Havoc Pennington <hp@redhat.com>
-
- * io-pnm.c (pnm_skip_whitespace): patch from Szekeres Istvan,
- bug #52560
-
-2001-06-01 Havoc Pennington <hp@redhat.com>
-
- Apply patch from sandmann@daimi.au.dk, with some tweaks.
- Makes things a bit more robust, and adds test-loaders.c
- which is good for finding further robustness bugs to fix.
-
- * io-tiff.c: Try to work around libtiff suckiness a bit;
- put a giant thread lock on the whole loader,
- paranoically check both whether error handlers were called and
- also whether functions return false. Handle case where width or
- height is 0. Various cleanups.
-
- * io-png.c (gdk_pixbuf__png_image_stop_load): only unref pixbuf
- if it existed
- (png_error_callback): apparently libpng expects you to longjmp out
- of this thing?
-
- * io-gif.c (struct _GifContext): remove unused "pixbuf" field
- (lzw_read_byte): change "Mail jrb if this fails" g_warning
- to a g_set_error()
- (gif_get_lzw): check for out-of-memory
- (gif_prepare_lzw): catch/report an error
- (new_context): use try_malloc, since GifContext is nearly 70K
- (gdk_pixbuf__gif_image_load_increment): set context->buf to NULL
- so we don't crash later.
-
- * Makefile.am: Add test-loaders
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_close): handle context ==
- NULL due to errors
-
-2001-05-29 Darin Adler <darin@eazel.com>
-
- * gdk-pixbuf.h: Fix prototype to use "(void)" instead of "()".
-
-Mon May 28 14:21:35 2001 Jonathan Blandford <jrb@redhat.com>
-
- * io-bmp.c: Patch from Helmethead <hoshem@mel.comcen.com.au> to
- fix up bmp decoder to:
- - adds 16 bpp bmp support (bug #53884)
- - adds OS/2 1.x format bmp support (bug #54964)
- - adds 4 bpp RLE compressed bmp support
- - adds 1 bpp colormap support
- - fixes negative height (top down) bmp support
-
-2001-05-25 Hans Breuer <hans@breuer.org>
-
- * gdk_pixbuf.def : reflect Havoc's recent api change
-
-Sun May 20 12:53:49 2001 Owen Taylor <otaylor@redhat.com>
-
- * Makefile.am (libgdk_pixbuf_1_3_la_LDFLAGS): Remove an
- excess $(GLIB_LIBS).
-
-Sun May 13 11:59:11 2001 Owen Taylor <otaylor@redhat.com>
-
- * Makefile.am: Make modules depend on libgdk_pixbuf.la.
-
-2001-05-04 Havoc Pennington <hp@redhat.com>
-
- * pixops/pixops.c (pixops_process): merge fix from stable: Patch
- from hoshem@mel.comcen.com.au to fix nonzero X offsets. Fixes
- bug #50371.
-
- * gdk-pixbuf/pixops/pixops.c (pixops_composite_nearest): merge
- from stable: Patch from OKADA Mitsuru <m-okada@fjb.co.jp> to fix
- confusion of using "src" instead of "p".
- (pixops_composite_color_nearest): Use a more accurate (and
- correct, to begin with) compositing method. This cures checks
- showing through on images with no alpha.
-
- * gdk-pixbuf.c (gdk_pixbuf_fill): fix bug that left some trailing
- bytes unfilled.
-
- * gdk-pixbuf-io.h: fix UpdatedNotifyFunc to use signed ints
-
- * gdk-pixbuf-loader.h (struct _GdkPixbufLoaderClass): Change
- area_updated signal to use signed ints. Removed animation-related
- signals.
-
- * io-gif.c, io-gif-animation.h, io-gif-animation.c: Massive
- rewrite action
-
- * gdk-pixbuf-animation.c: Add GdkPixbufAnimationIter to abstract
- all the pesky details. Remove old frame-based API. Make
- GdkPixbufAnimation an abstract base class, derived by the loaders.
-
-Sun Apr 22 15:51:32 2001 Owen Taylor <otaylor@redhat.com>
-
- * Makefile.am (LDADDS): Add $(MATH_LIB).
-
-2001-04-18 Havoc Pennington <hp@redhat.com>
-
- * gdk-pixbuf.c (gdk_pixbuf_fill): Function to fill pixbuf with a
- given color.
-
-Wed Apr 4 01:41:02 2001 Tim Janik <timj@gtk.org>
-
- * pixops/Makefile.am (noinst_LTLIBRARIES): include $top_srcdir
- so we don't try to get <gtk/gtkobject.h> from standard search
- paths.
-
- * Makefile.am (gdk-pixbuf-marshal.c): use deps from srcdir.
- add gdk-pixbuf-marshal.list to EXTRA_DIST.
- take gdk-pixbuf-marshal.h out of _la sources.
-
-2001-03-19 Tor Lillqvist <tml@iki.fi>
-
- * makefile.mingw.in: Handle gdk-pixbuf-marshal.c.
-
- * gdk_pixbuf.def: Update.
-
- * pixbufloader_*.def: Just export the fill_vtable functions now.
-
-2001-03-18 Mike Kestner <mkestner@ameritech.net>
-
- * make-inline-pixbuf.c (main): Added logic to remove output when
- failures occur.
-
-2001-03-14 Havoc Pennington <hp@redhat.com>
-
- * Makefile.am (gdk-pixbuf-marshal.c): Use different temporary file
- from gdk-pixbuf-marshal.h, fixes parallel makes.
-
-Thu Mar 1 04:01:57 2001 Tim Janik <timj@gtk.org>
-
- * test-gdk-pixbuf.c: fixed includes.
-
-2001-02-18 Havoc Pennington <hp@pobox.com>
-
- * gdk-pixbuf-io.c (gdk_pixbuf_load_module): prepend underscore
- (gdk_pixbuf_get_named_module): prepend underscore
- (gdk_pixbuf_get_module): prepend underscore
-
-2001-02-19 Havoc Pennington <hp@redhat.com>
-
- * gdk-pixbuf-io.c (gdk_pixbuf_load_module): const fix
-
-2001-02-17 Havoc Pennington <hp@pobox.com>
-
- * gdk-pixbuf-loader.c (gdk_pixbuf_loader_new_with_type): docs
-
-2001-02-07 Alexander Larsson <alexl@redhat.com>
-
- * io-xpm.c (free_buffer):
- Use g_free, since the buffer is allocated with g_try_alloc().
-
-2001-02-06 Christophe Merlet <redfox@eikonex.org>
-
- * gdk-pixbuf-data.c: Fixes a minor typo.
-
-Sun Feb 4 07:59:57 2001 Tim Janik <timj@gtk.org>
-
- * gdk-pixbuf.h: DOH! don't include glib/gobject.h but glib-object.h,
- we finally need the gobject->gruntime rename.
-
- * *.c: scratched calls to g_type_init(), there's simply no point in
- doing that, use gtk_init().
-
-2001-02-01 Havoc Pennington <hp@pobox.com>
-
- * gdk-pixbuf-loader.c, gdk-pixbuf-loader.h: rename "private" field
- in struct to "priv" for C++
-
-2001-01-31 Havoc Pennington <hp@pobox.com>
-
- * gdk-pixbuf.c: include glib-object.h instead of gvaluetypes.h
-
-2001-01-26 Havoc Pennington <hp@redhat.com>
-
- * gdk-pixbuf-io.c (mname): fix included modules case.
-
-2001-01-22 Havoc Pennington <hp@redhat.com>
-
- * gdk-pixbuf-io.c (gdk_pixbuf_new_from_xpm_data): check errors
- from gdk_pixbuf_load_module
-
-2001-01-22 Havoc Pennington <hp@redhat.com>
-
- * Makefile.am: Add built marshaller files to support
- GdkPixbufLoader signals
-
- * gdk-pixbuf-io.c (gdk_pixbuf_load_module): have
- GDK_PIXBUF_MODULEDIR unconditionally replace the compiled-in
- module location, rather than acting as a fallback, because we are
- using GDK_PIXBUF_MODULEDIR to use gdk-pixbuf before installing it.
-
- * gdk-pixbuf.h: include gdk-pixbuf-loader.h
-
- * gdk-pixbuf-loader.h, gdk-pixbuf-loader.c: Move back over here
- from gtk, and add error to close(), because stop_load may do
- parsing of the image.
-
- * pixops/have_mmx.S (_pixops_have_mmx): add newline at end of file
-
- * io-*.c: make individual operations static, and add fill_vtable
- functions which are exported. Fix the collection of type warnings
- that surfaced, including a number of functions that didn't
- properly take a GError and some that weren't
- const-correct. Involved adding error handling for a few loaders.
-
- * gdk-pixbuf-io.h: Add error reporting to stop_load function
-
- * gdk-pixbuf-io.c (gdk_pixbuf_load_module): change to just look up
- a function that fills in the GdkPixbufModule vtable, instead of
- looking up all the image functions individually; this means we
- can get type safety within modules for the loader functions.
- Also it means you don't have to keep the statically compiled and
- GModule versions in sync.
-
- * test-gdk-pixbuf.c (main): remove gdk_pixbuf_init()
-
- * make-inline-pixbuf.c (main): remove call to gdk_pixbuf_init()
-
- * gdk-pixbuf.h: nuke gdk_pixbuf_init()
-
- * gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_type): g_type_init
- () here
-
- * gdk-pixbuf.c (gdk_pixbuf_get_type): g_type_init () here
-
- * gdk-pixbuf-animation.c (gdk_pixbuf_animation_get_type):
- g_type_init() here
-
-2001-01-20 John Harper <jsh@eazel.com>
-
- * io-xbm.c: new pixbuf loader, for X bitmap files. Basically a
- collision between Xlib's RdBitF.c and io-tiff.c
-
- * gdk-pixbuf-io.c, Makefile.am, pixbufloader_xbm.def: added
- io-xbm.c support
-
- [ merged from stable gdk-pixbuf module. Untested, but it
- compiles, and works fine in the stable module ]
-
-2001-01-18 Tor Lillqvist <tml@iki.fi>
-
- * gdk-pixbuf-io.c (get_libdir): (Win32) Use the new
- g_win32_get_package_installation_subdirectory() function. No need
- to include windows.h.
- (gtk_win32_get_installation_directory): Remove this then.
-
-2001-01-01 Havoc Pennington <hp@redhat.com>
-
- * Makefile.am (libgdk_pixbuf_1_3_la_LDFLAGS): add
- @LIBTOOL_EXPORT_OPTIONS@
-
-2000-12-30 Tor Lillqvist <tml@iki.fi>
-
- * gdk_pixbuf.def: Update.
-
-2000-12-16 Havoc Pennington <hp@pobox.com>
-
- * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): ref
- the pixbuf in the frame, so we can use gdk_pixbuf_frame_free
- (gdk_pixbuf_frame_copy): new function
- (gdk_pixbuf_frame_free): new function
- (gdk_pixbuf_frame_get_type): new function
- (GDK_TYPE_PIXBUF_FRAME): macro to get type for GdkPixbufFrame
-
-Tue Nov 14 11:51:26 2000 Owen Taylor <otaylor@redhat.com>
-
- * Makefile.am: Add -avoid-version for all modules.
-
-2000-11-13 Havoc Pennington <hp@redhat.com>
-
- * io-png.c (png_simple_error_callback): fix error message to not
- say "save" since it's used for loading
-
-2000-11-11 Hans Breuer <Hans@Breuer.Org>
-
- * gdk-pixbuf-io.c : Fix all function prototype macros for self
- contained image handlers (!USE_G_MODULE). Files to save should
- be opened in binary mode, fopen(s, "wb").
-
- * io-xpm.c : added HAVE_UNISTD_H condition
-
-2000-11-11 Tor Lillqvist <tml@iki.fi>
-
- * gdk_pixbuf.def: Add gdk_pixbuf_new_subpixbuf.
-
- * io-tiff.c (gdk_pixbuf__tiff_image_begin_load): Use
- g_file_open_tmp() (just added to GLib) instead of mkstemp() (or
- mktemp() and open()).
-
- * io-xpm.c (gdk_pixbuf__xpm_image_begin_load): Ditto.
-
-2000-11-01 Havoc Pennington <hp@pobox.com>
-
- * gdk-pixbuf.c (gdk_pixbuf_new_subpixbuf): New function to create
- a pixbuf pointing to a subregion of another pixbuf.
-
-2000-10-16 Tor Lillqvist <tml@iki.fi>
-
- * gdk-pixbuf-io.c: Define also m_save (for the non-gmodule case).
-
-2000-10-16 Havoc Pennington <hp@redhat.com>
-
- * gdk-pixbuf-io.c (gdk_pixbuf_get_module)
- (gdk_pixbuf_get_named_module) (gdk_pixbuf_load_module):
- add error reporting here also
-
- * make-inline-pixbuf.c (main): use GError
-
- * io-xpm.c: include unistd.h
-
- * gdk-pixbuf-util.c: include string.h
-
- * io-*.c: add error reporting
-
- * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file): add
- error reporting
-
- * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Add error reporting
-
- * gdk-pixbuf-io.h: Add GError** to load_increment and load
- methods
-
- * gdk-pixbuf-io.c (gdk_pixbuf_save) (gdk_pixbuf_savev): return
- a G_FILE_ERROR if we fail to write or close the file.
-
- * gdk-pixbuf.h: remove GDK_PIXBUF_ERROR_IO, instead we'll use
- G_FILE_ERROR_*. Rename enum to GdkPixbufError, properly following
- the GError naming rules. Add GError** to load functions.
-
-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
- * pixbufloader_jpeg.def
- * pixbufloader_png.def: Add new entry points.
-
- * makefile.mingw.in: Use libintl.
-
-2000-10-06 Havoc Pennington <hp@redhat.com>
-
- * gdk-pixbuf-io.c (gdk_pixbuf_save): s/format/type/g to be
- consistent with gdk_pixbuf_loader_new_with_type().
- Return runtime error if a module is missing.
-
- * gdk-pixbuf.h: add GDK_PIXBUF_ERROR_UNKNOWN_TYPE
-
-2000-10-05 Havoc Pennington <hp@redhat.com>
-
- Pixbuf saving, patch from David Welton.
-
- * Makefile.am (GDK_PIXBUF_LIBS): add INTLLIBS
- (libgdk_pixbuf_1_3_la_SOURCES): add gdk-pixbuf-i18n.h
-
- * gdk-pixbuf-i18n.h: Add _() to gdk-pixbuf
-
- * io-png.c (gdk_pixbuf__png_image_save): PNG save routine.
-
- * io-jpeg.c (gdk_pixbuf__jpeg_image_save): JPEG save routine.
-
- * gdk-pixbuf-io.c (gdk_pixbuf_save):
- (gdk_pixbuf_savev): Implement pixbuf saving routines
-
- * gdk-pixbuf.c (gdk_pixbuf_error_quark): pixbuf error quark
- function
-
- * gdk-pixbuf.h: Add public save routines; add pixbuf error
- types
-
- * gdk-pixbuf-io.h: Add save function to GdkPixbufModule
-
-2000-10-05 Dan Winship <danw@helixcode.com>
-
- * io-png.c, io-tiff.c, io-xpm.c: Fix comments to not claim that
- all three of these files are the JPEG image loader. (From
- gdk-pixbuf module.)
-
-2000-10-03 Tor Lillqvist <tml@iki.fi>
-
- * makefile.mingw.in: Add rule for make-inline-pixbuf. Use
- gdk-pixbuf's version number in the rule for makefile.mingw itself.
-
- * gdk_pixbuf.def: Add new entry points.
-
-2000-09-26 Havoc Pennington <hp@redhat.com>
-
- * gdk-pixbuf-util.c (gdk_pixbuf_saturate_and_pixelate): Add this
- function here, instead of putting it in a private GTK+ file.
-
- * gdk-pixbuf-private.h (GdkPixbufInlineFormat): include an
- enum here for the known formats of inlined pixbufs.
- Also, #define our file magic here.
-
-2000-06-23 Havoc Pennington <hp@redhat.com>
-
- * make-inline-pixbuf.c: Small program that creates C variable
- declarations of inline pixbuf data. This can be read
- by gdk_pixbuf_new_from_inline.
-
- * gdk-pixbuf.h (gdk_pixbuf_new_from_inline): New function to read
- inline pixbuf data and create a pixbuf from it.
-
- * gdk-pixbuf-data.c (gdk_pixbuf_new_from_inline): implement here
-
-2000-09-07 Tor Lillqvist <tml@iki.fi>
-
- * makefile.mingw.in: Use own version number for gdk-pixbuf DLLs,
- like on Unix.
-
-2000-08-12 Tor Lillqvist <tml@iki.fi>
-
- * gdk_pixbuf.def: Add missing entry point.
-
-2000-08-10 Havoc Pennington <hp@redhat.com>
-
- * Makefile.am (EXTRA_DIST): The *.def files had the wrong names
- (s/pixbuf_/pixbufloader_)
-
-2000-08-02 Tor Lillqvist <tml@iki.fi>
-
- * io-bmp.c
- * io-ico.c
- * io-ras.c
- * io-tiff.c
- * io-wbmp.c: Conditionalise inclusion of <unistd.h>.
-
- * makefile.mingw.in: List loaders alphabetically. Add the wbmp
- one. Fix names of DLLs to have '-' instead of '_'.
-
-2000-07-31 Elliot Lee <sopwith@redhat.com>
- * io-wbmp.c: Some bug fixes - now tested to work.
-
-2000-07-27 Elliot Lee <sopwith@redhat.com>
-
- * gdk-pixbuf-io.h, gdk-pixbuf-io.c: Add
- gdk_pixbuf_get_named_module() function to facilitate above change
- * io-wbmp.c, pixbufloader_wbmp.defs, gdk-pixbuf-io.c, Makefile:
- Implement loader for WBMP format.
- * io-bmp.c: Don't malloc a temporary buffer - use stack instead.
-
-2000-07-23 Tor Lillqvist <tml@iki.fi>
-
- Win32 build setup:
-
- * makefile.mingw.in
- * pixops/makefile.mingw.in
- * pixbuf_*.def: New files.
-
- * Makefile.am
- * pixops/Makefile.am: Add them. Add rule to generate makefile.mingw.
-
- * gdk-pixbuf-io.c (gtk_win32_get_installation_directory):
- New function, to get the GTK+ installation directory from
- the Windows Registry, where the installation program
- for whatever software includes GTK+ has stored it.
-
- Used to avoid having hardcoding the directory where to look for
- loaders. This function is needed by gtk, too, so it should
- really be just in one place. Maybe a small static library
- one level up from here?
-
- * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file)
- * gdk-pixbuf-io.c (gdk_pixbuf_new_from_file):
- Open file in binary mode. This *is* standard C. (No-op on Unix,
- of course.)
-
- * io-jpeg.c: If we don't HAVE_SIGSETJMP, use normal setjmp().
-
- * io-tiff.c: Use g_get_tmp_dir(). If we don't HAVE_MKSTEMP, use
- mktemp() and open().
- (gdk_pixbuf__tiff_image_stop_load): g_free() also the tempname.
-
- * pixops/*.S: The Gas from mingw32 doesn't like the .type
- pseudo-op. Conditionalise on __MINGW32__, but probably
- should conditionalise on Gas version instead? Or could we
- do without .type on all systems?
-
- * pixops/timescale.c: Use g_get_current_time()
- instead of gettimeofday().
-
-Sat Jul 22 10:57:22 2000 Owen Taylor <otaylor@redhat.com>
-
- * Makefile.am (test_gdk_pixbuf_LDADD): Remove -lgmodule
-
-Tue Jul 11 11:26:42 2000 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixbuf.c: Add <string.h> include.
-
-Tue Jul 11 06:20:14 2000 Tim Janik <timj@gtk.org>
-
- * io-gif.c (gdk_pixbuf__gif_image_load_animation):
- * gdk-pixbuf-data.c (gdk_pixbuf_new_from_data):
- * gdk-pixbuf-animation.c (gdk_pixbuf_animation_new_from_file):
- use g_object_new() instead of g_type_create_instance() which
- is a private function for fundamental type implementations.
-
-Thu Jul 6 11:49:47 2000 Owen Taylor <otaylor@redhat.com>
-
- * Makefile.am (libgdk_pixbuf_la_LDFLAGS): Use GTK+ version
- soname scheme for gdk-pixbuf.
-
-2000-06-21 Havoc Pennington <hp@pobox.com>
-
- * gdk-pixbuf.c: Convert GdkPixbuf to GObject, leaving it opaque
- (i.e. derivation is not allowed, and there are no virtual methods
- anyway).
- (gdk_pixbuf_preinit): Call g_type_init() here.
- (gdk_pixbuf_init): Add a user-friendly init function, for users
- of standalone gdk-pixbuf
-
- * gdk-pixbuf-animation.c: Convert to GObject, in the same
- way GdkPixbufAnimation was done.
-
- * gdk-pixbuf.h: Remove gdk_pixbuf_set_unref_handler() and
- gdk_pixbuf_finalize() from API, since these are broken and don't
- make sense with new GObject stuff.
-
-Wed Jun 21 16:02:48 2000 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixbuf-io.c (gdk_pixbuf_load_module): Add feature to
- support a GDK_PIXBUF_MODULEDIR env variable as a secondary
- load location.
-
-2000-06-10 Federico Mena Quintero <federico@helixcode.com>
-
- * demo/pixbuf-demo.c: It was cold and rainy this Saturday morning,
- so I needed something to warm my thighs. Running plain infinite
- loops on your laptop to make it hot is not very much fun. A demo
- of the gdk-pixbuf scaling functions is way better, and looks
- prettier, too.
-
- * configure.in (AC_OUTPUT): Added the demo Makefile.
-
- * Makefile.am (SUBDIRS): Added the demo directory.
-
-2000-06-09 Larry Ewing <lewing@helixcode.com>
-
- * gdk-pixbuf/io-png.c (gdk_pixbuf__png_image_load_increment):
- setjmp for the png error handler. It seems setting the error
- handling functions does not avoid the jump, and so not calling
- setjmp was causing the incremental loader to jump into lala land.
- (gdk_pixbuf__png_image_begin_load): setjmp for error handling, I'm
- not sure this one is actually required but the docs say it must be
- set for every call to a png_* function.
- Also changed the comment to reflect the fact that setting the
- error handlers does _not_ avoid the longjmp.
-
-2000-06-06 Larry Ewing <lewing@helixcode.com>
-
- * gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_frame_done):
- take frame offest into account when trying to calculate the
- animation bbox. Also set the width to the width not the height.
- (gdk_pixbuf_loader_animation_done): cycle over the frames to
- calculate bbox because now we finally have all the offset
- information for each frame.
-
-2000-06-05 Mathieu Lacage <mathieu@gnome.org>
-
- * configure.in: add some gtk parameters to the
- GDK_PIXBUF_LIB?�?S and GDK_PIXBUG_INCLUDEDIR vars. One more
- fight in my crusade for strange prefix compile...
-
-2000-05-30 Not Zed <NotZed@HelixCode.com>
-
- * gdk-pixbuf/io-jpeg.c (gdk_pixbuf__jpeg_image_begin_load):
- Initialise the error handler exit routine to our own. Note this
- means that every function that accesses the jpeg lib on this
- object MUST do a setjmp.
- (gdk_pixbuf__jpeg_image_stop_load): setjmp before accessing jpeg
- lib for handling fatal error.
- (gdk_pixbuf__jpeg_image_load_increment): And here too. So now
- your applications dont quit if there's a jpeg error!
-
-2000-05-30 Federico Mena Quintero <federico@helixcode.com>
-
- * gdk-pixbuf.spec.in: Include all the loader libraries. Patch
- from Frank de Lange <frank@unternet.org>.
-
-2000-05-09 Darin Adler <darin@eazel.com>
-
- * gdk-pixbuf/test-gdk-pixbuf.c:
- Fixed includes to get rid of accidental GNOME dependency.
-
-2000-05-26 Cody Russell <car0969@gamma2.uta.edu>
- * Makefile.am: Added gdk-pixbuf.spec to EXTRA_DIST
-
-2000-05-22 Federico Mena Quintero <federico@helixcode.com>
-
- * configure.in: Bumped version number to 0.8.0.
-
- * doc/Makefile.am (content_files): The toplevel gdk-pixbuf.sgml
- file was not being distributed.
-
- * gdk-pixbuf/pixops/Makefile.am (EXTRA_DIST): Added DETAILS.
-
-2000-05-09 Darin Adler <darin@eazel.com>
-
- * gdk-pixbuf/gdk-pixbuf-drawable.c: (rgb565lsb), (rgb565msb),
- (rgb565alsb), (rgb565amsb), (rgb555lsb), (rgb555msb), (rgb555alsb),
- (rgb555amsb), (convert_real_slow): Change all conversion from 16-bit
- formats to 32-bit formats to re-use the high bits of the color values
- so that white maps to full white.
-
-Fri May 5 12:16:32 2000 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixbuf/pixops/DETAILS: Add beginnings of file with
- detailed information about the structure and algorithms
- of pixops so people can fix it instead of breaking it.
-
-2000-05-04 Darin Adler <darin@eazel.com>
-
- * gdk-pixbuf/pixops/pixops.c: (pixops_composite_nearest),
- (composite_pixel), (composite_line):
- * gdk-pixbuf/test-gdk-pixbuf.c: (simple_composite_test_one_type):
- Now that Owen explained the algorithm, I think I implemented it
- right for the cases where the destination pixbuf is not opaque.
- The test does seem to confirm it.
-
-2000-05-04 Darin Adler <darin@eazel.com>
-
- * gdk-pixbuf/.cvsignore:
- * gdk-pixbuf/Makefile.am:
- * gdk-pixbuf/test-gdk-pixbuf.c (store_pixel), (fill_with_pixel),
- (load_pixel), (simple_composite_test_one),
- (simple_composite_test_one_type), (simple_composite_test), (main):
- Added some tests of composite to highlight problems in the old
- implementation. These tests run without any user interaction.
- Just do "make check".
-
- * gdk-pixbuf/pixops/pixops.c (pixops_composite_nearest),
- (composite_pixel), (composite_line): Fix composite to do a textbook
- "A over B" composite. This was clearly the intent, and it was easy
- to fix the code to do it. (Note to those that read my earlier tries
- at a patch; this version fixes typos that were present in all
- my patch attempts. I checked the final version by adding more tests.)
-
-2000-04-22 05:27:43 2000 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixbuf/pixops/pixops.c (pixops_scale_nearest): Properly
- offset y coordinate accordining to render_y0.
-
- * gdk-pixbuf/gdk-pixbuf-scale.c: Properly handle nonzero
- dest_x, dest_y.
-
-2000-04-22 James Henstridge <james@daa.com.au>
-
- * gdk-pixbuf.spec.in (%files): moved %{prefix}/bin/* from the main
- package to the devel package. The only file installed in bin is
- gdk-pixbuf-config, which belongs in -devel. This should allow having
- multiple versions of the main gdk-pixbuf package installed.
-
-2000-04-17 Karl Eichwalder <ke@suse.de>
-
- * gdk-pixbuf/Makefile.am (INCLUDES): Add $(GNOME_CFLAGS).
- Reported by Jens Finke.
-
-2000-04-14 Tomasz K?�?opczko <kloczek@pld.org.pl>
-
- * gdk-pixbuf/pixops/makefile.am: $(LIBART_CFLAGS) replaced by
- $(GTK_CFLAGS) - now gdk-pixbuf compiles correctly.
-
-2000-04-13 James Henstridge <james@daa.com.au>
-
- * configure.in: when performing the configure check to see if
- gmodule works, set CFLAGS to GLIB_CFLAGS and LIBS to GLIB_LIBS,
- rather than the other way round. Also, call AC_MSG_RESULT in the
- even that dynamic modules were not supported.
-
-2000-04-12 Federico Mena Quintero <federico@helixcode.com>
-
- This comes from an excellent idea by Tim Janik (timj@gtk.org) to
- hook to the last unref operation.
-
- * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_set_last_unref_handler): New
- function to set the last unref handler for a pixbuf.
- (gdk_pixbuf_finalize): New function to actually finalize a pixbuf.
- It calls the pixbuf's destroy notification function and frees the
- GdkPixbuf structure itself.
- (gdk_pixbuf_unref): Use the last unref function of the pixbuf if
- available.
-
- * gdk-pixbuf/gdk-pixbuf-private.h (struct _GdkPixbuf): New fields
- for the last unref handler and its user data.
-
- * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Use
- g_new0() to allocate the pixbuf.
-
- * gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_class_init):
- Fixed the call to gtk_signal_new() for the "frame_done" signal; it
- was not specifying the `frame' argument.
-
- * gdk-pixbuf/gdk-pixbuf-animation.c
- (gdk_pixbuf_animation_get_width): Fixed docstring.
- (gdk_pixbuf_animation_get_height): Likewise.
- (gdk_pixbuf_animation_get_num_frames): Likewise.
- (gdk_pixbuf_animation_get_frames): Likewise.
-
- * doc/gdk-pixbuf-sections.txt: Updated with the new functions and
- types.
-
- * doc/tmpl/gdk-pixbuf.sgml: Added the description for GdkColorspace.
-
- * doc/tmpl/scaling.sgml: Added the description for GdkInterpType.
-
- * doc/tmpl/refcounting.sgml: Updated with the information about
- the last unref handler.
-
- * doc/tmpl/*.sgml: Markup tweaks.
-
- * gdk-pixbuf/Makefile.am (libgnomecanvaspixbuf_la_LDFLAGS): Sigh,
- update the libtool version number for libgnomecanvaspixbuf as
- well.
- (libpixbufloader_*_la_LDFLAGS): The loaders need to be versioned
- as well, or the old ones won't work with the new stuff. Also,
- renamed the modules as follows.
-
- * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_load_module): Now the
- modules are called "libpixbufloader-<format>.so" instead of
- "libpixbuf-<format>.so". They needed renaming so that the new
- loaders won't overwrite the old ones; even with the versioning
- stuff, the new .so symlink to the .so.1.0.0 would overwrite the
- old real .so file.
-
-2000-04-12 Paolo Molaro <lupus@debian.org>
-
- * .cvsignore, src/.cvsignore: shut up cvs.
-
-2000-04-11 Federico Mena Quintero <federico@helixcode.com>
-
- Most of this patch is based on a patch by Havoc Pennington
- (hp@redhat.com) to make GdkPixbuf's structures opaque and to
- remove the libart dependency.
-
- * gdk-pixbuf/gdk-pixbuf.h: Removed the public structures.
- (GdkColorspace): New enum that for now only contains
- GDK_COLORSPACE_RGB.
- (GdkPixbufDestroyNotify): New type for the pixbuf's pixels destroy
- notification function.
- (GdkInterpType): New num with interpolation types.
-
- * *.[ch]: Replace the libart stuff with our own stuff.
-
- * pixops/*.[ch]: Likewise.
-
- * gdk-pixbuf/gdk-pixbuf-private.h: New file with the private
- declarations of the GdkPixbuf structures.
-
- * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_new_from_art_pixbuf):
- Removed function.
- (gdk_pixbuf_get_format): Constify.
- (gdk_pixbuf_get_n_channels): Constify.
- (gdk_pixbuf_get_has_alpha): Constify.
- (gdk_pixbuf_get_bits_per_sample): Constify.
- (gdk_pixbuf_get_pixels): Constify.
- (gdk_pixbuf_get_width): Constify.
- (gdk_pixbuf_get_height): Constify.
- (gdk_pixbuf_get_rowstride): Constify.
-
- * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_copy): New function to copy
- a pixbuf.
-
- * gdk-pixbuf/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Added a
- bits_per_sample argument; currently only 8 bits per sample are
- supported.
-
- * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_frame_get_pixbuf):
- New accessor.
- (gdk_pixbuf_frame_get_x_offset): New accessor.
- (gdk_pixbuf_frame_get_y_offset): New accessor.
- (gdk_pixbuf_frame_get_delay_time): New accessor.
- (gdk_pixbuf_frame_get_action): New accessor.
-
- * gdk-pixbuf/gdk-pixbuf-render.c
- (gdk_pixbuf_render_pixmap_and_mask): Instead of returning a solid
- mask rectangle for pixbufs without an alpha channel, set the
- *mask_return to NULL.
-
- * gdk-pixbuf/gdk-pixbuf-util.c (gdk_pixbuf_add_alpha): Constify.
-
- * gdk-pixbuf/gdk-pixbuf-scale.c: Fix includes.
-
- * gdk-pixbuf/gdk-pixbuf-scale.c (gdk_pixbuf_scale): Added some
- preconditions. Maybe we should also check for the colorspace,
- bits per pixel, and such.
- (gdk_pixbuf_composite): Likewise.
- (gdk_pixbuf_composite_color): Likewise.
- (gdk_pixbuf_scale_simple): Likewise, and fail gracefully if we
- cannot allocate the new pixbuf.
- (gdk_pixbuf_composite_color_simple): Likewise.
-
- * gdk-pixbuf/gnome-canvas-pixbuf.c (gnome_canvas_pixbuf_render):
- Use art_rgb_rgba_affine() or art_rgb_affine() since we no longer
- have an ArtPixBuf.
-
- * gdk-pixbuf/io-bmp.c: Fix includes.
-
- * gdk-pixbuf/pixops/pixops.c (pixops_scale_nearest): Fixed cast in
- an lvalue.
-
- * TODO: Populated.
-
- * configure.in: Removed checks for libart.
-
- * gdk-pixbuf/Makefile.am: Removed references to libart.
- (noinst_HEADERS): Added gdk-pixbuf-private.h.
-
- * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_LDFLAGS): Incremented
- the version number of the libtool library to indicate that this
- definitely is not compatible with the old usage. I know you love
- me. I know you do.
-
- * configure.in: Bumped version number to 0.7.0.
-
- * README: Updated.
-
- * gdk-pixbuf-config.in (--libs): We no longer require libart.
-
- * DEPENDS.libgdk_pixbuf: We no longer depend on libart.
-
- * gdk-pixbuf.spec.in: Updated, but I don't guarantee anything.
-
-2000-04-06 Jonathan Blandford <jrb@redhat.com>
-
- * gdk-pixbuf/testanimation.c (main): add more info to the
- testanimation frames.
-
-2000-04-04 Ettore Perazzoli <ettore@helixcode.com>
-
- * gdk-pixbuf/gdk-pixbuf-animation.c
- (gdk_pixbuf_animation_get_width): New accessor function.
- (gdk_pixbuf_animation_get_height): New accessor function.
- (gdk_pixbuf_animation_get_num_frames): New accessor function.
- (gdk_pixbuf_animation_get_frames): New accessor function.
-
-2000-04-01 Federico Mena Quintero <federico@helixcode.com>
-
- * gdk-pixbuf/gdk-pixbuf.c: Reverted Mark's change. The refcount
- is private information, and the art_pixbuf will go away soon.
-
-2000-03-31 Mark Crichton <crichton@gimp.org>
-
- * gdk-pixbuf/gdk-pixbuf.c: Added gdk_pixbuf_get_refcount
- and gdk_pixbuf_get_artpixbuf accessor functions.
-
-2000-03-29 Federico Mena Quintero <federico@helixcode.com>
-
- * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_get_has_alpha): Return
- gboolean instead of int.
-
-2000-03-29 Radek Doulik <rodo@helixcode.com>
-
- * gdk-pixbuf/gdk-pixbuf-animation.c
- (gdk_pixbuf_animation_new_from_file): same as below
-
- * gdk-pixbuf/io-gif.c (gif_get_lzw): added update of width and
- height in GdkPixbufAnimation
-
-2000-03-28 Radek Doulik <rodo@helixcode.com>
-
- * gdk-pixbuf/io-gif.c (gif_get_lzw): test also for
- context->frame_done_func and context->anim_done_func to make
- progressive animation loading work
-
- * gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_frame_done):
- added priv->pixbuf = NULL as pixbuf is now in frame (and to make
- gdk_pixbuf_loader_prepare happy)
- (gdk_pixbuf_loader_frame_done): update animation bbox
-
- * gdk-pixbuf/gdk-pixbuf.h: added bbox size (width, height) to
- _GdkPixbufAnimation
-
-2000-03-27 Radek Doulik <rodo@helixcode.com>
-
- * gdk-pixbuf/io-gif.c (gif_get_lzw): use frame_len and frame_width
- instead of width and height
-
-2000-03-27 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixbuf/pixops/pixops.c: Fix problem with
- precendence of >> and & which was keeping composite_color
- from working with non-gray images.
-
-2000-03-08 Jonathan Blandford <jrb@redhat.com>
-
- * gdk-pixbuf/io-gif.c (gdk_pixbuf__gif_image_load): free the context.
- (gdk_pixbuf__gif_image_load_animation): free the context.
-
-2000-03-06 Arjan van de Ven <arjan@fenrus.demon.nl>
-
- * gdk-pixbuf/io-bmp.c: Fixed to pointer-bugs and a
- mis-interpretation of the Microsoft documentation. Now
- it can load .BMP files that are not generated by The Gimp
- as well.
-
-2000-03-01 Mark Crichton <crichton@gimp.org>
-
- * configure.in: Added BUILD_CANVAS_ITEM stuff to (finally)
- fix the last auto* build bug (where we have libart, but no
- gnome-libs)
-
- * gdk-pixbuf/Makefile.am: Same.
-
-2000-02-28 Matt Wilson <msw@redhat.com>
-
- * gdk-pixbuf/gdk-pixbuf-drawable.c: s/unsigned long/guint32/g,
- s/unsigned short/guint16/g, s/unsigned char/guint8/g
-
-2000-02-26 Federico Mena Quintero <federico@helixcode.com>
-
- * README: We don't require libgif/ungif nor libXpm.
-
- * NEWS: This was outdated, so updated it.
-
-2000-02-25 Federico Mena Quintero <federico@helixcode.com>
-
- * gdk-pixbuf.m4: Use the correct name for
- gdk-pixbuf/gdk-pixbuf.h. Thanks to Jacob Berkman for pointing
- this out.
-
-2000-02-21 Federico Mena Quintero <federico@helixcode.com>
-
- * configure.in (GDK_PIXBUF_MINOR): Bumped version number to 0.6.0.
-
- * doc/compiling.sgml: New appendix documenting the gdk-pixbuf
- library's particular options to configure.in.
-
- * doc/gdk-pixbuf.sgml: Include compiling.sgml appendix via an
- entity.
-
- * doc/Makefile.am (gdk-pixbuf.html): Added compiling.sgml.
-
- * gdk-pixbuf/io-ico.c (gdk_pixbuf__ico_image_load_increment):
- Fixed typo in prototype name.
-
- * configure.in: Changed duplicated AC_MSG_CHECKING message to
- something more meaningful; now it is "checking whether dynamic
- modules work".
-
- * gdk-pixbuf/pixops/Makefile.am (noinst_PROGRAMS): Do not install
- the timescale program.
-
- Integrated Miguel de Icaza's <miguel@gnu.org> patch for optionally
- creating a single static library with all the image format modules
- in it.
-
-2000-02-20 Miguel de Icaza <miguel@gnu.org>
-
- * gdk-pixbuf/io-xpm.c (gdk_pixbuf__xpm_image_load): Add prefix.
- (gdk_pixbuf__xpm_image_load_xpm_data): Add prefix.
-
- * gdk-pixbuf/io-tiff.c (gdk_pixbuf__tiff_image_load_real): Add prefix.
- (gdk_pixbuf__tiff_image_stop_load): Add prefix.
- (gdk_pixbuf__tiff_image_load_increment): Add prefix.
- (gdk_pixbuf__tiff_image_load): Add prefix.
- (gdk_pixbuf__tiff_image_stop_load): Update invocation.
- (gdk_pixbuf__tiff_image_begin_load): Add prefix.
-
- * gdk-pixbuf/io-ras.c (gdk_pixbuf__ras_image_load): Add prefix.
- (gdk_pixbuf__ras_image_load): Updated invocation.
- (gdk_pixbuf__ras_image_begin_load): Add prefix.
- (gdk_pixbuf__ras_image_stop_load): Add prefix.
- (gdk_pixbuf__ras_image_load_increment): Add prefix.
-
- * gdk-pixbuf/io-pnm.c (gdk_pixbuf__pnm_image_begin_load): Add prefix.
- (gdk_pixbuf__pnm_image_stop_load): Add prefix.
- (gdk_pixbuf__pnm_image_load_increment): Add prefix
- (gdk_pixbuf__pnm_image_load): Add prefix.
-
- * gdk-pixbuf/io-jpeg.c (gdk_pixbuf__jpeg_image_load): Add prefix.
- (gdk_pixbuf__jpeg_image_load_increment): Add prefix.
- (gdk_pixbuf__jpeg_image_begin_load): Add prefix.
- (gdk_pixbuf__jpeg_image_stop_load): Add prefix.
-
- * gdk-pixbuf/io-ico.c (gdk_pixbuf__ico_image_load): Add prefix.
- (gdk_pixbuf__ico_image_load): update invocation.
- (gdk_pixbuf__ico_image_load_increment): Add prefix.
- (gdk_pixbuf__ico_image_load): update invocation.
- (gdk_pixbuf__ico_image_begin_load): Add prefix.
- (gdk_pixbuf__ico_image_load): update invocation.
- (gdk_pixbuf__ico_image_stop_load): Add prefix.
-
- * gdk-pixbuf/io-gif.c (gdk_pixbuf__gif_image_load_animation): Add prefix.
- (gdk_pixbuf__gif_image_load): Add prefix.
- (gdk_pixbuf__gif_image_begin_load): Add prefix.
- (gdk_pixbuf__gif_image_load_increment): Add prefix.
- (gdk_pixbuf__gif_image_load_animation): Add prefix.
- (gdk_pixbuf__gif_image_stop_load): Add prefix.
-
- * gdk-pixbuf/io-bmp.c (gdk_pixbuf__bmp_image_load): Add prefix.
- (gdk_pixbuf__bmp_image_load): Rename function called.
- (gdk_pixbuf__bmp_image_load_increment): Add prefix
-
- * gdk-pixbuf/io-png.c (gdk_pixbuf__png_image_load): Add prefix.
- (gdk_pixbuf__png_image_begin_load): Add prefix.
- (gdk_pixbuf__png_image_stop_load): Add prefix.
- (gdk_pixbuf__png_image_load_increment): Add prefix.
-
- * gdk-pixbuf/gdk-pixbuf-io.c (file_formats): Make this static.
- (gdk_pixbuf_load_module): Load the shared library entry points
- using a "gdk_pixbuf__$module_name" prefix.
- (pixbuf_module_symbol): Wrapper routine that uses the module
- prefix for the modules to load the information.
-
- * configure.in (GDK_PIXBUF_VERSION): New option --disable-modules
- lets the user specify that gdk-pixbuf should link all image loader
- code into the library instaed of creating shared library modules.
-
- (dynworks): Renamed the automake conditional DYNAMIC_MODULES_WORK
- to BUILD_DYNAMIC_MODULES.
-
-2000-02-19 Jonathan Blandford <jrb@redhat.com>
-
- * gdk-pixbuf/io-gif.c (new_context): fix case where initial
- colormap entry is Transparent.
-
-2000-02-19 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixbuf/pixops/pixops.c (scale_pixel): Fix error in
- scale factors for non-alpha case.
-
-2000-02-14 Mark Crichton <crichton@gimp.org>
-
- * gdk-pixbuf/io-xpm.c (xpm_extract_color): Added check for "g"
- color type. Imlib/libXpm handle this, but we didn't.
-
-2000-02-14 Darin Adler <darin@eazel.com>
-
- * gdk-pixbuf/testpixbuf.c: Remove now-unnecessary cast.
- * .cvsignore: gdk-pixbuf/.cvsignore: More to ignore.
-
-2000-02-14 Elliot Lee <sopwith@redhat.com>
- * gdk-pixbuf/gdk-pixbuf.h, gdk-pixbuf/gdk-pixbuf-data.c: Make
- passed-in argument 'const'.
-
-2000-02-04 Michael Meeks <mmeeks@gnu.org>
-
- * gdk-pixbuf/io-gif.c (struct _GifContext): add x,y_offset.
- (gif_get_frame_info): put the offsets on the context.
- (gif_get_lzw): copy them off into the frame.
- (new_context): no change required; will 0 offsets by default.
-
-2000-01-28 Michael Meeks <michael@mejm2.dow.cam.ac.uk>
-
- * gdk-pixbuf/pixops/pixops.c (pixops_process): const + nasty
- un-consting cast.
-
- * gdk-pixbuf/pixops/pixops.h: const.
-
- * gdk-pixbuf/gdk-pixbuf-util.c: const.
-
- * gdk-pixbuf/gdk-pixbuf-scale.c: const.
-
- * gdk-pixbuf/gdk-pixbuf.h: constify lots of things.
-
-2000-02-03 Federico Mena Quintero <federico@helixcode.com>
-
- * gdk-pixbuf/gdk-pixbuf-render.c
- (gdk_pixbuf_render_threshold_alpha): Added sanity check for width
- and height being >= 0. Also, do nothing if either of them is
- zero. Thanks to Ettore for pointing this out.
- (gdk_pixbuf_render_to_drawable): Likewise.
- (gdk_pixbuf_render_to_drawable_alpha): Likewise.
-
-2000-02-02 Federico Mena Quintero <federico@helixcode.com>
-
- * gdk-pixbuf/io-gif.c (gif_get_lzw): Removed debugging g_print.
- Thanks to John Sullivan <sullivan@eazel.com> for the patch.
-
- * gdk-pixbuf/testpixbuf-drawable.c (configure_cb): Get a new area
- of the screen when the window is resized. Thanks to David
- N. Welton <davidw@linuxcare.com> for pointing this out.
- Misc. cleanups to the rest of the file.
-
-2000-02-01 Federico Mena Quintero <federico@helixcode.com>
-
- * doc/tmpl/rendering.sgml: gnome_init() does not call
- gdk_rgb_init(), so don't mention that it does in the
- documentation. Thanks to Alexander Kruuse <kruuse@home.se> for
- pointing this out.
-
-2000-01-31 Havoc Pennington <hp@redhat.com>
-
- * gdk-pixbuf/Makefile.am (noinst_PROGRAMS): no testpixbuf-foo target
-
-Mon Jan 31 12:38:50 2000 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixbuf/pixops/pixops.c (scale_line): Fix from Peter
- Wainwright to fix 4a => 4a scaling.
-
-2000-01-29 Mark Crichton <crichton@gimp.org>
-
- * gdk-pixbuf-config: Oh dear, we weren't Telsa/Alan proof...
- put `libart-config --libs` in instead of -lart_lgpl.
-
-2000-01-22 Federico Mena Quintero <federico@helixcode.com>
-
- * gdk-pixbuf/io-pnm.c (pnm_read_raw_scanline): Return an error on
- invalid pnm type.
- (pnm_read_ascii_scanline): Initialize data and mask.
-
- * gdk-pixbuf/io-xpm.c (pixbuf_create_from_xpm): Initialize
- fallbackcolor to keep gcc happy.
-
- * configure.in: Bumped version number to 0.5.0.
-
- * gdk-pixbuf/pixops/timescale.c (dump_array): Removed unused variable.
- (main): Return 0.
-
- * gdk-pixbuf/pixops/pixops.c (pixops_composite_color_nearest): Put
- parentheses around + in a shift to remove a compiler warning.
- (pixops_process): Likewise.
-
- Patch from Ross Golder <rossigee@bigfoot.com> to create an RPM
- specfile:
-
- * configure.in: Added gdk-pixbuf.spec to AC_OUTPUT.
-
- * Makefile.am (EXTRA_DIST): Added gdk-pixbuf.spec.in
-
-2000-01-22 Federico Mena Quintero <federico@helixcode.com>
-
- * gdk-pixbuf/gnome-canvas-pixbuf.c (PixbufPrivate): Removed the
- x_set and y_set arguments. Now they are always on and start with
- defaults of 0.0 in units.
- (gnome_canvas_pixbuf_class_init): Likewise.
- (gnome_canvas_pixbuf_set_arg): Likewise.
- (gnome_canvas_pixbuf_get_arg): Likewise.
- (compute_viewport_affine): Likewise; always use the priv->x and
- priv->y fields.
-
- * doc/tmpl/gnome-canvas-pixbuf.sgml: Modified to reflect the
- removal of the x_set/y_set arguments.
-
-2000-01-21 Federico Mena Quintero <federico@helixcode.com>
-
- * gdk-pixbuf/gdk-pixbuf.c (gdk_pixbuf_ref): Return the same pixbuf
- as the input parameter.
-
- * gdk-pixbuf/gdk-pixbuf-animation.c (gdk_pixbuf_animation_ref):
- Return the same animation as the input parameter.
-
-2000-01-16 Elliot Lee <sopwith@redhat.com>
-
- * gdk-pixbuf/Makefile.am: Don't link against libgnomecanvaspixbuf.la
-
-2000-01-16 Federico Mena Quintero <federico@helixcode.com>
-
- * configure.in: Removed the broken --enable-canvas-pixbuf option.
- Added the stuff necessary to substitute the variables in
- gnomecanvaspixbufConf.sh.in.
-
- * gnomecanvaspixbufConf.sh.in: New gnome-config handler for the
- tiny gnomecanvaspixbuf library.
-
- * Makefile.am: Build gnomecanvaspixbufConf.sh.
-
- * gdk-pixbuf/Makefile.am: Create a libgnomecanvaspixbuf and only
- build it if gdk-pixbuf is being built outside of gnome-libs.
-
- * doc/gdk-pixbuf-sections.txt: Added gdk_pixbuf_render_pixmap_and_mask().
-
- * gdk-pixbuf/gdk-pixbuf-render.c
- (gdk_pixbuf_render_pixmap_and_mask): Renamed from
- gdk_pixbuf_render_pixmap(). Do not create the mask if it is not
- needed, and do not use a clipping mask when rendering the pixmap.
- Tweaked documentation a little.
-
- * HACKING: New file with hacking policies for the gdk-pixbuf
- module.
-
- * doc/Makefile.am (tmpl_sources): Added missing backslash.
-
- * doc/Makefile.am: Use gnomecanvaspixbuf in gnome-config when
- scanning for docstrings.
-
- * gdk-pixbuf/gdk-pixbuf-util.c (gdk_pixbuf_copy_area): Made sanity
- checks more stringent. Removed "gint" abominations. Made
- documentation consistent with the rest of the functions.
-
- * doc/gdk-pixbuf-sections.txt: Added gdk_pixbuf_copy_area() to the
- utilities section.
-
-2000-01-14 Jonathan Blandford <jrb@redhat.com>
-
- * gdk-pixbuf/gdk-pixbuf-render.c (gdk_pixbuf_render_pixmap): new
- function to let you create a gdk_pixmap from a gdk_pixbuf.
-
-2000-01-11 Jacob Berkman <jacob@helixcode.com>
-
- * gdk-pixbuf/pixops/Makefile.am (INCLUDES): added
- $LIBART_CFLAGS to $INCLUDES
-
-2000-01-10 Elliot Lee <sopwith@redhat.com>
-
- * configure.in, gdk-pixbuf/Makefile.am: Build a libcanvas_pixbuf.
-
- * configure.in: Define version macros. Generate
- gdk-pixbuf/gdk-pixbuf-features.h. Always INSIDE_GNOME.
-
- * gdk-pixbuf/Makefile.am: Add gdk-pixbuf-features.h
-
- * gdk-pixbuf/gdk-pixbuf.c: Add definitions of
- gdk-pixbuf-features.h declarations, plus some initialization
- stubs.
-
-2000-01-05 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixbuf/pixops/pixops.c: Fixed src_channels/dest_channels
- confusion. (Again caught by Tomas Ogren's Purify)
-
-2000-01-07 Jonathan Blandford <jrb@redhat.com>
-
- * gdk-pixbuf/gdk-pixbuf-xform.c (gdk_pixbuf_rotate): comment out
- debugging printing.
-
- * gdk-pixbuf/gdk-pixbuf-io.c: Added progressive animation loading.
- * gdk-pixbuf/gdk-pixbuf-io.h: Added progressive animation loading.
- * gdk-pixbuf/gdk-pixbuf-loader.c: Added progressive animation
- loading.
- * gdk-pixbuf/gdk-pixbuf-loader.h: Added progressive animation
- loading.
- * gdk-pixbuf/io-gif.c (image_load_increment): I think the
- ref-counting mess is finally fixed. Added progressive animation
- loading.
- (gif_get_lzw): remove memory_leak
-
- * doc/tmpl/gdk-pixbuf-loader.sgml: much longer long description
- added.
-
-2000-01-05 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixbuf/pixops/pixops.c (pixops_process): Fix computation of
- end of run indices.
-
- * gdk-pixbuf/pixops/pixops.c: Fix double increments when
- dest_channels == 4. (Pointed out by Tomas Ogren)
-
-2000-01-05 Mark Crichton <crichton@gimp.org>
-
- * gdk-pixbuf/gdk-pixbuf-loader.c (gdk_pixbuf_loader_eat_header_write):
- Return 0 if gdk_pixbuf_load_loader_module returns FALSE.
-
-2000-01-05 Elliot Lee <sopwith@redhat.com>
-
- * gdk-pixbuf/pixops/Makefile.am: Link with -lm (to get 'ceil' function)
-
-2000-01-05 Owen Taylor <otaylor@redhat.com>
-
- * doc/Makefile.am doc/gdk-pixbuf-sections.txt
- doc/gdk-pixbuf.sgml doc/tmpl/scaling.sgml:
- Added scaling functions into gtk-doc framework.
-
- * gdk-pixbuf/gdk-pixbuf-scale.c: Documentation fixes.
-
- * gdk-pixbuf/testpixbuf-scale.c (expose_cb): Simplify a bit.
-
- * gdk-pixbuf/pixops/pixops.c (pixops_composite_color): Return
- immediately if scale_x or scale_y is 0.
-
-2000-01-05 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixbuf/pixops/timescale.c: quick fix for initializing
- arrays in benchmark.
-
-2000-01-05 Jonathan Blandford <jrb@redhat.com>
-
- * gdk-pixbuf/gdk-pixbuf-io.h: Change the order of the update func
- to make it more compatible with the rest of GTK. Added animation
- framework for progressive loading.
-
- * gdk-pixbuf/io-bmp.c (image_begin_load): Modified to handle new
- system.
- * gdk-pixbuf/io-ico.c (image_begin_load): ditto
- * gdk-pixbuf/io-png.c (image_begin_load): ditto
- * gdk-pixbuf/io-ras.c (image_begin_load): ditto
- * gdk-pixbuf/io-jpeg.c (image_begin_load): ditto
- * gdk-pixbuf/io-pnm.c (image_begin_load): ditto
- * gdk-pixbuf/io-tiff.c (image_begin_load): ditto
- * gdk-pixbuf/io-gif.c (image_begin_load): ditto
-
-2000-01-05 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixbuf/pixops/README: Added a README with a TODO
- and some explainations of the algorithms.
-
- * gdk-pixbuf/testpixbuf-scale.c: Set a background pixmap of None
- to reduce flashing when resizing.
-
-2000-01-05 Owen Taylor <otaylor@redhat.com>
-
- * gdk-pixbuf/pixops/: Directory full of pixel data scaling
- code that will eventually migrate into libart.
-
- * configure.in acconfig.h: Add checks for MMX compiler support
-
- * gdk-pixbuf/gdk-pixbuf.h gdk-pixbuf/gdk-pixbuf-scale.c:
- Nice wrapper routines for the code in pixops that operate
- on pixbufs instead of raw data.
-
- * gdk-pixbuf/testpixbuf-scale: Test program for scaling
- routines.
-
-2000-01-05 Jonathan Blandford <jrb@redhat.com>
-
- * doc/tmpl/animation.sgml: Documentation changes.
-
-2000-01-01 Federico Mena Quintero <federico@helixcode.com>
-
- * gdk-pixbuf/gdk-pixbuf.h (GdkPixbufAnimation): Added reference
- counting to animations. A web browser may want to share a single
- copy of an animated GIF if it appears multiple times in a web
- page, for example.
-
- * gdk-pixbuf/gdk-pixbuf-animation.c: New file. Moved the
- animation functions here.
- (gdk_pixbuf_animation_new_from_file): Prettified. Return a NULL
- animation if the loader does not support multiframe loading and
- the single-frame load returned NULL. Check that the filename is
- not NULL. Updated inline documentation.
- (gdk_pixbuf_animation_ref): New function.
- (gdk_pixbuf_animation_unref): New function.
- Removed gdk_pixbuf_animation_destroy() in favor of reference
- counting.
-
- * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file):
- Prettified. Made ref_count assertion more paranoid. Check that
- the filename is not NULL.
- (gdk_pixbuf_get_module): Use guchar * and guint for buffer and
- size, respectively.
- (gdk_pixbuf_new_from_xpm_data): Changed the "data" argument to
- const char **.
-
- * gdk-pixbuf/io-gif.c (image_load_animation): Create the animation
- with a reference count of 1.
-
- * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_SOURCES): Added
- gdk-pixbuf-animation.c.
-
- * doc/tmpl/animation.sgml: Populated. It is still missing a
- description of the overlay modes.
-
- * doc/gdk-pixbuf-sections.txt: Added the animation section. Moved
- the canvas item section to the end, as it will be moved later to
- gnome-libs.
-
- * doc/gdk-pixbuf.sgml: Added the animation section.
-
- * doc/Makefile.am (tmpl_sources): Added tmpl/animation.sgml.
-
-1999-12-26 Peter Teichman <pat@gnu.org>
-
- * gdk-pixbuf/Makefile.am (libpixbuf_tiff_la_LIBADD): add
- $(LIBTIFF) to libpixbuf_tiff_la_LIBADD, proxying for mmarker.
- This closes bug #4676.
-
-1999-12-23 Havoc Pennington <hp@pobox.com>
-
- * gdk-pixbuf/io-gif.c (image_load): Stuff that should have been
- set to NULL here (specifically context->animation) was not being
- set to NULL. use g_new0() to alloc the struct.
-
-1999-12-20 Jonathan Blandford <jrb@redhat.com>
-
- * gdk-pixbuf/io-gif.c: finished work to make animated gifs load
- correctly. Progressive loading needs some work, but that all
- needs doing from the gdk-pixbuf-loader end, not here.
-
-1999-12-17 Jonathan Blandford <jrb@redhat.com>
-
- * gdk-pixbuf/gdk-pixbuf-io.c (gdk_pixbuf_animation_new_from_file):
- moved the file here. It seems natural to put this function here,
- as that's where the gdk_pixbuf_new_from_file function is, but it's
- still a little convoluted. The source files might be played with
- in a bit.
-
-1999-12-14 Jonathan Blandford <jrb@redhat.com>
-
- * gdk-pixbuf/gdk-pixbuf-loader.c
- (gdk_pixbuf_loader_get_animation): Gets the animation from the
- loader.
-
-1999-12-16 Federico Mena Quintero <federico@redhat.com>
-
- * doc/tmpl/rendering.sgml: Added notice about initializing GdkRGB
- before using the GdkPixbuf rendering functions. Thanks to Joe
- Shaw <joe@off.net> for pointing this out.
-
-1999-12-13 Federico Mena Quintero <federico@redhat.com>
-
- * gdk-pixbuf/gnome-canvas-pixbuf.c
- (gnome_canvas_pixbuf_class_init): Renamed arguments to
- width_in_pixels, height_in_pixels, x_in_pixels, y_in_pixels, for
- consistency with the new canvas.
- (PixbufPrivate): Do the same renaming in the structure fields, for
- consistency.
-
- * doc/tmpl/gnome-canvas-pixbuf.sgml: Updated for new argument names.
-
-1999-12-12 Federico Mena Quintero <federico@redhat.com>
-
- * gdk-pixbuf/Makefile.am (libgdk_pixbuf_la_LDFLAGS): Use a
- conditional to see whether to link $(GNOME_LIBS) or not.
-
-1999-12-10 Jonathan Blandford <jrb@redhat.com>
-
- * gdk-pixbuf/gdk-pixbuf-io.h: thinking about the new loading API.
-
- * gdk-pixbuf/gdk-pixbuf-drawable.c (gdk_pixbuf_get_from_drawable):
- make a warning go away.
-
- * gdk-pixbuf/gdk-pixbuf.h: added new prototypes for animations.
-
- * gdk-pixbuf/gdk-pixbuf-loader.h: added new prototypes for
- animations.
-
-1999-12-09 Michael Zucchi <zucchi@zedzone.mmc.com.au>
-
- * gdk-pixbuf/gdk-pixbuf.h: Enable gdk_pixbuf_get_from_drawable()
- api call.
-
- * gdk-pixbuf/gdk-pixbuf-drawable.c (gdk_pixbuf_get_from_drawable):
- Filled in body of function.
- (rgbconvert): Added GdkColormap parameter, and to all conversion
- functions also.
- (convert_real_slow): New function - should convert ANY visual/data
- format properly, but it aint fast. Used as a fallback when an
- optimised routine wont match.
- (rgbconvert): Do very specific tests on the data format to verify
- properly if the optimised version will do, otherwise use the
- fallback function for all other data formats.
-
- * gdk-pixbuf/Makefile.am: Re-enabled building of
- textpixbuf-drawable.
-
- * gdk-pixbuf/testpixbuf-drawable.c (main): Changed to use
- gdk_pixbuf_get_from_drawable().
-
-1999-12-08 Arjan van de Ven <arjan@fenrus.demon.nl>
-
- * gdk-pixbuf/gdk-pixbuf-drawable.c : Fixed the red/green/red
- bug on two occasions.
- * gdk-pixbuf/io-ras.c: Changed from the custom be32_to_cpu
- function to the generic glib one.
-
-1999-12-08 Federico Mena Quintero <federico@redhat.com>
-
- * gdk-pixbuf/gdk-pixbuf-drawable.c: Fix includes.
- (gdk_pixbuf_get_from_drawable): Implemented the zillion sanity
- checks and API definition. The body needs filling in and it needs
- to do the Right Thing(tm) for pixmaps plus the given colormap and
- windows and their own colormaps.
-
- * gdk-pixbuf/gdk-pixbuf.h: Added prototype for
- gdk_pixbuf_get_from_drawable(). Killed gdk-pixbuf-drawable.h.
-
- * gdk-pixbuf/Makefile.am: Re-added the gdk-pixbuf-drawable sources.
-
- * doc/tmpl/from-drawables.sgml: Populated.
-
- * doc/gdk-pixbuf.sgml: Added the from-drawables section.
-
- * doc/Makefile.am (tmpl_sources): Added tmpl/from-drawables.sgml.
-
- * doc/gdk-pixbuf-sections.txt: Added a section for getting pixbufs
- from drawables.
-
-1999-12-07 Federico Mena Quintero <federico@redhat.com>
-
- * doc/tmpl/gnome-canvas-pixbuf.sgml: Added clarification about
- reference counting for GdkPixbuf structures.
-
-1999-12-07 Martin Baulig <martin@home-of-linux.org>
-
- * gdk-pixbuf/Makefile.am (testpixbuf_LDADD): Conditionally
- include $(GNOME_LIBS) here.
-
-1999-12-05 Arjan van de Ven <arjan@fenrus.demon.nl>
-
- Added missing "include <string.h>" to:
- * gdk-pixbuf/io-ras.c
- * gdk-pixbuf/io-bmp.c
- * gdk-pixbuf/io-ico.c
-
-1999-12-06 Federico Mena Quintero <federico@redhat.com>
-
- * gdk-pixbuf/gdk-pixbuf-io.c (file_formats): Patch from Arjan to
- fix an initializer.
-
-1999-12-05 Federico Mena Quintero <federico@redhat.com>
-
- * gdk-pixbuf/Makefile.am (testpixbuf_LDADD): Add back
- $(GNOME_LIBS). This must compile outside of gnome-libs. If you
- want, send me a patch to do the conditional stuff properly.
- Otherwise, please read the GNOME Programming Guidelines,
- especially the "CVS policies" section.
-
-1999-12-05 Jaka Mocnik <jaka.mocnik@kiss.uni-lj.si>
-
- * gdk-pixbuf/Makefile.am: removed GNOME_LIBS from testpixbuf_LDADD.
-
-1999-12-05 Arjan van de Ven <arjan@fenrus.demon.nl>
-
- * gdk-pixbuf/io-ico.c: Bug in palet-size
- calculation fixed
-
-1999-12-04 Arjan van de Ven <arjan@fenrus.demon.nl>
-
- * gdk-pixbuf/io-bmp.c: Major cleanup, added support for
- 32 bpp and 4 bpp (uncompressed) images, fixed 1bpp.
-
- * gdk-pixbuf/io-ras.c: Minor cleanup, ran through lclint
-
- * gdk-pixbuf/io-ico.c: Minor cleanup, fixed 1bpp icons,
- ran through lclint.
-
- * gdk-pixbuf/gdk-pixbuf-io.c: Added detection of .CUR files
- (Windows Cursor files). These are identical to .ICO files,
- except for the signature and 2 extra fields for the hotspot.
-
-1999-12-03 Federico Mena Quintero <federico@redhat.com>
-
- * gdk-pixbuf/gnome-canvas-pixbuf.c (gnome_canvas_pixbuf_get_arg):
- Removed unused variable `item'.
-
-1999-12-03 Jonathan Blandford <jrb@redhat.com>
-
- * gdk-pixbuf/io-gif.c (gif_fill_in_lines): added a comment to
- explain this function better.
-
-1999-12-02 Federico Mena Quintero <federico@redhat.com>
-
- Source files moved from src/ to gdk-pixbuf/, to be consistent with
- other libraries.
-
- * doc/Makefile.am: Modified for the new source directory.
-
- * configure.in: Likewise.
-
- * Makefile.am: Likewise.
-
- * autogen.sh: Likewise.
-
- * gdk-pixbuf/Makefile.am: Likewise.
-
-1999-12-02 Federico Mena Quintero <federico@redhat.com>
-
- * src/testpixbuf.c: #include <config.h>, and fix includes.
-
- * src/testpixbuf-drawable.c: #include <config.h>, and fix includes.
-
- * src/io-xpm.c: Fix includes.
-
- * src/io-tiff.c: Fix includes.
-
- * src/io-ras.c: Fix includes, and do not include more stuff than needed.
-
- * src/io-pnm.c: Fix inlcudes, and do not include more stuff than needed.
-
- * src/io-png.c: Fix includes.
-
- * src/io-ico.c: Fix includes, and do not include more stuff than needed.
-
- * src/io-gif.c: Fix includes, and do not include more stuff than needed.
-
- * src/io-bmp.c: Fix includes, and do not include more stuff than needed.
-
- * src/gnome-canvas-pixbuf.c: Fix includes.
-
- * src/gdk-pixbuf.c: Fix includes.
-
- * src/gdk-pixbuf-util.c: Fix includes.
-
- * src/gdk-pixbuf-render.c: Fix includes.
-
- * src/gdk-pixbuf-io.h: Fix includes.
-
- * src/gdk-pixbuf-drawable.c: Fix includes.
-
- * src/gdk-pixbuf-drawable.h: Use angle brackets for the gdk-pixbuf
- include files.
-
- * src/gdk-pixbuf-data.c: Fix includes.
-
- * src/gdk-pixbuf-loader.c: #include <config.h>
-
- * src/gdk-pixbuf-loader.h: Use angle brackets for the gdk-pixbuf
- include files.
-
- * src/Makefile.am: Commented out the gdk-pixbuf-drawable stuff,
- since it is not finished.
-
- * src/gdk-pixbuf.h: Removed unused transformation prototypes.
-
- * src/gdk-pixbuf-util.c: New file with utility and convenience
- functions for pixbufs.
-
- * src/Makefile.am (libgdk_pixbuf_la_SOURCES): Added gdk-pixbuf-util.c.
-
- * doc/gdk-pixbuf-sections.txt: Added section for utility functions.
-
- * doc/Makefile.am (tmpl_sources): Added tmpl/util.sgml.
-
- * doc/gdk-pixbuf.sgml: Added the utilities section.
-
- * doc/tmpl/util.sgml: Documentation for the utility functions.
-
-1999-11-29 Owen Taylor <otaylor@redhat.com>
-
- * src/gdk-pixbuf-render.c (gdk_pixbuf_render_to_drawable_alpha):
- Keep the mask around until after we draw ... since
- the GC changes aren't flushed to the X server until we
- draw, destroying it before that may result in BadPixmap
- errors.
-
-1999-11-30 Havoc Pennington <hp@pobox.com>
-
- * configure.in: Add AM_CONDITIONAL for inside gnome-libs
-
- * src/Makefile.am: conditionalize GnomeCanvasPixbuf
-
-1999-11-29 Federico Mena Quintero <federico@redhat.com>
-
- * src/Makefile.am: Uncomment the GnomeCanvasPixbuf sources. This
- should be made conditional, not blindly commented out.
-
-1999-11-29 Jonathan Blandford <jrb@redhat.com>
-
- * src/Makefile.am (ICO_LIB): Added another loader from Arjan to
- handle .ico files. Cool.
-
-1999-11-24 Jonathan Blandford <jrb@redhat.com>
-
- * src/io-bmp.c (OneLine24): new patch from Arjan to handle
- compressed bmps.
-
-1999-11-24 James Henstridge <james@daa.com.au>
-
- * configure.in (AC_OUTPUT): altered hack to place the symlink in the
- top builddir rather than src. This still builds fine, and does not
- get gtk-doc into an infinite loop when trying to find all the source
- files.
-
-1999-11-23 Jonathan Blandford <jrb@redhat.com>
-
- * Removed #PRAGMA } from headers. Also, make compile if you don't
- have it installed, already.
-
-1999-11-22 Federico Mena Quintero <federico@redhat.com>
-
- * src/gnome-canvas-pixbuf.c (gnome_canvas_pixbuf_draw): Create the
- temporary buffer to the size of the interesction of the bounding
- box and the expose area, not the whole expose area. This speeds
- up things a lot.
-
- * src/gdk-pixbuf-render.c (gdk_pixbuf_render_threshold_alpha): Do
- not paint black on the mask, since we already cleared it in a
- single gdk_draw_rectangle() operation.
-
-1999-11-22 Raja R Harinath <harinath@cs.umn.edu>
-
- * configure.in (GDK_PIXBUF_DIR): Fix for srcdir != builddir.
-
-1999-11-22 Havoc Pennington <hp@pobox.com>
-
- * src/Makefile.am (GDK_PIXBUF_LIBS): Patch from Paul Fisher
- <pnfisher@redhat.com> adds all -lgdk-pixbuf and all other
- dependencies to LIBADD variables for loadable modules. Necessary
- for a Java dynamic loading thing to be able to figure it out.
-
-1999-11-22 Havoc Pennington <hp@pobox.com>
-
- * src/io-png.c (image_load_increment): Call the update_area
- callback depending on the number of rows loaded in this increment.
-
- * src/testpixbuf.c (main): slow down the progressive load demo
-
-1999-11-16 Havoc Pennington <hp@pobox.com>
-
- * src/gdk-pixbuf-drawable.h: Get the quotes right on the #include
-
-1999-11-22 Jonathan Blandford <jrb@redhat.com>
-
- * configure.in (GDK_PIXBUF_DIR): make the symlink. Does not work
- for srcdir != buildir != . Beats me why; I can't figure it out.
- AC_OUTPUT_COMMANDS doesn't seem to let me substitute it correctly.
-
-1999-11-21 Jonathan Blandford <jrb@redhat.com>
-
- * src/gdk-pixbuf-io.c: added io-bmp from Arjan
- <arjan@fenrus.demon.nl>
-
-1999-11-20 Michael Zucchi <zucchi@zedzone.mmc.com.au>
-
- * src/gdk-pixbuf-drawable.c (gdk_pixbuf_from_drawable_core):
- Rework/reorder of the code. Each case has been separated into
- another function; its big but it should be quick.
- gdk_pixbuf_rgba_from_drawable() will now return a pixbuf with
- opaque alpha information. Not all depths/formats have been
- tested, but 8, 15/16 and 24 (alinged 32) should work ok.
-
-1999-11-17 Larry Ewing <lewing@gimp.org>
-
- * src/gnome-canvas-pixbuf.c (gnome_canvas_pixbuf_bounds):
- implement the bounds method correctly.
- (compute_viewport_affine): compute the affine need to fit the
- image within the viewport given by the args.
- (compute_render_affine): call compute_viewport_affine.
-
-1999-11-16 Havoc Pennington <hp@pobox.com>
-
- * src/gdk-pixbuf-drawable.h: Use includes from the current
- directory, not the system directory.
-
-Mon Nov 15 17:18:28 1999 George Lebl <jirka@5z.com>
-
- * src/testpixbuf-drawable.c: use includes from the current directory
- rather then from the system include directory as gdk-pixbuf
- includes are not yet installed when this is compiled.
-
-1999-11-13 Cody Russell <bratsche@dfw.net>
- * src/testpixbuf-drawable.c: Added a test program for drawable
- code.
-
- * src/Makefile.am: Build testpixbuf-drawable.
-
-1999-11-12 Cody Russell <bratsche@dfw.net>
-
- * src/gdk-pixbuf-drawable.c: Merged in Michael Zucchi's changes.
-
-1999-11-10 Federico Mena Quintero <federico@redhat.com>
-
- * doc/tmpl/gdk-pixbuf-loader.sgml: Populated.
-
- * doc/gdk-pixbuf.signals: Put in the real names of signal
- arguments.
-
- * src/gdk-pixbuf-loader.c: Improved documentation comments.
-
-1999-11-10 Jonathan Blandford <jrb@redhat.com>
-
- * src/gdk-pixbuf-loader.c (gdk_pixbuf_loader_close): emit the
- closed signal.
-
- * src/io-ras.c (OneLineMapped_file): Now can handle indexing
- correctly. Patch from Arjan to do so.
-
-1999-11-10 Michael Fulbright <drmike@redhat.com>
-
- * src/io-pnm.c (pnm_ascii_read_scanline): Fixed loading of ASCII PNM
- files.
-
- * src/testpixbuf.c: Added final queued draw when done loading image.
-
-1999-11-10 Jonathan Blandford <jrb@redhat.com>
-
- * src/gdk-pixbuf-io.c (gdk_pixbuf_load_module): removed spurious
- print statements.
-
-1999-11-10 Federico Mena Quintero <federico@redhat.com>
-
- * src/gdk-pixbuf-io.c (gdk_pixbuf_new_from_xpm_data): Added
- documentation.
-
-1999-11-09 Federico Mena Quintero <federico@redhat.com>
-
- * src/io-png.c: Fixed some incompatible pointer initializations.
-
- * src/io-jpeg.c (image_load_increment): Remove unused variable.
-
-1999-11-09 Michael Fulbright <drmike@redhat.com>
-
- * src/testpixbuf.c: Fixed it to use timeout to read from file
- for progressive loading. Set TBF_KBPS=n, where n is the number of
- kilobytes/second to simulate in downloading. n has to be an integer.
-
- * src/io-jpeg.c: Slight cosmetic cleanup.
-
- * src/io-pnm.c: Fixed raw PNM loading bug. Also discovered that ASCII
- PBM loading has a similar problem and will address tomorrow.
-
-1999-11-09 Havoc Pennington <hp@pobox.com>
-
- * src/Makefile.am (libgdk_pixbuf_la_SOURCES): build the
- gdk-pixbuf-drawable stuff.
-
-1999-11-09 Federico Mena Quintero <federico@redhat.com>
-
- * configure.in: Bumped version number to 0.4.
-
-1999-11-09 Michael Fulbright <drmike@redhat.com>
-
- * src/io-pnm.c : Finished progressive PNM loading code. Should handle
- all types of PNM files now.
-
- * src/io-jpeg.c (image_load_increment): Figured out problem with
- loading Progressive JPEG's progressively (say that 10 times fast).
- Currently for Progressive JPEG's the entire image is loaded before
- it is displayed. libjpeg supports a fancier mechanism which I may
- implement later.
-
- With these changes all JPEG formats appear to load properly for me.
-
-1999-11-08 Jonathan Blandford <jrb@redhat.com>
-
- * src/io-ras.c (image_load_increment): Final patch from Arjan.
- Seems to do progressive loading.
-
-1999-11-08 Michael Fulbright <drmike@redhat.com>
-
- * src/io-pnm.c image_load (): Fixed so we do not create a separate
- pixel buffer when reading in image - we reuse the pixel data in
- the GdkPixbuf structure instead.
-
-1999-11-08 Michael Fulbright <drmike@redhat.com>
-
- * src/io-pnm.c pnm_read_ascii_scanline (): Added support for
- ASCII PNM files. Note I haven't tested loaded ASCII PBM files because
- I can't seem to find a utility to convert into this format.
- Next is to add progressive loading support for the PNM format.
-
-1999-11-07 Federico Mena Quintero <federico@redhat.com>
-
- * doc/tmpl/gnome-canvas-pixbuf.sgml: Finished detailed explanation
- of the width, height, x, and y setting and pixels arguments.
-
-1999-11-05 Jonathan Blandford <jrb@redhat.com>
-
- * src/io-ras.c (image_load): third patch. Now it seems to load.
-
- * src/gdk-pixbuf-io.c: second patch Arjan van de Ven
- <arjan@fenrus.demon.nl> to autodetect/load the sunras files.
-
- * src/io-ras.c (image_load): new file from Arjan van de Ven
- <arjan@fenrus.demon.nl> to begin the ras loader.
-
-1999-11-05 Federico Mena Quintero <federico@redhat.com>
-
- * doc/gdk-pixbuf-sections.txt: Removed gdk-pixbuf-io, since it is
- for internal use only.
-
- * doc/gdk-pixbuf.sgml: Likewise.
-
- * doc/tmpl/gnome-canvas-pixbuf.sgml: Finished docs.
-
-1999-11-05 Michael Fulbright <drmike@redhat.com>
-
- * src/io-pnm.c: Implemented support for reading raw PBM/PGM/PPM
- files from a file. Next step is support for ASCII files, and
- then incremental loading.
-
-1999-11-04 Federico Mena Quintero <federico@redhat.com>
-
- * Makefile.am: Added doc to SUBDIRS.
-
-1999-11-04 Michael Fulbright <drmike@redhat.com>
-
- * src/io-jpeg.c: Prettied up code slightly.
- * src/io-pnm.c: Start of pnm loader (from file and progressively).
- Doesn't do much yet (will finish tomorrow).
- * src/gdk-pixbuf-io.c: Added pnm to structure of known types.
-
-1999-11-04 Federico Mena Quintero <federico@redhat.com>
-
- * doc/tmpl/rendering.sgml: Populated.
-
- * doc/Makefile.am: Added the template files.
-
-1999-11-04 Havoc Pennington <hp@pobox.com>
-
- * src/gdk-pixbuf-render.c (gdk_pixbuf_render_to_drawable): In
- docs, explain what a dither offset is for.
- (gdk_pixbuf_render_to_drawable_alpha): Explain why you would use
- this function vs. gdk_pixbuf_render_to_drawable().
-
-1999-11-04 Havoc Pennington <hp@pobox.com>
-
- * configure.in: Use libart-config correctly; find gnome-config
- separately. Fix GNOME_LIBS to be correct in "no gnome installed
- yet" case.
-
- * src/Makefile.am: Link to GNOME_LIBS instead of a hardcoded
- library list.
-
- Patch untested in the inside-gnome-libs case, I need to commit
- then check out to the gnome-libs I'm using.
-
-1999-11-04 Michael Fulbright <drmike@redhat.com>
-
- * src/io-jpeg.c (image_begin_load): Add update_func callback.
- * src/io-jpeg.c (image_load_increment): Call updated callback when
- new graphic data decoded.
-
-1999-11-04 Jonathan Blandford <jrb@redhat.com>
-
- * src/gdk-pixbuf-loader.c (gdk_pixbuf_loader_update): handle the
- actual update.
- * src/io-png.c (image_begin_load): add a update_func callback.
- * src/io-gif.c (image_begin_load): add a update_func callback.
- (gif_get_lzw): added the update_func ability
-
- * src/io-tiff.c (image_begin_load): add a update_func callback.
-
-1999-11-04 Federico Mena Quintero <federico@redhat.com>
-
- * doc/tmpl/gdk-pixbuf.sgml: Populated.
-
- * doc/tmpl/refcounting.sgml: Populated.
-
- * doc/tmpl/file-loading.sgml: Populated.
-
- * src/gdk-pixbuf.c: Added documentation comments.
-
- * src/gdk-pixbuf-io.c (gdk_pixbuf_new_from_file): Added
- documentation comments.
-
- * doc/: Finished integrating the documentation framework.
-
-1999-11-03 Federico Mena Quintero <federico@redhat.com>
-
- * configure.in: Removed libgif stuff now that we do not depend on it.
- Added the necessary cruft for gtk-doc.
-
- * src/Makefile.am: Unconditionally build the GIF loader.
-
-1999-11-03 Jonathan Blandford <jrb@redhat.com>
-
- * src/io-gif.c (gif_read): renamed ReadOK to gif_read.
- Added a lot of comments to the file.
-
- * src/Makefile.am (libpixbuf_gif_la_LIBADD): Remove dependency on
- lib*gif!!!!
-
-1999-11-03 Michael Fulbright <drmike@redhat.com>
-
- * src/io-jpeg.c (image_load_increment): Further removal of
- bugginess in local buffering code. Handles grayscale jpegs
- correctly now.
-
- * src/io-jpeg.c (image_load_stop): Was freeing local context
- for jpeg library before calling jpeg_decompres_finish ().
-
-1999-11-03 Jonathan Blandford <jrb@redhat.com>
-
- * src/io-gif.c (image_load_increment): now handle arbitrary buffer
- sizes.
- (gif_get_lzw): set the transparency to the right val.
-
-1999-11-03 Federico Mena Quintero <federico@redhat.com>
-
- * src/gnome-canvas-pixbuf.c (gnome_canvas_pixbuf_init):
- Initiailize the x and y fields.
- (gnome_canvas_pixbuf_destroy): Queue a redraw upon destruction.
- (PixbufPrivate): Renamed need_size_update to need_xform_update.
- (recompute_bounding_box): Do not use temporary values.
-
-1999-11-03 Jonathan Blandford <jrb@redhat.com>
-
- * src/io-gif.c (set_gif_lzw_clear_code): new state. Fixes
- un-compressed gifs.
-
- * src/gnome-canvas-pixbuf.c (recompute_bounding_box): remove
- unneeded x,y,h,w vars.
-
-1999-11-03 Larry Ewing <lewing@gimp.org>
-
- * src/gnome-canvas-pixbuf.c (compute_render_affine): adjust
- render_affine calculation for x,y offsets.
- (gnome_canvas_pixbuf_set_arg): add x,y args.
- (gnome_canvas_pixbuf_get_arg): add x,y args.
- (recompute_bounding_box): simply code using ArtDrect and the
- render_affine. Removed compute_xform_vectors as it was no longer
- needed.
-
-1999-11-03 Federico Mena Quintero <federico@redhat.com>
-
- * src/gnome-canvas-pixbuf.c (gnome_canvas_pixbuf_point): I'm a
- doofus. Return a distance, not a boolean, for opaque images.
-
- * src/gnome-canvas-pixbuf.c (recompute_bounding_box): Do proper
- rounding of bounding box coordinates.
- (gnome_canvas_pixbuf_bounds): Implemented the ::bounds() method.
- (gnome_canvas_pixbuf_draw): Use the correct alpha threshold value.
-
-1999-11-03 Jonathan Blandford <jrb@redhat.com>
-
- * src/io-gif.c (gif_prepare_lzw): s/lwz/lzw/g
-
-1999-11-03 Michael Fulbright <drmike@redhat.com>
-
- * src/io-jpg.c (image_load_increment): Fixed code which moved
- buffer around as new data comes in to work properly. JPEG progressive
- loading should be working now except for grayscale JPEG's, which I
- will look into next.
-
-1999-11-03 <sopwith@redhat.com>
- * src/testpixbuf.c: A GtkFunction needs to return a value for
- deterministic behaviour. Also put dot printing back in.
-
-1999-11-03 <jrb@redhat.com>
-
- * src/io-gif.c (gif_get_extension): Read 'til the next empty block
- correctly, now.
-
-1999-11-02 Cody Russell <bratsche@dfw.net>
- * src/gdk-pixbuf-drawable.c: Changed the behavior to return NULL
- if part of the requested image is offscreen, rather than clipping
- the image.
-
-1999-11-02 Jonathan Blandford <jrb@redhat.com>
-
- * src/io-gif.c (gif_fill_in_lines): Fill in the gif's blank areas
- for interlacing and progressive loading.
-
-1999-11-02 Cody Russell <bratsche@dfw.net>
- * src/gdk-pixbuf-drawable.c (gdk_pixbuf_from_drawable_core): Now
- calls gdk_pixbuf_new_from_art_pixbuf() instead of gdk_pixbuf_new().
-
-1999-11-02 Jonathan Blandford <jrb@redhat.com>
-
- * src/io-gif.c (gif_main_loop): Now progressive gif loading works!
- It's a little slow though. )-:
-
-1999-11-02 Elliot Lee <sopwith@redhat.com>
- * src/gdk-pixbuf-loader.[ch], src/gdk-pixbuf-io.h: Make the
- arguments to the write/load_increment operations const-correct.
-
-1999-11-02 Federico Mena Quintero <federico@redhat.com>
-
- * src/gnome-canvas-pixbuf.c (gnome_canvas_pixbuf_point):
- Implemented the ::point() method. We do a simple containment test
- instead of a full distance calculation since the canvas is going
- to change to that scheme, anyways.
-
-1999-11-02 Elliot Lee <sopwith@redhat.com>
-
- * src/testpixbuf.c: Allow using $TBF_READLEN to specify the size
- of the chunks that are read from the input file.
-
-1999-11-02 Larry Ewing <lewing@gimp.org>
-
- * src/gnome-canvas-pixbuf.c (gnome_canvas_pixbuf_render): add aa
- render function.
- (gnome_canvas_pixbuf_class_init): add gnome_canvas_pixbuf_render
- to class.
-
-1999-11-02 Federico Mena Quintero <federico@redhat.com>
-
- * src/gnome-canvas-pixbuf.c (compute_render_affine): Moved the
- affine computation code from ::draw() to here, since it is needed
- by ::point() as well.
-
-1999-11-02 Elliot Lee <sopwith@redhat.com>
-
- * src/gdk-pixbuf-loader.c: Reorganize gdk_pixbuf_loader_write into
- three functions, and eliminate duplication of code from write()
- and close(). Also fix bug where the 128-byte header was being
- written twice.
-
-1999-11-01 Federico Mena Quintero <federico@redhat.com>
- * src/gnome-canvas-pixbuf.c (recompute_bounding_box): Fixed
- bounding box computation.
-
-1999-11-01 Federico Mena Quintero <federico@redhat.com>
-
- * src/gnome-canvas-pixbuf.c: Start of the pixbuf canvas item.
- Drawing affines seem to work. Bounding box is fubared. ::point()
- is not implemented. This is a work in progress.
-
- * src/Makefile.am: Added gnome-canvas-pixbuf.[ch] to the list of
- sources.
-
- * configure.in: Sigh. We need to link in libgnomeui for the
- canvas stuff. This mess will disappear when gdk-pixbuf gets
- folded into gnome-libs.
-
-1999-10-30 Jonathan Blandford <jrb@redhat.com>
-
- * src/io-gif.c: Some more work. Now it generates a gdk_pixbuf of
- the right size, at a minimum, even if the image is squished and
- the wrong color.
- (ReadImage): lets get the offset right. This will let transparent
- gifs work.
-
-1999-10-29 Michael Fulbright <drmike@redhat.com>
-
- * src/io-jpeg.c: image_load_increment(): Fixed bug when
- image width was not a multiple of 4 - always use the
- gdk_pixbuf rowstride to increment pointers!
-
-1999-10-29 Michael Fulbright <drmike@redhat.com>
-
- * src/io-jpeg.c: Added first cut at progressive jpeg loading.
- Currently does not handle either progressive jpeg files (jpeg
- files with multiple scans at different quality settings), but
- I plan on adding this support soon. These are fairly rare in
- my experience, so it shouldn't slow people down too much.
- Grayscale jpegs also don't work but that should be easy to fix.
-
-1999-10-29 Michael Fulbright <drmike@redhat.com>
-
- * src/testpixbuf.c: Added title to windows so you can identify
- progressive and file windows.
-
-1999-10-29 Michael Fulbright <drmike@redhat.com>
-
- * src/gdk-pixbuf-loader.c (gdk_pixbuf_loader_write): Actually
- load the image handler when we determine the image type.
-
- * src/gdk-pixbuf-io.[ch] (gdk_pixbuf_load_module): Changed the
- previously static function load_image_handler () to
- a public function gdk_pixbuf_load_module (). It is needed in
- gdk-pixbuf-loader.c to load image handler modules. This function
- is different from gdk_pixbuf_get_module (), which only returns
- a reference to the required handler, because it actually loads
- the handler into memory. Both actions should possibly be combined
- in a convenience function since one w/o the other doesn't seem to
- make much sense.
-
-1999-10-28 Jonathan Blandford <jrb@redhat.com>
-
- * src/gdk-pixbuf-loader.c (gdk_pixbuf_loader_write): don't send a
- 0 length buffer.
-
-1999-10-28 Federico Mena Quintero <federico@redhat.com>
-
- * src/gdk-pixbuf-render.c (gdk_pixbuf_render_to_drawable): New
- function to render a portion of a pixbuf to a drawable. Ignores
- alpha information and takes in a GC.
- (gdk_pixbuf_render_to_drawable_alpha): New function to render a
- portion of a pixbuf to a drawable. It automatically creates a GC
- and a clipping mask for alpha pixbufs.
-
-1999-10-28 Jonathan Blandford <jrb@redhat.com>
-
- * src/gdk-pixbuf.h: turned convenience macros into convenience
- functions so some error checking could be added.
-
- * src/io-tiff.c (image_load_increment): started work on the tiff
- non-incremental loader.
- (image_begin_load): Finished the incremental loader.
-
- * src/io-gif.c (image_load_increment): started work on the gif
- incremental loader.
-
- * src/gdk-pixbuf-io.h: Changed ModuleType to GdkPixbufModule.
-
-1999-10-27 Federico Mena Quintero <federico@redhat.com>
-
- * src/gdk-pixbuf-render.c (gdk_pixbuf_render_threshold_alpha): New
- function to threshold a pixbuf's alpha channel into a bitmap.
-
- * src/gdk-pixbuf.c (gdk_pixbuf_new): Fixed so that it will
- contemplate future extensions to ArtPixBuf's formats.
-
- * src/io-png.c (png_info_callback): Use the new API of gdk_pixbuf_new().
-
- * src/gdk-pixbuf.h (gdk_pixbuf_get_height): Added some convenience
- macros to fetch the ArtPixBuf's fields.
-
-1999-10-27 Havoc Pennington <hp@pobox.com>
-
- * src/testpixbuf.c (main): Display the progressive load
-
- * src/io-png.c (setup_png_transformations): Break transformation
- code into separate function
- (png_info_callback): Use setup_png_transformations
-
-1999-10-27 Havoc Pennington <hp@pobox.com>
-
- * src/gdk-pixbuf-io.c (gdk_pixbuf_new_from_xpm_data): Check
- properly whether the XPM module has already been loaded
- (gdk_pixbuf_new_from_file): Check properly if loader module
- was already loaded (was checking if load symbol was present
- in order to decide whether to re-load; should check module !=
- NULL, then load != NULL)
- (image_handler_load): Check in present working directory,
- makes it easier to debug for now
- (file_formats): This array initializer was seriously on crack,
- was assigning a function pointer to a GModule*
-
- * src/testpixbuf.c (main): Change type of pixbuf_loader to
- GdkPixbufLoader*
-
-1999-10-27 Havoc Pennington <hp@pobox.com>
-
- * src/gdk-pixbuf-loader.c (gdk_pixbuf_loader_finalize):
- Fix typo that prevented compilation
- (gdk_pixbuf_loader_destroy): ditto
-
-1999-10-27 Federico Mena Quintero <federico@redhat.com>
-
- * src/gdk-pixbuf-loader.c (gdk_pixbuf_loader_new): Return a
- GdkPixbufLoader, not a GtkObject.
- (gtk_marshal_NONE__INT_INT_INT_INT): Made static.
- (gdk_pixbuf_loader_get_type): Documented.
- (gdk_pixbuf_loader_class_init): Initialize the parent class
- correctly.
- (gdk_pixbuf_loader_destroy): Added sanity checks. Call the parent
- class destroy function.
- (gdk_pixbuf_loader_new): Documented.
- (gdk_pixbuf_loader_finalize): Call the parent class finalize
- function.
- (gdk_pixbuf_loader_write): Use size_t for count.
-
-1999-10-27 Michael Fulbright <drmike@redhat.com>
-
- * src/gdk-pixbuf-loader.c (gdk_pixbuf_loader_destroy): Fixed
- logic so we only try to close loader if it wasn't previously closed.
-
-1999-10-27 Michael Fulbright <drmike@redhat.com>
-
- * src/gdk-pixbuf-loader.c: Made sure image_loader struct member of
- pixbuf_loader properly initialized.
-
- * src/testpixbuf.c: Made sure we cleanup pixbuf_loader properly
- when done.
-
-1999-10-26 Jonathan Blandford <jrb@redhat.com>
-
- * src/gdk-pixbuf-io.c (image_handler_load): load the vtable fully.
-
- * src/gdk-pixbuf-loader.c: Finished initial cut at the object.
-
-1999-10-26 Havoc Pennington <hp@pobox.com>
-
- * src/gdk-pixbuf-loader.h: fix signals
-
- * src/gdk-pixbuf-io.h: add new vtable fields
-
-
-1999-10-26 Jonathan Blandford <jrb@redhat.com>
-
- * src/gdk-pixbuf-loader.h: New Class. Beginning of progrssive
- loading.
-
-1999-10-25 Federico Mena Quintero <federico@redhat.com>
-
- * configure.in (CFLAGS): Patch from Uwe Koloska
- <koloska@Rcs1.urz.tu-dresden.de> to fix a stupid typo of mine.
-
-1999-10-22 Havoc Pennington <hp@pobox.com>
-
- * src/io-xpm.c (mem_buffer): Clean up stupid
- increment-inside-array-dereference thing
-
- * src/testpixbuf.c: Add XPM data tests.
-
- * src/io-xpm.c: Make the XPM data buffer const, fix const
- correctness throughout the code.
-
-1999-10-22 Havoc Pennington <hp@pobox.com>
-
- * src/gdk-pixbuf.h: Export gdk_pixbuf_new_from_xpm_data()
-
-1999-10-22 Havoc Pennington <hp@pobox.com>
-
- * src/io-xpm.c (image_load_xpm_data): Export this symbol for
- loading an XPM from memory.
-
- * src/gdk-pixbuf-io.c (gdk_pixbuf_new_from_xpm_data): New
- function, loads pixbuf from xpm data
- (image_handler_load): Add g_return_if_fail() to ensure the same
- module isn't loaded twice. Add g_module_symbol() to scan for XPM
- loader function.
-
-1999-10-22 Federico Mena Quintero <federico@redhat.com>
-
- * src/io-png.c (image_load): Patch from Kristian Hogsberg
- Kristensen <hogsberg@daimi.au.dk> to avoid allocating extra row
- buffers; the rows can be read in directly into the main pixel
- buffer.
-
-1999-10-20 Federico Mena Quintero <federico@redhat.com>
-
- * src/gdk-pixbuf-io.c (image_handler_load): Free path.
-
-1999-10-20 Federico Mena Quintero <federico@redhat.com>
-
- * configure.in: Bumped version number to 0.3.
-
- * src/Makefile.am (lbgdk_pixbuf_la_LDFLAGS): Added a libtool
- version number for the library.
-
-1999-10-20 Federico Mena Quintero <federico@redhat.com>
-
- * src/gdk-pixbuf.h (GdkPixbuf): Removed the unref_fn field. Now
- all memory management of the buffer is done by libart.
-
- * src/gdk-pixbuf.c (gdk_pixbuf_unref): Do destruction here.
- Removed gdk_pixbuf_destroy, gdk_pixbuf_duplicate.
-
- * src/gdk-pixbuf-data.c (gdk_pixbuf_new_from_data): Implemented in
- terms of the libart functions. Removed the old code.
-
- * src/gdk-pixbuf-io.c (image_handler_load): Removed the save
- symbols. Saving will not be implemented in GdkPixbuf.
-
- * src/io-gif.c: Removed the saving stub.
- (image_load): Fixed memory management to fail gracefully if we run
- out of memory while loading the image. Close the gif file when we
- are done. This still needs more error handling for the DGif
- functions.
-
- * src/io-jpeg.c (image_load): Some robustness fixes.
-
- * src/io-png.c: Removed the saving stuff.
- (image_load): Some memory management fixes.
-
- * src/io-tiff.c (image_load): Ditto.
-
- * src/io-xpm.c (pixbuf_create_from_xpm): Ditto.
-
-1999-10-18 Havoc Pennington <hp@pobox.com>
-
- * subautogen.sh: New name for macros/autogen.sh
-
- * autogen.sh: use subautogen.sh
-
-1999-10-18 Federico Mena Quintero <federico@redhat.com>
-
- * src/*: Reindented to use the GNOME Indentation. Renamed
- GdkPixBuf to GdkPixbuf, for consistency with the function names
- (and it is also easier to type) :-)
-
-1999-10-18 Havoc Pennington <hp@pobox.com>
-
- * configure.in: Use AM_PATH_GLIB instead of glib-config directly
-
- * src/Makefile.am: Re-enable testpixbuf with GTK_CFLAGS/GTK_LIBS
-
-1999-10-18 Havoc Pennington <hp@pobox.com>
-
- * Makefile.am (SUBDIRS): Remove "macros"
-
- * configure.in: Don't use GNOME_INIT, handle case where we are
- inside gnome-libs. AM_PATH_GTK for the GIF test
-
- * src/Makefile.am: Change flags to work without libgnomeui,
- comment out testpixbuf for now
-
-1999-10-18 Federico Mena Quintero <federico@redhat.com>
-
- * configure.in: Use $GTK_LIBS as the extra libs when checking for
- libgif/libungif, as they need the X libraries. Fixes bug #2472.
-
-1999-10-10 Cody Russell <bratsche@dfw.net>
- * src/gdk-pixbuf-drawable.c: core function now determines whether
- the requested geometry is on screen or not, and if some is not
- then the request is clamped to geometry that is on the screen.
-
- Changed 'pixbuf' to 'art_pixbuf' in core function.
-
-1999-10-08 Michael Fulbright <drmike@redhat.com>
-
- * src/gdk-pixbuf-data.c: Added to load rgb data from const data.
-
- * src/testpifbuf: Changed test program to display cdrom from rgb data
- if no filename given to test program.
-
-1999-10-07 Cody Russell <bratsche@dfw.net>
- * src/gdk-pixbuf-drawable.[ch]: Added. (Actually, Miguel committed
- them, but I wrote them).
-
- * src/gdk-pixbuf-drawable.h: Added a missing ; so things will now
- compile.
-
- * src/Makefile.am: Added gdk-pixbuf-drawable.[ch] to
- libgdk_pixbuf_la_SOURCES and libgdk_pixbufinclude_HEADERS.
-
- * src/gdk-pixbuf-drawable.c: Added #include "gdk-pixbuf-drawable.h"
- to fix compilation.
-
- * src/gdk-pixbuf-drawable.[ch]: Changed functions to return
- GdkPixBuf* instead of ArtPixBuf*.
-
-1999-09-22 Michael Meeks <michael@nuclecu.unam.mx>
-
- * src/gdk-pixbuf.c (gdk_pixbuf_new): created.
- (gdk_pixbuf_scale): use gdk_pixbuf_new + return a new scaled image.
-
- * src/gdk-pixbuf.h (struct _GdkPixBuf): Re-organise struct, + add
- GdkPixBufUnrefFunc + gdk_pixbuf_new.
-
- * src/io-jpeg.c (image_load): clean to use gdk_pixbuf_new.
-
- * src/io-xpm.c (_pixbuf_create_from_xpm): ditto.
-
- * src/io-tiff.c (image_load): ditto + fix leak
-
- * src/io-png.c (image_load): ditto + add more exit points; monitor.png
- crashes this module ( add warning :-)
-
- * src/io-bmp.c (image_load): ditto.
-
- * src/io-gif.c (image_load): ditto.
-
-1999-09-18 Michael Meeks <michael@nuclecu.unam.mx>
-
- * src/gdk-pixbuf.c (gdk_pixbuf_scale): Hack rgba support in so
- it doesn't crash scaling with alpha.
-
-1999-09-17 Federico Mena Quintero <federico@redhat.com>
-
- * src/io-bmp.c (image_load): Set the initial ref_count to 1.
-
- * src/io-gif.c (image_load): Likewise.
-
- * src/io-jpeg.c (image_load): Likewise.
-
- * src/io-png.c (image_load): Likewise.
-
- * src/io-tiff.c (image_load): Likewise.
-
- * src/io-xpm.c (_pixbuf_create_from_xpm): Likewise.
-
- * src/gdk-pixbuf-io.c (gdk_pixbuf_load_image): Added an assertion
- for the ref_count to be != 0.
-
- * src/gdk-pixbuf.c (gdk_pixbuf_ref): Be more paranoid with sanity
- checking.
- (gdk_pixbuf_unref): Fix incorrect sanity check and comparison.
-
-1999-08-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
-
- * src/io-png.c (image_save): Fixed compiler warnings. Fixed write
- to unallocated memory (row_ptr), and fixed its type as well. Take
- into account the ArtPixbuf's rowstride when assigning the row
- pointers.
-
- * src/gdk-pixbuf.c: Fixup includes.
-
- * src/gdk-pixbuf-io.c: Likewise.
-
-Sat Jul 31 19:19:47 CEST 1999
-
- * src/gdk-pixbuf-io.c:
- * src/io-png.c: Fixed two obvious C syntax bugs
-
-1999-07-29 Mark Crichton <crichton@gimp.org>
-
- * src/io-png.c (image_save): Added PNG saving function
-
- * src/gdk-pixbuf-io.c: Changed image_save function format. Now it's
- image_save(GdkPixBuf *p, FILE *f, ...)
-
-
-1999-07-26 Michael Zucchi <mzucchi@denr.sa.gov.au>
-
- * src/Makefile.am (*_LIB): Only build the relevant loaders which
- require extra libraries if we actually have those libraries.
-
-1999-07-23 Richard Hestilow <hestgray@ionet.net>
-
- * src/gdk-pixbuf.h: Include glib.h as it uses g* datatypes
- * gdk_pixbufConf.sh.in: Added for gnome-config
- * Makefile.am:
- * configure.in: Modified to generate gdk_pixbufConf.sh
-
-1999-07-20 Mark Crichton <crichton@gimp.org>
-
- * src/gdk-pixbuf.c (gdk_pixbuf_rotate): Fixed rotation. Now a bbox
- calculation needs to be done.
-
-1999-07-18 Larry Ewing <lewing@gimp.org>
-
- * src/io-xpm.c:
- * src/io-gif.c:
- * src/io-png.c:
- * src/io-jpeg.c: Fix a few memory leaks in the, most of them in
- error cases but one or two in the common case. There are probably
- a few small ones left.
-
-1999-07-18 Mark Crichton <crichton@gimp.org>
-
- * configure.in: removed version.h.
-
- * src/gdk-pixbuf-io.c (pixbuf_check_tiff): Minor readability
- improvements.
-
-1999-07-17 Mark Crichton <crichton@gimp.org>
-
- * src/gdk-pixbuf.c: Removed gdk_pixbuf_free, redundant code.
- (gdk_pixbuf_rotate): Added pixbuf rotation code.
- (gdk_pixbuf_scale): Changed // comments to /* */
-
- * src/gdk-pixbuf.h (gdk_pixbuf_destroy): Added gdk_pixbuf_destroy
- function to header.
-
-1999-07-16 Larry Ewing <lewing@gimp.org>
-
- * src/testpixbuf.c (expose_func): reverted the expose everything
- changes, I'm not sure why these went in.
- (config_func): bring this up to date with the new pixbuf_scale
- semantics.
-
- * src/gdk-pixbuf-io.c: added a couple of warnings to the module
- loading code so that poeple can diagnose problems better.
-
- * src/gdk-pixbuf.c (gdk_pixbux_scale): fix the borkedness, also it
- no longer allocates a new pixbuf, which make things nicer for the
- rest of the code. Unfortunately there is still a problem with
- scaling rgba images.
-
-1999-07-16 Mark Crichton <crichton@gimp.org>
-
- * src/testpixbuf.c (config_func): ConfigureEvent handler. This
- calls gdk_pixbuf_scale. However, something is not working.
- N.B.: current pixmap is now stored in user_data with a key of
- "pixmap"
-
- * src/gdk-pixbuf.c (gdk_pixbuf_scale): Implemented scaling function.
- Something is still borked, however.
-
-1999-07-15 Larry Ewing <lewing@gimp.org>
-
- * src/io-jpeg.c (image_load): add raph@gimp.org's fix to the jpeg
- indexing routine
-
- * src/testpixbuf.c (main): fix up the file routines a little so
- that you can load multiple files given the file names
-
-1999-07-14 Larry Ewing <lewing@gimp.org>
-
- * src/testpixbuf.c (expose_func): added an almost proper expose
- handler for testpixbuf
-
-1999-07-13 Mark Crichton <crichton@gimp.org>
-
- * configure.in: Fixed GIF check. Replaced " with '
- * src/gdk-pixbuf.c: More (minor) work on gdk_pixbuf_scale
-
-1999-07-13 Mark Crichton <crichton@gimp.org>
-
- * configure.in: I am a bonehead. Added gif-lib check.
diff --git a/gdk-pixbuf/Makefile.am b/gdk-pixbuf/Makefile.am
deleted file mode 100644
index bb0ac92d32..0000000000
--- a/gdk-pixbuf/Makefile.am
+++ /dev/null
@@ -1,748 +0,0 @@
-include $(top_srcdir)/Makefile.decl
--include $(INTROSPECTION_MAKEFILE)
-
-INTROSPECTION_GIRS =
-
-SUBDIRS = pixops
-
-if PLATFORM_WIN32
-no_undefined = -no-undefined
-endif
-
-if OS_WIN32
-gdk_pixbuf_def = gdk_pixbuf.def
-gdk_pixbuf_symbols = -export-symbols $(srcdir)/gdk_pixbuf.def
-
-gdk_pixbuf_win32_res = gdk_pixbuf-win32-res.o
-gdk_pixbuf_win32_res_ldflag = -Wl,gdk_pixbuf-win32-res.o
-
-libole32 = -lole32
-
-gdk_pixbuf-win32-res.o : gdk_pixbuf.rc
- $(WINDRES) gdk_pixbuf.rc $@
-
-install-def-file:
- $(INSTALL) $(srcdir)/gdk_pixbuf.def $(DESTDIR)$(libdir)/gdk_pixbuf-$(GTK_API_VERSION).def
-uninstall-def-file:
- -rm $(DESTDIR)$(libdir)/gdk_pixbuf-$(GTK_API_VERSION).def
-else
-install-def-file:
-uninstall-def-file:
-endif
-
-if MS_LIB_AVAILABLE
-noinst_DATA = gdk_pixbuf-$(GTK_API_VERSION).lib
-
-gdk_pixbuf-$(GTK_API_VERSION).lib: libgdk_pixbuf-$(GTK_API_VERSION).la gdk_pixbuf.def
- lib -machine:@LIB_EXE_MACHINE_FLAG@ -name:libgdk_pixbuf-$(GTK_API_VERSION)-@LT_CURRENT_MINUS_AGE@.dll -def:gdk_pixbuf.def -out:$@
-
-install-ms-lib:
- $(INSTALL) gdk_pixbuf-$(GTK_API_VERSION).lib $(DESTDIR)$(libdir)
-
-uninstall-ms-lib:
- -rm $(DESTDIR)$(libdir)/gdk_pixbuf-$(GTK_API_VERSION).lib
-else
-install-ms-lib:
-uninstall-ms-lib:
-endif
-
-# This places the generated .def file in srcdir, since it is expected to be there.
-# (The one from a tarball is)
-gdk_pixbuf.def: gdk-pixbuf.symbols
- (echo -e EXPORTS; $(CPP) -P -DINCLUDE_VARIABLES -DG_OS_WIN32 -DALL_FILES - <$(srcdir)/gdk-pixbuf.symbols | sed -e '/^$$/d' -e 's/^/ /' -e 's/G_GNUC_[^ ]*//g') > $(srcdir)/gdk_pixbuf.def
-
-gdk-pixbuf-alias.h: gdk-pixbuf.symbols
- $(PERL) $(srcdir)/makegdkpixbufalias.pl < $(srcdir)/gdk-pixbuf.symbols > gdk-pixbuf-alias.h
-
-gdk-pixbuf-aliasdef.c: gdk-pixbuf.symbols
- $(PERL) $(srcdir)/makegdkpixbufalias.pl -def < $(srcdir)/gdk-pixbuf.symbols > gdk-pixbuf-aliasdef.c
-
-if OS_LINUX
-TESTS = abicheck.sh pltcheck.sh
-endif
-
-lib_LTLIBRARIES = \
- libgdk_pixbuf-3.0.la
-
-loaderdir = $(libdir)/gtk-3.0/$(GTK_BINARY_VERSION)/loaders
-
-module_libs = libgdk_pixbuf-$(GTK_API_VERSION).la $(GDK_PIXBUF_DEP_LIBS)
-
-#
-# The PNG loader
-#
-libstatic_pixbufloader_png_la_SOURCES = io-png.c
-libpixbufloader_png_la_SOURCES = io-png.c
-libpixbufloader_png_la_LDFLAGS = -avoid-version -module $(no_undefined)
-libpixbufloader_png_la_LIBADD = $(LIBPNG) $(module_libs)
-
-#
-# The BMP loader
-#
-libstatic_pixbufloader_bmp_la_SOURCES = io-bmp.c
-libpixbufloader_bmp_la_SOURCES = io-bmp.c
-libpixbufloader_bmp_la_LDFLAGS = -avoid-version -module $(no_undefined)
-libpixbufloader_bmp_la_LIBADD = $(module_libs)
-
-#
-# The WBMP loader
-#
-libstatic_pixbufloader_wbmp_la_SOURCES = io-wbmp.c
-libpixbufloader_wbmp_la_SOURCES = io-wbmp.c
-libpixbufloader_wbmp_la_LDFLAGS = -avoid-version -module $(no_undefined)
-libpixbufloader_wbmp_la_LIBADD = $(module_libs)
-
-#
-# The GIF loader
-#
-libstatic_pixbufloader_gif_la_SOURCES = io-gif.c io-gif-animation.c io-gif-animation.h
-libpixbufloader_gif_la_SOURCES = io-gif.c io-gif-animation.c io-gif-animation.h
-libpixbufloader_gif_la_LDFLAGS = -avoid-version -module $(no_undefined)
-libpixbufloader_gif_la_LIBADD = $(module_libs)
-
-#
-# The ICO loader
-#
-libstatic_pixbufloader_ico_la_SOURCES = io-ico.c
-libpixbufloader_ico_la_SOURCES = io-ico.c
-libpixbufloader_ico_la_LDFLAGS = -avoid-version -module $(no_undefined)
-libpixbufloader_ico_la_LIBADD = $(module_libs)
-
-#
-# The ANI loader
-#
-libstatic_pixbufloader_ani_la_SOURCES = io-ani.c io-ani-animation.c io-ani-animation.h
-libpixbufloader_ani_la_SOURCES = io-ani.c io-ani-animation.c io-ani-animation.h
-libpixbufloader_ani_la_LDFLAGS = -avoid-version -module $(no_undefined)
-libpixbufloader_ani_la_LIBADD = $(module_libs)
-
-#
-# The JPEG loader
-#
-libstatic_pixbufloader_jpeg_la_SOURCES = io-jpeg.c
-libpixbufloader_jpeg_la_SOURCES = io-jpeg.c
-libpixbufloader_jpeg_la_LDFLAGS = -avoid-version -module $(no_undefined)
-libpixbufloader_jpeg_la_LIBADD = $(LIBJPEG) $(module_libs)
-
-#
-# The PNM loader
-#
-libstatic_pixbufloader_pnm_la_SOURCES = io-pnm.c
-libpixbufloader_pnm_la_SOURCES = io-pnm.c
-libpixbufloader_pnm_la_LDFLAGS = -avoid-version -module $(no_undefined)
-libpixbufloader_pnm_la_LIBADD = $(module_libs)
-
-#
-# The RAS loader
-#
-libstatic_pixbufloader_ras_la_SOURCES = io-ras.c
-libpixbufloader_ras_la_SOURCES = io-ras.c
-libpixbufloader_ras_la_LDFLAGS = -avoid-version -module $(no_undefined)
-libpixbufloader_ras_la_LIBADD = $(module_libs)
-
-#
-# The TIFF loader
-#
-libstatic_pixbufloader_tiff_la_SOURCES = io-tiff.c
-libpixbufloader_tiff_la_SOURCES = io-tiff.c
-libpixbufloader_tiff_la_LDFLAGS = -avoid-version -module $(no_undefined)
-libpixbufloader_tiff_la_LIBADD = $(LIBTIFF) $(module_libs)
-
-#
-# The XPM loader
-#
-libstatic_pixbufloader_xpm_la_SOURCES = io-xpm.c
-libpixbufloader_xpm_la_SOURCES = io-xpm.c
-libpixbufloader_xpm_la_LDFLAGS = -avoid-version -module $(no_undefined)
-libpixbufloader_xpm_la_LIBADD = $(module_libs)
-
-#
-# The XBM loader
-#
-libstatic_pixbufloader_xbm_la_SOURCES = io-xbm.c
-libpixbufloader_xbm_la_SOURCES = io-xbm.c
-libpixbufloader_xbm_la_LDFLAGS = -avoid-version -module $(no_undefined)
-libpixbufloader_xbm_la_LIBADD = $(module_libs)
-
-#
-# The TGA loader
-#
-libstatic_pixbufloader_tga_la_SOURCES = io-tga.c
-libpixbufloader_tga_la_SOURCES = io-tga.c
-libpixbufloader_tga_la_LDFLAGS = -avoid-version -module $(no_undefined)
-libpixbufloader_tga_la_LIBADD = $(module_libs)
-
-#
-# The .icns loader
-#
-libstatic_pixbufloader_icns_la_SOURCES = io-icns.c
-libpixbufloader_icns_la_SOURCES = io-icns.c
-libpixbufloader_icns_la_LDFLAGS = -avoid-version -module $(no_undefined)
-libpixbufloader_icns_la_LIBADD = $(module_libs)
-
-#
-# The PCX loader
-#
-libstatic_pixbufloader_pcx_la_SOURCES = io-pcx.c
-libpixbufloader_pcx_la_SOURCES = io-pcx.c
-libpixbufloader_pcx_la_LDFLAGS = -avoid-version -module $(no_undefined)
-libpixbufloader_pcx_la_LIBADD = $(module_libs)
-
-#
-# The JPEG2000 loader
-#
-libstatic_pixbufloader_jasper_la_SOURCES = io-jasper.c
-libpixbufloader_jasper_la_SOURCES = io-jasper.c
-libpixbufloader_jasper_la_LDFLAGS = -avoid-version -module $(no_undefined)
-libpixbufloader_jasper_la_LIBADD = $(LIBJASPER) $(module_libs)
-
-#
-# The QTIF loader
-#
-libstatic_pixbufloader_qtif_la_SOURCES = io-qtif.c
-libpixbufloader_qtif_la_SOURCES = io-qtif.c
-libpixbufloader_qtif_la_LDFLAGS = -avoid-version -module $(no_undefined)
-libpixbufloader_qtif_la_LIBADD = $(module_libs)
-
-if BUILD_GDIPLUS_LOADERS
-
-if INCLUDE_GDIPLUS
-
-# When building the GDI+ loader statically, we put the "common" objects
-# only in one of the archives to avoid duplicate definitions
-
-STATIC_GDIPLUS_LIBS = \
- libstatic-pixbufloader-gdip-ico.la \
- libstatic-pixbufloader-gdip-wmf.la \
- libstatic-pixbufloader-gdip-emf.la \
- libstatic-pixbufloader-gdip-bmp.la \
- libstatic-pixbufloader-gdip-gif.la \
- libstatic-pixbufloader-gdip-jpeg.la \
- libstatic-pixbufloader-gdip-tiff.la
-
-libstatic_pixbufloader_gdip_ico_la_SOURCES = \
- io-gdip-native.h \
- io-gdip-propertytags.h \
- io-gdip-utils.h \
- io-gdip-utils.c \
- io-gdip-animation.c \
- io-gdip-animation.h \
- io-gdip-ico.c
-
-libstatic_pixbufloader_gdip_wmf_la_SOURCES = \
- io-gdip-wmf.c
-
-libstatic_pixbufloader_gdip_emf_la_SOURCES = \
- io-gdip-emf.c
-
-libstatic_pixbufloader_gdip_bmp_la_SOURCES = \
- io-gdip-bmp.c
-
-libstatic_pixbufloader_gdip_gif_la_SOURCES = \
- io-gdip-gif.c
-
-libstatic_pixbufloader_gdip_jpeg_la_SOURCES = \
- io-gdip-jpeg.c
-
-libstatic_pixbufloader_gdip_tiff_la_SOURCES = \
- io-gdip-tiff.c
-
-else
-
-GDIPLUS_LIBS = \
- libpixbufloader-gdip-ico.la \
- libpixbufloader-gdip-wmf.la \
- libpixbufloader-gdip-emf.la \
- libpixbufloader-gdip-bmp.la \
- libpixbufloader-gdip-gif.la \
- libpixbufloader-gdip-jpeg.la \
- libpixbufloader-gdip-tiff.la
-
-libpixbufloader_gdip_ico_la_LDFLAGS = -avoid-version -module -no-undefined
-libpixbufloader_gdip_ico_la_SOURCES = \
- io-gdip-native.h \
- io-gdip-propertytags.h \
- io-gdip-utils.h \
- io-gdip-utils.c \
- io-gdip-animation.c \
- io-gdip-animation.h \
- io-gdip-ico.c
-libpixbufloader_gdip_ico_la_LIBADD = $(module_libs) $(libole32)
-
-libpixbufloader_gdip_wmf_la_LDFLAGS = -avoid-version -module -no-undefined
-libpixbufloader_gdip_wmf_la_SOURCES = \
- io-gdip-native.h \
- io-gdip-propertytags.h \
- io-gdip-utils.h \
- io-gdip-utils.c \
- io-gdip-animation.c \
- io-gdip-animation.h \
- io-gdip-wmf.c
-libpixbufloader_gdip_wmf_la_LIBADD = $(module_libs) $(libole32)
-
-libpixbufloader_gdip_emf_la_LDFLAGS = -avoid-version -module -no-undefined
-libpixbufloader_gdip_emf_la_SOURCES = \
- io-gdip-native.h \
- io-gdip-propertytags.h \
- io-gdip-utils.h \
- io-gdip-utils.c \
- io-gdip-animation.c \
- io-gdip-animation.h \
- io-gdip-emf.c
-libpixbufloader_gdip_emf_la_LIBADD = $(module_libs) $(libole32)
-
-libpixbufloader_gdip_bmp_la_LDFLAGS = -avoid-version -module -no-undefined
-libpixbufloader_gdip_bmp_la_SOURCES = \
- io-gdip-native.h \
- io-gdip-propertytags.h \
- io-gdip-utils.h \
- io-gdip-utils.c \
- io-gdip-animation.c \
- io-gdip-animation.h \
- io-gdip-bmp.c
-libpixbufloader_gdip_bmp_la_LIBADD = $(module_libs) $(libole32)
-
-libpixbufloader_gdip_gif_la_LDFLAGS = -avoid-version -module -no-undefined
-libpixbufloader_gdip_gif_la_SOURCES = \
- io-gdip-native.h \
- io-gdip-propertytags.h \
- io-gdip-utils.h \
- io-gdip-utils.c \
- io-gdip-animation.c \
- io-gdip-animation.h \
- io-gdip-gif.c
-libpixbufloader_gdip_gif_la_LIBADD = $(module_libs) $(libole32)
-
-libpixbufloader_gdip_jpeg_la_LDFLAGS = -avoid-version -module -no-undefined
-libpixbufloader_gdip_jpeg_la_SOURCES = \
- io-gdip-native.h \
- io-gdip-propertytags.h \
- io-gdip-utils.h \
- io-gdip-utils.c \
- io-gdip-animation.c \
- io-gdip-animation.h \
- io-gdip-jpeg.c
-libpixbufloader_gdip_jpeg_la_LIBADD = $(module_libs) $(libole32)
-
-libpixbufloader_gdip_tiff_la_LDFLAGS = -avoid-version -module -no-undefined
-libpixbufloader_gdip_tiff_la_SOURCES = \
- io-gdip-native.h \
- io-gdip-propertytags.h \
- io-gdip-utils.h \
- io-gdip-utils.c \
- io-gdip-animation.c \
- io-gdip-animation.h \
- io-gdip-tiff.c
-libpixbufloader_gdip_tiff_la_LIBADD = $(module_libs) $(libole32)
-
-endif
-
-else
-
-# Loaders that aren't built if we build the GDI+ loader
-
-if INCLUDE_BMP
-STATIC_BMP_LIB = libstatic-pixbufloader-bmp.la
-else
-BMP_LIB = libpixbufloader-bmp.la
-endif
-
-if INCLUDE_GIF
-STATIC_GIF_LIB = libstatic-pixbufloader-gif.la
-else
-GIF_LIB = libpixbufloader-gif.la
-endif
-
-if INCLUDE_ICO
-STATIC_ICO_LIB = libstatic-pixbufloader-ico.la
-else
-ICO_LIB = libpixbufloader-ico.la
-endif
-
-if HAVE_JPEG
-if INCLUDE_JPEG
-STATIC_JPEG_LIB = libstatic-pixbufloader-jpeg.la
-else
-JPEG_LIB = libpixbufloader-jpeg.la
-endif
-endif
-
-if HAVE_TIFF
-if INCLUDE_TIFF
-STATIC_TIFF_LIB = libstatic-pixbufloader-tiff.la
-else
-TIFF_LIB = libpixbufloader-tiff.la
-endif
-endif
-
-# End of loaders not built if building GDI+ loader
-endif
-
-if HAVE_PNG
-if INCLUDE_PNG
-STATIC_PNG_LIB = libstatic-pixbufloader-png.la
-else
-PNG_LIB = libpixbufloader-png.la
-endif
-endif
-
-if INCLUDE_WBMP
-STATIC_WBMP_LIB = libstatic-pixbufloader-wbmp.la
-else
-WBMP_LIB = libpixbufloader-wbmp.la
-endif
-
-if INCLUDE_ANI
-STATIC_ANI_LIB = libstatic-pixbufloader-ani.la
-else
-ANI_LIB = libpixbufloader-ani.la
-endif
-
-if INCLUDE_PNM
-STATIC_PNM_LIB = libstatic-pixbufloader-pnm.la
-else
-PNM_LIB = libpixbufloader-pnm.la
-endif
-
-if INCLUDE_RAS
-STATIC_RAS_LIB = libstatic-pixbufloader-ras.la
-else
-RAS_LIB = libpixbufloader-ras.la
-endif
-
-if INCLUDE_XPM
-STATIC_XPM_LIB = libstatic-pixbufloader-xpm.la
-else
-XPM_LIB = libpixbufloader-xpm.la
-endif
-
-if INCLUDE_XBM
-STATIC_XBM_LIB = libstatic-pixbufloader-xbm.la
-else
-XBM_LIB = libpixbufloader-xbm.la
-endif
-
-if INCLUDE_TGA
-STATIC_TGA_LIB = libstatic-pixbufloader-tga.la
-else
-TGA_LIB = libpixbufloader-tga.la
-endif
-
-if INCLUDE_PCX
-STATIC_PCX_LIB = libstatic-pixbufloader-pcx.la
-else
-PCX_LIB = libpixbufloader-pcx.la
-endif
-
-if INCLUDE_ICNS
-STATIC_ICNS_LIB = libstatic-pixbufloader-icns.la
-else
-ICNS_LIB = libpixbufloader-icns.la
-endif
-
-if HAVE_JASPER
-if INCLUDE_JASPER
-STATIC_JASPER_LIB = libstatic-pixbufloader-jasper.la
-else
-JASPER_LIB = libpixbufloader-jasper.la
-endif
-endif
-
-if INCLUDE_QTIF
-STATIC_QTIF_LIB = libstatic-pixbufloader-qtif.la
-else
-QTIF_LIB = libpixbufloader-qtif.la
-endif
-
-if BUILD_DYNAMIC_MODULES
-
-loader_LTLIBRARIES = \
- $(PNG_LIB) \
- $(BMP_LIB) \
- $(WBMP_LIB) \
- $(GIF_LIB) \
- $(ICO_LIB) \
- $(ANI_LIB) \
- $(JPEG_LIB) \
- $(PNM_LIB) \
- $(RAS_LIB) \
- $(TIFF_LIB) \
- $(XPM_LIB) \
- $(XBM_LIB) \
- $(TGA_LIB) \
- $(ICNS_LIB) \
- $(PCX_LIB) \
- $(JASPER_LIB) \
- $(QTIF_LIB) \
- $(GDIPLUS_LIBS)
-
-
-endif
-
-noinst_LTLIBRARIES = \
- $(STATIC_PNG_LIB) \
- $(STATIC_BMP_LIB) \
- $(STATIC_WBMP_LIB) \
- $(STATIC_GIF_LIB) \
- $(STATIC_ICO_LIB) \
- $(STATIC_ANI_LIB) \
- $(STATIC_JPEG_LIB) \
- $(STATIC_PNM_LIB) \
- $(STATIC_RAS_LIB) \
- $(STATIC_TIFF_LIB) \
- $(STATIC_XPM_LIB) \
- $(STATIC_XBM_LIB) \
- $(STATIC_TGA_LIB) \
- $(STATIC_ICNS_LIB) \
- $(STATIC_PCX_LIB) \
- $(STATIC_JASPER_LIB) \
- $(STATIC_QTIF_LIB) \
- $(STATIC_GDIPLUS_LIBS)
-
-builtin_objs = @INCLUDED_LOADER_OBJ@
-
-
-DEPS = libgdk_pixbuf-$(GTK_API_VERSION).la
-INCLUDES = \
- -DG_LOG_DOMAIN=\"GdkPixbuf\" \
- -DGDK_PIXBUF_COMPILATION \
- -I$(top_srcdir) -I$(top_builddir) \
- -I$(top_srcdir)/gdk-pixbuf \
- -I$(top_builddir)/gdk-pixbuf \
- -DGTK_LIBDIR=\"$(libdir)\" \
- -DGTK_VERSION=\"$(GTK_VERSION)\" \
- -DGTK_BINARY_VERSION=\"$(GTK_BINARY_VERSION)\" \
- -DGTK_PREFIX=\"$(prefix)\" \
- $(INCLUDED_LOADER_DEFINE) \
- $(GTK_DEBUG_FLAGS) \
- $(GDK_PIXBUF_DEP_CFLAGS) \
- -DGDK_PIXBUF_ENABLE_BACKEND
-
-AM_CPPFLAGS = "-DPIXBUF_LIBDIR=\"$(loaderdir)\"" "-DBUILT_MODULES_DIR=\"$(srcdir)/.libs\""
-LDADDS = libgdk_pixbuf-$(GTK_API_VERSION).la $(GDK_PIXBUF_DEP_LIBS)
-
-noinst_PROGRAMS = test-gdk-pixbuf
-test_gdk_pixbuf_LDADD = $(LDADDS)
-
-bin_PROGRAMS = gdk-pixbuf-csource-3.0 gdk-pixbuf-query-loaders-3.0
-gdk_pixbuf_csource_3_0_SOURCES = gdk-pixbuf-csource.c
-gdk_pixbuf_csource_3_0_LDADD = $(LDADDS)
-
-gdk_pixbuf_query_loaders_3_0_DEPENDENCIES = $(DEPS)
-gdk_pixbuf_query_loaders_3_0_LDADD = $(LDADDS)
-
-gdk_pixbuf_query_loaders_3_0_SOURCES = queryloaders.c
-
-
-#
-# The GdkPixBuf library
-#
-libgdk_pixbufincludedir = $(includedir)/gtk-3.0/gdk-pixbuf
-libgdk_pixbuf_3_0_la_SOURCES = \
- gdk-pixbuf-i18n.h \
- gdk-pixbuf.c \
- gdk-pixbuf-animation.c \
- gdk-pixbuf-data.c \
- gdk-pixbuf-io.c \
- gdk-pixbuf-loader.c \
- gdk-pixbuf-scale.c \
- gdk-pixbuf-simple-anim.c \
- gdk-pixbuf-scaled-anim.c \
- gdk-pixbuf-util.c \
- gdk-pixdata.c \
- gdk-pixbuf-enum-types.c
-
-libgdk_pixbuf_3_0_la_LDFLAGS = \
- $(gdk_pixbuf_win32_res_ldflag) \
- -version-info $(LT_VERSION_INFO) \
- $(LIBTOOL_EXPORT_OPTIONS) \
- $(no_undefined) \
- $(gdk_pixbuf_symbols)
-
-
-libgdk_pixbuf_3_0_la_LIBADD = pixops/libpixops.la $(builtin_objs) $(GDK_PIXBUF_DEP_LIBS) $(libole32)
-libgdk_pixbuf_3_0_la_DEPENDENCIES = pixops/libpixops.la $(builtin_objs) $(gdk_pixbuf_def) $(gdk_pixbuf_win32_res)
-
-gdk_pixbuf_headers = \
- gdk-pixbuf.h \
- gdk-pixbuf-core.h \
- gdk-pixbuf-transform.h \
- gdk-pixbuf-io.h \
- gdk-pixbuf-animation.h \
- gdk-pixbuf-simple-anim.h \
- gdk-pixbuf-loader.h
-
-libgdk_pixbufinclude_HEADERS = \
- $(gdk_pixbuf_headers) \
- gdk-pixbuf-enum-types.h \
- gdk-pixbuf-marshal.h \
- gdk-pixbuf-features.h \
- gdk-pixdata.h
-
-noinst_HEADERS = \
- gdk-pixbuf-alias.h \
- gdk-pixbuf-private.h \
- gdk-pixbuf-scaled-anim.h \
- xpm-color-table.h
-
-BUILT_SOURCES = \
- gdk-pixbuf-alias.h \
- gdk-pixbuf-aliasdef.c \
- gdk-pixbuf-enum-types.h \
- gdk-pixbuf-enum-types.c \
- gdk-pixbuf-marshal.h \
- gdk-pixbuf-marshal.c \
- gdk-pixbuf-features.h
-
-CLEANFILES =
-MAINTAINERCLEANFILES = \
- gdk-pixbuf-aliasdef.c \
- gdk-pixbuf-enum-types.h \
- gdk-pixbuf-enum-types.c \
- gdk-pixbuf-marshal.h \
- gdk-pixbuf-marshal.c \
- loaders.cache
-
-#
-# gdk-pixbuf-enum-types.h
-#
-gdk-pixbuf-enum-types.h: s-enum-types-h
- @true
-
-s-enum-types-h: @REBUILD@ $(gdk_pixbuf_headers) gdk-pixbuf-enum-types.h.template
- ( cd $(srcdir) && $(GLIB_MKENUMS) --template gdk-pixbuf-enum-types.h.template \
- $(gdk_pixbuf_headers) ) > tmp-gdk-pixbuf-enum-types.h \
- && (cmp -s tmp-gdk-pixbuf-enum-types.h gdk-pixbuf-enum-types.h || cp tmp-gdk-pixbuf-enum-types.h gdk-pixbuf-enum-types.h ) \
- && rm -f tmp-gdk-pixbuf-enum-types.h \
- && echo timestamp > $(@F)
-
-CLEANFILES += tmp-gdk-pixbuf-enum-types.h
-MAINTAINERCLEANFILES += s-enum-types-h
-
-#
-# gdk-pixbuf-enum-types.c
-#
-gdk-pixbuf-enum-types.c: @REBUILD@ $(gdk_pixbuf_headers) gdk-pixbuf-enum-types.c.template
- (cd $(srcdir) && $(GLIB_MKENUMS) --template gdk-pixbuf-enum-types.c.template \
- $(gdk_pixbuf_headers)) > gdk-pixbuf-enum-types.c
-
-#
-# gdk-pixbuf-marshal.h
-#
-gdk-pixbuf-marshal.h: @REBUILD@ stamp-gdk-pixbuf-marshal.h
- @true
-
-stamp-gdk-pixbuf-marshal.h: @REBUILD@ $(srcdir)/gdk-pixbuf-marshal.list
- echo "#if !defined(GDK_PIXBUF_DISABLE_DEPRECATED) || defined(GDK_PIXBUF_COMPILATION)" > xgen-gmh \
- && $(GLIB_GENMARSHAL) --prefix=_gdk_pixbuf_marshal $(srcdir)/gdk-pixbuf-marshal.list --header >> xgen-gmh \
- && echo "#endif /* !GDK_PIXBUF_DISABLE_DEPRECATED || GDK_PIXBUF_COMPILATION */" >> xgen-gmh \
- && (cmp -s xgen-gmh gdk-pixbuf-marshal.h || cp xgen-gmh gdk-pixbuf-marshal.h) \
- && rm -f xgen-gmh xgen-gmh~ \
- && echo timestamp > $(@F)
-
-CLEANFILES += xgen-gmh
-MAINTAINERCLEANFILES += stamp-gdk-pixbuf-marshal.h
-
-#
-# gdk-pixbuf-marshal.c
-#
-$(srcdir)/gdk-pixbuf-marshal.c: @REBUILD@ $(srcdir)/gdk-pixbuf-marshal.list
- (echo -e "#include <gdk-pixbuf/gdk-pixbuf.h>\n#include \"gdk-pixbuf-alias.h\"" | $(GLIB_GENMARSHAL) --prefix=_gdk_pixbuf_marshal $(srcdir)/gdk-pixbuf-marshal.list --body ) >> xgen-gmc \
- && cp xgen-gmc gdk-pixbuf-marshal.c \
- && rm -f xgen-gmc xgen-gmc~
-
-CLEANFILES += xgen-gmc
-
-# if srcdir!=builddir, clean out maintainer-clean files from builddir
-# this allows dist to pass.
-distclean-local:
- if test $(srcdir) != .; then \
- rm -f $(MAINTAINERCLEANFILES); \
- fi
-
-EXTRA_DIST += \
- gdk-pixbuf-csource.1 \
- makefile.msc \
- gdk-pixbuf.symbols \
- makegdkpixbufalias.pl \
- abicheck.sh \
- pltcheck.sh \
- gdk_pixbuf.def \
- gdk_pixbuf.rc \
- gdk-pixbuf-marshal.c \
- gdk-pixbuf-marshal.list \
- gdk-pixbuf-enum-types.c.template \
- gdk-pixbuf-enum-types.h.template \
- gen-color-table.pl
-
-if HAVE_INTROSPECTION
-
-GdkPixbuf-3.0.gir: libgdk_pixbuf-3.0.la Makefile
-GdkPixbuf_3_0_gir_SCANNERFLAGS = --strip-prefix=Gdk
-GdkPixbuf_3_0_gir_INCLUDES = GModule-2.0 Gio-2.0
-GdkPixbuf_3_0_gir_LIBS = libgdk_pixbuf-3.0.la
-GdkPixbuf_3_0_gir_CFLAGS = $(INCLUDES)
-GdkPixbuf_3_0_gir_FILES = \
- $(addprefix $(srcdir)/,$(libgdk_pixbufinclude_HEADERS)) \
- $(addprefix $(srcdir)/,$(libgdk_pixbuf_3_0_la_SOURCES))
-INTROSPECTION_GIRS += GdkPixbuf-3.0.gir
-
-girdir = $(datadir)/gir-1.0
-gir_DATA = $(INTROSPECTION_GIRS)
-
-typelibsdir = $(libdir)/girepository-1.0
-typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
-
-CLEANFILES += $(gir_DATA) $(typelibs_DATA)
-endif
-
-if CROSS_COMPILING
-RUN_QUERY_LOADER_TEST=false
-else
-RUN_QUERY_LOADER_TEST=test -z "$(DESTDIR)"
-endif
-
-# Running this if cross compiling or if DESTDIR is set is going to
-# not work at all, so skip it
-# We use install-data-hook here to workaround a bug in automake and/or libtool
-# that makes the install target for the loader libraries a dependency on
-# install-data-am, and not install-exec-am. We need to ensure this gets run
-# after the libraries are installed in their final locations.
-install-data-hook: install-ms-lib install-def-file
- @if $(RUN_QUERY_LOADER_TEST) ; then \
- $(mkinstalldirs) $(DESTDIR)$(libdir)/gtk-3.0/3.0.0 ; \
- $(top_builddir)/gdk-pixbuf/gdk-pixbuf-query-loaders-3.0 > $(DESTDIR)$(libdir)/gtk-3.0/3.0.0/loaders.cache ; \
- else \
- echo "***" ; \
- echo "*** Warning: loaders.cache not built" ; \
- echo "***" ; \
- echo "*** Generate this file manually on host" ; \
- echo "*** system using gdk-pixbuf-query-loaders-3.0" ; \
- echo "***" ; \
- fi
-
-uninstall-local: uninstall-ms-lib uninstall-def-file
- rm -f $(DESTDIR)$(libdir)/gtk-3.0/3.0.0/loaders.cache
-
-if CROSS_COMPILING
-else
-all-local: loaders.cache
-endif
-
-if BUILD_DYNAMIC_MODULES
-loaders.cache: $(loader_LTLIBRARIES) gdk-pixbuf-query-loaders-3.0$(EXEEXT)
- LOADERS=`echo libpixbufloader-*.la` ; \
- if test "x$$LOADERS" != 'xlibpixbufloader-*.la' ; then \
- echo "Writing a loaders.cache file to use when running examples before installing gdk-pixbuf."; \
- $(top_builddir)/gdk-pixbuf/gdk-pixbuf-query-loaders-3.0 $$LOADERS > ./loaders.cache ;\
- else \
- echo "No dynamic modules found; will use only static modules for uninstalled example programs."; \
- touch loaders.cache; \
- fi
-else
-loaders.cache:
- echo "No dynamic modules found; will use only static modules for uninstalled example programs."; \
- touch loaders.cache;
-endif
-
--include $(top_srcdir)/git.mk
diff --git a/gdk-pixbuf/abicheck.sh b/gdk-pixbuf/abicheck.sh
deleted file mode 100755
index b6b47ab454..0000000000
--- a/gdk-pixbuf/abicheck.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#! /bin/sh
-
-cpp -DINCLUDE_VARIABLES -P -DALL_FILES ${srcdir:-.}/gdk-pixbuf.symbols | sed -e '/^$/d' -e 's/ G_GNUC.*$//' -e 's/ PRIVATE$//' | sort > expected-abi
-nm -D -g --defined-only .libs/libgdk_pixbuf-3.0.so | cut -d ' ' -f 3 | egrep -v '^(__bss_start|_edata|_end)' | sort > actual-abi
-diff -u expected-abi actual-abi && rm -f expected-abi actual-abi
diff --git a/gdk-pixbuf/gdk-pixbuf-animation.c b/gdk-pixbuf/gdk-pixbuf-animation.c
deleted file mode 100644
index 6d5e835963..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-animation.c
+++ /dev/null
@@ -1,704 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/* GdkPixbuf library - Simple animation support
- *
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Authors: Jonathan Blandford <jrb@redhat.com>
- * Havoc Pennington <hp@redhat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 <errno.h>
-#include "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-io.h"
-#include "gdk-pixbuf-i18n.h"
-#include "gdk-pixbuf-animation.h"
-#include "gdk-pixbuf-alias.h"
-
-#include <glib/gstdio.h>
-
-typedef struct _GdkPixbufNonAnim GdkPixbufNonAnim;
-typedef struct _GdkPixbufNonAnimClass GdkPixbufNonAnimClass;
-
-#define GDK_TYPE_PIXBUF_NON_ANIM (gdk_pixbuf_non_anim_get_type ())
-#define GDK_PIXBUF_NON_ANIM(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_NON_ANIM, GdkPixbufNonAnim))
-#define GDK_IS_PIXBUF_NON_ANIM(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_NON_ANIM))
-
-#define GDK_PIXBUF_NON_ANIM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_NON_ANIM, GdkPixbufNonAnimClass))
-#define GDK_IS_PIXBUF_NON_ANIM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_NON_ANIM))
-#define GDK_PIXBUF_NON_ANIM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_NON_ANIM, GdkPixbufNonAnimClass))
-
-/* Private part of the GdkPixbufNonAnim structure */
-struct _GdkPixbufNonAnim {
- GdkPixbufAnimation parent_instance;
-
- GdkPixbuf *pixbuf;
-};
-
-struct _GdkPixbufNonAnimClass {
- GdkPixbufAnimationClass parent_class;
-
-};
-
-
-typedef struct _GdkPixbufNonAnimIter GdkPixbufNonAnimIter;
-typedef struct _GdkPixbufNonAnimIterClass GdkPixbufNonAnimIterClass;
-
-
-#define GDK_TYPE_PIXBUF_NON_ANIM_ITER (gdk_pixbuf_non_anim_iter_get_type ())
-#define GDK_PIXBUF_NON_ANIM_ITER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_NON_ANIM_ITER, GdkPixbufNonAnimIter))
-#define GDK_IS_PIXBUF_NON_ANIM_ITER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_NON_ANIM_ITER))
-
-#define GDK_PIXBUF_NON_ANIM_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_NON_ANIM_ITER, GdkPixbufNonAnimIterClass))
-#define GDK_IS_PIXBUF_NON_ANIM_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_NON_ANIM_ITER))
-#define GDK_PIXBUF_NON_ANIM_ITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_NON_ANIM_ITER, GdkPixbufNonAnimIterClass))
-
-struct _GdkPixbufNonAnimIter {
- GdkPixbufAnimationIter parent_instance;
-
- GdkPixbufNonAnim *non_anim;
-};
-
-struct _GdkPixbufNonAnimIterClass {
- GdkPixbufAnimationIterClass parent_class;
-
-};
-
-static GType gdk_pixbuf_non_anim_iter_get_type (void) G_GNUC_CONST;
-
-G_DEFINE_TYPE (GdkPixbufAnimation, gdk_pixbuf_animation, G_TYPE_OBJECT);
-
-static void
-gdk_pixbuf_animation_class_init (GdkPixbufAnimationClass *klass)
-{
-}
-
-static void
-gdk_pixbuf_animation_init (GdkPixbufAnimation *animation)
-{
-}
-
-/**
- * gdk_pixbuf_animation_new_from_file:
- * @filename: Name of file to load, in the GLib file name encoding
- * @error: return location for error
- *
- * Creates a new animation by loading it from a file. The file format is
- * detected automatically. If the file's format does not support multi-frame
- * images, then an animation with a single frame will be created. Possible errors
- * are in the #GDK_PIXBUF_ERROR and #G_FILE_ERROR domains.
- *
- * Return value: A newly-created animation with a reference count of 1, or %NULL
- * if any of several error conditions ocurred: the file could not be opened,
- * there was no loader for the file's format, there was not enough memory to
- * allocate the image buffer, or the image file contained invalid data.
- **/
-GdkPixbufAnimation *
-gdk_pixbuf_animation_new_from_file (const char *filename,
- GError **error)
-{
- GdkPixbufAnimation *animation;
- int size;
- FILE *f;
- guchar buffer [1024];
- GdkPixbufModule *image_module;
- gchar *display_name;
- gboolean locked = FALSE;
-
- g_return_val_if_fail (filename != NULL, NULL);
- g_return_val_if_fail (error == NULL || *error == NULL, NULL);
-
- display_name = g_filename_display_name (filename);
- f = g_fopen (filename, "rb");
- if (!f) {
- gint save_errno = errno;
- g_set_error (error,
- G_FILE_ERROR,
- g_file_error_from_errno (save_errno),
- _("Failed to open file '%s': %s"),
- display_name,
- g_strerror (save_errno));
- g_free (display_name);
- return NULL;
- }
-
- size = fread (&buffer, 1, sizeof (buffer), f);
-
- if (size == 0) {
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Image file '%s' contains no data"),
- display_name);
- g_free (display_name);
- fclose (f);
- return NULL;
- }
-
- image_module = _gdk_pixbuf_get_module (buffer, size, filename, error);
- if (!image_module) {
- g_free (display_name);
- fclose (f);
- return NULL;
- }
-
- if (image_module->module == NULL)
- if (!_gdk_pixbuf_load_module (image_module, error)) {
- g_free (display_name);
- fclose (f);
- return NULL;
- }
-
- if (image_module->load_animation == NULL) {
- GdkPixbuf *pixbuf;
-
- /* Keep this logic in sync with gdk_pixbuf_new_from_file() */
-
- fseek (f, 0, SEEK_SET);
- pixbuf = _gdk_pixbuf_generic_image_load (image_module, f, error);
- fclose (f);
-
- if (pixbuf == NULL && error != NULL && *error == NULL) {
- /* I don't trust these crufty longjmp()'ing image libs
- * to maintain proper error invariants, and I don't
- * want user code to segfault as a result. We need to maintain
- * the invariant that error gets set if NULL is returned.
- */
-
- g_warning ("Bug! gdk-pixbuf loader '%s' didn't set an error on failure.",
- image_module->module_name);
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_FAILED,
- _("Failed to load image '%s': reason not known, probably a corrupt image file"),
- display_name);
- }
-
- if (pixbuf == NULL) {
- g_free (display_name);
- animation = NULL;
- goto out_unlock;
- }
-
- animation = gdk_pixbuf_non_anim_new (pixbuf);
-
- g_object_unref (pixbuf);
- } else {
- locked = _gdk_pixbuf_lock (image_module);
-
- fseek (f, 0, SEEK_SET);
- animation = (* image_module->load_animation) (f, error);
-
- if (animation == NULL && error != NULL && *error == NULL) {
- /* I don't trust these crufty longjmp()'ing
- * image libs to maintain proper error
- * invariants, and I don't want user code to
- * segfault as a result. We need to maintain
- * the invariant that error gets set if NULL
- * is returned.
- */
-
- g_warning ("Bug! gdk-pixbuf loader '%s' didn't set an error on failure.",
- image_module->module_name);
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_FAILED,
- _("Failed to load animation '%s': reason not known, probably a corrupt animation file"),
- display_name);
- }
-
- fclose (f);
- }
-
- g_free (display_name);
-
- out_unlock:
- if (locked)
- _gdk_pixbuf_unlock (image_module);
- return animation;
-}
-
-#ifdef G_OS_WIN32
-
-#undef gdk_pixbuf_animation_new_from_file
-
-GdkPixbufAnimation *
-gdk_pixbuf_animation_new_from_file (const char *filename,
- GError **error)
-{
- gchar *utf8_filename =
- g_locale_to_utf8 (filename, -1, NULL, NULL, error);
- GdkPixbufAnimation *retval;
-
- if (utf8_filename == NULL)
- return NULL;
-
- retval = gdk_pixbuf_animation_new_from_file_utf8 (utf8_filename, error);
-
- g_free (utf8_filename);
-
- return retval;
-}
-
-#endif
-
-/**
- * gdk_pixbuf_animation_is_static_image:
- * @animation: a #GdkPixbufAnimation
- *
- * If you load a file with gdk_pixbuf_animation_new_from_file() and it turns
- * out to be a plain, unanimated image, then this function will return
- * %TRUE. Use gdk_pixbuf_animation_get_static_image() to retrieve
- * the image.
- *
- * Return value: %TRUE if the "animation" was really just an image
- **/
-gboolean
-gdk_pixbuf_animation_is_static_image (GdkPixbufAnimation *animation)
-{
- g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION (animation), FALSE);
-
- return GDK_PIXBUF_ANIMATION_GET_CLASS (animation)->is_static_image (animation);
-}
-
-/**
- * gdk_pixbuf_animation_get_static_image:
- * @animation: a #GdkPixbufAnimation
- *
- * If an animation is really just a plain image (has only one frame),
- * this function returns that image. If the animation is an animation,
- * this function returns a reasonable thing to display as a static
- * unanimated image, which might be the first frame, or something more
- * sophisticated. If an animation hasn't loaded any frames yet, this
- * function will return %NULL.
- *
- * Return value: unanimated image representing the animation
- **/
-GdkPixbuf*
-gdk_pixbuf_animation_get_static_image (GdkPixbufAnimation *animation)
-{
- g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION (animation), NULL);
-
- return GDK_PIXBUF_ANIMATION_GET_CLASS (animation)->get_static_image (animation);
-}
-
-/**
- * gdk_pixbuf_animation_get_width:
- * @animation: An animation.
- *
- * Queries the width of the bounding box of a pixbuf animation.
- *
- * Return value: Width of the bounding box of the animation.
- **/
-int
-gdk_pixbuf_animation_get_width (GdkPixbufAnimation *animation)
-{
- int width;
-
- g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION (animation), 0);
-
- width = 0;
- GDK_PIXBUF_ANIMATION_GET_CLASS (animation)->get_size (animation,
- &width, NULL);
-
-
- return width;
-}
-
-/**
- * gdk_pixbuf_animation_get_height:
- * @animation: An animation.
- *
- * Queries the height of the bounding box of a pixbuf animation.
- *
- * Return value: Height of the bounding box of the animation.
- **/
-int
-gdk_pixbuf_animation_get_height (GdkPixbufAnimation *animation)
-{
- int height;
-
- g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION (animation), 0);
-
- height = 0;
- GDK_PIXBUF_ANIMATION_GET_CLASS (animation)->get_size (animation,
- NULL, &height);
-
-
- return height;
-}
-
-
-/**
- * gdk_pixbuf_animation_get_iter:
- * @animation: a #GdkPixbufAnimation
- * @start_time: time when the animation starts playing
- *
- * Get an iterator for displaying an animation. The iterator provides
- * the frames that should be displayed at a given time.
- * It should be freed after use with g_object_unref().
- *
- * @start_time would normally come from g_get_current_time(), and
- * marks the beginning of animation playback. After creating an
- * iterator, you should immediately display the pixbuf returned by
- * gdk_pixbuf_animation_iter_get_pixbuf(). Then, you should install a
- * timeout (with g_timeout_add()) or by some other mechanism ensure
- * that you'll update the image after
- * gdk_pixbuf_animation_iter_get_delay_time() milliseconds. Each time
- * the image is updated, you should reinstall the timeout with the new,
- * possibly-changed delay time.
- *
- * As a shortcut, if @start_time is %NULL, the result of
- * g_get_current_time() will be used automatically.
- *
- * To update the image (i.e. possibly change the result of
- * gdk_pixbuf_animation_iter_get_pixbuf() to a new frame of the animation),
- * call gdk_pixbuf_animation_iter_advance().
- *
- * If you're using #GdkPixbufLoader, in addition to updating the image
- * after the delay time, you should also update it whenever you
- * receive the area_updated signal and
- * gdk_pixbuf_animation_iter_on_currently_loading_frame() returns
- * %TRUE. In this case, the frame currently being fed into the loader
- * has received new data, so needs to be refreshed. The delay time for
- * a frame may also be modified after an area_updated signal, for
- * example if the delay time for a frame is encoded in the data after
- * the frame itself. So your timeout should be reinstalled after any
- * area_updated signal.
- *
- * A delay time of -1 is possible, indicating "infinite."
- *
- * Return value: an iterator to move over the animation
- **/
-GdkPixbufAnimationIter*
-gdk_pixbuf_animation_get_iter (GdkPixbufAnimation *animation,
- const GTimeVal *start_time)
-{
- GTimeVal val;
-
- g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION (animation), NULL);
-
-
- if (start_time)
- val = *start_time;
- else
- g_get_current_time (&val);
-
- return GDK_PIXBUF_ANIMATION_GET_CLASS (animation)->get_iter (animation, &val);
-}
-
-G_DEFINE_TYPE (GdkPixbufAnimationIter, gdk_pixbuf_animation_iter, G_TYPE_OBJECT);
-
-static void
-gdk_pixbuf_animation_iter_class_init (GdkPixbufAnimationIterClass *klass)
-{
-}
-
-static void
-gdk_pixbuf_animation_iter_init (GdkPixbufAnimationIter *iter)
-{
-}
-
-/**
- * gdk_pixbuf_animation_iter_get_delay_time:
- * @iter: an animation iterator
- *
- * Gets the number of milliseconds the current pixbuf should be displayed,
- * or -1 if the current pixbuf should be displayed forever. g_timeout_add()
- * conveniently takes a timeout in milliseconds, so you can use a timeout
- * to schedule the next update.
- *
- * Return value: delay time in milliseconds (thousandths of a second)
- **/
-int
-gdk_pixbuf_animation_iter_get_delay_time (GdkPixbufAnimationIter *iter)
-{
- g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION_ITER (iter), -1);
- g_return_val_if_fail (GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->get_delay_time, -1);
-
- return GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->get_delay_time (iter);
-}
-
-/**
- * gdk_pixbuf_animation_iter_get_pixbuf:
- * @iter: an animation iterator
- *
- * Gets the current pixbuf which should be displayed; the pixbuf will
- * be the same size as the animation itself
- * (gdk_pixbuf_animation_get_width(), gdk_pixbuf_animation_get_height()).
- * This pixbuf should be displayed for
- * gdk_pixbuf_animation_iter_get_delay_time() milliseconds. The caller
- * of this function does not own a reference to the returned pixbuf;
- * the returned pixbuf will become invalid when the iterator advances
- * to the next frame, which may happen anytime you call
- * gdk_pixbuf_animation_iter_advance(). Copy the pixbuf to keep it
- * (don't just add a reference), as it may get recycled as you advance
- * the iterator.
- *
- * Return value: the pixbuf to be displayed
- **/
-GdkPixbuf*
-gdk_pixbuf_animation_iter_get_pixbuf (GdkPixbufAnimationIter *iter)
-{
- g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION_ITER (iter), NULL);
- g_return_val_if_fail (GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->get_pixbuf, NULL);
-
- return GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->get_pixbuf (iter);
-}
-
-/**
- * gdk_pixbuf_animation_iter_on_currently_loading_frame:
- * @iter: a #GdkPixbufAnimationIter
- *
- * Used to determine how to respond to the area_updated signal on
- * #GdkPixbufLoader when loading an animation. area_updated is emitted
- * for an area of the frame currently streaming in to the loader. So if
- * you're on the currently loading frame, you need to redraw the screen for
- * the updated area.
- *
- * Return value: %TRUE if the frame we're on is partially loaded, or the last frame
- **/
-gboolean
-gdk_pixbuf_animation_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter)
-{
- g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION_ITER (iter), FALSE);
- g_return_val_if_fail (GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->on_currently_loading_frame, FALSE);
-
- return GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->on_currently_loading_frame (iter);
-}
-
-/**
- * gdk_pixbuf_animation_iter_advance:
- * @iter: a #GdkPixbufAnimationIter
- * @current_time: current time
- *
- * Possibly advances an animation to a new frame. Chooses the frame based
- * on the start time passed to gdk_pixbuf_animation_get_iter().
- *
- * @current_time would normally come from g_get_current_time(), and
- * must be greater than or equal to the time passed to
- * gdk_pixbuf_animation_get_iter(), and must increase or remain
- * unchanged each time gdk_pixbuf_animation_iter_get_pixbuf() is
- * called. That is, you can't go backward in time; animations only
- * play forward.
- *
- * As a shortcut, pass %NULL for the current time and g_get_current_time()
- * will be invoked on your behalf. So you only need to explicitly pass
- * @current_time if you're doing something odd like playing the animation
- * at double speed.
- *
- * If this function returns %FALSE, there's no need to update the animation
- * display, assuming the display had been rendered prior to advancing;
- * if %TRUE, you need to call gdk_animation_iter_get_pixbuf() and update the
- * display with the new pixbuf.
- *
- * Returns: %TRUE if the image may need updating
- *
- **/
-gboolean
-gdk_pixbuf_animation_iter_advance (GdkPixbufAnimationIter *iter,
- const GTimeVal *current_time)
-{
- GTimeVal val;
-
- g_return_val_if_fail (GDK_IS_PIXBUF_ANIMATION_ITER (iter), FALSE);
- g_return_val_if_fail (GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->advance, FALSE);
-
- if (current_time)
- val = *current_time;
- else
- g_get_current_time (&val);
-
- return GDK_PIXBUF_ANIMATION_ITER_GET_CLASS (iter)->advance (iter, &val);
-}
-
-static void gdk_pixbuf_non_anim_finalize (GObject *object);
-static gboolean gdk_pixbuf_non_anim_is_static_image (GdkPixbufAnimation *animation);
-static GdkPixbuf* gdk_pixbuf_non_anim_get_static_image (GdkPixbufAnimation *animation);
-static void gdk_pixbuf_non_anim_get_size (GdkPixbufAnimation *anim,
- int *width,
- int *height);
-static GdkPixbufAnimationIter* gdk_pixbuf_non_anim_get_iter (GdkPixbufAnimation *anim,
- const GTimeVal *start_time);
-
-G_DEFINE_TYPE (GdkPixbufNonAnim, gdk_pixbuf_non_anim, GDK_TYPE_PIXBUF_ANIMATION);
-
-static void
-gdk_pixbuf_non_anim_class_init (GdkPixbufNonAnimClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GdkPixbufAnimationClass *anim_class = GDK_PIXBUF_ANIMATION_CLASS (klass);
-
- object_class->finalize = gdk_pixbuf_non_anim_finalize;
-
- anim_class->is_static_image = gdk_pixbuf_non_anim_is_static_image;
- anim_class->get_static_image = gdk_pixbuf_non_anim_get_static_image;
- anim_class->get_size = gdk_pixbuf_non_anim_get_size;
- anim_class->get_iter = gdk_pixbuf_non_anim_get_iter;
-}
-
-static void
-gdk_pixbuf_non_anim_init (GdkPixbufNonAnim *non_anim)
-{
-}
-
-static void
-gdk_pixbuf_non_anim_finalize (GObject *object)
-{
- GdkPixbufNonAnim *non_anim = GDK_PIXBUF_NON_ANIM (object);
-
- if (non_anim->pixbuf)
- g_object_unref (non_anim->pixbuf);
-
- G_OBJECT_CLASS (gdk_pixbuf_non_anim_parent_class)->finalize (object);
-}
-
-GdkPixbufAnimation*
-gdk_pixbuf_non_anim_new (GdkPixbuf *pixbuf)
-{
- GdkPixbufNonAnim *non_anim;
-
- non_anim = g_object_new (GDK_TYPE_PIXBUF_NON_ANIM, NULL);
-
- non_anim->pixbuf = pixbuf;
-
- if (pixbuf)
- g_object_ref (pixbuf);
-
- return GDK_PIXBUF_ANIMATION (non_anim);
-}
-
-static gboolean
-gdk_pixbuf_non_anim_is_static_image (GdkPixbufAnimation *animation)
-{
-
- return TRUE;
-}
-
-static GdkPixbuf*
-gdk_pixbuf_non_anim_get_static_image (GdkPixbufAnimation *animation)
-{
- GdkPixbufNonAnim *non_anim;
-
- non_anim = GDK_PIXBUF_NON_ANIM (animation);
-
- return non_anim->pixbuf;
-}
-
-static void
-gdk_pixbuf_non_anim_get_size (GdkPixbufAnimation *anim,
- int *width,
- int *height)
-{
- GdkPixbufNonAnim *non_anim;
-
- non_anim = GDK_PIXBUF_NON_ANIM (anim);
-
- if (width)
- *width = gdk_pixbuf_get_width (non_anim->pixbuf);
-
- if (height)
- *height = gdk_pixbuf_get_height (non_anim->pixbuf);
-}
-
-static GdkPixbufAnimationIter*
-gdk_pixbuf_non_anim_get_iter (GdkPixbufAnimation *anim,
- const GTimeVal *start_time)
-{
- GdkPixbufNonAnimIter *iter;
-
- iter = g_object_new (GDK_TYPE_PIXBUF_NON_ANIM_ITER, NULL);
-
- iter->non_anim = GDK_PIXBUF_NON_ANIM (anim);
-
- g_object_ref (iter->non_anim);
-
- return GDK_PIXBUF_ANIMATION_ITER (iter);
-}
-
-static void gdk_pixbuf_non_anim_iter_finalize (GObject *object);
-static int gdk_pixbuf_non_anim_iter_get_delay_time (GdkPixbufAnimationIter *iter);
-static GdkPixbuf* gdk_pixbuf_non_anim_iter_get_pixbuf (GdkPixbufAnimationIter *iter);
-static gboolean gdk_pixbuf_non_anim_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter);
-static gboolean gdk_pixbuf_non_anim_iter_advance (GdkPixbufAnimationIter *iter,
- const GTimeVal *current_time);
-
-G_DEFINE_TYPE (GdkPixbufNonAnimIter,
- gdk_pixbuf_non_anim_iter,
- GDK_TYPE_PIXBUF_ANIMATION_ITER);
-
-static void
-gdk_pixbuf_non_anim_iter_class_init (GdkPixbufNonAnimIterClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GdkPixbufAnimationIterClass *anim_iter_class =
- GDK_PIXBUF_ANIMATION_ITER_CLASS (klass);
-
- object_class->finalize = gdk_pixbuf_non_anim_iter_finalize;
-
- anim_iter_class->get_delay_time = gdk_pixbuf_non_anim_iter_get_delay_time;
- anim_iter_class->get_pixbuf = gdk_pixbuf_non_anim_iter_get_pixbuf;
- anim_iter_class->on_currently_loading_frame = gdk_pixbuf_non_anim_iter_on_currently_loading_frame;
- anim_iter_class->advance = gdk_pixbuf_non_anim_iter_advance;
-}
-
-static void
-gdk_pixbuf_non_anim_iter_init (GdkPixbufNonAnimIter *non_iter)
-{
-}
-
-static void
-gdk_pixbuf_non_anim_iter_finalize (GObject *object)
-{
- GdkPixbufNonAnimIter *iter = GDK_PIXBUF_NON_ANIM_ITER (object);
-
- g_object_unref (iter->non_anim);
-
- G_OBJECT_CLASS (gdk_pixbuf_non_anim_iter_parent_class)->finalize (object);
-}
-
-static int
-gdk_pixbuf_non_anim_iter_get_delay_time (GdkPixbufAnimationIter *iter)
-{
- return -1; /* show only frame forever */
-}
-
-static GdkPixbuf*
-gdk_pixbuf_non_anim_iter_get_pixbuf (GdkPixbufAnimationIter *iter)
-{
- return GDK_PIXBUF_NON_ANIM_ITER (iter)->non_anim->pixbuf;
-}
-
-
-static gboolean
-gdk_pixbuf_non_anim_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter)
-{
- return TRUE;
-}
-
-static gboolean
-gdk_pixbuf_non_anim_iter_advance (GdkPixbufAnimationIter *iter,
- const GTimeVal *current_time)
-{
-
- /* Advancing never requires a refresh */
- return FALSE;
-}
-
-#define __GDK_PIXBUF_ANIMATION_C__
-#include "gdk-pixbuf-aliasdef.c"
diff --git a/gdk-pixbuf/gdk-pixbuf-animation.h b/gdk-pixbuf/gdk-pixbuf-animation.h
deleted file mode 100644
index a67e3c9073..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-animation.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/* GdkPixbuf library - Animation support
- *
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Authors: Mark Crichton <crichton@gimp.org>
- * Miguel de Icaza <miguel@gnu.org>
- * Federico Mena-Quintero <federico@gimp.org>
- * Havoc Pennington <hp@redhat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.
- */
-
-#if !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION)
-#error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
-#endif
-
-#ifndef GDK_PIXBUF_ANIMATION_H
-#define GDK_PIXBUF_ANIMATION_H
-
-#include <glib-object.h>
-#include <gdk-pixbuf/gdk-pixbuf-core.h>
-
-G_BEGIN_DECLS
-
-/* Animation support */
-
-typedef struct _GdkPixbufAnimation GdkPixbufAnimation;
-typedef struct _GdkPixbufAnimationIter GdkPixbufAnimationIter;
-
-#define GDK_TYPE_PIXBUF_ANIMATION (gdk_pixbuf_animation_get_type ())
-#define GDK_PIXBUF_ANIMATION(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_ANIMATION, GdkPixbufAnimation))
-#define GDK_IS_PIXBUF_ANIMATION(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_ANIMATION))
-
-#define GDK_TYPE_PIXBUF_ANIMATION_ITER (gdk_pixbuf_animation_iter_get_type ())
-#define GDK_PIXBUF_ANIMATION_ITER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_ANIMATION_ITER, GdkPixbufAnimationIter))
-#define GDK_IS_PIXBUF_ANIMATION_ITER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_ANIMATION_ITER))
-
-GType gdk_pixbuf_animation_get_type (void) G_GNUC_CONST;
-
-#ifdef G_OS_WIN32
-#define gdk_pixbuf_animation_new_from_file gdk_pixbuf_animation_new_from_file_utf8
-#endif
-
-GdkPixbufAnimation *gdk_pixbuf_animation_new_from_file (const char *filename,
- GError **error);
-
-int gdk_pixbuf_animation_get_width (GdkPixbufAnimation *animation);
-int gdk_pixbuf_animation_get_height (GdkPixbufAnimation *animation);
-gboolean gdk_pixbuf_animation_is_static_image (GdkPixbufAnimation *animation);
-GdkPixbuf *gdk_pixbuf_animation_get_static_image (GdkPixbufAnimation *animation);
-
-GdkPixbufAnimationIter *gdk_pixbuf_animation_get_iter (GdkPixbufAnimation *animation,
- const GTimeVal *start_time);
-GType gdk_pixbuf_animation_iter_get_type (void) G_GNUC_CONST;
-int gdk_pixbuf_animation_iter_get_delay_time (GdkPixbufAnimationIter *iter);
-GdkPixbuf *gdk_pixbuf_animation_iter_get_pixbuf (GdkPixbufAnimationIter *iter);
-gboolean gdk_pixbuf_animation_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter);
-gboolean gdk_pixbuf_animation_iter_advance (GdkPixbufAnimationIter *iter,
- const GTimeVal *current_time);
-
-
-#ifdef GDK_PIXBUF_ENABLE_BACKEND
-
-
-
-typedef struct _GdkPixbufAnimationClass GdkPixbufAnimationClass;
-
-#define GDK_PIXBUF_ANIMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_ANIMATION, GdkPixbufAnimationClass))
-#define GDK_IS_PIXBUF_ANIMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_ANIMATION))
-#define GDK_PIXBUF_ANIMATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_ANIMATION, GdkPixbufAnimationClass))
-
-/* Private part of the GdkPixbufAnimation structure */
-struct _GdkPixbufAnimation {
- GObject parent_instance;
-
-};
-
-struct _GdkPixbufAnimationClass {
- GObjectClass parent_class;
-
- /*< public >*/
-
- gboolean (*is_static_image) (GdkPixbufAnimation *anim);
-
- GdkPixbuf* (*get_static_image) (GdkPixbufAnimation *anim);
-
- void (*get_size) (GdkPixbufAnimation *anim,
- int *width,
- int *height);
-
- GdkPixbufAnimationIter* (*get_iter) (GdkPixbufAnimation *anim,
- const GTimeVal *start_time);
-
-};
-
-
-
-typedef struct _GdkPixbufAnimationIterClass GdkPixbufAnimationIterClass;
-
-#define GDK_PIXBUF_ANIMATION_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_ANIMATION_ITER, GdkPixbufAnimationIterClass))
-#define GDK_IS_PIXBUF_ANIMATION_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_ANIMATION_ITER))
-#define GDK_PIXBUF_ANIMATION_ITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_ANIMATION_ITER, GdkPixbufAnimationIterClass))
-
-struct _GdkPixbufAnimationIter {
- GObject parent_instance;
-
-};
-
-struct _GdkPixbufAnimationIterClass {
- GObjectClass parent_class;
-
- /*< public >*/
-
- int (*get_delay_time) (GdkPixbufAnimationIter *iter);
-
- GdkPixbuf* (*get_pixbuf) (GdkPixbufAnimationIter *iter);
-
- gboolean (*on_currently_loading_frame) (GdkPixbufAnimationIter *iter);
-
- gboolean (*advance) (GdkPixbufAnimationIter *iter,
- const GTimeVal *current_time);
-};
-
-
-GType gdk_pixbuf_non_anim_get_type (void) G_GNUC_CONST;
-GdkPixbufAnimation* gdk_pixbuf_non_anim_new (GdkPixbuf *pixbuf);
-
-#endif /* GDK_PIXBUF_ENABLE_BACKEND */
-
-G_END_DECLS
-
-#endif /* GDK_PIXBUF_ANIMATION_H */
diff --git a/gdk-pixbuf/gdk-pixbuf-core.h b/gdk-pixbuf/gdk-pixbuf-core.h
deleted file mode 100644
index 4ea16934c3..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-core.h
+++ /dev/null
@@ -1,260 +0,0 @@
-/* GdkPixbuf library - GdkPixbuf data structure
- *
- * Copyright (C) 2003 The Free Software Foundation
- *
- * Authors: Mark Crichton <crichton@gimp.org>
- * Miguel de Icaza <miguel@gnu.org>
- * Federico Mena-Quintero <federico@gimp.org>
- * Havoc Pennington <hp@redhat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.
- */
-
-#if !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION)
-#error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
-#endif
-
-#ifndef GDK_PIXBUF_CORE_H
-#define GDK_PIXBUF_CORE_H
-
-#include <glib.h>
-#include <glib-object.h>
-#include <gio/gio.h>
-
-G_BEGIN_DECLS
-
-/* 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
- */
-typedef enum {
- GDK_COLORSPACE_RGB
-} GdkColorspace;
-
-/* All of these are opaque structures */
-typedef struct _GdkPixbuf GdkPixbuf;
-
-#define GDK_TYPE_PIXBUF (gdk_pixbuf_get_type ())
-#define GDK_PIXBUF(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF, GdkPixbuf))
-#define GDK_IS_PIXBUF(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF))
-
-
-/* Handler that must free the pixel array */
-typedef void (* GdkPixbufDestroyNotify) (guchar *pixels, gpointer data);
-
-#define GDK_PIXBUF_ERROR gdk_pixbuf_error_quark ()
-
-typedef enum {
- /* image data hosed */
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- /* no mem to load image */
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- /* bad option passed to save routine */
- GDK_PIXBUF_ERROR_BAD_OPTION,
- /* unsupported image type (sort of an ENOSYS) */
- GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
- /* unsupported operation (load, save) for image type */
- GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION,
- GDK_PIXBUF_ERROR_FAILED
-} GdkPixbufError;
-
-GQuark gdk_pixbuf_error_quark (void);
-
-
-
-GType gdk_pixbuf_get_type (void) G_GNUC_CONST;
-
-/* GdkPixbuf accessors */
-
-GdkColorspace gdk_pixbuf_get_colorspace (const GdkPixbuf *pixbuf);
-int gdk_pixbuf_get_n_channels (const GdkPixbuf *pixbuf);
-gboolean gdk_pixbuf_get_has_alpha (const GdkPixbuf *pixbuf);
-int gdk_pixbuf_get_bits_per_sample (const GdkPixbuf *pixbuf);
-guchar *gdk_pixbuf_get_pixels (const GdkPixbuf *pixbuf);
-int gdk_pixbuf_get_width (const GdkPixbuf *pixbuf);
-int gdk_pixbuf_get_height (const GdkPixbuf *pixbuf);
-int gdk_pixbuf_get_rowstride (const GdkPixbuf *pixbuf);
-
-
-
-/* Create a blank pixbuf with an optimal rowstride and a new buffer */
-GdkPixbuf *gdk_pixbuf_new (GdkColorspace colorspace, gboolean has_alpha, int bits_per_sample,
- int width, int height);
-
-/* Copy a pixbuf */
-
-GdkPixbuf *gdk_pixbuf_copy (const GdkPixbuf *pixbuf);
-
-/* Create a pixbuf which points to the pixels of another pixbuf */
-GdkPixbuf *gdk_pixbuf_new_subpixbuf (GdkPixbuf *src_pixbuf,
- int src_x,
- int src_y,
- int width,
- int height);
-
-/* Simple loading */
-
-#ifdef G_OS_WIN32
-/* DLL ABI stability hack. */
-#define gdk_pixbuf_new_from_file gdk_pixbuf_new_from_file_utf8
-#define gdk_pixbuf_new_from_file_at_size gdk_pixbuf_new_from_file_at_size_utf8
-#define gdk_pixbuf_new_from_file_at_scale gdk_pixbuf_new_from_file_at_scale_utf8
-#endif
-
-GdkPixbuf *gdk_pixbuf_new_from_file (const char *filename,
- GError **error);
-GdkPixbuf *gdk_pixbuf_new_from_file_at_size (const char *filename,
- int width,
- int height,
- GError **error);
-GdkPixbuf *gdk_pixbuf_new_from_file_at_scale (const char *filename,
- int width,
- int height,
- gboolean preserve_aspect_ratio,
- GError **error);
-
-GdkPixbuf *gdk_pixbuf_new_from_data (const guchar *data,
- GdkColorspace colorspace,
- gboolean has_alpha,
- int bits_per_sample,
- int width, int height,
- int rowstride,
- GdkPixbufDestroyNotify destroy_fn,
- gpointer destroy_fn_data);
-
-GdkPixbuf *gdk_pixbuf_new_from_xpm_data (const char **data);
-GdkPixbuf* gdk_pixbuf_new_from_inline (gint data_length,
- const guint8 *data,
- gboolean copy_pixels,
- GError **error);
-
-/* Mutations */
-void gdk_pixbuf_fill (GdkPixbuf *pixbuf,
- guint32 pixel);
-
-/* Saving */
-
-#ifdef G_OS_WIN32
-/* DLL ABI stability hack. */
-#define gdk_pixbuf_save gdk_pixbuf_save_utf8
-#define gdk_pixbuf_savev gdk_pixbuf_savev_utf8
-#endif
-
-gboolean gdk_pixbuf_save (GdkPixbuf *pixbuf,
- const char *filename,
- const char *type,
- GError **error,
- ...) G_GNUC_NULL_TERMINATED;
-
-gboolean gdk_pixbuf_savev (GdkPixbuf *pixbuf,
- const char *filename,
- const char *type,
- char **option_keys,
- char **option_values,
- GError **error);
-
-/* Saving to a callback function */
-
-typedef gboolean (*GdkPixbufSaveFunc) (const gchar *buf,
- gsize count,
- GError **error,
- gpointer data);
-
-gboolean gdk_pixbuf_save_to_callback (GdkPixbuf *pixbuf,
- GdkPixbufSaveFunc save_func,
- gpointer user_data,
- const char *type,
- GError **error,
- ...) G_GNUC_NULL_TERMINATED;
-
-gboolean gdk_pixbuf_save_to_callbackv (GdkPixbuf *pixbuf,
- GdkPixbufSaveFunc save_func,
- gpointer user_data,
- const char *type,
- char **option_keys,
- char **option_values,
- GError **error);
-
-/* Saving into a newly allocated char array */
-
-gboolean gdk_pixbuf_save_to_buffer (GdkPixbuf *pixbuf,
- gchar **buffer,
- gsize *buffer_size,
- const char *type,
- GError **error,
- ...) G_GNUC_NULL_TERMINATED;
-
-gboolean gdk_pixbuf_save_to_bufferv (GdkPixbuf *pixbuf,
- gchar **buffer,
- gsize *buffer_size,
- const char *type,
- char **option_keys,
- char **option_values,
- GError **error);
-
-GdkPixbuf *gdk_pixbuf_new_from_stream (GInputStream *stream,
- GCancellable *cancellable,
- GError **error);
-
-GdkPixbuf *gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream,
- gint width,
- gint height,
- gboolean preserve_aspect_ratio,
- GCancellable *cancellable,
- GError **error);
-
-gboolean gdk_pixbuf_save_to_stream (GdkPixbuf *pixbuf,
- GOutputStream *stream,
- const char *type,
- GCancellable *cancellable,
- GError **error,
- ...);
-
-/* Adding an alpha channel */
-GdkPixbuf *gdk_pixbuf_add_alpha (const GdkPixbuf *pixbuf, gboolean substitute_color,
- guchar r, guchar g, guchar b);
-
-/* Copy an area of a pixbuf onto another one */
-void gdk_pixbuf_copy_area (const GdkPixbuf *src_pixbuf,
- int src_x, int src_y,
- int width, int height,
- GdkPixbuf *dest_pixbuf,
- int dest_x, int dest_y);
-
-/* Brighten/darken and optionally make it pixelated-looking */
-void gdk_pixbuf_saturate_and_pixelate (const GdkPixbuf *src,
- GdkPixbuf *dest,
- gfloat saturation,
- gboolean pixelate);
-
-/* Transform an image to agree with its embedded orientation option / tag */
-GdkPixbuf *gdk_pixbuf_apply_embedded_orientation (GdkPixbuf *src);
-
-G_CONST_RETURN gchar * gdk_pixbuf_get_option (GdkPixbuf *pixbuf,
- const gchar *key);
-
-
-G_END_DECLS
-
-
-#endif /* GDK_PIXBUF_CORE_H */
diff --git a/gdk-pixbuf/gdk-pixbuf-csource.1 b/gdk-pixbuf/gdk-pixbuf-csource.1
deleted file mode 100644
index d992921b6d..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-csource.1
+++ /dev/null
@@ -1,91 +0,0 @@
-.TH GDK-PIXBUF-CSOURCE 1 "04 Sep 2001"
-.SH NAME
-gdk-pixbuf-csource \- C code generation utility for GdkPixbuf images
-.SH SYNOPSIS
-
-\fBgdk-pixbuf-csource\fP [\fIoptions\fP] [\fIimage\fP]
-.br
-\fBgdk-pixbuf-csource\fP [\fIoptions\fP] \fI--build-list\fP [[\fIname image\fP]...]
-
-.SH DESCRIPTION
-\fBgdk-pixbuf-csource\fP is a small utility that generates C code containing
-images, useful for compiling images directly into programs.
-
-.SH INVOCATION
-
-\fBgdk-pixbuf-csource\fP either takes as input one image file name to generate code
-for, or, using the \fI--build-list\fP option, a list of (\fIname\fP, \fIimage\fP)
-pairs to generate code for a list of images into named variables.
-
-.SS Options
-.TP
-\fI--stream
-Generate pixbuf data stream (a single string containing a serialized
-GdkPixdata structure in network byte order).
-
-.TP
-\fI--struct
-Generate GdkPixdata structure (needs the GdkPixdata structure definition from
-gdk-pixdata.h).
-
-.TP
-\fI--macros
-Generate *_ROWSTRIDE, *_WIDTH, *_HEIGHT, *_BYTES_PER_PIXEL and
-*_RLE_PIXEL_DATA or *_PIXEL_DATA macro definitions for the image.
-
-.TP
-\fI--rle
-Enables run-length encoding for the generated pixel data (default).
-
-.TP
-\fI--raw
-Disables run-length encoding for the generated pixel data.
-
-.TP
-\fI--extern
-Generate extern symbols.
-
-.TP
-\fI--static
-Generate static symbols (default).
-
-.TP
-\fI--decoder
-Provide a *_RUN_LENGTH_DECODE(image_buf, rle_data, size, bpp) macro definition
-to decode run-length encoded image data.
-
-.TP
-\fI--name=identifier
-Specifies the identifier name (prefix) for the generated variables or
-macros (useful only if \fI--build-list\fP was not specified).
-
-.TP
-\fI--build-list
-Enables (\fIname\fP, \fIimage\fP) pair parsing mode.
-
-.TP
-\fI-h, --help\fP
-Print brief help and exit.
-
-.TP
-\fI-v, --version\fP
-Print version and exit.
-
-.TP
-\fI--g-fatal-warnings
-Make warnings fatal (causes the program to abort).
-
-.PP
-
-.SH SEE ALSO
-The \fIGdkPixbuf\fP documentation, shipped with the \fIGtk+\fP distribution,
-available from \fIhttp://www.gtk.org\fP.
-
-.SH BUGS
-None known yet.
-
-.SH AUTHOR
-.B gdk-pixbuf-csource
-was written by Tim Janik <timj@gtk.org>.
-.PP
-This manual page was provided by Tim Janik <timj@gtk.org>.
diff --git a/gdk-pixbuf/gdk-pixbuf-csource.c b/gdk-pixbuf/gdk-pixbuf-csource.c
deleted file mode 100644
index c9b0d4f238..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-csource.c
+++ /dev/null
@@ -1,304 +0,0 @@
-/* Gdk-Pixbuf-CSource - GdkPixbuf based image CSource generator
- * Copyright (C) 1999, 2001 Tim Janik
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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"
-
-#define __GTK_H_INSIDE__
-#include "../gtk/gtkversion.h" /* versioning */
-#undef __GTK_H_INSIDE__
-#include "gdk-pixbuf.h"
-#include "gdk-pixdata.h"
-#include <glib/gprintf.h>
-#include <stdlib.h>
-#include <string.h>
-
-
-/* --- defines --- */
-#undef G_LOG_DOMAIN
-#define G_LOG_DOMAIN "Gdk-Pixbuf-CSource"
-#define PRG_NAME "gdk-pixbuf-csource-3.0"
-#define PKG_NAME "GTK+"
-#define PKG_HTTP_HOME "http://www.gtk.org"
-
-
-/* --- prototypes --- */
-static void parse_args (gint *argc_p,
- gchar ***argv_p);
-static void print_blurb (FILE *bout,
- gboolean print_help);
-
-
-/* --- variables --- */
-static guint gen_type = GDK_PIXDATA_DUMP_PIXDATA_STREAM;
-static guint gen_ctype = GDK_PIXDATA_DUMP_GTYPES | GDK_PIXDATA_DUMP_STATIC | GDK_PIXDATA_DUMP_CONST;
-static gboolean use_rle = TRUE;
-static gboolean with_decoder = FALSE;
-static gchar *image_name = "my_pixbuf";
-static gboolean build_list = FALSE;
-
-
-/* --- functions --- */
-static void
-print_csource (FILE *f_out,
- GdkPixbuf *pixbuf)
-{
- GdkPixdata pixdata;
- gpointer free_me;
- GString *gstring;
-
- free_me = gdk_pixdata_from_pixbuf (&pixdata, pixbuf, use_rle);
- gstring = gdk_pixdata_to_csource (&pixdata, image_name,
- gen_type | gen_ctype |
- (with_decoder ? GDK_PIXDATA_DUMP_RLE_DECODER : 0));
-
- g_fprintf (f_out, "%s\n", gstring->str);
-
- g_free (free_me);
-}
-
-int
-main (int argc,
- char *argv[])
-{
- GdkPixbuf *pixbuf;
- GError *error = NULL;
- gchar *infilename;
-
- /* initialize glib/GdkPixbuf */
- g_type_init ();
-
- /* parse args and do fast exits */
- parse_args (&argc, &argv);
-
- if (!build_list)
- {
- if (argc != 2)
- {
- print_blurb (stderr, TRUE);
- return 1;
- }
-
-#ifdef G_OS_WIN32
- infilename = g_locale_to_utf8 (argv[1], -1, NULL, NULL, NULL);
-#else
- infilename = argv[1];
-#endif
-
- pixbuf = gdk_pixbuf_new_from_file (infilename, &error);
- if (!pixbuf)
- {
- g_fprintf (stderr, "failed to load \"%s\": %s\n",
- argv[1],
- error->message);
- g_error_free (error);
- return 1;
- }
-
- print_csource (stdout, pixbuf);
- g_object_unref (pixbuf);
- }
- else /* parse name, file pairs */
- {
- gchar **p = argv + 1;
- guint j = argc - 1;
- gboolean toggle = FALSE;
-
- while (j--)
- {
-#ifdef G_OS_WIN32
- infilename = g_locale_to_utf8 (*p, -1, NULL, NULL, NULL);
-#else
- infilename = *p;
-#endif
-
- if (!toggle)
- {
- image_name = infilename;
- p++;
- }
- else
- {
- pixbuf = gdk_pixbuf_new_from_file (infilename, &error);
- if (!pixbuf)
- {
- g_fprintf (stderr, "failed to load \"%s\": %s\n",
- *p,
- error->message);
- g_error_free (error);
- return 1;
- }
- print_csource (stdout, pixbuf);
- g_object_unref (pixbuf);
- p++;
- }
- toggle = !toggle;
- }
- }
-
- return 0;
-}
-
-static void
-parse_args (gint *argc_p,
- gchar ***argv_p)
-{
- guint argc = *argc_p;
- gchar **argv = *argv_p;
- guint i, e;
-
- for (i = 1; i < argc; i++)
- {
- if (strcmp ("--macros", argv[i]) == 0)
- {
- gen_type = GDK_PIXDATA_DUMP_MACROS;
- argv[i] = NULL;
- }
- else if (strcmp ("--struct", argv[i]) == 0)
- {
- gen_type = GDK_PIXDATA_DUMP_PIXDATA_STRUCT;
- argv[i] = NULL;
- }
- else if (strcmp ("--stream", argv[i]) == 0)
- {
- gen_type = GDK_PIXDATA_DUMP_PIXDATA_STREAM;
- argv[i] = NULL;
- }
- else if (strcmp ("--rle", argv[i]) == 0)
- {
- use_rle = TRUE;
- argv[i] = NULL;
- }
- else if (strcmp ("--raw", argv[i]) == 0)
- {
- use_rle = FALSE;
- argv[i] = NULL;
- }
- else if (strcmp ("--extern", argv[i]) == 0)
- {
- gen_ctype &= ~GDK_PIXDATA_DUMP_STATIC;
- argv[i] = NULL;
- }
- else if (strcmp ("--static", argv[i]) == 0)
- {
- gen_ctype |= GDK_PIXDATA_DUMP_STATIC;
- argv[i] = NULL;
- }
- else if (strcmp ("--decoder", argv[i]) == 0)
- {
- with_decoder = TRUE;
- argv[i] = NULL;
- }
- else if ((strcmp ("--name", argv[i]) == 0) ||
- (strncmp ("--name=", argv[i], 7) == 0))
- {
- gchar *equal = argv[i] + 6;
-
- if (*equal == '=')
- image_name = g_strdup (equal + 1);
- else if (i + 1 < argc)
- {
- image_name = g_strdup (argv[i + 1]);
- argv[i] = NULL;
- i += 1;
- }
- argv[i] = NULL;
- }
- else if (strcmp ("--build-list", argv[i]) == 0)
- {
- build_list = TRUE;
- argv[i] = NULL;
- }
- else if (strcmp ("-h", argv[i]) == 0 ||
- strcmp ("--help", argv[i]) == 0)
- {
- print_blurb (stderr, TRUE);
- argv[i] = NULL;
- exit (0);
- }
- else if (strcmp ("-v", argv[i]) == 0 ||
- strcmp ("--version", argv[i]) == 0)
- {
- print_blurb (stderr, FALSE);
- argv[i] = NULL;
- exit (0);
- }
- else if (strcmp (argv[i], "--g-fatal-warnings") == 0)
- {
- GLogLevelFlags fatal_mask;
-
- fatal_mask = g_log_set_always_fatal (G_LOG_FATAL_MASK);
- fatal_mask |= G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL;
- g_log_set_always_fatal (fatal_mask);
-
- argv[i] = NULL;
- }
- }
-
- e = 0;
- for (i = 1; i < argc; i++)
- {
- if (e)
- {
- if (argv[i])
- {
- argv[e++] = argv[i];
- argv[i] = NULL;
- }
- }
- else if (!argv[i])
- e = i;
- }
- if (e)
- *argc_p = e;
-}
-
-static void
-print_blurb (FILE *bout,
- gboolean print_help)
-{
- if (!print_help)
- {
- g_fprintf (bout, "%s version ", PRG_NAME);
- g_fprintf (bout, "%d.%d.%d", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
- g_fprintf (bout, "\n");
- g_fprintf (bout, "%s comes with ABSOLUTELY NO WARRANTY.\n", PRG_NAME);
- g_fprintf (bout, "You may redistribute copies of %s under the terms of\n", PRG_NAME);
- g_fprintf (bout, "the GNU Lesser General Public License which can be found in the\n");
- g_fprintf (bout, "%s source package. Sources, examples and contact\n", PKG_NAME);
- g_fprintf (bout, "information are available at %s\n", PKG_HTTP_HOME);
- }
- else
- {
- g_fprintf (bout, "Usage: %s [options] [image]\n", PRG_NAME);
- g_fprintf (bout, " %s [options] --build-list [[name image]...]\n", PRG_NAME);
- g_fprintf (bout, " --stream generate pixbuf data stream\n");
- g_fprintf (bout, " --struct generate GdkPixdata structure\n");
- g_fprintf (bout, " --macros generate image size/pixel macros\n");
- g_fprintf (bout, " --rle use one byte run-length-encoding\n");
- g_fprintf (bout, " --raw provide raw image data copy\n");
- g_fprintf (bout, " --extern generate extern symbols\n");
- g_fprintf (bout, " --static generate static symbols\n");
- g_fprintf (bout, " --decoder provide rle decoder\n");
- g_fprintf (bout, " --name=identifier C macro/variable name\n");
- g_fprintf (bout, " --build-list parse (name, image) pairs\n");
- g_fprintf (bout, " -h, --help show this help message\n");
- g_fprintf (bout, " -v, --version print version informations\n");
- g_fprintf (bout, " --g-fatal-warnings make warnings fatal (abort)\n");
- }
-}
-
diff --git a/gdk-pixbuf/gdk-pixbuf-data.c b/gdk-pixbuf/gdk-pixbuf-data.c
deleted file mode 100644
index 800d64d2a6..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-data.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/* GdkPixbuf library - Image creation from in-memory buffers
- *
- * 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 Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 "gdk-pixbuf.h"
-#include "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-alias.h"
-#include <stdlib.h>
-#include <string.h>
-
-
-
-/**
- * gdk_pixbuf_new_from_data:
- * @data: Image data in 8-bit/sample packed format
- * @colorspace: Colorspace for the image data
- * @has_alpha: Whether the data has an opacity channel
- * @bits_per_sample: Number of bits per sample
- * @width: Width of the image in pixels, must be > 0
- * @height: Height of the image in pixels, must be > 0
- * @rowstride: Distance in bytes between row starts
- * @destroy_fn: Function used to free the data when the pixbuf's reference count
- * drops to zero, or %NULL if the data should not be freed
- * @destroy_fn_data: Closure data to pass to the destroy notification function
- *
- * Creates a new #GdkPixbuf out of in-memory image data. Currently only RGB
- * images with 8 bits per sample are supported.
- *
- * Return value: A newly-created #GdkPixbuf structure with a reference count of 1.
- **/
-GdkPixbuf *
-gdk_pixbuf_new_from_data (const guchar *data, GdkColorspace colorspace, gboolean has_alpha,
- int bits_per_sample, int width, int height, int rowstride,
- GdkPixbufDestroyNotify destroy_fn, gpointer destroy_fn_data)
-{
- GdkPixbuf *pixbuf;
-
- /* Only 8-bit/sample RGB buffers are supported for now */
-
- g_return_val_if_fail (data != NULL, NULL);
- g_return_val_if_fail (colorspace == GDK_COLORSPACE_RGB, NULL);
- g_return_val_if_fail (bits_per_sample == 8, NULL);
- g_return_val_if_fail (width > 0, NULL);
- g_return_val_if_fail (height > 0, NULL);
-
- pixbuf = g_object_new (GDK_TYPE_PIXBUF,
- "colorspace", colorspace,
- "n-channels", has_alpha ? 4 : 3,
- "bits-per-sample", bits_per_sample,
- "has-alpha", has_alpha ? TRUE : FALSE,
- "width", width,
- "height", height,
- "rowstride", rowstride,
- "pixels", data,
- NULL);
-
- pixbuf->destroy_fn = destroy_fn;
- pixbuf->destroy_fn_data = destroy_fn_data;
-
- return pixbuf;
-}
-
-#define __GDK_PIXBUF_DATA_C__
-#include "gdk-pixbuf-aliasdef.c"
diff --git a/gdk-pixbuf/gdk-pixbuf-enum-types.c.template b/gdk-pixbuf/gdk-pixbuf-enum-types.c.template
deleted file mode 100644
index 8496c13a57..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-enum-types.c.template
+++ /dev/null
@@ -1,38 +0,0 @@
-/*** BEGIN file-header ***/
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include "gdk-pixbuf-alias.h"
-
-/*** END file-header ***/
-
-/*** BEGIN file-production ***/
-/* enumerations from "@filename@" */
-/*** END file-production ***/
-
-/*** BEGIN value-header ***/
-GType
-@enum_name@_get_type (void)
-{
- static GType etype = 0;
-
- if (G_UNLIKELY(etype == 0)) {
- static const G@Type@Value values[] = {
-/*** END value-header ***/
-
-/*** BEGIN value-production ***/
- { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
-/*** END value-production ***/
-
-/*** BEGIN value-tail ***/
- { 0, NULL, NULL }
- };
- etype = g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
- }
- return etype;
-}
-
-/*** END value-tail ***/
-
-/*** BEGIN file-tail ***/
-#define __GDK_PIXBUF_ENUM_TYPES_C__
-#include "gdk-pixbuf-aliasdef.c"
-/*** END file-tail ***/
diff --git a/gdk-pixbuf/gdk-pixbuf-enum-types.h.template b/gdk-pixbuf/gdk-pixbuf-enum-types.h.template
deleted file mode 100644
index 3989980b03..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-enum-types.h.template
+++ /dev/null
@@ -1,28 +0,0 @@
-/*** BEGIN file-header ***/
-#if !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION)
-#error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
-#endif
-
-#ifndef __GDK_PIXBUF_ENUM_TYPES_H__
-#define __GDK_PIXBUF_ENUM_TYPES_H__
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-/*** END file-header ***/
-
-/*** BEGIN file-production ***/
-
-/* enumerations from "@filename@" */
-/*** END file-production ***/
-
-/*** BEGIN value-header ***/
-GType @enum_name@_get_type (void) G_GNUC_CONST;
-#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
-/*** END value-header ***/
-
-/*** BEGIN file-tail ***/
-G_END_DECLS
-
-#endif /* __GDK_PIXBUF_ENUM_TYPES_H__ */
-/*** END file-tail ***/
diff --git a/gdk-pixbuf/gdk-pixbuf-features.h.in b/gdk-pixbuf/gdk-pixbuf-features.h.in
deleted file mode 100644
index ec5f647ed0..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-features.h.in
+++ /dev/null
@@ -1,39 +0,0 @@
-#if !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION)
-#error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
-#endif
-
-#ifndef GDK_PIXBUF_FEATURES_H
-#define GDK_PIXBUF_FEATURES_H 1
-
-#define GDK_PIXBUF_MAJOR (@GDK_PIXBUF_MAJOR@)
-#define GDK_PIXBUF_MINOR (@GDK_PIXBUF_MINOR@)
-#define GDK_PIXBUF_MICRO (@GDK_PIXBUF_MICRO@)
-#define GDK_PIXBUF_VERSION "@GDK_PIXBUF_VERSION@"
-
-/* We prefix variable declarations so they can
- * properly get exported/imported from Windows DLLs.
- */
-#ifdef G_PLATFORM_WIN32
-# ifdef GDK_PIXBUF_STATIC_COMPILATION
-# define GDK_PIXBUF_VAR extern
-# else /* !GDK_PIXBUF_STATIC_COMPILATION */
-# ifdef GDK_PIXBUF_C_COMPILATION
-# ifdef DLL_EXPORT
-# define GDK_PIXBUF_VAR __declspec(dllexport)
-# else /* !DLL_EXPORT */
-# define GDK_PIXBUF_VAR extern
-# endif /* !DLL_EXPORT */
-# else /* !GDK_PIXBUF_C_COMPILATION */
-# define GDK_PIXBUF_VAR extern __declspec(dllimport)
-# endif /* !GDK_PIXBUF_C_COMPILATION */
-# endif /* !GDK_PIXBUF_STATIC_COMPILATION */
-#else /* !G_PLATFORM_WIN32 */
-# define GDK_PIXBUF_VAR extern
-#endif /* !G_PLATFORM_WIN32 */
-
-GDK_PIXBUF_VAR const guint gdk_pixbuf_major_version;
-GDK_PIXBUF_VAR const guint gdk_pixbuf_minor_version;
-GDK_PIXBUF_VAR const guint gdk_pixbuf_micro_version;
-GDK_PIXBUF_VAR const char *gdk_pixbuf_version;
-
-#endif /* GDK_PIXBUF_FEATURES_H */
diff --git a/gdk-pixbuf/gdk-pixbuf-i18n.h b/gdk-pixbuf/gdk-pixbuf-i18n.h
deleted file mode 100644
index fcd5e8b51a..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-i18n.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* GdkPixbuf library - Internationalization
- *
- * Copyright (C) 2000 Havoc Pennington
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 __GDKPIXBUFINTL_H__
-#define __GDKPIXBUFINTL_H__
-
-#include "config.h"
-#include <glib/gi18n-lib.h>
-
-#ifdef ENABLE_NLS
-#define P_(String) dgettext(GETTEXT_PACKAGE "-properties",String)
-#else
-#define P_(String) (String)
-#endif
-
-#endif
diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
deleted file mode 100644
index bd6a78722c..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-io.c
+++ /dev/null
@@ -1,2678 +0,0 @@
-/* -*- mode: C; c-file-style: "linux" -*- */
-/* GdkPixbuf library - Main loading interface.
- *
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Authors: Miguel de Icaza <miguel@gnu.org>
- * 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 Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <glib.h>
-#include <gio/gio.h>
-
-#include "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-io.h"
-#include "gdk-pixbuf-loader.h"
-#include "gdk-pixbuf-alias.h"
-
-#include <glib/gstdio.h>
-
-#ifdef G_OS_WIN32
-#define STRICT
-#include <windows.h>
-#undef STRICT
-#endif
-
-#define SNIFF_BUFFER_SIZE 4096
-#define LOAD_BUFFER_SIZE 65536
-
-#ifndef GDK_PIXBUF_USE_GIO_MIME
-static gint
-format_check (GdkPixbufModule *module, guchar *buffer, int size)
-{
- int i, j;
- gchar m;
- GdkPixbufModulePattern *pattern;
- gboolean anchored;
- guchar *prefix;
- gchar *mask;
-
- for (pattern = module->info->signature; pattern->prefix; pattern++) {
- if (pattern->mask && pattern->mask[0] == '*') {
- prefix = (guchar *)pattern->prefix + 1;
- mask = pattern->mask + 1;
- anchored = FALSE;
- }
- else {
- prefix = (guchar *)pattern->prefix;
- mask = pattern->mask;
- anchored = TRUE;
- }
- for (i = 0; i < size; i++) {
- for (j = 0; i + j < size && prefix[j] != 0; j++) {
- m = mask ? mask[j] : ' ';
- if (m == ' ') {
- if (buffer[i + j] != prefix[j])
- break;
- }
- else if (m == '!') {
- if (buffer[i + j] == prefix[j])
- break;
- }
- else if (m == 'z') {
- if (buffer[i + j] != 0)
- break;
- }
- else if (m == 'n') {
- if (buffer[i + j] == 0)
- break;
- }
- }
-
- if (prefix[j] == 0)
- return pattern->relevance;
-
- if (anchored)
- break;
- }
- }
- return 0;
-}
-#endif
-
-G_LOCK_DEFINE_STATIC (init_lock);
-G_LOCK_DEFINE_STATIC (threadunsafe_loader_lock);
-
-gboolean
-_gdk_pixbuf_lock (GdkPixbufModule *image_module)
-{
- if (g_threads_got_initialized &&
- !(image_module->info->flags & GDK_PIXBUF_FORMAT_THREADSAFE)) {
- G_LOCK (threadunsafe_loader_lock);
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-void
-_gdk_pixbuf_unlock (GdkPixbufModule *image_module)
-{
- if (!(image_module->info->flags & GDK_PIXBUF_FORMAT_THREADSAFE)) {
- G_UNLOCK (threadunsafe_loader_lock);
- }
-}
-
-static GSList *file_formats = NULL;
-
-static void gdk_pixbuf_io_init (void);
-
-static GSList *
-get_file_formats (void)
-{
- G_LOCK (init_lock);
- if (file_formats == NULL)
- gdk_pixbuf_io_init ();
- G_UNLOCK (init_lock);
-
- return file_formats;
-}
-
-
-#ifdef USE_GMODULE
-
-static gboolean
-scan_string (const char **pos, GString *out)
-{
- const char *p = *pos, *q = *pos;
- char *tmp, *tmp2;
- gboolean quoted;
-
- while (g_ascii_isspace (*p))
- p++;
-
- if (!*p)
- return FALSE;
- else if (*p == '"') {
- p++;
- quoted = FALSE;
- for (q = p; (*q != '"') || quoted; q++) {
- if (!*q)
- return FALSE;
- quoted = (*q == '\\') && !quoted;
- }
-
- tmp = g_strndup (p, q - p);
- tmp2 = g_strcompress (tmp);
- g_string_truncate (out, 0);
- g_string_append (out, tmp2);
- g_free (tmp);
- g_free (tmp2);
- }
-
- q++;
- *pos = q;
-
- return TRUE;
-}
-
-static gboolean
-scan_int (const char **pos, int *out)
-{
- int i = 0;
- char buf[32];
- const char *p = *pos;
-
- while (g_ascii_isspace (*p))
- p++;
-
- if (*p < '0' || *p > '9')
- return FALSE;
-
- while ((*p >= '0') && (*p <= '9') && i < sizeof (buf)) {
- buf[i] = *p;
- i++;
- p++;
- }
-
- if (i == sizeof (buf))
- return FALSE;
- else
- buf[i] = '\0';
-
- *out = atoi (buf);
-
- *pos = p;
-
- return TRUE;
-}
-
-static gboolean
-skip_space (const char **pos)
-{
- const char *p = *pos;
-
- while (g_ascii_isspace (*p))
- p++;
-
- *pos = p;
-
- return !(*p == '\0');
-}
-
-#ifdef G_OS_WIN32
-
-/* DllMain function needed to tuck away the gdk-pixbuf DLL handle */
-
-static HMODULE gdk_pixbuf_dll;
-
-BOOL WINAPI
-DllMain (HINSTANCE hinstDLL,
- DWORD fdwReason,
- LPVOID lpvReserved)
-{
- switch (fdwReason) {
- case DLL_PROCESS_ATTACH:
- gdk_pixbuf_dll = (HMODULE) hinstDLL;
- break;
- }
-
- return TRUE;
-}
-
-static char *
-get_toplevel (void)
-{
- static char *toplevel = NULL;
-
- if (toplevel == NULL)
- toplevel = g_win32_get_package_installation_directory_of_module (gdk_pixbuf_dll);
-
- return toplevel;
-}
-
-static char *
-get_sysconfdir (void)
-{
- static char *sysconfdir = NULL;
-
- if (sysconfdir == NULL)
- sysconfdir = g_build_filename (get_toplevel (), "etc", NULL);
-
- return sysconfdir;
-}
-
-#undef GTK_SYSCONFDIR
-#define GTK_SYSCONFDIR get_sysconfdir()
-
-static void
-correct_prefix (gchar **path)
-{
- if (strncmp (*path, GTK_PREFIX "/", strlen (GTK_PREFIX "/")) == 0 ||
- strncmp (*path, GTK_PREFIX "\\", strlen (GTK_PREFIX "\\")) == 0)
- {
- gchar *tem = NULL;
- if (strlen(*path) > 5 && strncmp (*path - 5, ".libs", 5) == 0)
- {
- /* We are being run from inside the build tree, and shouldn't mess about. */
- return;
- }
-
- /* This is an entry put there by gdk-pixbuf-query-loaders on the
- * packager's system. On Windows a prebuilt GTK+ package can be
- * installed in a random location. The gdk-pixbuf.loaders file
- * distributed in such a package contains paths from the package
- * builder's machine. Replace the build-time prefix with the
- * installation prefix on this machine.
- */
- tem = *path;
- *path = g_strconcat (get_toplevel (), tem + strlen (GTK_PREFIX), NULL);
- g_free (tem);
- }
-}
-
-#endif /* G_OS_WIN32 */
-
-static gchar *
-gdk_pixbuf_get_module_file (void)
-{
- gchar *result = g_strdup (g_getenv ("GDK_PIXBUF_MODULE_FILE"));
-
- if (!result)
- result = g_build_filename (GTK_LIBDIR, "gtk-3.0", GTK_BINARY_VERSION, "loaders.cache", NULL);
-
- return result;
-}
-
-#endif /* USE_GMODULE */
-
-
-static gboolean
-gdk_pixbuf_load_module_unlocked (GdkPixbufModule *image_module,
- GError **error);
-
-static void
-gdk_pixbuf_io_init (void)
-{
-#ifdef USE_GMODULE
- GIOChannel *channel;
- gchar *line_buf;
- gsize term;
- GString *tmp_buf = g_string_new (NULL);
- gboolean have_error = FALSE;
- GdkPixbufModule *module = NULL;
- gchar *filename = gdk_pixbuf_get_module_file ();
- int flags;
- int n_patterns = 0;
- GdkPixbufModulePattern *pattern;
- GError *error = NULL;
-#endif
- GdkPixbufModule *builtin_module ;
-
- /* initialize on separate line to avoid compiler warnings in the
- * common case of no compiled-in modules.
- */
- builtin_module = NULL;
-
-#define load_one_builtin_module(format) \
- builtin_module = g_new0 (GdkPixbufModule, 1); \
- builtin_module->module_name = #format; \
- if (gdk_pixbuf_load_module_unlocked (builtin_module, NULL)) \
- file_formats = g_slist_prepend (file_formats, builtin_module);\
- else \
- g_free (builtin_module)
-
-#ifdef INCLUDE_ani
- load_one_builtin_module (ani);
-#endif
-#ifdef INCLUDE_png
- load_one_builtin_module (png);
-#endif
-#ifdef INCLUDE_bmp
- load_one_builtin_module (bmp);
-#endif
-#ifdef INCLUDE_wbmp
- load_one_builtin_module (wbmp);
-#endif
-#ifdef INCLUDE_gif
- load_one_builtin_module (gif);
-#endif
-#ifdef INCLUDE_ico
- load_one_builtin_module (ico);
-#endif
-#ifdef INCLUDE_jpeg
- load_one_builtin_module (jpeg);
-#endif
-#ifdef INCLUDE_pnm
- load_one_builtin_module (pnm);
-#endif
-#ifdef INCLUDE_ras
- load_one_builtin_module (ras);
-#endif
-#ifdef INCLUDE_tiff
- load_one_builtin_module (tiff);
-#endif
-#ifdef INCLUDE_xpm
- load_one_builtin_module (xpm);
-#endif
-#ifdef INCLUDE_xbm
- load_one_builtin_module (xbm);
-#endif
-#ifdef INCLUDE_tga
- load_one_builtin_module (tga);
-#endif
-#ifdef INCLUDE_pcx
- load_one_builtin_module (pcx);
-#endif
-#ifdef INCLUDE_icns
- load_one_builtin_module (icns);
-#endif
-#ifdef INCLUDE_jasper
- load_one_builtin_module (jasper);
-#endif
-#ifdef INCLUDE_qtif
- load_one_builtin_module (qtif);
-#endif
-#ifdef INCLUDE_gdiplus
- /* We don't bother having the GDI+ loaders individually selectable
- * for building in or not.
- */
- load_one_builtin_module (ico);
- load_one_builtin_module (wmf);
- load_one_builtin_module (emf);
- load_one_builtin_module (bmp);
- load_one_builtin_module (gif);
- load_one_builtin_module (jpeg);
- load_one_builtin_module (tiff);
-#endif
-#ifdef INCLUDE_gdip_png
- /* Except the gdip-png loader which normally isn't built at all even */
- load_one_builtin_module (png);
-#endif
-
-#undef load_one_builtin_module
-
-#ifdef USE_GMODULE
- channel = g_io_channel_new_file (filename, "r", &error);
- if (!channel) {
- /* Don't bother warning if we have some built-in loaders */
- if (file_formats == NULL)
- g_warning ("Cannot open pixbuf loader module file '%s': %s",
- filename, error->message);
- g_string_free (tmp_buf, TRUE);
- g_free (filename);
- return;
- }
-
- while (!have_error && g_io_channel_read_line (channel, &line_buf, NULL, &term, NULL) == G_IO_STATUS_NORMAL) {
- const char *p;
-
- p = line_buf;
-
- line_buf[term] = 0;
-
- if (!skip_space (&p)) {
- /* Blank line marking the end of a module
- */
- if (module && *p != '#') {
-#ifdef G_OS_WIN32
- correct_prefix (&module->module_path);
-#endif
- file_formats = g_slist_prepend (file_formats, module);
- module = NULL;
- }
-
- goto next_line;
- }
-
- if (*p == '#')
- goto next_line;
-
- if (!module) {
- /* Read a module location
- */
- module = g_new0 (GdkPixbufModule, 1);
- n_patterns = 0;
-
- if (!scan_string (&p, tmp_buf)) {
- g_warning ("Error parsing loader info in '%s'\n %s",
- filename, line_buf);
- have_error = TRUE;
- }
- module->module_path = g_strdup (tmp_buf->str);
- }
- else if (!module->module_name) {
- module->info = g_new0 (GdkPixbufFormat, 1);
- if (!scan_string (&p, tmp_buf)) {
- g_warning ("Error parsing loader info in '%s'\n %s",
- filename, line_buf);
- have_error = TRUE;
- }
- module->info->name = g_strdup (tmp_buf->str);
- module->module_name = module->info->name;
-
- if (!scan_int (&p, &flags)) {
- g_warning ("Error parsing loader info in '%s'\n %s",
- filename, line_buf);
- have_error = TRUE;
- }
- module->info->flags = flags;
-
- if (!scan_string (&p, tmp_buf)) {
- g_warning ("Error parsing loader info in '%s'\n %s",
- filename, line_buf);
- have_error = TRUE;
- }
- if (tmp_buf->str[0] != 0)
- module->info->domain = g_strdup (tmp_buf->str);
-
- if (!scan_string (&p, tmp_buf)) {
- g_warning ("Error parsing loader info in '%s'\n %s",
- filename, line_buf);
- have_error = TRUE;
- }
- module->info->description = g_strdup (tmp_buf->str);
-
- if (scan_string (&p, tmp_buf)) {
- module->info->license = g_strdup (tmp_buf->str);
- }
- }
- else if (!module->info->mime_types) {
- int n = 1;
- module->info->mime_types = g_new0 (gchar*, 1);
- while (scan_string (&p, tmp_buf)) {
- if (tmp_buf->str[0] != 0) {
- module->info->mime_types =
- g_realloc (module->info->mime_types, (n + 1) * sizeof (gchar*));
- module->info->mime_types[n - 1] = g_strdup (tmp_buf->str);
- module->info->mime_types[n] = NULL;
- n++;
- }
- }
- }
- else if (!module->info->extensions) {
- int n = 1;
- module->info->extensions = g_new0 (gchar*, 1);
- while (scan_string (&p, tmp_buf)) {
- if (tmp_buf->str[0] != 0) {
- module->info->extensions =
- g_realloc (module->info->extensions, (n + 1) * sizeof (gchar*));
- module->info->extensions[n - 1] = g_strdup (tmp_buf->str);
- module->info->extensions[n] = NULL;
- n++;
- }
- }
- }
- else {
- n_patterns++;
- module->info->signature = (GdkPixbufModulePattern *)
- g_realloc (module->info->signature, (n_patterns + 1) * sizeof (GdkPixbufModulePattern));
- pattern = module->info->signature + n_patterns;
- pattern->prefix = NULL;
- pattern->mask = NULL;
- pattern->relevance = 0;
- pattern--;
- if (!scan_string (&p, tmp_buf))
- goto context_error;
- pattern->prefix = g_strdup (tmp_buf->str);
-
- if (!scan_string (&p, tmp_buf))
- goto context_error;
- if (*tmp_buf->str)
- pattern->mask = g_strdup (tmp_buf->str);
- else
- pattern->mask = NULL;
-
- if (!scan_int (&p, &pattern->relevance))
- goto context_error;
-
- goto next_line;
-
- context_error:
- g_free (pattern->prefix);
- g_free (pattern->mask);
- g_free (pattern);
- g_warning ("Error parsing loader info in '%s'\n %s",
- filename, line_buf);
- have_error = TRUE;
- }
- next_line:
- g_free (line_buf);
- }
- g_string_free (tmp_buf, TRUE);
- g_io_channel_unref (channel);
- g_free (filename);
-#endif
-}
-
-
-#define module(type) \
- extern void _gdk_pixbuf__##type##_fill_info (GdkPixbufFormat *info); \
- extern void _gdk_pixbuf__##type##_fill_vtable (GdkPixbufModule *module)
-
-module (png);
-module (jpeg);
-module (gif);
-module (ico);
-module (ani);
-module (ras);
-module (xpm);
-module (tiff);
-module (pnm);
-module (bmp);
-module (wbmp);
-module (xbm);
-module (tga);
-module (pcx);
-module (icns);
-module (jasper);
-module (qtif);
-module (gdip_ico);
-module (gdip_wmf);
-module (gdip_emf);
-module (gdip_bmp);
-module (gdip_gif);
-module (gdip_jpeg);
-module (gdip_png);
-module (gdip_tiff);
-
-#undef module
-
-/* actually load the image handler - gdk_pixbuf_get_module only get a */
-/* reference to the module to load, it doesn't actually load it */
-/* perhaps these actions should be combined in one function */
-static gboolean
-gdk_pixbuf_load_module_unlocked (GdkPixbufModule *image_module,
- GError **error)
-{
- GdkPixbufModuleFillInfoFunc fill_info = NULL;
- GdkPixbufModuleFillVtableFunc fill_vtable = NULL;
-
- if (image_module->module != NULL)
- return TRUE;
-
-#define try_module(format,id) \
- if (fill_info == NULL && \
- strcmp (image_module->module_name, #format) == 0) { \
- fill_info = _gdk_pixbuf__##id##_fill_info; \
- fill_vtable = _gdk_pixbuf__##id##_fill_vtable; \
- }
-#ifdef INCLUDE_png
- try_module (png,png);
-#endif
-#ifdef INCLUDE_bmp
- try_module (bmp,bmp);
-#endif
-#ifdef INCLUDE_wbmp
- try_module (wbmp,wbmp);
-#endif
-#ifdef INCLUDE_gif
- try_module (gif,gif);
-#endif
-#ifdef INCLUDE_ico
- try_module (ico,ico);
-#endif
-#ifdef INCLUDE_ani
- try_module (ani,ani);
-#endif
-#ifdef INCLUDE_jpeg
- try_module (jpeg,jpeg);
-#endif
-#ifdef INCLUDE_pnm
- try_module (pnm,pnm);
-#endif
-#ifdef INCLUDE_ras
- try_module (ras,ras);
-#endif
-#ifdef INCLUDE_tiff
- try_module (tiff,tiff);
-#endif
-#ifdef INCLUDE_xpm
- try_module (xpm,xpm);
-#endif
-#ifdef INCLUDE_xbm
- try_module (xbm,xbm);
-#endif
-#ifdef INCLUDE_tga
- try_module (tga,tga);
-#endif
-#ifdef INCLUDE_pcx
- try_module (pcx,pcx);
-#endif
-#ifdef INCLUDE_icns
- try_module (icns,icns);
-#endif
-#ifdef INCLUDE_jasper
- try_module (jasper,jasper);
-#endif
-#ifdef INCLUDE_qtif
- try_module (qtif,qtif);
-#endif
-#ifdef INCLUDE_gdiplus
- try_module (ico,gdip_ico);
- try_module (wmf,gdip_wmf);
- try_module (emf,gdip_emf);
- try_module (bmp,gdip_bmp);
- try_module (gif,gdip_gif);
- try_module (jpeg,gdip_jpeg);
- try_module (tiff,gdip_tiff);
-#endif
-#ifdef INCLUDE_gdip_png
- try_module (png,gdip_png);
-#endif
-
-#undef try_module
-
- if (fill_vtable) {
- image_module->module = (void *) 1;
- (* fill_vtable) (image_module);
- if (image_module->info == NULL) {
- image_module->info = g_new0 (GdkPixbufFormat, 1);
- (* fill_info) (image_module->info);
- }
- return TRUE;
- }
- else
-#ifdef USE_GMODULE
- {
- char *path;
- GModule *module;
- gpointer sym;
-
- path = image_module->module_path;
- module = g_module_open (path, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
-
- if (!module) {
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_FAILED,
- _("Unable to load image-loading module: %s: %s"),
- path, g_module_error ());
- return FALSE;
- }
-
- image_module->module = module;
-
- if (g_module_symbol (module, "fill_vtable", &sym)) {
- fill_vtable = (GdkPixbufModuleFillVtableFunc) sym;
- (* fill_vtable) (image_module);
- return TRUE;
- } else {
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_FAILED,
- _("Image-loading module %s does not export the proper interface; perhaps it's from a different GTK version?"),
- path);
- return FALSE;
- }
- }
-#else
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
- _("Image type '%s' is not supported"),
- image_module->module_name);
- return FALSE;
-#endif /* !USE_GMODULE */
-}
-
-
-gboolean
-_gdk_pixbuf_load_module (GdkPixbufModule *image_module,
- GError **error)
-{
- gboolean ret;
- gboolean locked = FALSE;
-
- /* be extra careful, maybe the module initializes
- * the thread system
- */
- if (g_threads_got_initialized) {
- G_LOCK (init_lock);
- locked = TRUE;
- }
-
- ret = gdk_pixbuf_load_module_unlocked (image_module, error);
-
- if (locked)
- G_UNLOCK (init_lock);
-
- return ret;
-}
-
-
-
-GdkPixbufModule *
-_gdk_pixbuf_get_named_module (const char *name,
- GError **error)
-{
- GSList *modules;
-
- for (modules = get_file_formats (); modules; modules = g_slist_next (modules)) {
- GdkPixbufModule *module = (GdkPixbufModule *)modules->data;
-
- if (module->info->disabled)
- continue;
-
- if (!strcmp (name, module->module_name))
- return module;
- }
-
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
- _("Image type '%s' is not supported"),
- name);
-
- return NULL;
-}
-
-GdkPixbufModule *
-_gdk_pixbuf_get_module (guchar *buffer, guint size,
- const gchar *filename,
- GError **error)
-{
- GSList *modules;
-
- GdkPixbufModule *selected = NULL;
- gchar *display_name = NULL;
-#ifdef GDK_PIXBUF_USE_GIO_MIME
- gchar *mime_type;
- gchar **mimes;
- gchar *type;
- gint j;
- gboolean uncertain;
-
- mime_type = g_content_type_guess (NULL, buffer, size, &uncertain);
- if (uncertain)
- mime_type = g_content_type_guess (filename, buffer, size, NULL);
-
- for (modules = get_file_formats (); modules; modules = g_slist_next (modules)) {
- GdkPixbufModule *module = (GdkPixbufModule *)modules->data;
- GdkPixbufFormat *info = module->info;
-
- if (info->disabled)
- continue;
-
- mimes = info->mime_types;
- for (j = 0; mimes[j] != NULL; j++) {
- type = g_content_type_from_mime_type (mimes[j]);
- if (g_ascii_strcasecmp (type, mime_type) == 0) {
- g_free (type);
- selected = module;
- break;
- }
- g_free (type);
- }
- }
- g_free (mime_type);
-#else
- gint score, best = 0;
-
- for (modules = get_file_formats (); modules; modules = g_slist_next (modules)) {
- GdkPixbufModule *module = (GdkPixbufModule *)modules->data;
-
- if (module->info->disabled)
- continue;
-
- score = format_check (module, buffer, size);
- if (score > best) {
- best = score;
- selected = module;
- }
- if (score >= 100)
- break;
- }
-#endif
-
- if (selected != NULL)
- return selected;
-
- if (filename)
- {
- display_name = g_filename_display_name (filename);
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
- _("Couldn't recognize the image file format for file '%s'"),
- display_name);
- g_free (display_name);
- }
- else
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
- _("Unrecognized image file format"));
-
-
- return NULL;
-}
-
-
-static void
-prepared_notify (GdkPixbuf *pixbuf,
- GdkPixbufAnimation *anim,
- gpointer user_data)
-{
- if (pixbuf != NULL)
- g_object_ref (pixbuf);
- *((GdkPixbuf **)user_data) = pixbuf;
-}
-
-GdkPixbuf *
-_gdk_pixbuf_generic_image_load (GdkPixbufModule *module,
- FILE *f,
- GError **error)
-{
- guchar buffer[LOAD_BUFFER_SIZE];
- size_t length;
- GdkPixbuf *pixbuf = NULL;
- GdkPixbufAnimation *animation = NULL;
- gpointer context;
- gboolean locked;
-
- locked = _gdk_pixbuf_lock (module);
-
- if (module->load != NULL) {
- pixbuf = (* module->load) (f, error);
- } else if (module->begin_load != NULL) {
-
- context = module->begin_load (NULL, prepared_notify, NULL, &pixbuf, error);
-
- if (!context)
- goto out;
-
- while (!feof (f) && !ferror (f)) {
- length = fread (buffer, 1, sizeof (buffer), f);
- if (length > 0)
- if (!module->load_increment (context, buffer, length, error)) {
- module->stop_load (context, NULL);
- if (pixbuf != NULL) {
- g_object_unref (pixbuf);
- pixbuf = NULL;
- }
- goto out;
- }
- }
-
- if (!module->stop_load (context, error)) {
- if (pixbuf != NULL) {
- g_object_unref (pixbuf);
- pixbuf = NULL;
- }
- }
- } else if (module->load_animation != NULL) {
- animation = (* module->load_animation) (f, error);
- if (animation != NULL) {
- pixbuf = gdk_pixbuf_animation_get_static_image (animation);
-
- g_object_ref (pixbuf);
- g_object_unref (animation);
- }
- }
-
- out:
- if (locked)
- _gdk_pixbuf_unlock (module);
- return pixbuf;
-}
-
-/**
- * gdk_pixbuf_new_from_file:
- * @filename: Name of file to load, in the GLib file name encoding
- * @error: Return location for an error
- *
- * Creates a new pixbuf by loading an image from a file. The file format is
- * detected automatically. If %NULL is returned, then @error will be set.
- * Possible errors are in the #GDK_PIXBUF_ERROR and #G_FILE_ERROR domains.
- *
- * Return value: A newly-created pixbuf with a reference count of 1, or %NULL if
- * any of several error conditions occurred: the file could not be opened,
- * there was no loader for the file's format, there was not enough memory to
- * allocate the image buffer, or the image file contained invalid data.
- **/
-GdkPixbuf *
-gdk_pixbuf_new_from_file (const char *filename,
- GError **error)
-{
- GdkPixbuf *pixbuf;
- int size;
- FILE *f;
- guchar buffer[SNIFF_BUFFER_SIZE];
- GdkPixbufModule *image_module;
- gchar *display_name;
-
- g_return_val_if_fail (filename != NULL, NULL);
- g_return_val_if_fail (error == NULL || *error == NULL, NULL);
-
- display_name = g_filename_display_name (filename);
-
- f = g_fopen (filename, "rb");
- if (!f) {
- gint save_errno = errno;
- g_set_error (error,
- G_FILE_ERROR,
- g_file_error_from_errno (save_errno),
- _("Failed to open file '%s': %s"),
- display_name,
- g_strerror (save_errno));
- g_free (display_name);
- return NULL;
- }
-
- size = fread (&buffer, 1, sizeof (buffer), f);
- if (size == 0) {
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Image file '%s' contains no data"),
- display_name);
- g_free (display_name);
- fclose (f);
- return NULL;
- }
-
- image_module = _gdk_pixbuf_get_module (buffer, size, filename, error);
- if (image_module == NULL) {
- g_free (display_name);
- fclose (f);
- return NULL;
- }
-
- if (!_gdk_pixbuf_load_module (image_module, error)) {
- g_free (display_name);
- fclose (f);
- return NULL;
- }
-
- fseek (f, 0, SEEK_SET);
- pixbuf = _gdk_pixbuf_generic_image_load (image_module, f, error);
- fclose (f);
-
- if (pixbuf == NULL && error != NULL && *error == NULL) {
-
- /* I don't trust these crufty longjmp()'ing image libs
- * to maintain proper error invariants, and I don't
- * want user code to segfault as a result. We need to maintain
- * the invariant that error gets set if NULL is returned.
- */
-
- g_warning ("Bug! gdk-pixbuf loader '%s' didn't set an error on failure.", image_module->module_name);
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_FAILED,
- _("Failed to load image '%s': reason not known, probably a corrupt image file"),
- display_name);
- } else if (error != NULL && *error != NULL) {
-
- /* Add the filename to the error message */
- GError *e = *error;
- gchar *old;
-
- old = e->message;
- e->message = g_strdup_printf (_("Failed to load image '%s': %s"),
- display_name,
- old);
- g_free (old);
- }
-
- g_free (display_name);
- return pixbuf;
-}
-
-#ifdef G_OS_WIN32
-
-#undef gdk_pixbuf_new_from_file
-GdkPixbuf *
-gdk_pixbuf_new_from_file (const char *filename,
- GError **error)
-{
- gchar *utf8_filename =
- g_locale_to_utf8 (filename, -1, NULL, NULL, error);
- GdkPixbuf *retval;
-
- if (utf8_filename == NULL)
- return NULL;
-
- retval = gdk_pixbuf_new_from_file_utf8 (utf8_filename, error);
-
- g_free (utf8_filename);
-
- return retval;
-}
-#endif
-
-
-/**
- * gdk_pixbuf_new_from_file_at_size:
- * @filename: Name of file to load, in the GLib file name encoding
- * @width: The width the image should have or -1 to not constrain the width
- * @height: The height the image should have or -1 to not constrain the height
- * @error: Return location for an error
- *
- * Creates a new pixbuf by loading an image from a file.
- * The file format is detected automatically. If %NULL is returned, then
- * @error will be set. Possible errors are in the #GDK_PIXBUF_ERROR and
- * #G_FILE_ERROR domains.
- *
- * The image will be scaled to fit in the requested size, preserving
- * the image's aspect ratio. Note that the returned pixbuf may be smaller
- * than @width x @height, if the aspect ratio requires it. To load
- * and image at the requested size, regardless of aspect ratio, use
- * gdk_pixbuf_new_from_file_at_scale().
- *
- * Return value: A newly-created pixbuf with a reference count of 1, or
- * %NULL if any of several error conditions occurred: the file could not
- * be opened, there was no loader for the file's format, there was not
- * enough memory to allocate the image buffer, or the image file contained
- * invalid data.
- *
- * Since: 2.4
- **/
-GdkPixbuf *
-gdk_pixbuf_new_from_file_at_size (const char *filename,
- int width,
- int height,
- GError **error)
-{
- return gdk_pixbuf_new_from_file_at_scale (filename,
- width, height,
- TRUE, error);
-}
-
-#ifdef G_OS_WIN32
-
-#undef gdk_pixbuf_new_from_file_at_size
-
-GdkPixbuf *
-gdk_pixbuf_new_from_file_at_size (const char *filename,
- int width,
- int height,
- GError **error)
-{
- gchar *utf8_filename =
- g_locale_to_utf8 (filename, -1, NULL, NULL, error);
- GdkPixbuf *retval;
-
- if (utf8_filename == NULL)
- return NULL;
-
- retval = gdk_pixbuf_new_from_file_at_size_utf8 (utf8_filename,
- width, height,
- error);
-
- g_free (utf8_filename);
-
- return retval;
-}
-#endif
-
-typedef struct {
- gint width;
- gint height;
- gboolean preserve_aspect_ratio;
-} AtScaleData;
-
-static void
-at_scale_size_prepared_cb (GdkPixbufLoader *loader,
- int width,
- int height,
- gpointer data)
-{
- AtScaleData *info = data;
-
- g_return_if_fail (width > 0 && height > 0);
-
- if (info->preserve_aspect_ratio &&
- (info->width > 0 || info->height > 0)) {
- if (info->width < 0)
- {
- width = width * (double)info->height/(double)height;
- height = info->height;
- }
- else if (info->height < 0)
- {
- height = height * (double)info->width/(double)width;
- width = info->width;
- }
- else if ((double)height * (double)info->width >
- (double)width * (double)info->height) {
- width = 0.5 + (double)width * (double)info->height / (double)height;
- height = info->height;
- } else {
- height = 0.5 + (double)height * (double)info->width / (double)width;
- width = info->width;
- }
- } else {
- if (info->width > 0)
- width = info->width;
- if (info->height > 0)
- height = info->height;
- }
-
- width = MAX (width, 1);
- height = MAX (height, 1);
-
- gdk_pixbuf_loader_set_size (loader, width, height);
-}
-
-/**
- * gdk_pixbuf_new_from_file_at_scale:
- * @filename: Name of file to load, in the GLib file name encoding
- * @width: The width the image should have or -1 to not constrain the width
- * @height: The height the image should have or -1 to not constrain the height
- * @preserve_aspect_ratio: %TRUE to preserve the image's aspect ratio
- * @error: Return location for an error
- *
- * Creates a new pixbuf by loading an image from a file. The file format is
- * detected automatically. If %NULL is returned, then @error will be set.
- * Possible errors are in the #GDK_PIXBUF_ERROR and #G_FILE_ERROR domains.
- * The image will be scaled to fit in the requested size, optionally preserving
- * the image's aspect ratio.
- *
- * When preserving the aspect ratio, a @width of -1 will cause the image
- * to be scaled to the exact given height, and a @height of -1 will cause
- * the image to be scaled to the exact given width. When not preserving
- * aspect ratio, a @width or @height of -1 means to not scale the image
- * at all in that dimension. Negative values for @width and @height are
- * allowed since 2.8.
- *
- * Return value: A newly-created pixbuf with a reference count of 1, or %NULL
- * if any of several error conditions occurred: the file could not be opened,
- * there was no loader for the file's format, there was not enough memory to
- * allocate the image buffer, or the image file contained invalid data.
- *
- * Since: 2.6
- **/
-GdkPixbuf *
-gdk_pixbuf_new_from_file_at_scale (const char *filename,
- int width,
- int height,
- gboolean preserve_aspect_ratio,
- GError **error)
-{
-
- GdkPixbufLoader *loader;
- GdkPixbuf *pixbuf;
- guchar buffer[LOAD_BUFFER_SIZE];
- int length;
- FILE *f;
- AtScaleData info;
- GdkPixbufAnimation *animation;
- GdkPixbufAnimationIter *iter;
- gboolean has_frame;
-
- g_return_val_if_fail (filename != NULL, NULL);
- g_return_val_if_fail (width > 0 || width == -1, NULL);
- g_return_val_if_fail (height > 0 || height == -1, NULL);
-
- f = g_fopen (filename, "rb");
- if (!f) {
- gint save_errno = errno;
- gchar *display_name = g_filename_display_name (filename);
- g_set_error (error,
- G_FILE_ERROR,
- g_file_error_from_errno (save_errno),
- _("Failed to open file '%s': %s"),
- display_name,
- g_strerror (save_errno));
- g_free (display_name);
- return NULL;
- }
-
- loader = gdk_pixbuf_loader_new ();
-
- info.width = width;
- info.height = height;
- info.preserve_aspect_ratio = preserve_aspect_ratio;
-
- g_signal_connect (loader, "size-prepared",
- G_CALLBACK (at_scale_size_prepared_cb), &info);
-
- has_frame = FALSE;
- while (!has_frame && !feof (f) && !ferror (f)) {
- length = fread (buffer, 1, sizeof (buffer), f);
- if (length > 0)
- if (!gdk_pixbuf_loader_write (loader, buffer, length, error)) {
- gdk_pixbuf_loader_close (loader, NULL);
- fclose (f);
- g_object_unref (loader);
- return NULL;
- }
-
- animation = gdk_pixbuf_loader_get_animation (loader);
- if (animation) {
- iter = gdk_pixbuf_animation_get_iter (animation, NULL);
- if (!gdk_pixbuf_animation_iter_on_currently_loading_frame (iter)) {
- has_frame = TRUE;
- }
- g_object_unref (iter);
- }
- }
-
- fclose (f);
-
- if (!gdk_pixbuf_loader_close (loader, error) && !has_frame) {
- g_object_unref (loader);
- return NULL;
- }
-
- pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
-
- if (!pixbuf) {
- gchar *display_name = g_filename_display_name (filename);
- g_object_unref (loader);
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_FAILED,
- _("Failed to load image '%s': reason not known, probably a corrupt image file"),
- display_name);
- g_free (display_name);
- return NULL;
- }
-
- g_object_ref (pixbuf);
-
- g_object_unref (loader);
-
- return pixbuf;
-}
-
-#ifdef G_OS_WIN32
-
-#undef gdk_pixbuf_new_from_file_at_scale
-
-GdkPixbuf *
-gdk_pixbuf_new_from_file_at_scale (const char *filename,
- int width,
- int height,
- gboolean preserve_aspect_ratio,
- GError **error)
-{
- gchar *utf8_filename =
- g_locale_to_utf8 (filename, -1, NULL, NULL, error);
- GdkPixbuf *retval;
-
- if (utf8_filename == NULL)
- return NULL;
-
- retval = gdk_pixbuf_new_from_file_at_scale_utf8 (utf8_filename,
- width, height,
- preserve_aspect_ratio,
- error);
-
- g_free (utf8_filename);
-
- return retval;
-}
-#endif
-
-
-static GdkPixbuf *
-load_from_stream (GdkPixbufLoader *loader,
- GInputStream *stream,
- GCancellable *cancellable,
- GError **error)
-{
- GdkPixbuf *pixbuf;
- gssize n_read;
- guchar buffer[LOAD_BUFFER_SIZE];
- gboolean res;
-
- res = TRUE;
- while (1) {
- n_read = g_input_stream_read (stream,
- buffer,
- sizeof (buffer),
- cancellable,
- error);
- if (n_read < 0) {
- res = FALSE;
- error = NULL; /* Ignore further errors */
- break;
- }
-
- if (n_read == 0)
- break;
-
- if (!gdk_pixbuf_loader_write (loader,
- buffer,
- n_read,
- error)) {
- res = FALSE;
- error = NULL;
- break;
- }
- }
-
- if (!gdk_pixbuf_loader_close (loader, error)) {
- res = FALSE;
- error = NULL;
- }
-
- pixbuf = NULL;
- if (res) {
- pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
- if (pixbuf)
- g_object_ref (pixbuf);
- }
-
- return pixbuf;
-}
-
-
-/**
- * gdk_pixbuf_new_from_stream_at_scale:
- * @stream: a #GInputStream to load the pixbuf from
- * @width: The width the image should have or -1 to not constrain the width
- * @height: The height the image should have or -1 to not constrain the height
- * @preserve_aspect_ratio: %TRUE to preserve the image's aspect ratio
- * @cancellable: optional #GCancellable object, %NULL to ignore
- * @error: Return location for an error
- *
- * Creates a new pixbuf by loading an image from an input stream.
- *
- * The file format is detected automatically. If %NULL is returned, then
- * @error will be set. The @cancellable can be used to abort the operation
- * from another thread. If the operation was cancelled, the error
- * %GIO_ERROR_CANCELLED will be returned. Other possible errors are in
- * the #GDK_PIXBUF_ERROR and %G_IO_ERROR domains.
- *
- * The image will be scaled to fit in the requested size, optionally
- * preserving the image's aspect ratio. When preserving the aspect ratio,
- * a @width of -1 will cause the image to be scaled to the exact given
- * height, and a @height of -1 will cause the image to be scaled to the
- * exact given width. When not preserving aspect ratio, a @width or
- * @height of -1 means to not scale the image at all in that dimension.
- *
- * The stream is not closed.
- *
- * Return value: A newly-created pixbuf, or %NULL if any of several error
- * conditions occurred: the file could not be opened, the image format is
- * not supported, there was not enough memory to allocate the image buffer,
- * the stream contained invalid data, or the operation was cancelled.
- *
- * Since: 2.14
- */
-GdkPixbuf *
-gdk_pixbuf_new_from_stream_at_scale (GInputStream *stream,
- gint width,
- gint height,
- gboolean preserve_aspect_ratio,
- GCancellable *cancellable,
- GError **error)
-{
- GdkPixbufLoader *loader;
- GdkPixbuf *pixbuf;
- AtScaleData info;
-
- loader = gdk_pixbuf_loader_new ();
-
- info.width = width;
- info.height = height;
- info.preserve_aspect_ratio = preserve_aspect_ratio;
-
- g_signal_connect (loader, "size-prepared",
- G_CALLBACK (at_scale_size_prepared_cb), &info);
-
- pixbuf = load_from_stream (loader, stream, cancellable, error);
- g_object_unref (loader);
-
- return pixbuf;
-}
-
-/**
- * gdk_pixbuf_new_from_stream:
- * @stream: a #GInputStream to load the pixbuf from
- * @cancellable: optional #GCancellable object, %NULL to ignore
- * @error: Return location for an error
- *
- * Creates a new pixbuf by loading an image from an input stream.
- *
- * The file format is detected automatically. If %NULL is returned, then
- * @error will be set. The @cancellable can be used to abort the operation
- * from another thread. If the operation was cancelled, the error
- * %GIO_ERROR_CANCELLED will be returned. Other possible errors are in
- * the #GDK_PIXBUF_ERROR and %G_IO_ERROR domains.
- *
- * The stream is not closed.
- *
- * Return value: A newly-created pixbuf, or %NULL if any of several error
- * conditions occurred: the file could not be opened, the image format is
- * not supported, there was not enough memory to allocate the image buffer,
- * the stream contained invalid data, or the operation was cancelled.
- *
- * Since: 2.14
- **/
-GdkPixbuf *
-gdk_pixbuf_new_from_stream (GInputStream *stream,
- GCancellable *cancellable,
- GError **error)
-{
- GdkPixbuf *pixbuf;
- GdkPixbufLoader *loader;
-
- loader = gdk_pixbuf_loader_new ();
- pixbuf = load_from_stream (loader, stream, cancellable, error);
- g_object_unref (loader);
-
- return pixbuf;
-}
-
-static void
-info_cb (GdkPixbufLoader *loader,
- int width,
- int height,
- gpointer data)
-{
- struct {
- GdkPixbufFormat *format;
- int width;
- int height;
- } *info = data;
-
- g_return_if_fail (width > 0 && height > 0);
-
- info->format = gdk_pixbuf_loader_get_format (loader);
- info->width = width;
- info->height = height;
-
- gdk_pixbuf_loader_set_size (loader, 0, 0);
-}
-
-/**
- * gdk_pixbuf_get_file_info:
- * @filename: The name of the file to identify.
- * @width: Return location for the width of the image, or %NULL
- * @height: Return location for the height of the image, or %NULL
- *
- * Parses an image file far enough to determine its format and size.
- *
- * Returns: A #GdkPixbufFormat describing the image format of the file
- * or %NULL if the image format wasn't recognized. The return value
- * is owned by GdkPixbuf and should not be freed.
- *
- * Since: 2.4
- **/
-GdkPixbufFormat *
-gdk_pixbuf_get_file_info (const gchar *filename,
- gint *width,
- gint *height)
-{
- GdkPixbufLoader *loader;
- guchar buffer[SNIFF_BUFFER_SIZE];
- int length;
- FILE *f;
- struct {
- GdkPixbufFormat *format;
- gint width;
- gint height;
- } info;
-
- g_return_val_if_fail (filename != NULL, NULL);
-
- f = g_fopen (filename, "rb");
- if (!f)
- return NULL;
-
- loader = gdk_pixbuf_loader_new ();
-
- info.format = NULL;
- info.width = -1;
- info.height = -1;
-
- g_signal_connect (loader, "size-prepared", G_CALLBACK (info_cb), &info);
-
- while (!feof (f) && !ferror (f)) {
- length = fread (buffer, 1, sizeof (buffer), f);
- if (length > 0) {
- if (!gdk_pixbuf_loader_write (loader, buffer, length, NULL))
- break;
- }
- if (info.format != NULL)
- break;
- }
-
- fclose (f);
- gdk_pixbuf_loader_close (loader, NULL);
- g_object_unref (loader);
-
- if (width)
- *width = info.width;
- if (height)
- *height = info.height;
-
- return info.format;
-}
-
-/**
- * gdk_pixbuf_new_from_xpm_data:
- * @data: Pointer to inline XPM data.
- *
- * Creates a new pixbuf by parsing XPM data in memory. This data is commonly
- * the result of including an XPM file into a program's C source.
- *
- * Return value: A newly-created pixbuf with a reference count of 1.
- **/
-GdkPixbuf *
-gdk_pixbuf_new_from_xpm_data (const char **data)
-{
- GdkPixbuf *(* load_xpm_data) (const char **data);
- GdkPixbuf *pixbuf;
- GError *error = NULL;
- GdkPixbufModule *xpm_module;
- gboolean locked;
-
- g_return_val_if_fail (data != NULL, NULL);
-
- xpm_module = _gdk_pixbuf_get_named_module ("xpm", &error);
- if (xpm_module == NULL) {
- g_warning ("Error loading XPM image loader: %s", error->message);
- g_error_free (error);
- return NULL;
- }
-
- if (!_gdk_pixbuf_load_module (xpm_module, &error)) {
- g_warning ("Error loading XPM image loader: %s", error->message);
- g_error_free (error);
- return NULL;
- }
-
- locked = _gdk_pixbuf_lock (xpm_module);
-
- if (xpm_module->load_xpm_data == NULL) {
- g_warning ("gdk-pixbuf XPM module lacks XPM data capability");
- pixbuf = NULL;
- } else {
- load_xpm_data = xpm_module->load_xpm_data;
- pixbuf = (* load_xpm_data) (data);
- }
-
- if (locked)
- _gdk_pixbuf_unlock (xpm_module);
- return pixbuf;
-}
-
-static void
-collect_save_options (va_list opts,
- gchar ***keys,
- gchar ***vals)
-{
- gchar *key;
- gchar *val;
- gchar *next;
- gint count;
-
- count = 0;
- *keys = NULL;
- *vals = NULL;
-
- next = va_arg (opts, gchar*);
- while (next)
- {
- key = next;
- val = va_arg (opts, gchar*);
-
- ++count;
-
- /* woo, slow */
- *keys = g_realloc (*keys, sizeof(gchar*) * (count + 1));
- *vals = g_realloc (*vals, sizeof(gchar*) * (count + 1));
-
- (*keys)[count-1] = g_strdup (key);
- (*vals)[count-1] = g_strdup (val);
-
- (*keys)[count] = NULL;
- (*vals)[count] = NULL;
-
- next = va_arg (opts, gchar*);
- }
-}
-
-static gboolean
-save_to_file_callback (const gchar *buf,
- gsize count,
- GError **error,
- gpointer data)
-{
- FILE *filehandle = data;
- gsize n;
-
- n = fwrite (buf, 1, count, filehandle);
- if (n != count) {
- gint save_errno = errno;
- g_set_error (error,
- G_FILE_ERROR,
- g_file_error_from_errno (save_errno),
- _("Error writing to image file: %s"),
- g_strerror (save_errno));
- return FALSE;
- }
- return TRUE;
-}
-
-static gboolean
-gdk_pixbuf_real_save (GdkPixbuf *pixbuf,
- FILE *filehandle,
- const char *type,
- gchar **keys,
- gchar **values,
- GError **error)
-{
- gboolean ret;
- GdkPixbufModule *image_module = NULL;
- gboolean locked;
-
- image_module = _gdk_pixbuf_get_named_module (type, error);
-
- if (image_module == NULL)
- return FALSE;
-
- if (!_gdk_pixbuf_load_module (image_module, error))
- return FALSE;
-
- locked = _gdk_pixbuf_lock (image_module);
-
- if (image_module->save) {
- /* save normally */
- ret = (* image_module->save) (filehandle, pixbuf,
- keys, values,
- error);
- } else if (image_module->save_to_callback) {
- /* save with simple callback */
- ret = (* image_module->save_to_callback) (save_to_file_callback,
- filehandle, pixbuf,
- keys, values,
- error);
- } else {
- /* can't save */
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION,
- _("This build of gdk-pixbuf does not support saving the image format: %s"),
- type);
- ret = FALSE;
- }
-
- if (locked)
- _gdk_pixbuf_unlock (image_module);
- return ret;
-}
-
-#define TMP_FILE_BUF_SIZE 4096
-
-static gboolean
-save_to_callback_with_tmp_file (GdkPixbufModule *image_module,
- GdkPixbuf *pixbuf,
- GdkPixbufSaveFunc save_func,
- gpointer user_data,
- gchar **keys,
- gchar **values,
- GError **error)
-{
- int fd;
- FILE *f = NULL;
- gboolean retval = FALSE;
- gchar *buf = NULL;
- gsize n;
- gchar *filename = NULL;
- gboolean locked;
-
- buf = g_try_malloc (TMP_FILE_BUF_SIZE);
- if (buf == NULL) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Insufficient memory to save image to callback"));
- goto end;
- }
-
- fd = g_file_open_tmp ("gdkpixbuf-save-tmp.XXXXXX", &filename, error);
- if (fd == -1)
- goto end;
- f = fdopen (fd, "wb+");
- if (f == NULL) {
- gint save_errno = errno;
- g_set_error_literal (error,
- G_FILE_ERROR,
- g_file_error_from_errno (save_errno),
- _("Failed to open temporary file"));
- goto end;
- }
-
- locked = _gdk_pixbuf_lock (image_module);
- retval = (image_module->save) (f, pixbuf, keys, values, error);
- if (locked)
- _gdk_pixbuf_unlock (image_module);
- if (!retval)
- goto end;
-
- rewind (f);
- for (;;) {
- n = fread (buf, 1, TMP_FILE_BUF_SIZE, f);
- if (n > 0) {
- if (!save_func (buf, n, error, user_data))
- goto end;
- }
- if (n != TMP_FILE_BUF_SIZE)
- break;
- }
- if (ferror (f)) {
- gint save_errno = errno;
- g_set_error_literal (error,
- G_FILE_ERROR,
- g_file_error_from_errno (save_errno),
- _("Failed to read from temporary file"));
- goto end;
- }
- retval = TRUE;
-
- end:
- /* cleanup and return retval */
- if (f)
- fclose (f);
- if (filename) {
- g_unlink (filename);
- g_free (filename);
- }
- g_free (buf);
-
- return retval;
-}
-
-static gboolean
-gdk_pixbuf_real_save_to_callback (GdkPixbuf *pixbuf,
- GdkPixbufSaveFunc save_func,
- gpointer user_data,
- const char *type,
- gchar **keys,
- gchar **values,
- GError **error)
-{
- gboolean ret;
- GdkPixbufModule *image_module = NULL;
- gboolean locked;
-
- image_module = _gdk_pixbuf_get_named_module (type, error);
-
- if (image_module == NULL)
- return FALSE;
-
- if (!_gdk_pixbuf_load_module (image_module, error))
- return FALSE;
-
- locked = _gdk_pixbuf_lock (image_module);
-
- if (image_module->save_to_callback) {
- /* save normally */
- ret = (* image_module->save_to_callback) (save_func, user_data,
- pixbuf, keys, values,
- error);
- } else if (image_module->save) {
- /* use a temporary file */
- ret = save_to_callback_with_tmp_file (image_module, pixbuf,
- save_func, user_data,
- keys, values,
- error);
- } else {
- /* can't save */
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION,
- _("This build of gdk-pixbuf does not support saving the image format: %s"),
- type);
- ret = FALSE;
- }
-
- if (locked)
- _gdk_pixbuf_unlock (image_module);
- return ret;
-}
-
-
-/**
- * gdk_pixbuf_save:
- * @pixbuf: a #GdkPixbuf.
- * @filename: name of file to save.
- * @type: name of file format.
- * @error: (allow-none): return location for error, or %NULL
- * @Varargs: list of key-value save options
- *
- * Saves pixbuf to a file in format @type. By default, "jpeg", "png", "ico"
- * and "bmp" are possible file formats to save in, but more formats may be
- * installed. The list of all writable formats can be determined in the
- * following way:
- *
- * |[
- * void add_if_writable (GdkPixbufFormat *data, GSList **list)
- * {
- * if (gdk_pixbuf_format_is_writable (data))
- * *list = g_slist_prepend (*list, data);
- * }
- *
- * GSList *formats = gdk_pixbuf_get_formats ();
- * GSList *writable_formats = NULL;
- * g_slist_foreach (formats, add_if_writable, &writable_formats);
- * g_slist_free (formats);
- * ]|
- *
- * If @error is set, %FALSE will be returned. Possible errors include
- * those in the #GDK_PIXBUF_ERROR domain and those in the #G_FILE_ERROR domain.
- *
- * The variable argument list should be %NULL-terminated; if not empty,
- * it should contain pairs of strings that modify the save
- * parameters. For example:
- * <informalexample><programlisting>
- * gdk_pixbuf_save (pixbuf, handle, "jpeg", &amp;error,
- * "quality", "100", NULL);
- * </programlisting></informalexample>
- *
- * Currently only few parameters exist. JPEG images can be saved with a
- * "quality" parameter; its value should be in the range [0,100].
- *
- * Text chunks can be attached to PNG images by specifying parameters of
- * the form "tEXt::key", where key is an ASCII string of length 1-79.
- * The values are UTF-8 encoded strings. The PNG compression level can
- * be specified using the "compression" parameter; it's value is in an
- * integer in the range of [0,9].
- *
- * ICC color profiles can also be embedded into PNG and TIFF images.
- * The "icc-profile" value should be the complete ICC profile encoded
- * into base64.
- *
- * <informalexample><programlisting>
- * gchar *contents;
- * gchar *contents_encode;
- * gsize length;
- * g_file_get_contents ("/home/hughsie/.color/icc/L225W.icm", &contents, &length, NULL);
- * contents_encode = g_base64_encode ((const guchar *) contents, length);
- * gdk_pixbuf_save (pixbuf, handle, "png", &amp;error,
- * "icc-profile", contents_encode,
- * NULL);
- * </programlisting></informalexample>
- *
- * TIFF images recognize a "compression" option which acceps an integer value.
- * Among the codecs are 1 None, 2 Huffman, 5 LZW, 7 JPEG and 8 Deflate, see
- * the libtiff documentation and tiff.h for all supported codec values.
- *
- * ICO images can be saved in depth 16, 24, or 32, by using the "depth"
- * parameter. When the ICO saver is given "x_hot" and "y_hot" parameters,
- * it produces a CUR instead of an ICO.
- *
- * Return value: whether an error was set
- **/
-
-gboolean
-gdk_pixbuf_save (GdkPixbuf *pixbuf,
- const char *filename,
- const char *type,
- GError **error,
- ...)
-{
- gchar **keys = NULL;
- gchar **values = NULL;
- va_list args;
- gboolean result;
-
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
- va_start (args, error);
-
- collect_save_options (args, &keys, &values);
-
- va_end (args);
-
- result = gdk_pixbuf_savev (pixbuf, filename, type,
- keys, values,
- error);
-
- g_strfreev (keys);
- g_strfreev (values);
-
- return result;
-}
-
-#ifdef G_OS_WIN32
-
-#undef gdk_pixbuf_save
-
-gboolean
-gdk_pixbuf_save (GdkPixbuf *pixbuf,
- const char *filename,
- const char *type,
- GError **error,
- ...)
-{
- char *utf8_filename;
- gchar **keys = NULL;
- gchar **values = NULL;
- va_list args;
- gboolean result;
-
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
- utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, error);
-
- if (utf8_filename == NULL)
- return FALSE;
-
- va_start (args, error);
-
- collect_save_options (args, &keys, &values);
-
- va_end (args);
-
- result = gdk_pixbuf_savev_utf8 (pixbuf, utf8_filename, type,
- keys, values,
- error);
-
- g_free (utf8_filename);
-
- g_strfreev (keys);
- g_strfreev (values);
-
- return result;
-}
-
-#endif
-
-/**
- * gdk_pixbuf_savev:
- * @pixbuf: a #GdkPixbuf.
- * @filename: name of file to save.
- * @type: name of file format.
- * @option_keys: name of options to set, %NULL-terminated
- * @option_values: values for named options
- * @error: (allow-none): return location for error, or %NULL
- *
- * Saves pixbuf to a file in @type, which is currently "jpeg", "png", "tiff", "ico" or "bmp".
- * If @error is set, %FALSE will be returned.
- * See gdk_pixbuf_save () for more details.
- *
- * Return value: whether an error was set
- **/
-
-gboolean
-gdk_pixbuf_savev (GdkPixbuf *pixbuf,
- const char *filename,
- const char *type,
- char **option_keys,
- char **option_values,
- GError **error)
-{
- FILE *f = NULL;
- gboolean result;
-
- g_return_val_if_fail (filename != NULL, FALSE);
- g_return_val_if_fail (type != NULL, FALSE);
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
- f = g_fopen (filename, "wb");
-
- if (f == NULL) {
- gint save_errno = errno;
- gchar *display_name = g_filename_display_name (filename);
- g_set_error (error,
- G_FILE_ERROR,
- g_file_error_from_errno (save_errno),
- _("Failed to open '%s' for writing: %s"),
- display_name,
- g_strerror (save_errno));
- g_free (display_name);
- return FALSE;
- }
-
-
- result = gdk_pixbuf_real_save (pixbuf, f, type,
- option_keys, option_values,
- error);
-
-
- if (!result) {
- g_return_val_if_fail (error == NULL || *error != NULL, FALSE);
- fclose (f);
- g_unlink (filename);
- return FALSE;
- }
-
- if (fclose (f) < 0) {
- gint save_errno = errno;
- gchar *display_name = g_filename_display_name (filename);
- g_set_error (error,
- G_FILE_ERROR,
- g_file_error_from_errno (save_errno),
- _("Failed to close '%s' while writing image, all data may not have been saved: %s"),
- display_name,
- g_strerror (save_errno));
- g_free (display_name);
- return FALSE;
- }
-
- return TRUE;
-}
-
-#ifdef G_OS_WIN32
-
-#undef gdk_pixbuf_savev
-
-gboolean
-gdk_pixbuf_savev (GdkPixbuf *pixbuf,
- const char *filename,
- const char *type,
- char **option_keys,
- char **option_values,
- GError **error)
-{
- char *utf8_filename;
- gboolean retval;
-
- g_return_val_if_fail (filename != NULL, FALSE);
-
- utf8_filename = g_locale_to_utf8 (filename, -1, NULL, NULL, error);
-
- if (utf8_filename == NULL)
- return FALSE;
-
- retval = gdk_pixbuf_savev_utf8 (pixbuf, utf8_filename, type,
- option_keys, option_values, error);
-
- g_free (utf8_filename);
-
- return retval;
-}
-
-#endif
-
-/**
- * gdk_pixbuf_save_to_callback:
- * @pixbuf: a #GdkPixbuf.
- * @save_func: a function that is called to save each block of data that
- * the save routine generates.
- * @user_data: user data to pass to the save function.
- * @type: name of file format.
- * @error: (allow-none): return location for error, or %NULL
- * @Varargs: list of key-value save options
- *
- * Saves pixbuf in format @type by feeding the produced data to a
- * callback. Can be used when you want to store the image to something
- * other than a file, such as an in-memory buffer or a socket.
- * If @error is set, %FALSE will be returned. Possible errors
- * include those in the #GDK_PIXBUF_ERROR domain and whatever the save
- * function generates.
- *
- * See gdk_pixbuf_save() for more details.
- *
- * Return value: whether an error was set
- *
- * Since: 2.4
- **/
-gboolean
-gdk_pixbuf_save_to_callback (GdkPixbuf *pixbuf,
- GdkPixbufSaveFunc save_func,
- gpointer user_data,
- const char *type,
- GError **error,
- ...)
-{
- gchar **keys = NULL;
- gchar **values = NULL;
- va_list args;
- gboolean result;
-
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
- va_start (args, error);
-
- collect_save_options (args, &keys, &values);
-
- va_end (args);
-
- result = gdk_pixbuf_save_to_callbackv (pixbuf, save_func, user_data,
- type, keys, values,
- error);
-
- g_strfreev (keys);
- g_strfreev (values);
-
- return result;
-}
-
-/**
- * gdk_pixbuf_save_to_callbackv:
- * @pixbuf: a #GdkPixbuf.
- * @save_func: a function that is called to save each block of data that
- * the save routine generates.
- * @user_data: user data to pass to the save function.
- * @type: name of file format.
- * @option_keys: name of options to set, %NULL-terminated
- * @option_values: values for named options
- * @error: (allow-none): return location for error, or %NULL
- *
- * Saves pixbuf to a callback in format @type, which is currently "jpeg",
- * "png", "tiff", "ico" or "bmp". If @error is set, %FALSE will be returned. See
- * gdk_pixbuf_save_to_callback () for more details.
- *
- * Return value: whether an error was set
- *
- * Since: 2.4
- **/
-gboolean
-gdk_pixbuf_save_to_callbackv (GdkPixbuf *pixbuf,
- GdkPixbufSaveFunc save_func,
- gpointer user_data,
- const char *type,
- char **option_keys,
- char **option_values,
- GError **error)
-{
- gboolean result;
-
-
- g_return_val_if_fail (save_func != NULL, FALSE);
- g_return_val_if_fail (type != NULL, FALSE);
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
- result = gdk_pixbuf_real_save_to_callback (pixbuf,
- save_func, user_data, type,
- option_keys, option_values,
- error);
-
- if (!result) {
- g_return_val_if_fail (error == NULL || *error != NULL, FALSE);
- return FALSE;
- }
-
- return TRUE;
-}
-
-/**
- * gdk_pixbuf_save_to_buffer:
- * @pixbuf: a #GdkPixbuf.
- * @buffer: location to receive a pointer to the new buffer.
- * @buffer_size: location to receive the size of the new buffer.
- * @type: name of file format.
- * @error: (allow-none): return location for error, or %NULL
- * @Varargs: list of key-value save options
- *
- * Saves pixbuf to a new buffer in format @type, which is currently "jpeg",
- * "png", "tiff", "ico" or "bmp". This is a convenience function that uses
- * gdk_pixbuf_save_to_callback() to do the real work. Note that the buffer
- * is not nul-terminated and may contain embedded nuls.
- * If @error is set, %FALSE will be returned and @buffer will be set to
- * %NULL. Possible errors include those in the #GDK_PIXBUF_ERROR
- * domain.
- *
- * See gdk_pixbuf_save() for more details.
- *
- * Return value: whether an error was set
- *
- * Since: 2.4
- **/
-gboolean
-gdk_pixbuf_save_to_buffer (GdkPixbuf *pixbuf,
- gchar **buffer,
- gsize *buffer_size,
- const char *type,
- GError **error,
- ...)
-{
- gchar **keys = NULL;
- gchar **values = NULL;
- va_list args;
- gboolean result;
-
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
- va_start (args, error);
-
- collect_save_options (args, &keys, &values);
-
- va_end (args);
-
- result = gdk_pixbuf_save_to_bufferv (pixbuf, buffer, buffer_size,
- type, keys, values,
- error);
-
- g_strfreev (keys);
- g_strfreev (values);
-
- return result;
-}
-
-struct SaveToBufferData {
- gchar *buffer;
- gsize len, max;
-};
-
-static gboolean
-save_to_buffer_callback (const gchar *data,
- gsize count,
- GError **error,
- gpointer user_data)
-{
- struct SaveToBufferData *sdata = user_data;
- gchar *new_buffer;
- gsize new_max;
-
- if (sdata->len + count > sdata->max) {
- new_max = MAX (sdata->max*2, sdata->len + count);
- new_buffer = g_try_realloc (sdata->buffer, new_max);
- if (!new_buffer) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Insufficient memory to save image into a buffer"));
- return FALSE;
- }
- sdata->buffer = new_buffer;
- sdata->max = new_max;
- }
- memcpy (sdata->buffer + sdata->len, data, count);
- sdata->len += count;
- return TRUE;
-}
-
-/**
- * gdk_pixbuf_save_to_bufferv:
- * @pixbuf: a #GdkPixbuf.
- * @buffer: location to receive a pointer to the new buffer.
- * @buffer_size: location to receive the size of the new buffer.
- * @type: name of file format.
- * @option_keys: name of options to set, %NULL-terminated
- * @option_values: values for named options
- * @error: (allow-none): return location for error, or %NULL
- *
- * Saves pixbuf to a new buffer in format @type, which is currently "jpeg",
- * "tiff", "png", "ico" or "bmp". See gdk_pixbuf_save_to_buffer()
- * for more details.
- *
- * Return value: whether an error was set
- *
- * Since: 2.4
- **/
-gboolean
-gdk_pixbuf_save_to_bufferv (GdkPixbuf *pixbuf,
- gchar **buffer,
- gsize *buffer_size,
- const char *type,
- char **option_keys,
- char **option_values,
- GError **error)
-{
- static const gint initial_max = 1024;
- struct SaveToBufferData sdata;
-
- *buffer = NULL;
- *buffer_size = 0;
-
- sdata.buffer = g_try_malloc (initial_max);
- sdata.max = initial_max;
- sdata.len = 0;
- if (!sdata.buffer) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Insufficient memory to save image into a buffer"));
- return FALSE;
- }
-
- if (!gdk_pixbuf_save_to_callbackv (pixbuf,
- save_to_buffer_callback, &sdata,
- type, option_keys, option_values,
- error)) {
- g_free (sdata.buffer);
- return FALSE;
- }
-
- *buffer = sdata.buffer;
- *buffer_size = sdata.len;
- return TRUE;
-}
-
-typedef struct {
- GOutputStream *stream;
- GCancellable *cancellable;
-} SaveToStreamData;
-
-static gboolean
-save_to_stream (const gchar *buffer,
- gsize count,
- GError **error,
- gpointer data)
-{
- SaveToStreamData *sdata = (SaveToStreamData *)data;
- gsize remaining;
- gssize written;
- GError *my_error = NULL;
-
- remaining = count;
- written = 0;
- while (remaining > 0) {
- buffer += written;
- remaining -= written;
- written = g_output_stream_write (sdata->stream,
- buffer, remaining,
- sdata->cancellable,
- &my_error);
- if (written < 0) {
- if (!my_error) {
- g_set_error_literal (error,
- G_IO_ERROR, 0,
- _("Error writing to image stream"));
- }
- else {
- g_propagate_error (error, my_error);
- }
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-/**
- * gdk_pixbuf_save_to_stream:
- * @pixbuf: a #GdkPixbuf
- * @stream: a #GOutputStream to save the pixbuf to
- * @type: name of file format
- * @cancellable: optional #GCancellable object, %NULL to ignore
- * @error: (allow-none): return location for error, or %NULL
- * @Varargs: list of key-value save options
- *
- * Saves @pixbuf to an output stream.
- *
- * Supported file formats are currently "jpeg", "tiff", "png", "ico" or
- * "bmp". See gdk_pixbuf_save_to_buffer() for more details.
- *
- * The @cancellable can be used to abort the operation from another
- * thread. If the operation was cancelled, the error %GIO_ERROR_CANCELLED
- * will be returned. Other possible errors are in the #GDK_PIXBUF_ERROR
- * and %G_IO_ERROR domains.
- *
- * The stream is not closed.
- *
- * Returns: %TRUE if the pixbuf was saved successfully, %FALSE if an
- * error was set.
- *
- * Since: 2.14
- */
-gboolean
-gdk_pixbuf_save_to_stream (GdkPixbuf *pixbuf,
- GOutputStream *stream,
- const char *type,
- GCancellable *cancellable,
- GError **error,
- ...)
-{
- gboolean res;
- gchar **keys = NULL;
- gchar **values = NULL;
- va_list args;
- SaveToStreamData data;
-
- va_start (args, error);
- collect_save_options (args, &keys, &values);
- va_end (args);
-
- data.stream = stream;
- data.cancellable = cancellable;
-
- res = gdk_pixbuf_save_to_callbackv (pixbuf, save_to_stream,
- &data, type,
- keys, values,
- error);
-
- g_strfreev (keys);
- g_strfreev (values);
-
- return res;
-}
-
-/**
- * gdk_pixbuf_format_get_name:
- * @format: a #GdkPixbufFormat
- *
- * Returns the name of the format.
- *
- * Return value: the name of the format.
- *
- * Since: 2.2
- */
-gchar *
-gdk_pixbuf_format_get_name (GdkPixbufFormat *format)
-{
- g_return_val_if_fail (format != NULL, NULL);
-
- return g_strdup (format->name);
-}
-
-/**
- * gdk_pixbuf_format_get_description:
- * @format: a #GdkPixbufFormat
- *
- * Returns a description of the format.
- *
- * Return value: a description of the format.
- *
- * Since: 2.2
- */
-gchar *
-gdk_pixbuf_format_get_description (GdkPixbufFormat *format)
-{
- gchar *domain;
- const gchar *description;
- g_return_val_if_fail (format != NULL, NULL);
-
- if (format->domain != NULL)
- domain = format->domain;
- else
- domain = GETTEXT_PACKAGE;
- description = g_dgettext (domain, format->description);
-
- return g_strdup (description);
-}
-
-/**
- * gdk_pixbuf_format_get_mime_types:
- * @format: a #GdkPixbufFormat
- *
- * Returns the mime types supported by the format.
- *
- * Return value: a %NULL-terminated array of mime types which must be freed with
- * g_strfreev() when it is no longer needed.
- *
- * Since: 2.2
- */
-gchar **
-gdk_pixbuf_format_get_mime_types (GdkPixbufFormat *format)
-{
- g_return_val_if_fail (format != NULL, NULL);
-
- return g_strdupv (format->mime_types);
-}
-
-/**
- * gdk_pixbuf_format_get_extensions:
- * @format: a #GdkPixbufFormat
- *
- * Returns the filename extensions typically used for files in the
- * given format.
- *
- * Return value: a %NULL-terminated array of filename extensions which must be
- * freed with g_strfreev() when it is no longer needed.
- *
- * Since: 2.2
- */
-gchar **
-gdk_pixbuf_format_get_extensions (GdkPixbufFormat *format)
-{
- g_return_val_if_fail (format != NULL, NULL);
-
- return g_strdupv (format->extensions);
-}
-
-/**
- * gdk_pixbuf_format_is_writable:
- * @format: a #GdkPixbufFormat
- *
- * Returns whether pixbufs can be saved in the given format.
- *
- * Return value: whether pixbufs can be saved in the given format.
- *
- * Since: 2.2
- */
-gboolean
-gdk_pixbuf_format_is_writable (GdkPixbufFormat *format)
-{
- g_return_val_if_fail (format != NULL, FALSE);
-
- return (format->flags & GDK_PIXBUF_FORMAT_WRITABLE) != 0;
-}
-
-/**
- * gdk_pixbuf_format_is_scalable:
- * @format: a #GdkPixbufFormat
- *
- * Returns whether this image format is scalable. If a file is in a
- * scalable format, it is preferable to load it at the desired size,
- * rather than loading it at the default size and scaling the
- * resulting pixbuf to the desired size.
- *
- * Return value: whether this image format is scalable.
- *
- * Since: 2.6
- */
-gboolean
-gdk_pixbuf_format_is_scalable (GdkPixbufFormat *format)
-{
- g_return_val_if_fail (format != NULL, FALSE);
-
- return (format->flags & GDK_PIXBUF_FORMAT_SCALABLE) != 0;
-}
-
-/**
- * gdk_pixbuf_format_is_disabled:
- * @format: a #GdkPixbufFormat
- *
- * Returns whether this image format is disabled. See
- * gdk_pixbuf_format_set_disabled().
- *
- * Return value: whether this image format is disabled.
- *
- * Since: 2.6
- */
-gboolean
-gdk_pixbuf_format_is_disabled (GdkPixbufFormat *format)
-{
- g_return_val_if_fail (format != NULL, FALSE);
-
- return format->disabled;
-}
-
-/**
- * gdk_pixbuf_format_set_disabled:
- * @format: a #GdkPixbufFormat
- * @disabled: %TRUE to disable the format @format
- *
- * Disables or enables an image format. If a format is disabled,
- * gdk-pixbuf won't use the image loader for this format to load
- * images. Applications can use this to avoid using image loaders
- * with an inappropriate license, see gdk_pixbuf_format_get_license().
- *
- * Since: 2.6
- */
-void
-gdk_pixbuf_format_set_disabled (GdkPixbufFormat *format,
- gboolean disabled)
-{
- g_return_if_fail (format != NULL);
-
- format->disabled = disabled != FALSE;
-}
-
-/**
- * gdk_pixbuf_format_get_license:
- * @format: a #GdkPixbufFormat
- *
- * Returns information about the license of the image loader for the format. The
- * returned string should be a shorthand for a wellknown license, e.g. "LGPL",
- * "GPL", "QPL", "GPL/QPL", or "other" to indicate some other license. This
- * string should be freed with g_free() when it's no longer needed.
- *
- * Returns: a string describing the license of @format.
- *
- * Since: 2.6
- */
-gchar*
-gdk_pixbuf_format_get_license (GdkPixbufFormat *format)
-{
- g_return_val_if_fail (format != NULL, NULL);
-
- return g_strdup (format->license);
-}
-
-GdkPixbufFormat *
-_gdk_pixbuf_get_format (GdkPixbufModule *module)
-{
- g_return_val_if_fail (module != NULL, NULL);
-
- return module->info;
-}
-
-/**
- * gdk_pixbuf_get_formats:
- *
- * Obtains the available information about the image formats supported
- * by GdkPixbuf.
- *
- * Returns: A list of #GdkPixbufFormat<!-- -->s describing the supported
- * image formats. The list should be freed when it is no longer needed,
- * but the structures themselves are owned by #GdkPixbuf and should not be
- * freed.
- *
- * Since: 2.2
- */
-GSList *
-gdk_pixbuf_get_formats (void)
-{
- GSList *result = NULL;
- GSList *modules;
-
- for (modules = get_file_formats (); modules; modules = g_slist_next (modules)) {
- GdkPixbufModule *module = (GdkPixbufModule *)modules->data;
- GdkPixbufFormat *info = _gdk_pixbuf_get_format (module);
- result = g_slist_prepend (result, info);
- }
-
- return result;
-}
-
-
-#define __GDK_PIXBUF_IO_C__
-#include "gdk-pixbuf-aliasdef.c"
diff --git a/gdk-pixbuf/gdk-pixbuf-io.h b/gdk-pixbuf/gdk-pixbuf-io.h
deleted file mode 100644
index a6e07ca623..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-io.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/* GdkPixbuf library - Io handling. This is an internal header for
- * GdkPixbuf. You should never use it unless you are doing development for
- * GdkPixbuf itself.
- *
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Authors: Mark Crichton <crichton@gimp.org>
- * Miguel de Icaza <miguel@gnu.org>
- * Federico Mena-Quintero <federico@gimp.org>
- * Jonathan Blandford <jrb@redhat.com>
- * Michael Fulbright <drmike@redhat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.
- */
-
-#if !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION)
-#error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
-#endif
-
-#ifndef GDK_PIXBUF_IO_H
-#define GDK_PIXBUF_IO_H
-
-#include <stdio.h>
-#include <glib.h>
-#include <gmodule.h>
-#include <gdk-pixbuf/gdk-pixbuf-core.h>
-#include <gdk-pixbuf/gdk-pixbuf-animation.h>
-
-G_BEGIN_DECLS
-
-typedef struct _GdkPixbufFormat GdkPixbufFormat;
-
-GSList *gdk_pixbuf_get_formats (void);
-gchar *gdk_pixbuf_format_get_name (GdkPixbufFormat *format);
-gchar *gdk_pixbuf_format_get_description (GdkPixbufFormat *format);
-gchar **gdk_pixbuf_format_get_mime_types (GdkPixbufFormat *format);
-gchar **gdk_pixbuf_format_get_extensions (GdkPixbufFormat *format);
-gboolean gdk_pixbuf_format_is_writable (GdkPixbufFormat *format);
-gboolean gdk_pixbuf_format_is_scalable (GdkPixbufFormat *format);
-gboolean gdk_pixbuf_format_is_disabled (GdkPixbufFormat *format);
-void gdk_pixbuf_format_set_disabled (GdkPixbufFormat *format,
- gboolean disabled);
-gchar *gdk_pixbuf_format_get_license (GdkPixbufFormat *format);
-
-GdkPixbufFormat *gdk_pixbuf_get_file_info (const gchar *filename,
- gint *width,
- gint *height);
-
-#ifdef GDK_PIXBUF_ENABLE_BACKEND
-
-
-
-typedef void (* GdkPixbufModuleSizeFunc) (gint *width,
- gint *height,
- gpointer user_data);
-
-typedef void (* GdkPixbufModulePreparedFunc) (GdkPixbuf *pixbuf,
- GdkPixbufAnimation *anim,
- gpointer user_data);
-typedef void (* GdkPixbufModuleUpdatedFunc) (GdkPixbuf *pixbuf,
- int x,
- int y,
- int width,
- int height,
- gpointer user_data);
-
-typedef struct _GdkPixbufModulePattern GdkPixbufModulePattern;
-struct _GdkPixbufModulePattern {
- char *prefix;
- char *mask;
- int relevance;
-};
-
-typedef struct _GdkPixbufModule GdkPixbufModule;
-struct _GdkPixbufModule {
- char *module_name;
- char *module_path;
- GModule *module;
- GdkPixbufFormat *info;
-
- GdkPixbuf *(* load) (FILE *f,
- GError **error);
- GdkPixbuf *(* load_xpm_data) (const char **data);
-
- /* Incremental loading */
-
- gpointer (* begin_load) (GdkPixbufModuleSizeFunc size_func,
- GdkPixbufModulePreparedFunc prepare_func,
- GdkPixbufModuleUpdatedFunc update_func,
- gpointer user_data,
- GError **error);
- gboolean (* stop_load) (gpointer context,
- GError **error);
- gboolean (* load_increment) (gpointer context,
- const guchar *buf,
- guint size,
- GError **error);
-
- /* Animation loading */
- GdkPixbufAnimation *(* load_animation) (FILE *f,
- GError **error);
-
- /* Saving */
- gboolean (* save) (FILE *f,
- GdkPixbuf *pixbuf,
- gchar **param_keys,
- gchar **param_values,
- GError **error);
-
- gboolean (*save_to_callback) (GdkPixbufSaveFunc save_func,
- gpointer user_data,
- GdkPixbuf *pixbuf,
- gchar **option_keys,
- gchar **option_values,
- GError **error);
-
- /*< private >*/
- void (*_reserved1) (void);
- void (*_reserved2) (void);
- void (*_reserved3) (void);
- void (*_reserved4) (void);
- void (*_reserved5) (void);
-
-};
-
-typedef void (* GdkPixbufModuleFillVtableFunc) (GdkPixbufModule *module);
-typedef void (* GdkPixbufModuleFillInfoFunc) (GdkPixbufFormat *info);
-
-/* key/value pairs that can be attached by the pixbuf loader */
-
-gboolean gdk_pixbuf_set_option (GdkPixbuf *pixbuf,
- const gchar *key,
- const gchar *value);
-
-typedef enum /*< skip >*/
-{
- GDK_PIXBUF_FORMAT_WRITABLE = 1 << 0,
- GDK_PIXBUF_FORMAT_SCALABLE = 1 << 1,
- GDK_PIXBUF_FORMAT_THREADSAFE = 1 << 2
-} GdkPixbufFormatFlags;
-
-struct _GdkPixbufFormat {
- gchar *name;
- GdkPixbufModulePattern *signature;
- gchar *domain;
- gchar *description;
- gchar **mime_types;
- gchar **extensions;
- guint32 flags;
- gboolean disabled;
- gchar *license;
-};
-
-
-#endif /* GDK_PIXBUF_ENABLE_BACKEND */
-
-G_END_DECLS
-
-#endif /* GDK_PIXBUF_IO_H */
diff --git a/gdk-pixbuf/gdk-pixbuf-loader.c b/gdk-pixbuf/gdk-pixbuf-loader.c
deleted file mode 100644
index 6b7b547971..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-loader.c
+++ /dev/null
@@ -1,789 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/* GdkPixbuf library - Progressive loader object
- *
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Authors: Mark Crichton <crichton@gimp.org>
- * Miguel de Icaza <miguel@gnu.org>
- * Federico Mena-Quintero <federico@gimp.org>
- * Jonathan Blandford <jrb@redhat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 <string.h>
-
-#include "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-animation.h"
-#include "gdk-pixbuf-scaled-anim.h"
-#include "gdk-pixbuf-io.h"
-#include "gdk-pixbuf-loader.h"
-#include "gdk-pixbuf-marshal.h"
-#include "gdk-pixbuf-alias.h"
-
-enum {
- SIZE_PREPARED,
- AREA_PREPARED,
- AREA_UPDATED,
- CLOSED,
- LAST_SIGNAL
-};
-
-
-static void gdk_pixbuf_loader_finalize (GObject *loader);
-
-static guint pixbuf_loader_signals[LAST_SIGNAL] = { 0 };
-
-/* Internal data */
-
-#define LOADER_HEADER_SIZE 1024
-
-typedef struct
-{
- GdkPixbufAnimation *animation;
- gboolean closed;
- gboolean holds_threadlock;
- guchar header_buf[LOADER_HEADER_SIZE];
- gint header_buf_offset;
- GdkPixbufModule *image_module;
- gpointer context;
- gint width;
- gint height;
- gboolean size_fixed;
- gboolean needs_scale;
-} GdkPixbufLoaderPrivate;
-
-G_DEFINE_TYPE (GdkPixbufLoader, gdk_pixbuf_loader, G_TYPE_OBJECT)
-
-static void
-gdk_pixbuf_loader_class_init (GdkPixbufLoaderClass *class)
-{
- GObjectClass *object_class;
-
- object_class = (GObjectClass *) class;
-
- object_class->finalize = gdk_pixbuf_loader_finalize;
-
- /**
- * GdkPixbufLoader::size-prepared:
- * @loader: the object which received the signal.
- * @width: the original width of the image
- * @height: the original height of the image
- *
- * This signal is emitted when the pixbuf loader has been fed the
- * initial amount of data that is required to figure out the size
- * of the image that it will create. Applications can call
- * gdk_pixbuf_loader_set_size() in response to this signal to set
- * the desired size to which the image should be scaled.
- */
- pixbuf_loader_signals[SIZE_PREPARED] =
- g_signal_new ("size-prepared",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GdkPixbufLoaderClass, size_prepared),
- NULL, NULL,
- _gdk_pixbuf_marshal_VOID__INT_INT,
- G_TYPE_NONE, 2,
- G_TYPE_INT,
- G_TYPE_INT);
-
- /**
- * GdkPixbufLoader::area-prepared:
- * @loader: the object which received the signal.
- *
- * This signal is emitted when the pixbuf loader has allocated the
- * pixbuf in the desired size. After this signal is emitted,
- * applications can call gdk_pixbuf_loader_get_pixbuf() to fetch
- * the partially-loaded pixbuf.
- */
- pixbuf_loader_signals[AREA_PREPARED] =
- g_signal_new ("area-prepared",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GdkPixbufLoaderClass, area_prepared),
- NULL, NULL,
- _gdk_pixbuf_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- /**
- * GdkPixbufLoader::area-updated:
- * @loader: the object which received the signal.
- * @x: X offset of upper-left corner of the updated area.
- * @y: Y offset of upper-left corner of the updated area.
- * @width: Width of updated area.
- * @height: Height of updated area.
- *
- * This signal is emitted when a significant area of the image being
- * loaded has been updated. Normally it means that a complete
- * scanline has been read in, but it could be a different area as
- * well. Applications can use this signal to know when to repaint
- * areas of an image that is being loaded.
- */
- pixbuf_loader_signals[AREA_UPDATED] =
- g_signal_new ("area-updated",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GdkPixbufLoaderClass, area_updated),
- NULL, NULL,
- _gdk_pixbuf_marshal_VOID__INT_INT_INT_INT,
- G_TYPE_NONE, 4,
- G_TYPE_INT,
- G_TYPE_INT,
- G_TYPE_INT,
- G_TYPE_INT);
-
- /**
- * GdkPixbufLoader::closed:
- * @loader: the object which received the signal.
- *
- * This signal is emitted when gdk_pixbuf_loader_close() is called.
- * It can be used by different parts of an application to receive
- * notification when an image loader is closed by the code that
- * drives it.
- */
- pixbuf_loader_signals[CLOSED] =
- g_signal_new ("closed",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GdkPixbufLoaderClass, closed),
- NULL, NULL,
- _gdk_pixbuf_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-}
-
-static void
-gdk_pixbuf_loader_init (GdkPixbufLoader *loader)
-{
- GdkPixbufLoaderPrivate *priv;
-
- priv = g_new0 (GdkPixbufLoaderPrivate, 1);
- priv->width = -1;
- priv->height = -1;
-
- loader->priv = priv;
-}
-
-static void
-gdk_pixbuf_loader_finalize (GObject *object)
-{
- GdkPixbufLoader *loader;
- GdkPixbufLoaderPrivate *priv = NULL;
-
- loader = GDK_PIXBUF_LOADER (object);
- priv = loader->priv;
-
- if (!priv->closed) {
- g_warning ("GdkPixbufLoader finalized without calling gdk_pixbuf_loader_close() - this is not allowed. You must explicitly end the data stream to the loader before dropping the last reference.");
- if (priv->holds_threadlock) {
- _gdk_pixbuf_unlock (priv->image_module);
- }
- }
- if (priv->animation)
- g_object_unref (priv->animation);
-
- g_free (priv);
-
- G_OBJECT_CLASS (gdk_pixbuf_loader_parent_class)->finalize (object);
-}
-
-/**
- * gdk_pixbuf_loader_set_size:
- * @loader: A pixbuf loader.
- * @width: The desired width of the image being loaded.
- * @height: The desired height of the image being loaded.
- *
- * Causes the image to be scaled while it is loaded. The desired
- * image size can be determined relative to the original size of
- * the image by calling gdk_pixbuf_loader_set_size() from a
- * signal handler for the ::size-prepared signal.
- *
- * Attempts to set the desired image size are ignored after the
- * emission of the ::size-prepared signal.
- *
- * Since: 2.2
- */
-void
-gdk_pixbuf_loader_set_size (GdkPixbufLoader *loader,
- gint width,
- gint height)
-{
- GdkPixbufLoaderPrivate *priv;
-
- g_return_if_fail (GDK_IS_PIXBUF_LOADER (loader));
- g_return_if_fail (width >= 0 && height >= 0);
-
- priv = GDK_PIXBUF_LOADER (loader)->priv;
-
- if (!priv->size_fixed)
- {
- priv->width = width;
- priv->height = height;
- }
-}
-
-static void
-gdk_pixbuf_loader_size_func (gint *width, gint *height, gpointer loader)
-{
- GdkPixbufLoaderPrivate *priv = GDK_PIXBUF_LOADER (loader)->priv;
-
- /* allow calling gdk_pixbuf_loader_set_size() before the signal */
- if (priv->width == -1 && priv->height == -1)
- {
- priv->width = *width;
- priv->height = *height;
- }
-
- g_signal_emit (loader, pixbuf_loader_signals[SIZE_PREPARED], 0, *width, *height);
- priv->size_fixed = TRUE;
-
- *width = priv->width;
- *height = priv->height;
-}
-
-static void
-gdk_pixbuf_loader_prepare (GdkPixbuf *pixbuf,
- GdkPixbufAnimation *anim,
- gpointer loader)
-{
- GdkPixbufLoaderPrivate *priv = GDK_PIXBUF_LOADER (loader)->priv;
- g_return_if_fail (pixbuf != NULL);
-
- if (!priv->size_fixed)
- {
- /* Defend against lazy loaders which don't call size_func */
- gint width = gdk_pixbuf_get_width (pixbuf);
- gint height = gdk_pixbuf_get_height (pixbuf);
-
- gdk_pixbuf_loader_size_func (&width, &height, loader);
- }
-
- priv->needs_scale = FALSE;
- if (priv->width > 0 && priv->height > 0 &&
- (priv->width != gdk_pixbuf_get_width (pixbuf) ||
- priv->height != gdk_pixbuf_get_height (pixbuf)))
- priv->needs_scale = TRUE;
-
- if (anim)
- g_object_ref (anim);
- else
- anim = gdk_pixbuf_non_anim_new (pixbuf);
-
- if (priv->needs_scale) {
- priv->animation = GDK_PIXBUF_ANIMATION (_gdk_pixbuf_scaled_anim_new (anim,
- (double) priv->width / gdk_pixbuf_get_width (pixbuf),
- (double) priv->height / gdk_pixbuf_get_height (pixbuf),
- 1.0));
- g_object_unref (anim);
- }
- else
- priv->animation = anim;
-
- if (!priv->needs_scale)
- g_signal_emit (loader, pixbuf_loader_signals[AREA_PREPARED], 0);
-}
-
-static void
-gdk_pixbuf_loader_update (GdkPixbuf *pixbuf,
- gint x,
- gint y,
- gint width,
- gint height,
- gpointer loader)
-{
- GdkPixbufLoaderPrivate *priv = GDK_PIXBUF_LOADER (loader)->priv;
-
- if (!priv->needs_scale)
- g_signal_emit (loader,
- pixbuf_loader_signals[AREA_UPDATED],
- 0,
- x, y,
- /* sanity check in here. Defend against an errant loader */
- MIN (width, gdk_pixbuf_animation_get_width (priv->animation)),
- MIN (height, gdk_pixbuf_animation_get_height (priv->animation)));
-}
-
-/* Defense against broken loaders; DO NOT take this as a GError example! */
-static void
-gdk_pixbuf_loader_ensure_error (GdkPixbufLoader *loader,
- GError **error)
-{
- GdkPixbufLoaderPrivate *priv = loader->priv;
-
- if (error == NULL || *error != NULL)
- return;
-
- g_warning ("Bug! loader '%s' didn't set an error on failure",
- priv->image_module->module_name);
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_FAILED,
- _("Internal error: Image loader module '%s' failed to"
- " complete an operation, but didn't give a reason for"
- " the failure"),
- priv->image_module->module_name);
-}
-
-static gint
-gdk_pixbuf_loader_load_module (GdkPixbufLoader *loader,
- const char *image_type,
- GError **error)
-{
- GdkPixbufLoaderPrivate *priv = loader->priv;
-
- if (image_type)
- {
- priv->image_module = _gdk_pixbuf_get_named_module (image_type,
- error);
- }
- else
- {
- priv->image_module = _gdk_pixbuf_get_module (priv->header_buf,
- priv->header_buf_offset,
- NULL,
- error);
- }
-
- if (priv->image_module == NULL)
- return 0;
-
- if (!_gdk_pixbuf_load_module (priv->image_module, error))
- return 0;
-
- if (priv->image_module->module == NULL)
- return 0;
-
- if ((priv->image_module->begin_load == NULL) ||
- (priv->image_module->stop_load == NULL) ||
- (priv->image_module->load_increment == NULL))
- {
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION,
- _("Incremental loading of image type '%s' is not supported"),
- priv->image_module->module_name);
-
- return 0;
- }
-
- if (!priv->holds_threadlock) {
- priv->holds_threadlock = _gdk_pixbuf_lock (priv->image_module);
- }
-
- priv->context = priv->image_module->begin_load (gdk_pixbuf_loader_size_func,
- gdk_pixbuf_loader_prepare,
- gdk_pixbuf_loader_update,
- loader,
- error);
-
- if (priv->context == NULL)
- {
- gdk_pixbuf_loader_ensure_error (loader, error);
- return 0;
- }
-
- if (priv->header_buf_offset
- && priv->image_module->load_increment (priv->context, priv->header_buf, priv->header_buf_offset, error))
- return priv->header_buf_offset;
-
- return 0;
-}
-
-static int
-gdk_pixbuf_loader_eat_header_write (GdkPixbufLoader *loader,
- const guchar *buf,
- gsize count,
- GError **error)
-{
- gint n_bytes;
- GdkPixbufLoaderPrivate *priv = loader->priv;
-
- n_bytes = MIN(LOADER_HEADER_SIZE - priv->header_buf_offset, count);
- memcpy (priv->header_buf + priv->header_buf_offset, buf, n_bytes);
-
- priv->header_buf_offset += n_bytes;
-
- if (priv->header_buf_offset >= LOADER_HEADER_SIZE)
- {
- if (gdk_pixbuf_loader_load_module (loader, NULL, error) == 0)
- return 0;
- }
-
- return n_bytes;
-}
-
-/**
- * gdk_pixbuf_loader_write:
- * @loader: A pixbuf loader.
- * @buf: Pointer to image data.
- * @count: Length of the @buf buffer in bytes.
- * @error: return location for errors
- *
- * This will cause a pixbuf loader to parse the next @count bytes of
- * an image. It will return %TRUE if the data was loaded successfully,
- * and %FALSE if an error occurred. In the latter case, the loader
- * will be closed, and will not accept further writes. If %FALSE is
- * returned, @error will be set to an error from the #GDK_PIXBUF_ERROR
- * or #G_FILE_ERROR domains.
- *
- * Return value: %TRUE if the write was successful, or %FALSE if the loader
- * cannot parse the buffer.
- **/
-gboolean
-gdk_pixbuf_loader_write (GdkPixbufLoader *loader,
- const guchar *buf,
- gsize count,
- GError **error)
-{
- GdkPixbufLoaderPrivate *priv;
-
- g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), FALSE);
-
- g_return_val_if_fail (buf != NULL, FALSE);
- g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
-
- priv = loader->priv;
-
- /* we expect it's not to be closed */
- g_return_val_if_fail (priv->closed == FALSE, FALSE);
-
- if (count > 0 && priv->image_module == NULL)
- {
- gint eaten;
-
- eaten = gdk_pixbuf_loader_eat_header_write (loader, buf, count, error);
- if (eaten <= 0)
- goto fail;
-
- count -= eaten;
- buf += eaten;
- }
-
- if (count > 0 && priv->image_module->load_increment)
- {
- if (!priv->image_module->load_increment (priv->context, buf, count,
- error))
- goto fail;
- }
-
- return TRUE;
-
- fail:
- gdk_pixbuf_loader_ensure_error (loader, error);
- gdk_pixbuf_loader_close (loader, NULL);
-
- return FALSE;
-}
-
-/**
- * gdk_pixbuf_loader_new:
- *
- * Creates a new pixbuf loader object.
- *
- * Return value: A newly-created pixbuf loader.
- **/
-GdkPixbufLoader *
-gdk_pixbuf_loader_new (void)
-{
- return g_object_new (GDK_TYPE_PIXBUF_LOADER, NULL);
-}
-
-/**
- * gdk_pixbuf_loader_new_with_type:
- * @image_type: name of the image format to be loaded with the image
- * @error: (allow-none): return location for an allocated #GError, or %NULL to ignore errors
- *
- * Creates a new pixbuf loader object that always attempts to parse
- * image data as if it were an image of type @image_type, instead of
- * identifying the type automatically. Useful if you want an error if
- * the image isn't the expected type, for loading image formats
- * that can't be reliably identified by looking at the data, or if
- * the user manually forces a specific type.
- *
- * The list of supported image formats depends on what image loaders
- * are installed, but typically "png", "jpeg", "gif", "tiff" and
- * "xpm" are among the supported formats. To obtain the full list of
- * supported image formats, call gdk_pixbuf_format_get_name() on each
- * of the #GdkPixbufFormat structs returned by gdk_pixbuf_get_formats().
- *
- * Return value: A newly-created pixbuf loader.
- **/
-GdkPixbufLoader *
-gdk_pixbuf_loader_new_with_type (const char *image_type,
- GError **error)
-{
- GdkPixbufLoader *retval;
- GError *tmp;
- g_return_val_if_fail (error == NULL || *error == NULL, NULL);
-
- retval = g_object_new (GDK_TYPE_PIXBUF_LOADER, NULL);
-
- tmp = NULL;
- gdk_pixbuf_loader_load_module (retval, image_type, &tmp);
- if (tmp != NULL)
- {
- g_propagate_error (error, tmp);
- gdk_pixbuf_loader_close (retval, NULL);
- g_object_unref (retval);
- return NULL;
- }
-
- return retval;
-}
-
-/**
- * gdk_pixbuf_loader_new_with_mime_type:
- * @mime_type: the mime type to be loaded
- * @error: (allow-none): return location for an allocated #GError, or %NULL to ignore errors
- *
- * Creates a new pixbuf loader object that always attempts to parse
- * image data as if it were an image of mime type @mime_type, instead of
- * identifying the type automatically. Useful if you want an error if
- * the image isn't the expected mime type, for loading image formats
- * that can't be reliably identified by looking at the data, or if
- * the user manually forces a specific mime type.
- *
- * The list of supported mime types depends on what image loaders
- * are installed, but typically "image/png", "image/jpeg", "image/gif",
- * "image/tiff" and "image/x-xpixmap" are among the supported mime types.
- * To obtain the full list of supported mime types, call
- * gdk_pixbuf_format_get_mime_types() on each of the #GdkPixbufFormat
- * structs returned by gdk_pixbuf_get_formats().
- *
- * Return value: A newly-created pixbuf loader.
- * Since: 2.4
- **/
-GdkPixbufLoader *
-gdk_pixbuf_loader_new_with_mime_type (const char *mime_type,
- GError **error)
-{
- const char * image_type = NULL;
- char ** mimes;
-
- GdkPixbufLoader *retval;
- GError *tmp;
-
- GSList * formats;
- GdkPixbufFormat *info;
- int i, j, length;
-
- formats = gdk_pixbuf_get_formats ();
- length = g_slist_length (formats);
-
- for (i = 0; i < length && image_type == NULL; i++) {
- info = (GdkPixbufFormat *)g_slist_nth_data (formats, i);
- mimes = info->mime_types;
-
- for (j = 0; mimes[j] != NULL; j++)
- if (g_ascii_strcasecmp (mimes[j], mime_type) == 0) {
- image_type = info->name;
- break;
- }
- }
-
- g_slist_free (formats);
-
- retval = g_object_new (GDK_TYPE_PIXBUF_LOADER, NULL);
-
- tmp = NULL;
- gdk_pixbuf_loader_load_module (retval, image_type, &tmp);
- if (tmp != NULL)
- {
- g_propagate_error (error, tmp);
- gdk_pixbuf_loader_close (retval, NULL);
- g_object_unref (retval);
- return NULL;
- }
-
- return retval;
-}
-
-/**
- * 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 after 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 g_object_ref() should be sufficient to continue
- * using it. Additionally, if the loader is an animation, it will
- * return the "static image" of the animation
- * (see gdk_pixbuf_animation_get_static_image()).
- *
- * 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.
- **/
-GdkPixbuf *
-gdk_pixbuf_loader_get_pixbuf (GdkPixbufLoader *loader)
-{
- GdkPixbufLoaderPrivate *priv;
-
- g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), NULL);
-
- priv = loader->priv;
-
- if (priv->animation)
- return gdk_pixbuf_animation_get_static_image (priv->animation);
- else
- return NULL;
-}
-
-/**
- * gdk_pixbuf_loader_get_animation:
- * @loader: A pixbuf loader
- *
- * Queries the #GdkPixbufAnimation that a pixbuf loader is currently creating.
- * In general it only makes sense to call this function after the "area-prepared"
- * signal has been emitted by the loader. If the loader doesn't have enough
- * bytes yet (hasn't emitted the "area-prepared" signal) this function will
- * return %NULL.
- *
- * Return value: The #GdkPixbufAnimation that the loader is loading, or %NULL if
- not enough data has been read to determine the information.
-**/
-GdkPixbufAnimation *
-gdk_pixbuf_loader_get_animation (GdkPixbufLoader *loader)
-{
- GdkPixbufLoaderPrivate *priv;
-
- g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), NULL);
-
- priv = loader->priv;
-
- return priv->animation;
-}
-
-/**
- * gdk_pixbuf_loader_close:
- * @loader: A pixbuf loader.
- * @error: (allow-none): return location for a #GError, or %NULL to ignore errors
- *
- * Informs a pixbuf loader that no further writes with
- * gdk_pixbuf_loader_write() will occur, so that it can free its
- * internal loading structures. Also, tries to parse any data that
- * hasn't yet been parsed; if the remaining data is partial or
- * corrupt, an error will be returned. If %FALSE is returned, @error
- * will be set to an error from the #GDK_PIXBUF_ERROR or #G_FILE_ERROR
- * domains. If you're just cancelling a load rather than expecting it
- * to be finished, passing %NULL for @error to ignore it is
- * reasonable.
- *
- * Returns: %TRUE if all image data written so far was successfully
- passed out via the update_area signal
- **/
-gboolean
-gdk_pixbuf_loader_close (GdkPixbufLoader *loader,
- GError **error)
-{
- GdkPixbufLoaderPrivate *priv;
- gboolean retval = TRUE;
-
- g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), TRUE);
- g_return_val_if_fail (error == NULL || *error == NULL, TRUE);
-
- priv = loader->priv;
-
- if (priv->closed)
- return TRUE;
-
- /* We have less the LOADER_HEADER_SIZE bytes in the image.
- * Flush it, and keep going.
- */
- if (priv->image_module == NULL)
- {
- GError *tmp = NULL;
- gdk_pixbuf_loader_load_module (loader, NULL, &tmp);
- if (tmp != NULL)
- {
- g_propagate_error (error, tmp);
- retval = FALSE;
- }
- }
-
- if (priv->image_module && priv->image_module->stop_load && priv->context)
- {
- GError *tmp = NULL;
- if (!priv->image_module->stop_load (priv->context, &tmp) || tmp)
- {
- /* don't call gdk_pixbuf_loader_ensure_error()
- * here, since we might not get an error in the
- * gdk_pixbuf_get_file_info() case
- */
- if (tmp) {
- if (error && *error == NULL)
- g_propagate_error (error, tmp);
- else
- g_error_free (tmp);
- }
- retval = FALSE;
- }
- }
-
- priv->closed = TRUE;
- if (priv->image_module && priv->holds_threadlock) {
- _gdk_pixbuf_unlock (priv->image_module);
- priv->holds_threadlock = FALSE;
- }
-
- if (priv->needs_scale)
- {
-
- g_signal_emit (loader, pixbuf_loader_signals[AREA_PREPARED], 0);
- g_signal_emit (loader, pixbuf_loader_signals[AREA_UPDATED], 0,
- 0, 0, priv->width, priv->height);
- }
-
-
- g_signal_emit (loader, pixbuf_loader_signals[CLOSED], 0);
-
- return retval;
-}
-
-/**
- * gdk_pixbuf_loader_get_format:
- * @loader: A pixbuf loader.
- *
- * Obtains the available information about the format of the
- * currently loading image file.
- *
- * Returns: A #GdkPixbufFormat or %NULL. The return value is owned
- * by GdkPixbuf and should not be freed.
- *
- * Since: 2.2
- */
-GdkPixbufFormat *
-gdk_pixbuf_loader_get_format (GdkPixbufLoader *loader)
-{
- GdkPixbufLoaderPrivate *priv;
-
- g_return_val_if_fail (GDK_IS_PIXBUF_LOADER (loader), NULL);
-
- priv = loader->priv;
-
- if (priv->image_module)
- return _gdk_pixbuf_get_format (priv->image_module);
- else
- return NULL;
-}
-
-
-#define __GDK_PIXBUF_LOADER_C__
-#include "gdk-pixbuf-aliasdef.c"
-
diff --git a/gdk-pixbuf/gdk-pixbuf-loader.h b/gdk-pixbuf/gdk-pixbuf-loader.h
deleted file mode 100644
index de4c53763b..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-loader.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* GdkPixbuf library - Progressive loader object
- *
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Authors: Mark Crichton <crichton@gimp.org>
- * Miguel de Icaza <miguel@gnu.org>
- * Federico Mena-Quintero <federico@gimp.org>
- * Jonathan Blandford <jrb@redhat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.
- */
-
-#if !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION)
-#error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
-#endif
-
-#ifndef GDK_PIXBUF_LOADER_H
-#define GDK_PIXBUF_LOADER_H
-
-#include <glib.h>
-#include <glib-object.h>
-#include <gdk-pixbuf/gdk-pixbuf-core.h>
-#include <gdk-pixbuf/gdk-pixbuf-animation.h>
-#include <gdk-pixbuf/gdk-pixbuf-io.h>
-
-G_BEGIN_DECLS
-
-#define GDK_TYPE_PIXBUF_LOADER (gdk_pixbuf_loader_get_type ())
-#define GDK_PIXBUF_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoader))
-#define GDK_PIXBUF_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoaderClass))
-#define GDK_IS_PIXBUF_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_PIXBUF_LOADER))
-#define GDK_IS_PIXBUF_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_LOADER))
-#define GDK_PIXBUF_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_LOADER, GdkPixbufLoaderClass))
-
-
-typedef struct _GdkPixbufLoader GdkPixbufLoader;
-struct _GdkPixbufLoader
-{
- GObject parent_instance;
-
- /*< private >*/
- gpointer priv;
-};
-
-typedef struct _GdkPixbufLoaderClass GdkPixbufLoaderClass;
-struct _GdkPixbufLoaderClass
-{
- GObjectClass parent_class;
-
- void (*size_prepared) (GdkPixbufLoader *loader,
- int width,
- int height);
-
- void (*area_prepared) (GdkPixbufLoader *loader);
-
- /* Last known frame needs a redraw for x, y, width, height */
- void (*area_updated) (GdkPixbufLoader *loader,
- int x,
- int y,
- int width,
- int height);
-
- void (*closed) (GdkPixbufLoader *loader);
-};
-
-GType gdk_pixbuf_loader_get_type (void) G_GNUC_CONST;
-GdkPixbufLoader * gdk_pixbuf_loader_new (void);
-GdkPixbufLoader * gdk_pixbuf_loader_new_with_type (const char *image_type,
- GError **error);
-GdkPixbufLoader * gdk_pixbuf_loader_new_with_mime_type (const char *mime_type,
- GError **error);
-void gdk_pixbuf_loader_set_size (GdkPixbufLoader *loader,
- int width,
- int height);
-gboolean gdk_pixbuf_loader_write (GdkPixbufLoader *loader,
- const guchar *buf,
- gsize count,
- GError **error);
-GdkPixbuf * gdk_pixbuf_loader_get_pixbuf (GdkPixbufLoader *loader);
-GdkPixbufAnimation * gdk_pixbuf_loader_get_animation (GdkPixbufLoader *loader);
-gboolean gdk_pixbuf_loader_close (GdkPixbufLoader *loader,
- GError **error);
-GdkPixbufFormat *gdk_pixbuf_loader_get_format (GdkPixbufLoader *loader);
-
-G_END_DECLS
-
-#endif
-
-
diff --git a/gdk-pixbuf/gdk-pixbuf-marshal.list b/gdk-pixbuf/gdk-pixbuf-marshal.list
deleted file mode 100644
index a43f7ce69c..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-marshal.list
+++ /dev/null
@@ -1,28 +0,0 @@
-# see glib-genmarshal(1) for a detailed description of the file format,
-# possible parameter types are:
-# VOID indicates no return type, or no extra
-# parameters. if VOID is used as the parameter
-# list, no additional parameters may be present.
-# BOOLEAN for boolean types (gboolean)
-# CHAR for signed char types (gchar)
-# UCHAR for unsigned char types (guchar)
-# INT for signed integer types (gint)
-# UINT for unsigned integer types (guint)
-# LONG for signed long integer types (glong)
-# ULONG for unsigned long integer types (gulong)
-# ENUM for enumeration types (gint)
-# FLAGS for flag enumeration types (guint)
-# FLOAT for single-precision float types (gfloat)
-# DOUBLE for double-precision float types (gdouble)
-# STRING for string types (gchar*)
-# PARAM for GParamSpec or derived types (GParamSpec*)
-# BOXED for boxed (anonymous but reference counted) types (GBoxed*)
-# POINTER for anonymous pointer types (gpointer)
-# OBJECT for GObject or derived types (GObject*)
-# NONE deprecated alias for VOID
-# BOOL deprecated alias for BOOLEAN
-
-VOID:VOID
-VOID:INT,INT
-VOID:INT,INT,INT,INT
-VOID:POINTER
diff --git a/gdk-pixbuf/gdk-pixbuf-private.h b/gdk-pixbuf/gdk-pixbuf-private.h
deleted file mode 100644
index c0220d36e5..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-private.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/* GdkPixbuf library - Private declarations
- *
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Authors: Mark Crichton <crichton@gimp.org>
- * Miguel de Icaza <miguel@gnu.org>
- * Federico Mena-Quintero <federico@gimp.org>
- * Havoc Pennington <hp@redhat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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_PRIVATE_H
-#define GDK_PIXBUF_PRIVATE_H
-
-#include "gdk-pixbuf.h"
-#include "gdk-pixbuf-i18n.h"
-#include <stdio.h>
-
-
-
-typedef struct _GdkPixbufClass GdkPixbufClass;
-
-#define GDK_PIXBUF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF, GdkPixbufClass))
-#define GDK_IS_PIXBUF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF))
-#define GDK_PIXBUF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF, GdkPixbufClass))
-
-/* Private part of the GdkPixbuf structure */
-struct _GdkPixbuf {
- GObject parent_instance;
-
- /* Color space */
- GdkColorspace colorspace;
-
- /* Number of channels, alpha included */
- int n_channels;
-
- /* Bits per channel */
- int bits_per_sample;
-
- /* Size */
- int width, height;
-
- /* Offset between rows */
- int rowstride;
-
- /* The pixel array */
- guchar *pixels;
-
- /* Destroy notification function; it is supposed to free the pixel array */
- GdkPixbufDestroyNotify destroy_fn;
-
- /* User data for the destroy notification function */
- gpointer destroy_fn_data;
-
- /* Do we have an alpha channel? */
- guint has_alpha : 1;
-};
-
-struct _GdkPixbufClass {
- GObjectClass parent_class;
-
-};
-
-#ifdef GDK_PIXBUF_ENABLE_BACKEND
-
-gboolean _gdk_pixbuf_lock (GdkPixbufModule *image_module);
-void _gdk_pixbuf_unlock (GdkPixbufModule *image_module);
-
-GdkPixbufModule *_gdk_pixbuf_get_module (guchar *buffer, guint size,
- const gchar *filename,
- GError **error);
-GdkPixbufModule *_gdk_pixbuf_get_named_module (const char *name,
- GError **error);
-gboolean _gdk_pixbuf_load_module (GdkPixbufModule *image_module,
- GError **error);
-
-GdkPixbuf *_gdk_pixbuf_generic_image_load (GdkPixbufModule *image_module,
- FILE *f,
- GError **error);
-
-GdkPixbufFormat *_gdk_pixbuf_get_format (GdkPixbufModule *image_module);
-
-#endif /* GDK_PIXBUF_ENABLE_BACKEND */
-
-#endif /* GDK_PIXBUF_PRIVATE_H */
-
-
diff --git a/gdk-pixbuf/gdk-pixbuf-scale.c b/gdk-pixbuf/gdk-pixbuf-scale.c
deleted file mode 100644
index 694a8cb6ec..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-scale.c
+++ /dev/null
@@ -1,463 +0,0 @@
-/* GdkPixbuf library - Scaling and compositing functions
- *
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Author: Owen Taylor <otaylor@redhat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 <math.h>
-#include <string.h>
-#include "gdk-pixbuf-private.h"
-#include "pixops/pixops.h"
-#include "gdk-pixbuf-alias.h"
-
-
-
-/**
- * gdk_pixbuf_scale:
- * @src: a #GdkPixbuf
- * @dest: the #GdkPixbuf into which to render the results
- * @dest_x: the left coordinate for region to render
- * @dest_y: the top coordinate for region to render
- * @dest_width: the width of the region to render
- * @dest_height: the height of the region to render
- * @offset_x: the offset in the X direction (currently rounded to an integer)
- * @offset_y: the offset in the Y direction (currently rounded to an integer)
- * @scale_x: the scale factor in the X direction
- * @scale_y: the scale factor in the Y direction
- * @interp_type: the interpolation type for the transformation.
- *
- * Creates a transformation of the source image @src by scaling by
- * @scale_x and @scale_y then translating by @offset_x and @offset_y,
- * then renders the rectangle (@dest_x, @dest_y, @dest_width,
- * @dest_height) of the resulting image onto the destination image
- * replacing the previous contents.
- *
- * Try to use gdk_pixbuf_scale_simple() first, this function is
- * the industrial-strength power tool you can fall back to if
- * gdk_pixbuf_scale_simple() isn't powerful enough.
- *
- * If the source rectangle overlaps the destination rectangle on the
- * same pixbuf, it will be overwritten during the scaling which
- * results in rendering artifacts.
- **/
-void
-gdk_pixbuf_scale (const GdkPixbuf *src,
- GdkPixbuf *dest,
- int dest_x,
- int dest_y,
- int dest_width,
- int dest_height,
- double offset_x,
- double offset_y,
- double scale_x,
- double scale_y,
- GdkInterpType interp_type)
-{
- g_return_if_fail (GDK_IS_PIXBUF (src));
- g_return_if_fail (GDK_IS_PIXBUF (dest));
- g_return_if_fail (dest_x >= 0 && dest_x + dest_width <= dest->width);
- g_return_if_fail (dest_y >= 0 && dest_y + dest_height <= dest->height);
-
- offset_x = floor (offset_x + 0.5);
- offset_y = floor (offset_y + 0.5);
-
- _pixops_scale (dest->pixels, dest->width, dest->height, dest->rowstride,
- dest->n_channels, dest->has_alpha, src->pixels, src->width,
- src->height, src->rowstride, src->n_channels, src->has_alpha,
- dest_x, dest_y, dest_width, dest_height, offset_x, offset_y,
- scale_x, scale_y, (PixopsInterpType)interp_type);
-}
-
-/**
- * gdk_pixbuf_composite:
- * @src: a #GdkPixbuf
- * @dest: the #GdkPixbuf into which to render the results
- * @dest_x: the left coordinate for region to render
- * @dest_y: the top coordinate for region to render
- * @dest_width: the width of the region to render
- * @dest_height: the height of the region to render
- * @offset_x: the offset in the X direction (currently rounded to an integer)
- * @offset_y: the offset in the Y direction (currently rounded to an integer)
- * @scale_x: the scale factor in the X direction
- * @scale_y: the scale factor in the Y direction
- * @interp_type: the interpolation type for the transformation.
- * @overall_alpha: overall alpha for source image (0..255)
- *
- * Creates a transformation of the source image @src by scaling by
- * @scale_x and @scale_y then translating by @offset_x and @offset_y.
- * This gives an image in the coordinates of the destination pixbuf.
- * The rectangle (@dest_x, @dest_y, @dest_width, @dest_height)
- * is then composited onto the corresponding rectangle of the
- * original destination image.
- *
- * When the destination rectangle contains parts not in the source
- * image, the data at the edges of the source image is replicated
- * to infinity.
- *
- * <figure id="pixbuf-composite-diagram">
- * <title>Compositing of pixbufs</title>
- * <graphic fileref="composite.png" format="PNG"/>
- * </figure>
- **/
-void
-gdk_pixbuf_composite (const GdkPixbuf *src,
- GdkPixbuf *dest,
- int dest_x,
- int dest_y,
- int dest_width,
- int dest_height,
- double offset_x,
- double offset_y,
- double scale_x,
- double scale_y,
- GdkInterpType interp_type,
- int overall_alpha)
-{
- g_return_if_fail (GDK_IS_PIXBUF (src));
- g_return_if_fail (GDK_IS_PIXBUF (dest));
- g_return_if_fail (dest_x >= 0 && dest_x + dest_width <= dest->width);
- g_return_if_fail (dest_y >= 0 && dest_y + dest_height <= dest->height);
- g_return_if_fail (overall_alpha >= 0 && overall_alpha <= 255);
-
- offset_x = floor (offset_x + 0.5);
- offset_y = floor (offset_y + 0.5);
-
- _pixops_composite (dest->pixels, dest->width, dest->height, dest->rowstride,
- dest->n_channels, dest->has_alpha, src->pixels,
- src->width, src->height, src->rowstride, src->n_channels,
- src->has_alpha, dest_x, dest_y, dest_width, dest_height,
- offset_x, offset_y, scale_x, scale_y,
- (PixopsInterpType)interp_type, overall_alpha);
-}
-
-/**
- * gdk_pixbuf_composite_color:
- * @src: a #GdkPixbuf
- * @dest: the #GdkPixbuf into which to render the results
- * @dest_x: the left coordinate for region to render
- * @dest_y: the top coordinate for region to render
- * @dest_width: the width of the region to render
- * @dest_height: the height of the region to render
- * @offset_x: the offset in the X direction (currently rounded to an integer)
- * @offset_y: the offset in the Y direction (currently rounded to an integer)
- * @scale_x: the scale factor in the X direction
- * @scale_y: the scale factor in the Y direction
- * @interp_type: the interpolation type for the transformation.
- * @overall_alpha: overall alpha for source image (0..255)
- * @check_x: the X offset for the checkboard (origin of checkboard is at -@check_x, -@check_y)
- * @check_y: the Y offset for the checkboard
- * @check_size: the size of checks in the checkboard (must be a power of two)
- * @color1: the color of check at upper left
- * @color2: the color of the other check
- *
- * Creates a transformation of the source image @src by scaling by
- * @scale_x and @scale_y then translating by @offset_x and @offset_y,
- * then composites the rectangle (@dest_x ,@dest_y, @dest_width,
- * @dest_height) of the resulting image with a checkboard of the
- * colors @color1 and @color2 and renders it onto the destination
- * image.
- *
- * See gdk_pixbuf_composite_color_simple() for a simpler variant of this
- * function suitable for many tasks.
- *
- **/
-void
-gdk_pixbuf_composite_color (const GdkPixbuf *src,
- GdkPixbuf *dest,
- int dest_x,
- int dest_y,
- int dest_width,
- int dest_height,
- double offset_x,
- double offset_y,
- double scale_x,
- double scale_y,
- GdkInterpType interp_type,
- int overall_alpha,
- int check_x,
- int check_y,
- int check_size,
- guint32 color1,
- guint32 color2)
-{
- g_return_if_fail (GDK_IS_PIXBUF (src));
- g_return_if_fail (GDK_IS_PIXBUF (dest));
- g_return_if_fail (dest_x >= 0 && dest_x + dest_width <= dest->width);
- g_return_if_fail (dest_y >= 0 && dest_y + dest_height <= dest->height);
- g_return_if_fail (overall_alpha >= 0 && overall_alpha <= 255);
-
- offset_x = floor (offset_x + 0.5);
- offset_y = floor (offset_y + 0.5);
-
- _pixops_composite_color (dest->pixels, dest_width, dest_height,
- dest->rowstride, dest->n_channels, dest->has_alpha,
- src->pixels, src->width, src->height,
- src->rowstride, src->n_channels, src->has_alpha,
- dest_x, dest_y, dest_width, dest_height, offset_x,
- offset_y, scale_x, scale_y,
- (PixopsInterpType)interp_type, overall_alpha,
- check_x, check_y, check_size, color1, color2);
-}
-
-/**
- * gdk_pixbuf_scale_simple:
- * @src: a #GdkPixbuf
- * @dest_width: the width of destination image
- * @dest_height: the height of destination image
- * @interp_type: the interpolation type for the transformation.
- *
- * Create a new #GdkPixbuf containing a copy of @src scaled to
- * @dest_width x @dest_height. Leaves @src unaffected. @interp_type
- * should be #GDK_INTERP_NEAREST if you want maximum speed (but when
- * scaling down #GDK_INTERP_NEAREST is usually unusably ugly). The
- * default @interp_type should be #GDK_INTERP_BILINEAR which offers
- * reasonable quality and speed.
- *
- * You can scale a sub-portion of @src by creating a sub-pixbuf
- * pointing into @src; see gdk_pixbuf_new_subpixbuf().
- *
- * For more complicated scaling/compositing see gdk_pixbuf_scale()
- * and gdk_pixbuf_composite().
- *
- * Return value: the new #GdkPixbuf, or %NULL if not enough memory could be
- * allocated for it.
- **/
-GdkPixbuf *
-gdk_pixbuf_scale_simple (const GdkPixbuf *src,
- int dest_width,
- int dest_height,
- GdkInterpType interp_type)
-{
- GdkPixbuf *dest;
-
- g_return_val_if_fail (GDK_IS_PIXBUF (src), NULL);
- g_return_val_if_fail (dest_width > 0, NULL);
- g_return_val_if_fail (dest_height > 0, NULL);
-
- dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, src->has_alpha, 8, dest_width, dest_height);
- if (!dest)
- return NULL;
-
- gdk_pixbuf_scale (src, dest, 0, 0, dest_width, dest_height, 0, 0,
- (double) dest_width / src->width,
- (double) dest_height / src->height,
- interp_type);
-
- return dest;
-}
-
-/**
- * gdk_pixbuf_composite_color_simple:
- * @src: a #GdkPixbuf
- * @dest_width: the width of destination image
- * @dest_height: the height of destination image
- * @interp_type: the interpolation type for the transformation.
- * @overall_alpha: overall alpha for source image (0..255)
- * @check_size: the size of checks in the checkboard (must be a power of two)
- * @color1: the color of check at upper left
- * @color2: the color of the other check
- *
- * Creates a new #GdkPixbuf by scaling @src to @dest_width x
- * @dest_height and compositing the result with a checkboard of colors
- * @color1 and @color2.
- *
- * Return value: the new #GdkPixbuf, or %NULL if not enough memory could be
- * allocated for it.
- **/
-GdkPixbuf *
-gdk_pixbuf_composite_color_simple (const GdkPixbuf *src,
- int dest_width,
- int dest_height,
- GdkInterpType interp_type,
- int overall_alpha,
- int check_size,
- guint32 color1,
- guint32 color2)
-{
- GdkPixbuf *dest;
-
- g_return_val_if_fail (GDK_IS_PIXBUF (src), NULL);
- g_return_val_if_fail (dest_width > 0, NULL);
- g_return_val_if_fail (dest_height > 0, NULL);
- g_return_val_if_fail (overall_alpha >= 0 && overall_alpha <= 255, NULL);
-
- dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, src->has_alpha, 8, dest_width, dest_height);
- if (!dest)
- return NULL;
-
- gdk_pixbuf_composite_color (src, dest, 0, 0, dest_width, dest_height, 0, 0,
- (double) dest_width / src->width,
- (double) dest_height / src->height,
- interp_type, overall_alpha, 0, 0, check_size, color1, color2);
-
- return dest;
-}
-
-#define OFFSET(pb, x, y) ((x) * (pb)->n_channels + (y) * (pb)->rowstride)
-
-/**
- * gdk_pixbuf_rotate_simple:
- * @src: a #GdkPixbuf
- * @angle: the angle to rotate by
- *
- * Rotates a pixbuf by a multiple of 90 degrees, and returns the
- * result in a new pixbuf.
- *
- * Returns: the new #GdkPixbuf, or %NULL if not enough memory could be
- * allocated for it.
- *
- * Since: 2.6
- */
-GdkPixbuf *
-gdk_pixbuf_rotate_simple (const GdkPixbuf *src,
- GdkPixbufRotation angle)
-{
- GdkPixbuf *dest;
- guchar *p, *q;
- gint x, y;
-
- switch (angle % 360)
- {
- case 0:
- dest = gdk_pixbuf_copy (src);
- break;
- case 90:
- dest = gdk_pixbuf_new (src->colorspace,
- src->has_alpha,
- src->bits_per_sample,
- src->height,
- src->width);
- if (!dest)
- return NULL;
-
- for (y = 0; y < src->height; y++)
- {
- for (x = 0; x < src->width; x++)
- {
- p = src->pixels + OFFSET (src, x, y);
- q = dest->pixels + OFFSET (dest, y, src->width - x - 1);
- memcpy (q, p, dest->n_channels);
- }
- }
- break;
- case 180:
- dest = gdk_pixbuf_new (src->colorspace,
- src->has_alpha,
- src->bits_per_sample,
- src->width,
- src->height);
- if (!dest)
- return NULL;
-
- for (y = 0; y < src->height; y++)
- {
- for (x = 0; x < src->width; x++)
- {
- p = src->pixels + OFFSET (src, x, y);
- q = dest->pixels + OFFSET (dest, src->width - x - 1, src->height - y - 1);
- memcpy (q, p, dest->n_channels);
- }
- }
- break;
- case 270:
- dest = gdk_pixbuf_new (src->colorspace,
- src->has_alpha,
- src->bits_per_sample,
- src->height,
- src->width);
- if (!dest)
- return NULL;
-
- for (y = 0; y < src->height; y++)
- {
- for (x = 0; x < src->width; x++)
- {
- p = src->pixels + OFFSET (src, x, y);
- q = dest->pixels + OFFSET (dest, src->height - y - 1, x);
- memcpy (q, p, dest->n_channels);
- }
- }
- break;
- default:
- dest = NULL;
- g_warning ("gdk_pixbuf_rotate_simple() can only rotate "
- "by multiples of 90 degrees");
- g_assert_not_reached ();
- }
-
- return dest;
-}
-
-/**
- * gdk_pixbuf_flip:
- * @src: a #GdkPixbuf
- * @horizontal: %TRUE to flip horizontally, %FALSE to flip vertically
- *
- * Flips a pixbuf horizontally or vertically and returns the
- * result in a new pixbuf.
- *
- * Returns: the new #GdkPixbuf, or %NULL if not enough memory could be
- * allocated for it.
- *
- * Since: 2.6
- */
-GdkPixbuf *
-gdk_pixbuf_flip (const GdkPixbuf *src,
- gboolean horizontal)
-{
- GdkPixbuf *dest;
- guchar *p, *q;
- gint x, y;
-
- dest = gdk_pixbuf_new (src->colorspace,
- src->has_alpha,
- src->bits_per_sample,
- src->width,
- src->height);
- if (!dest)
- return NULL;
-
- if (!horizontal) /* flip vertical */
- {
- for (y = 0; y < dest->height; y++)
- {
- p = src->pixels + OFFSET (src, 0, y);
- q = dest->pixels + OFFSET (dest, 0, dest->height - y - 1);
- memcpy (q, p, dest->rowstride);
- }
- }
- else /* flip horizontal */
- {
- for (y = 0; y < dest->height; y++)
- {
- for (x = 0; x < dest->width; x++)
- {
- p = src->pixels + OFFSET (src, x, y);
- q = dest->pixels + OFFSET (dest, dest->width - x - 1, y);
- memcpy (q, p, dest->n_channels);
- }
- }
- }
-
- return dest;
-}
-
-#define __GDK_PIXBUF_SCALE_C__
-#include "gdk-pixbuf-aliasdef.c"
diff --git a/gdk-pixbuf/gdk-pixbuf-scaled-anim.c b/gdk-pixbuf/gdk-pixbuf-scaled-anim.c
deleted file mode 100644
index 06d1cc087d..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-scaled-anim.c
+++ /dev/null
@@ -1,286 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/* GdkPixbuf library - Simple transformations of animations
- *
- * Copyright (C) Red Hat, Inc
- *
- * Authors: Matthias Clasen <mclasen@redhat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 <glib.h>
-
-#include "gdk-pixbuf.h"
-#include "gdk-pixbuf-io.h"
-#include "gdk-pixbuf-scaled-anim.h"
-#include "gdk-pixbuf-alias.h"
-
-
-struct _GdkPixbufScaledAnimClass
-{
- GdkPixbufAnimationClass parent_class;
-};
-
-struct _GdkPixbufScaledAnim
-{
- GdkPixbufAnimation parent_instance;
-
- GdkPixbufAnimation *anim;
- gdouble xscale;
- gdouble yscale;
- gdouble tscale;
-
- GdkPixbuf *current;
-};
-
-struct _GdkPixbufScaledAnimIterClass
-{
- GdkPixbufAnimationClass parent_class;
-};
-
-struct _GdkPixbufScaledAnimIter
-{
- GdkPixbufAnimationIter parent_instance;
-
- GdkPixbufScaledAnim *scaled;
- GdkPixbufAnimationIter *iter;
-};
-
-typedef struct _GdkPixbufScaledAnimIter GdkPixbufScaledAnimIter;
-typedef struct _GdkPixbufScaledAnimIterClass GdkPixbufScaledAnimIterClass;
-
-GdkPixbufScaledAnim *
-_gdk_pixbuf_scaled_anim_new (GdkPixbufAnimation *anim,
- gdouble xscale,
- gdouble yscale,
- gdouble tscale)
-{
- GdkPixbufScaledAnim *scaled;
-
- scaled = g_object_new (GDK_TYPE_PIXBUF_SCALED_ANIM, NULL);
-
- scaled->anim = g_object_ref (anim);
- scaled->xscale = xscale;
- scaled->yscale = yscale;
- scaled->tscale = tscale;
-
- return scaled;
-}
-
-G_DEFINE_TYPE (GdkPixbufScaledAnim, gdk_pixbuf_scaled_anim, GDK_TYPE_PIXBUF_ANIMATION);
-
-static void
-gdk_pixbuf_scaled_anim_init (GdkPixbufScaledAnim *scaled)
-{
- scaled->xscale = 1.0;
- scaled->yscale = 1.0;
- scaled->tscale = 1.0;
-}
-
-static void
-gdk_pixbuf_scaled_anim_finalize (GObject *object)
-{
- GdkPixbufScaledAnim *scaled = (GdkPixbufScaledAnim *)object;
-
- if (scaled->anim) {
- g_object_unref (scaled->anim);
- scaled->anim = NULL;
- }
-
- if (scaled->current) {
- g_object_unref (scaled->current);
- scaled->current = NULL;
- }
-
- G_OBJECT_CLASS (gdk_pixbuf_scaled_anim_parent_class)->finalize (object);
-}
-
-static gboolean
-is_static_image (GdkPixbufAnimation *anim)
-{
- GdkPixbufScaledAnim *scaled = (GdkPixbufScaledAnim *)anim;
-
- return gdk_pixbuf_animation_is_static_image (scaled->anim);
-}
-
-static GdkPixbuf *
-get_scaled_pixbuf (GdkPixbufScaledAnim *scaled,
- GdkPixbuf *pixbuf)
-{
- GQuark quark;
- gchar **options;
-
- if (scaled->current)
- g_object_unref (scaled->current);
-
- /* Preserve the options associated with the original pixbuf
- (if present), mostly so that client programs can use the
- "orientation" option (if present) to rotate the image
- appropriately. gdk_pixbuf_scale_simple (and most other
- gdk transform operations) does not preserve the attached
- options when returning a new pixbuf. */
-
- quark = g_quark_from_static_string ("gdk_pixbuf_options");
- options = g_object_get_qdata (G_OBJECT (pixbuf), quark);
-
- /* Get a new scaled pixbuf */
- scaled->current = gdk_pixbuf_scale_simple (pixbuf,
- (int) (gdk_pixbuf_get_width (pixbuf) * scaled->xscale + .5),
- (int) (gdk_pixbuf_get_height (pixbuf) * scaled->yscale + .5),
- GDK_INTERP_BILINEAR);
-
- /* Copy the original pixbuf options to the scaled pixbuf */
- if (options && scaled->current)
- g_object_set_qdata_full (G_OBJECT (scaled->current), quark,
- g_strdupv (options), (GDestroyNotify) g_strfreev);
-
- return scaled->current;
-}
-
-static GdkPixbuf *
-get_static_image (GdkPixbufAnimation *anim)
-{
- GdkPixbufScaledAnim *scaled = (GdkPixbufScaledAnim *)anim;
- GdkPixbuf *pixbuf;
-
- pixbuf = gdk_pixbuf_animation_get_static_image (scaled->anim);
- return get_scaled_pixbuf (scaled, pixbuf);
-}
-
-static void
-get_size (GdkPixbufAnimation *anim,
- int *width,
- int *height)
-{
- GdkPixbufScaledAnim *scaled = (GdkPixbufScaledAnim *)anim;
-
- GDK_PIXBUF_ANIMATION_GET_CLASS (scaled->anim)->get_size (scaled->anim, width, height);
- if (width)
- *width = (int)(*width * scaled->xscale + .5);
- if (height)
- *height = (int)(*height * scaled->yscale + .5);
-}
-
-static GdkPixbufAnimationIter *
-get_iter (GdkPixbufAnimation *anim,
- const GTimeVal *start_time)
-{
- GdkPixbufScaledAnim *scaled = (GdkPixbufScaledAnim *)anim;
- GdkPixbufScaledAnimIter *iter;
-
- iter = g_object_new (GDK_TYPE_PIXBUF_SCALED_ANIM_ITER, NULL);
-
- iter->scaled = g_object_ref (scaled);
- iter->iter = gdk_pixbuf_animation_get_iter (scaled->anim, start_time);
-
- return (GdkPixbufAnimationIter*)iter;
-}
-
-static void
-gdk_pixbuf_scaled_anim_class_init (GdkPixbufScaledAnimClass *klass)
-{
- GObjectClass *object_class;
- GdkPixbufAnimationClass *anim_class;
-
- object_class = G_OBJECT_CLASS (klass);
- anim_class = GDK_PIXBUF_ANIMATION_CLASS (klass);
-
- object_class->finalize = gdk_pixbuf_scaled_anim_finalize;
-
- anim_class->is_static_image = is_static_image;
- anim_class->get_static_image = get_static_image;
- anim_class->get_size = get_size;
- anim_class->get_iter = get_iter;
-}
-
-
-G_DEFINE_TYPE (GdkPixbufScaledAnimIter, gdk_pixbuf_scaled_anim_iter, GDK_TYPE_PIXBUF_ANIMATION_ITER);
-
-static void
-gdk_pixbuf_scaled_anim_iter_init (GdkPixbufScaledAnimIter *iter)
-{
-}
-
-static int
-get_delay_time (GdkPixbufAnimationIter *iter)
-{
- GdkPixbufScaledAnimIter *scaled = (GdkPixbufScaledAnimIter *)iter;
- int delay;
-
- delay = gdk_pixbuf_animation_iter_get_delay_time (scaled->iter);
- delay = (int)(delay * scaled->scaled->tscale);
-
- return delay;
-}
-
-static GdkPixbuf *
-get_pixbuf (GdkPixbufAnimationIter *iter)
-{
- GdkPixbufScaledAnimIter *scaled = (GdkPixbufScaledAnimIter *)iter;
- GdkPixbuf *pixbuf;
-
- pixbuf = gdk_pixbuf_animation_iter_get_pixbuf (scaled->iter);
- return get_scaled_pixbuf (scaled->scaled, pixbuf);
-}
-
-static gboolean
-on_currently_loading_frame (GdkPixbufAnimationIter *iter)
-{
- GdkPixbufScaledAnimIter *scaled = (GdkPixbufScaledAnimIter *)iter;
-
- return gdk_pixbuf_animation_iter_on_currently_loading_frame (scaled->iter);
-}
-
-static gboolean
-advance (GdkPixbufAnimationIter *iter,
- const GTimeVal *current_time)
-{
- GdkPixbufScaledAnimIter *scaled = (GdkPixbufScaledAnimIter *)iter;
-
- return gdk_pixbuf_animation_iter_advance (scaled->iter, current_time);
-}
-
-static void
-gdk_pixbuf_scaled_anim_iter_finalize (GObject *object)
-{
- GdkPixbufScaledAnimIter *iter = (GdkPixbufScaledAnimIter *)object;
-
- g_object_unref (iter->iter);
- g_object_unref (iter->scaled);
-
- G_OBJECT_CLASS (gdk_pixbuf_scaled_anim_iter_parent_class)->finalize (object);
-}
-
-static void
-gdk_pixbuf_scaled_anim_iter_class_init (GdkPixbufScaledAnimIterClass *klass)
-{
- GObjectClass *object_class;
- GdkPixbufAnimationIterClass *anim_iter_class;
-
- object_class = G_OBJECT_CLASS (klass);
- anim_iter_class = GDK_PIXBUF_ANIMATION_ITER_CLASS (klass);
-
- object_class->finalize = gdk_pixbuf_scaled_anim_iter_finalize;
-
- anim_iter_class->get_delay_time = get_delay_time;
- anim_iter_class->get_pixbuf = get_pixbuf;
- anim_iter_class->on_currently_loading_frame = on_currently_loading_frame;
- anim_iter_class->advance = advance;
-}
-
-#define __GDK_PIXBUF_SCALED_ANIM_C__
-#include "gdk-pixbuf-aliasdef.c"
diff --git a/gdk-pixbuf/gdk-pixbuf-scaled-anim.h b/gdk-pixbuf/gdk-pixbuf-scaled-anim.h
deleted file mode 100644
index 58c38c5cba..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-scaled-anim.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/* GdkPixbuf library - Simple transformations of animations
- *
- * Copyright (C) 2007 Red Hat, Inc
- *
- * Authors: Matthias Clasen <mclasen@redhat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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_SCALED_ANIM_H
-#define GDK_PIXBUF_SCALED_ANIM_H
-
-#include <gdk-pixbuf/gdk-pixbuf-animation.h>
-
-G_BEGIN_DECLS
-
-#define GDK_TYPE_PIXBUF_SCALED_ANIM (gdk_pixbuf_scaled_anim_get_type ())
-#define GDK_TYPE_PIXBUF_SCALED_ANIM_ITER (gdk_pixbuf_scaled_anim_iter_get_type ())
-
-typedef struct _GdkPixbufScaledAnim GdkPixbufScaledAnim;
-typedef struct _GdkPixbufScaledAnimClass GdkPixbufScaledAnimClass;
-
-GType gdk_pixbuf_scaled_anim_get_type (void) G_GNUC_CONST;
-GType gdk_pixbuf_scaled_anim_iter_get_type (void) G_GNUC_CONST;
-
-GdkPixbufScaledAnim *_gdk_pixbuf_scaled_anim_new (GdkPixbufAnimation *anim,
- gdouble xscale,
- gdouble yscale,
- gdouble tscale);
-
-G_END_DECLS
-
-#endif /* GDK_PIXBUF_SCALED_ANIM_H */
diff --git a/gdk-pixbuf/gdk-pixbuf-simple-anim.c b/gdk-pixbuf/gdk-pixbuf-simple-anim.c
deleted file mode 100644
index 24d7ba48dd..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-simple-anim.c
+++ /dev/null
@@ -1,553 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/* GdkPixbuf library - Simple frame-based animations
- *
- * Copyright (C) Dom Lachowicz
- *
- * Authors: Dom Lachowicz <cinamod@hotmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.
- *
- * Based on code originally by:
- * Jonathan Blandford <jrb@redhat.com>
- * Havoc Pennington <hp@redhat.com>
- */
-
-#include "config.h"
-#include <glib.h>
-
-#define GDK_PIXBUF_C_COMPILATION
-#include "gdk-pixbuf.h"
-#include "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-io.h"
-#include "gdk-pixbuf-simple-anim.h"
-#include "gdk-pixbuf-alias.h"
-
-struct _GdkPixbufSimpleAnimClass
-{
- GdkPixbufAnimationClass parent_class;
-};
-
-/* Private part of the GdkPixbufSimpleAnim structure */
-struct _GdkPixbufSimpleAnim
-{
- GdkPixbufAnimation parent_instance;
-
- gint n_frames;
-
- gfloat rate;
- gint total_time;
-
- GList *frames;
-
- gint width;
- gint height;
-
- gboolean loop;
-};
-
-
-typedef struct _GdkPixbufSimpleAnimIter GdkPixbufSimpleAnimIter;
-typedef struct _GdkPixbufSimpleAnimIterClass GdkPixbufSimpleAnimIterClass;
-
-#define GDK_TYPE_PIXBUF_SIMPLE_ANIM_ITER (gdk_pixbuf_simple_anim_iter_get_type ())
-#define GDK_PIXBUF_SIMPLE_ANIM_ITER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_SIMPLE_ANIM_ITER, GdkPixbufSimpleAnimIter))
-#define GDK_IS_PIXBUF_SIMPLE_ANIM_ITER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_SIMPLE_ANIM_ITER))
-
-#define GDK_PIXBUF_SIMPLE_ANIM_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_SIMPLE_ANIM_ITER, GdkPixbufSimpleAnimIterClass))
-#define GDK_IS_PIXBUF_SIMPLE_ANIM_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_SIMPLE_ANIM_ITER))
-#define GDK_PIXBUF_SIMPLE_ANIM_ITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_SIMPLE_ANIM_ITER, GdkPixbufSimpleAnimIterClass))
-
-GType gdk_pixbuf_simple_anim_iter_get_type (void) G_GNUC_CONST;
-
-
-struct _GdkPixbufSimpleAnimIterClass
-{
- GdkPixbufAnimationIterClass parent_class;
-};
-
-struct _GdkPixbufSimpleAnimIter
-{
- GdkPixbufAnimationIter parent_instance;
-
- GdkPixbufSimpleAnim *simple_anim;
-
- GTimeVal start_time;
- GTimeVal current_time;
-
- gint position;
-
- GList *current_frame;
-};
-
-typedef struct _GdkPixbufFrame GdkPixbufFrame;
-struct _GdkPixbufFrame
-{
- GdkPixbuf *pixbuf;
- gint delay_time;
- gint elapsed;
-};
-
-static void gdk_pixbuf_simple_anim_finalize (GObject *object);
-
-static gboolean is_static_image (GdkPixbufAnimation *animation);
-static GdkPixbuf *get_static_image (GdkPixbufAnimation *animation);
-
-static void get_size (GdkPixbufAnimation *anim,
- gint *width,
- gint *height);
-static GdkPixbufAnimationIter *get_iter (GdkPixbufAnimation *anim,
- const GTimeVal *start_time);
-
-
-static void gdk_pixbuf_simple_anim_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gdk_pixbuf_simple_anim_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-
-enum
-{
- PROP_0,
- PROP_LOOP
-};
-
-G_DEFINE_TYPE (GdkPixbufSimpleAnim, gdk_pixbuf_simple_anim, GDK_TYPE_PIXBUF_ANIMATION)
-
-static void
-gdk_pixbuf_simple_anim_init (GdkPixbufSimpleAnim *anim)
-{
-}
-
-static void
-gdk_pixbuf_simple_anim_class_init (GdkPixbufSimpleAnimClass *klass)
-{
- GObjectClass *object_class;
- GdkPixbufAnimationClass *anim_class;
-
- object_class = G_OBJECT_CLASS (klass);
- anim_class = GDK_PIXBUF_ANIMATION_CLASS (klass);
-
- object_class->set_property = gdk_pixbuf_simple_anim_set_property;
- object_class->get_property = gdk_pixbuf_simple_anim_get_property;
- object_class->finalize = gdk_pixbuf_simple_anim_finalize;
-
- anim_class->is_static_image = is_static_image;
- anim_class->get_static_image = get_static_image;
- anim_class->get_size = get_size;
- anim_class->get_iter = get_iter;
-
- /**
- * GdkPixbufSimpleAnim:loop:
- *
- * Whether the animation should loop when it reaches the end.
- *
- * Since: 2.18
- */
- g_object_class_install_property (object_class,
- PROP_LOOP,
- g_param_spec_boolean ("loop",
- P_("Loop"),
- P_("Whether the animation should loop when it reaches the end"),
- FALSE,
- G_PARAM_READWRITE));
-}
-
-static void
-gdk_pixbuf_simple_anim_finalize (GObject *object)
-{
- GdkPixbufSimpleAnim *anim;
- GList *l;
- GdkPixbufFrame *frame;
-
- anim = GDK_PIXBUF_SIMPLE_ANIM (object);
-
- for (l = anim->frames; l; l = l->next) {
- frame = l->data;
- g_object_unref (frame->pixbuf);
- g_free (frame);
- }
-
- g_list_free (anim->frames);
-
- G_OBJECT_CLASS (gdk_pixbuf_simple_anim_parent_class)->finalize (object);
-}
-
-static gboolean
-is_static_image (GdkPixbufAnimation *animation)
-{
- GdkPixbufSimpleAnim *anim;
-
- anim = GDK_PIXBUF_SIMPLE_ANIM (animation);
-
- return (anim->frames != NULL && anim->frames->next == NULL);
-}
-
-static GdkPixbuf *
-get_static_image (GdkPixbufAnimation *animation)
-{
- GdkPixbufSimpleAnim *anim;
-
- anim = GDK_PIXBUF_SIMPLE_ANIM (animation);
-
- if (anim->frames == NULL)
- return NULL;
- else
- return ((GdkPixbufFrame *)anim->frames->data)->pixbuf;
-}
-
-static void
-get_size (GdkPixbufAnimation *animation,
- gint *width,
- gint *height)
-{
- GdkPixbufSimpleAnim *anim;
-
- anim = GDK_PIXBUF_SIMPLE_ANIM (animation);
-
- if (width)
- *width = anim->width;
-
- if (height)
- *height = anim->height;
-}
-
-static void
-iter_clear (GdkPixbufSimpleAnimIter *iter)
-{
- iter->current_frame = NULL;
-}
-
-static void
-iter_restart (GdkPixbufSimpleAnimIter *iter)
-{
- iter_clear (iter);
-
- iter->current_frame = iter->simple_anim->frames;
-}
-
-static GdkPixbufAnimationIter *
-get_iter (GdkPixbufAnimation *anim,
- const GTimeVal *start_time)
-{
- GdkPixbufSimpleAnimIter *iter;
-
- iter = g_object_new (GDK_TYPE_PIXBUF_SIMPLE_ANIM_ITER, NULL);
-
- iter->simple_anim = GDK_PIXBUF_SIMPLE_ANIM (anim);
-
- g_object_ref (iter->simple_anim);
-
- iter_restart (iter);
-
- iter->start_time = *start_time;
- iter->current_time = *start_time;
-
- return GDK_PIXBUF_ANIMATION_ITER (iter);
-}
-
-static void gdk_pixbuf_simple_anim_iter_finalize (GObject *object);
-
-static gint get_delay_time (GdkPixbufAnimationIter *iter);
-static GdkPixbuf *get_pixbuf (GdkPixbufAnimationIter *iter);
-static gboolean on_currently_loading_frame (GdkPixbufAnimationIter *iter);
-static gboolean advance (GdkPixbufAnimationIter *iter,
- const GTimeVal *current_time);
-
-G_DEFINE_TYPE (GdkPixbufSimpleAnimIter, gdk_pixbuf_simple_anim_iter, GDK_TYPE_PIXBUF_ANIMATION_ITER)
-
-static void
-gdk_pixbuf_simple_anim_iter_init (GdkPixbufSimpleAnimIter *iter)
-{
-}
-
-static void
-gdk_pixbuf_simple_anim_iter_class_init (GdkPixbufSimpleAnimIterClass *klass)
-{
- GObjectClass *object_class;
- GdkPixbufAnimationIterClass *anim_iter_class;
-
- object_class = G_OBJECT_CLASS (klass);
- anim_iter_class = GDK_PIXBUF_ANIMATION_ITER_CLASS (klass);
-
- object_class->finalize = gdk_pixbuf_simple_anim_iter_finalize;
-
- anim_iter_class->get_delay_time = get_delay_time;
- anim_iter_class->get_pixbuf = get_pixbuf;
- anim_iter_class->on_currently_loading_frame = on_currently_loading_frame;
- anim_iter_class->advance = advance;
-}
-
-static void
-gdk_pixbuf_simple_anim_iter_finalize (GObject *object)
-{
- GdkPixbufSimpleAnimIter *iter;
-
- iter = GDK_PIXBUF_SIMPLE_ANIM_ITER (object);
- iter_clear (iter);
-
- g_object_unref (iter->simple_anim);
-
- G_OBJECT_CLASS (gdk_pixbuf_simple_anim_iter_parent_class)->finalize (object);
-}
-
-static gboolean
-advance (GdkPixbufAnimationIter *anim_iter,
- const GTimeVal *current_time)
-{
- GdkPixbufSimpleAnimIter *iter;
- gint elapsed;
- gint loop_count;
- GList *tmp;
- GList *old;
-
- iter = GDK_PIXBUF_SIMPLE_ANIM_ITER (anim_iter);
-
- iter->current_time = *current_time;
-
- /* We use milliseconds for all times */
- elapsed = (((iter->current_time.tv_sec - iter->start_time.tv_sec) * G_USEC_PER_SEC +
- iter->current_time.tv_usec - iter->start_time.tv_usec)) / 1000;
-
- if (elapsed < 0) {
- /* Try to compensate; probably the system clock
- * was set backwards
- */
- iter->start_time = iter->current_time;
- elapsed = 0;
- }
-
- g_assert (iter->simple_anim->total_time > 0);
-
- /* See how many times we've already played the full animation,
- * and subtract time for that.
- */
- loop_count = elapsed / iter->simple_anim->total_time;
- elapsed = elapsed % iter->simple_anim->total_time;
-
- iter->position = elapsed;
-
- /* Now move to the proper frame */
- if (loop_count < 1 || iter->simple_anim->loop)
- tmp = iter->simple_anim->frames;
- else
- tmp = NULL;
-
- while (tmp != NULL) {
- GdkPixbufFrame *frame = tmp->data;
-
- if (iter->position >= frame->elapsed &&
- iter->position < (frame->elapsed + frame->delay_time))
- break;
-
- tmp = tmp->next;
- }
-
- old = iter->current_frame;
-
- iter->current_frame = tmp;
-
- return iter->current_frame != old;
-}
-
-static gint
-get_delay_time (GdkPixbufAnimationIter *anim_iter)
-{
- GdkPixbufFrame *frame;
- GdkPixbufSimpleAnimIter *iter;
-
- iter = GDK_PIXBUF_SIMPLE_ANIM_ITER (anim_iter);
-
- if (iter->current_frame) {
- frame = iter->current_frame->data;
- return frame->delay_time - (iter->position - frame->elapsed);
- }
- else {
- return -1; /* show last frame forever */
- }
-}
-
-static GdkPixbuf *
-get_pixbuf (GdkPixbufAnimationIter *anim_iter)
-{
- GdkPixbufSimpleAnimIter *iter;
- GdkPixbufFrame *frame;
-
- iter = GDK_PIXBUF_SIMPLE_ANIM_ITER (anim_iter);
-
- if (iter->current_frame)
- frame = iter->current_frame->data;
- else if (g_list_length (iter->simple_anim->frames) > 0)
- frame = g_list_last (iter->simple_anim->frames)->data;
- else
- frame = NULL;
-
- if (frame == NULL)
- return NULL;
-
- return frame->pixbuf;
-}
-
-static gboolean
-on_currently_loading_frame (GdkPixbufAnimationIter *anim_iter)
-{
- GdkPixbufSimpleAnimIter *iter;
-
- iter = GDK_PIXBUF_SIMPLE_ANIM_ITER (anim_iter);
-
- return iter->current_frame == NULL || iter->current_frame->next == NULL;
-}
-
-/**
- * gdk_pixbuf_simple_anim_new:
- * @width: the width of the animation
- * @height: the height of the animation
- * @rate: the speed of the animation, in frames per second
- *
- * Creates a new, empty animation.
- *
- * Returns: a newly allocated #GdkPixbufSimpleAnim
- *
- * Since: 2.8
- */
-GdkPixbufSimpleAnim *
-gdk_pixbuf_simple_anim_new (gint width,
- gint height,
- gfloat rate)
-{
- GdkPixbufSimpleAnim *anim;
-
- anim = g_object_new (GDK_TYPE_PIXBUF_SIMPLE_ANIM, NULL);
- anim->width = width;
- anim->height = height;
- anim->rate = rate;
-
- return anim;
-}
-
-/**
- * gdk_pixbuf_simple_anim_add_frame:
- * @animation: a #GdkPixbufSimpleAnim
- * @pixbuf: the pixbuf to add
- *
- * Adds a new frame to @animation. The @pixbuf must
- * have the dimensions specified when the animation
- * was constructed.
- *
- * Since: 2.8
- */
-void
-gdk_pixbuf_simple_anim_add_frame (GdkPixbufSimpleAnim *animation,
- GdkPixbuf *pixbuf)
-{
- GdkPixbufFrame *frame;
- int nframe = 0;
-
- g_return_if_fail (GDK_IS_PIXBUF_SIMPLE_ANIM (animation));
- g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
-
- nframe = g_list_length (animation->frames);
-
- frame = g_new0 (GdkPixbufFrame, 1);
- frame->delay_time = (gint) (1000 / animation->rate);
- frame->elapsed = (gint) (frame->delay_time * nframe);
- animation->total_time += frame->delay_time;
- frame->pixbuf = g_object_ref (pixbuf);
-
- animation->frames = g_list_append (animation->frames, frame);
-}
-
-static void
-gdk_pixbuf_simple_anim_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GdkPixbufSimpleAnim *animation = GDK_PIXBUF_SIMPLE_ANIM (object);
-
- switch (prop_id) {
- case PROP_LOOP:
- g_value_set_boolean (value,
- gdk_pixbuf_simple_anim_get_loop (animation));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gdk_pixbuf_simple_anim_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GdkPixbufSimpleAnim *animation = GDK_PIXBUF_SIMPLE_ANIM (object);
-
- switch (prop_id) {
- case PROP_LOOP:
- gdk_pixbuf_simple_anim_set_loop (animation,
- g_value_get_boolean (value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-/**
- * gdk_pixbuf_simple_anim_set_loop:
- * @animation: a #GdkPixbufSimpleAnim
- * @loop: whether to loop the animation
- *
- * Sets whether @animation should loop indefinitely when it reaches the end.
- *
- * Since: 2.18
- **/
-void
-gdk_pixbuf_simple_anim_set_loop (GdkPixbufSimpleAnim *animation,
- gboolean loop)
-{
- g_return_if_fail (GDK_IS_PIXBUF_SIMPLE_ANIM (animation));
-
- if (loop != animation->loop) {
- animation->loop = loop;
- g_object_notify (G_OBJECT (animation), "loop");
- }
-}
-
-/**
- * gdk_pixbuf_simple_anim_get_loop:
- * @animation: a #GdkPixbufSimpleAnim
- *
- * Gets whether @animation should loop indefinitely when it reaches the end.
- *
- * Returns: %TRUE if the animation loops forever, %FALSE otherwise
- *
- * Since: 2.18
- **/
-gboolean
-gdk_pixbuf_simple_anim_get_loop (GdkPixbufSimpleAnim *animation)
-{
- g_return_val_if_fail (GDK_IS_PIXBUF_SIMPLE_ANIM (animation), FALSE);
-
- return animation->loop;
-}
-
-#define __GDK_PIXBUF_SIMPLE_ANIM_C__
-#include "gdk-pixbuf-aliasdef.c"
diff --git a/gdk-pixbuf/gdk-pixbuf-simple-anim.h b/gdk-pixbuf/gdk-pixbuf-simple-anim.h
deleted file mode 100644
index fe364bec5e..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-simple-anim.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/* GdkPixbuf library - Simple frame-based animations
- *
- * Copyright (C) 2004 Dom Lachowicz
- *
- * Authors: Dom Lachowicz <cinamod@hotmail.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.
- */
-
-#if !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION)
-#error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
-#endif
-
-#ifndef GDK_PIXBUF_SIMPLE_ANIM_H
-#define GDK_PIXBUF_SIMPLE_ANIM_H
-
-#include <gdk-pixbuf/gdk-pixbuf-animation.h>
-
-G_BEGIN_DECLS
-
-typedef struct _GdkPixbufSimpleAnim GdkPixbufSimpleAnim;
-typedef struct _GdkPixbufSimpleAnimClass GdkPixbufSimpleAnimClass;
-
-#define GDK_TYPE_PIXBUF_SIMPLE_ANIM (gdk_pixbuf_simple_anim_get_type ())
-#define GDK_PIXBUF_SIMPLE_ANIM(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_SIMPLE_ANIM, GdkPixbufSimpleAnim))
-#define GDK_IS_PIXBUF_SIMPLE_ANIM(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_SIMPLE_ANIM))
-
-#define GDK_PIXBUF_SIMPLE_ANIM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_SIMPLE_ANIM, GdkPixbufSimpleAnimClass))
-#define GDK_IS_PIXBUF_SIMPLE_ANIM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_SIMPLE_ANIM))
-#define GDK_PIXBUF_SIMPLE_ANIM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_SIMPLE_ANIM, GdkPixbufSimpleAnimClass))
-
-GType gdk_pixbuf_simple_anim_get_type (void) G_GNUC_CONST;
-GType gdk_pixbuf_simple_anim_iter_get_type (void) G_GNUC_CONST;
-
-GdkPixbufSimpleAnim *gdk_pixbuf_simple_anim_new (gint width,
- gint height,
- gfloat rate);
-void gdk_pixbuf_simple_anim_add_frame (GdkPixbufSimpleAnim *animation,
- GdkPixbuf *pixbuf);
-void gdk_pixbuf_simple_anim_set_loop (GdkPixbufSimpleAnim *animation,
- gboolean loop);
-gboolean gdk_pixbuf_simple_anim_get_loop (GdkPixbufSimpleAnim *animation);
-
-G_END_DECLS
-
-
-#endif /* GDK_PIXBUF_SIMPLE_ANIM_H */
diff --git a/gdk-pixbuf/gdk-pixbuf-transform.h b/gdk-pixbuf/gdk-pixbuf-transform.h
deleted file mode 100644
index 57ced64d08..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-transform.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/* GdkPixbuf library - transformations
- *
- * Copyright (C) 2003 The Free Software Foundation
- *
- * Authors: Mark Crichton <crichton@gimp.org>
- * Miguel de Icaza <miguel@gnu.org>
- * Federico Mena-Quintero <federico@gimp.org>
- * Havoc Pennington <hp@redhat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.
- */
-
-#if !defined (GDK_PIXBUF_H_INSIDE) && !defined (GDK_PIXBUF_COMPILATION)
-#error "Only <gdk-pixbuf/gdk-pixbuf.h> can be included directly."
-#endif
-
-#ifndef GDK_PIXBUF_TRANSFORM_H
-#define GDK_PIXBUF_TRANSFORM_H
-
-#include <glib.h>
-#include <gdk-pixbuf/gdk-pixbuf-core.h>
-
-
-G_BEGIN_DECLS
-
-/* Scaling */
-
-/* Interpolation modes */
-typedef enum {
- GDK_INTERP_NEAREST,
- GDK_INTERP_TILES,
- GDK_INTERP_BILINEAR,
- GDK_INTERP_HYPER
-} GdkInterpType;
-
-typedef enum {
- GDK_PIXBUF_ROTATE_NONE = 0,
- GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE = 90,
- GDK_PIXBUF_ROTATE_UPSIDEDOWN = 180,
- GDK_PIXBUF_ROTATE_CLOCKWISE = 270
-} GdkPixbufRotation;
-
-void gdk_pixbuf_scale (const GdkPixbuf *src,
- GdkPixbuf *dest,
- int dest_x,
- int dest_y,
- int dest_width,
- int dest_height,
- double offset_x,
- double offset_y,
- double scale_x,
- double scale_y,
- GdkInterpType interp_type);
-void gdk_pixbuf_composite (const GdkPixbuf *src,
- GdkPixbuf *dest,
- int dest_x,
- int dest_y,
- int dest_width,
- int dest_height,
- double offset_x,
- double offset_y,
- double scale_x,
- double scale_y,
- GdkInterpType interp_type,
- int overall_alpha);
-void gdk_pixbuf_composite_color (const GdkPixbuf *src,
- GdkPixbuf *dest,
- int dest_x,
- int dest_y,
- int dest_width,
- int dest_height,
- double offset_x,
- double offset_y,
- double scale_x,
- double scale_y,
- GdkInterpType interp_type,
- int overall_alpha,
- int check_x,
- int check_y,
- int check_size,
- guint32 color1,
- guint32 color2);
-
-GdkPixbuf *gdk_pixbuf_scale_simple (const GdkPixbuf *src,
- int dest_width,
- int dest_height,
- GdkInterpType interp_type);
-
-GdkPixbuf *gdk_pixbuf_composite_color_simple (const GdkPixbuf *src,
- int dest_width,
- int dest_height,
- GdkInterpType interp_type,
- int overall_alpha,
- int check_size,
- guint32 color1,
- guint32 color2);
-
-GdkPixbuf *gdk_pixbuf_rotate_simple (const GdkPixbuf *src,
- GdkPixbufRotation angle);
-GdkPixbuf *gdk_pixbuf_flip (const GdkPixbuf *src,
- gboolean horizontal);
-
-G_END_DECLS
-
-
-#endif /* GDK_PIXBUF_TRANSFORM_H */
diff --git a/gdk-pixbuf/gdk-pixbuf-util.c b/gdk-pixbuf/gdk-pixbuf-util.c
deleted file mode 100644
index 58ee842cc7..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-util.c
+++ /dev/null
@@ -1,337 +0,0 @@
-/* GdkPixbuf library - Utilities and miscellaneous convenience functions
- *
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Authors: Federico Mena-Quintero <federico@gimp.org>
- * 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
- * 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-alias.h"
-#include <string.h>
-
-
-
-/**
- * gdk_pixbuf_add_alpha:
- * @pixbuf: A #GdkPixbuf.
- * @substitute_color: Whether to set a color to zero opacity. If this
- * is %FALSE, then the (@r, @g, @b) arguments will be ignored.
- * @r: Red value to substitute.
- * @g: Green value to substitute.
- * @b: Blue value to substitute.
- *
- * Takes an existing pixbuf and adds an alpha channel to it.
- * If the existing pixbuf already had an alpha channel, the channel
- * values are copied from the original; otherwise, the alpha channel
- * is initialized to 255 (full opacity).
- *
- * If @substitute_color is %TRUE, then the color specified by (@r, @g, @b) will be
- * assigned zero opacity. That is, if you pass (255, 255, 255) for the
- * substitute color, all white pixels will become fully transparent.
- *
- * Return value: A newly-created pixbuf with a reference count of 1.
- **/
-GdkPixbuf *
-gdk_pixbuf_add_alpha (const GdkPixbuf *pixbuf,
- gboolean substitute_color, guchar r, guchar g, guchar b)
-{
- GdkPixbuf *new_pixbuf;
- int x, y;
-
- g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
- g_return_val_if_fail (pixbuf->colorspace == GDK_COLORSPACE_RGB, NULL);
- g_return_val_if_fail (pixbuf->n_channels == 3 || pixbuf->n_channels == 4, NULL);
- g_return_val_if_fail (pixbuf->bits_per_sample == 8, NULL);
-
- if (pixbuf->has_alpha) {
- new_pixbuf = gdk_pixbuf_copy (pixbuf);
- if (!new_pixbuf)
- return NULL;
-
- if (!substitute_color)
- return new_pixbuf;
- } else {
- new_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, pixbuf->width, pixbuf->height);
- }
-
- if (!new_pixbuf)
- return NULL;
-
- for (y = 0; y < pixbuf->height; y++) {
- guchar *src, *dest;
- guchar tr, tg, tb;
-
- src = pixbuf->pixels + y * pixbuf->rowstride;
- dest = new_pixbuf->pixels + y * new_pixbuf->rowstride;
-
- if (pixbuf->has_alpha) {
- /* Just subst color, we already copied everything else */
- for (x = 0; x < pixbuf->width; x++) {
- if (src[0] == r && src[1] == g && src[2] == b)
- dest[3] = 0;
- src += 4;
- dest += 4;
- }
- } else {
- for (x = 0; x < pixbuf->width; x++) {
- tr = *dest++ = *src++;
- tg = *dest++ = *src++;
- tb = *dest++ = *src++;
-
- if (substitute_color && tr == r && tg == g && tb == b)
- *dest++ = 0;
- else
- *dest++ = 255;
- }
- }
- }
-
- return new_pixbuf;
-}
-
-/**
- * gdk_pixbuf_copy_area:
- * @src_pixbuf: Source pixbuf.
- * @src_x: Source X coordinate within @src_pixbuf.
- * @src_y: Source Y coordinate within @src_pixbuf.
- * @width: Width of the area to copy.
- * @height: Height of the area to copy.
- * @dest_pixbuf: Destination pixbuf.
- * @dest_x: X coordinate within @dest_pixbuf.
- * @dest_y: Y coordinate within @dest_pixbuf.
- *
- * Copies a rectangular area from @src_pixbuf to @dest_pixbuf. Conversion of
- * pixbuf formats is done automatically.
- *
- * If the source rectangle overlaps the destination rectangle on the
- * same pixbuf, it will be overwritten during the copy operation.
- * Therefore, you can not use this function to scroll a pixbuf.
- **/
-void
-gdk_pixbuf_copy_area (const GdkPixbuf *src_pixbuf,
- int src_x, int src_y,
- int width, int height,
- GdkPixbuf *dest_pixbuf,
- int dest_x, int dest_y)
-{
- g_return_if_fail (src_pixbuf != NULL);
- g_return_if_fail (dest_pixbuf != NULL);
-
- g_return_if_fail (src_x >= 0 && src_x + width <= src_pixbuf->width);
- g_return_if_fail (src_y >= 0 && src_y + height <= src_pixbuf->height);
-
- g_return_if_fail (dest_x >= 0 && dest_x + width <= dest_pixbuf->width);
- g_return_if_fail (dest_y >= 0 && dest_y + height <= dest_pixbuf->height);
-
- g_return_if_fail (!(gdk_pixbuf_get_has_alpha (src_pixbuf) && !gdk_pixbuf_get_has_alpha (dest_pixbuf)));
-
- /* This will perform format conversions automatically */
-
- gdk_pixbuf_scale (src_pixbuf,
- dest_pixbuf,
- dest_x, dest_y,
- width, height,
- (double) (dest_x - src_x),
- (double) (dest_y - src_y),
- 1.0, 1.0,
- GDK_INTERP_NEAREST);
-}
-
-
-
-/**
- * gdk_pixbuf_saturate_and_pixelate:
- * @src: source image
- * @dest: place to write modified version of @src
- * @saturation: saturation factor
- * @pixelate: whether to pixelate
- *
- * Modifies saturation and optionally pixelates @src, placing the result in
- * @dest. @src and @dest may be the same pixbuf with no ill effects. If
- * @saturation is 1.0 then saturation is not changed. If it's less than 1.0,
- * saturation is reduced (the image turns toward grayscale); if greater than
- * 1.0, saturation is increased (the image gets more vivid colors). If @pixelate
- * is %TRUE, then pixels are faded in a checkerboard pattern to create a
- * pixelated image. @src and @dest must have the same image format, size, and
- * rowstride.
- *
- **/
-void
-gdk_pixbuf_saturate_and_pixelate(const GdkPixbuf *src,
- GdkPixbuf *dest,
- gfloat saturation,
- gboolean pixelate)
-{
- /* NOTE that src and dest MAY be the same pixbuf! */
-
- g_return_if_fail (GDK_IS_PIXBUF (src));
- g_return_if_fail (GDK_IS_PIXBUF (dest));
- g_return_if_fail (gdk_pixbuf_get_height (src) == gdk_pixbuf_get_height (dest));
- g_return_if_fail (gdk_pixbuf_get_width (src) == gdk_pixbuf_get_width (dest));
- g_return_if_fail (gdk_pixbuf_get_has_alpha (src) == gdk_pixbuf_get_has_alpha (dest));
- g_return_if_fail (gdk_pixbuf_get_colorspace (src) == gdk_pixbuf_get_colorspace (dest));
-
- if (saturation == 1.0 && !pixelate) {
- if (dest != src)
- gdk_pixbuf_copy_area (src, 0, 0,
- gdk_pixbuf_get_width (src),
- gdk_pixbuf_get_height (src),
- dest, 0, 0);
- } else {
- int i, j, t;
- int width, height, has_alpha, src_rowstride, dest_rowstride, bytes_per_pixel;
- guchar *src_line;
- guchar *dest_line;
- guchar *src_pixel;
- guchar *dest_pixel;
- guchar intensity;
-
- has_alpha = gdk_pixbuf_get_has_alpha (src);
- bytes_per_pixel = has_alpha ? 4 : 3;
- width = gdk_pixbuf_get_width (src);
- height = gdk_pixbuf_get_height (src);
- src_rowstride = gdk_pixbuf_get_rowstride (src);
- dest_rowstride = gdk_pixbuf_get_rowstride (dest);
-
- src_line = gdk_pixbuf_get_pixels (src);
- dest_line = gdk_pixbuf_get_pixels (dest);
-
-#define DARK_FACTOR 0.7
-#define INTENSITY(r, g, b) ((r) * 0.30 + (g) * 0.59 + (b) * 0.11)
-#define CLAMP_UCHAR(v) (t = (v), CLAMP (t, 0, 255))
-#define SATURATE(v) ((1.0 - saturation) * intensity + saturation * (v))
-
- for (i = 0 ; i < height ; i++) {
- src_pixel = src_line;
- src_line += src_rowstride;
- dest_pixel = dest_line;
- dest_line += dest_rowstride;
-
- for (j = 0 ; j < width ; j++) {
- intensity = INTENSITY (src_pixel[0], src_pixel[1], src_pixel[2]);
- if (pixelate && (i + j) % 2 == 0) {
- dest_pixel[0] = intensity / 2 + 127;
- dest_pixel[1] = intensity / 2 + 127;
- dest_pixel[2] = intensity / 2 + 127;
- } else if (pixelate) {
- dest_pixel[0] = CLAMP_UCHAR ((SATURATE (src_pixel[0])) * DARK_FACTOR);
- dest_pixel[1] = CLAMP_UCHAR ((SATURATE (src_pixel[1])) * DARK_FACTOR);
- dest_pixel[2] = CLAMP_UCHAR ((SATURATE (src_pixel[2])) * DARK_FACTOR);
- } else {
- dest_pixel[0] = CLAMP_UCHAR (SATURATE (src_pixel[0]));
- dest_pixel[1] = CLAMP_UCHAR (SATURATE (src_pixel[1]));
- dest_pixel[2] = CLAMP_UCHAR (SATURATE (src_pixel[2]));
- }
-
- if (has_alpha)
- dest_pixel[3] = src_pixel[3];
-
- src_pixel += bytes_per_pixel;
- dest_pixel += bytes_per_pixel;
- }
- }
- }
-}
-
-
-/**
- * gdk_pixbuf_apply_embedded_orientation:
- * @src: A #GdkPixbuf.
- *
- * Takes an existing pixbuf and checks for the presence of an
- * associated "orientation" option, which may be provided by the
- * jpeg loader (which reads the exif orientation tag) or the
- * tiff loader (which reads the tiff orientation tag, and
- * compensates it for the partial transforms performed by
- * libtiff). If an orientation option/tag is present, the
- * appropriate transform will be performed so that the pixbuf
- * is oriented correctly.
- *
- * Return value: A newly-created pixbuf, or a reference to the
- * input pixbuf (with an increased reference count).
- *
- * Since: 2.12
- **/
-GdkPixbuf *
-gdk_pixbuf_apply_embedded_orientation (GdkPixbuf *src)
-{
- const gchar *orientation_string;
- int transform = 0;
- GdkPixbuf *temp;
- GdkPixbuf *dest;
-
- g_return_val_if_fail (GDK_IS_PIXBUF (src), NULL);
-
- /* Read the orientation option associated with the pixbuf */
- orientation_string = gdk_pixbuf_get_option (src, "orientation");
-
- if (orientation_string) {
- /* If an orientation option was found, convert the
- orientation string into an integer. */
- transform = (int) g_ascii_strtoll (orientation_string, NULL, 10);
- }
-
- /* Apply the actual transforms, which involve rotations and flips.
- The meaning of orientation values 1-8 and the required transforms
- are defined by the TIFF and EXIF (for JPEGs) standards. */
- switch (transform) {
- case 1:
- dest = src;
- g_object_ref (dest);
- break;
- case 2:
- dest = gdk_pixbuf_flip (src, TRUE);
- break;
- case 3:
- dest = gdk_pixbuf_rotate_simple (src, GDK_PIXBUF_ROTATE_UPSIDEDOWN);
- break;
- case 4:
- dest = gdk_pixbuf_flip (src, FALSE);
- break;
- case 5:
- temp = gdk_pixbuf_rotate_simple (src, GDK_PIXBUF_ROTATE_CLOCKWISE);
- dest = gdk_pixbuf_flip (temp, TRUE);
- g_object_unref (temp);
- break;
- case 6:
- dest = gdk_pixbuf_rotate_simple (src, GDK_PIXBUF_ROTATE_CLOCKWISE);
- break;
- case 7:
- temp = gdk_pixbuf_rotate_simple (src, GDK_PIXBUF_ROTATE_CLOCKWISE);
- dest = gdk_pixbuf_flip (temp, FALSE);
- g_object_unref (temp);
- break;
- case 8:
- dest = gdk_pixbuf_rotate_simple (src, GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE);
- break;
- default:
- /* if no orientation tag was present */
- dest = src;
- g_object_ref (dest);
- break;
- }
-
- return dest;
-}
-
-
-#define __GDK_PIXBUF_UTIL_C__
-#include "gdk-pixbuf-aliasdef.c"
-
diff --git a/gdk-pixbuf/gdk-pixbuf-xform.c b/gdk-pixbuf/gdk-pixbuf-xform.c
deleted file mode 100644
index 1ca70cd604..0000000000
--- a/gdk-pixbuf/gdk-pixbuf-xform.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/* FIXME FIXME FIXME
- *
- * This file is not being used. The gdk_pixbuf_scale() here is not useful
- * anymore, since we have the new functions in gdk-pixbuf-scale.c.
- *
- * The rotation function needs to be implemented without libart if it is
- * to go inside the GdkPixbuf library.
- */
-
-GdkPixbuf *
-gdk_pixbuf_scale (const GdkPixbuf *pixbuf, gint w, gint h)
-{
- guchar *pixels;
- gint rowstride;
- double affine[6];
- ArtAlphaGamma *alphagamma;
- ArtPixBuf *art_pixbuf = NULL;
- GdkPixbuf *copy = NULL;
-
- alphagamma = NULL;
-
- affine[1] = affine[2] = affine[4] = affine[5] = 0;
-
- affine[0] = w / (double)(pixbuf->width);
- affine[3] = h / (double)(pixbuf->height);
-
- /* rowstride = w * pixbuf->n_channels; */
- rowstride = w * 3;
-
- pixels = art_alloc (h * rowstride);
- art_rgb_pixbuf_affine (pixels, 0, 0, w, h, rowstride,
- pixbuf->art_pixbuf,
- affine, ART_FILTER_NEAREST, alphagamma);
-
- if (pixbuf->art_pixbuf->has_alpha)
- /* should be rgba */
- art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
- else
- art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
-
- copy = gdk_pixbuf_new (art_pixbuf, NULL);
-
- if (!copy)
- art_free (pixels);
-
- return copy;
-}
-
-GdkPixbuf *
-gdk_pixbuf_rotate (GdkPixbuf *pixbuf, gdouble angle)
-{
- art_u8 *pixels;
- gint rowstride, w, h;
- gdouble rad;
- double rot[6], trans[6], affine[6];
- ArtAlphaGamma *alphagamma = NULL;
- ArtPixBuf *art_pixbuf = NULL;
-
- w = pixbuf->art_pixbuf->width;
- h = pixbuf->art_pixbuf->height;
-
- rad = (M_PI * angle / 180.0);
-
- rot[0] = cos(rad);
- rot[1] = sin(rad);
- rot[2] = -sin(rad);
- rot[3] = cos(rad);
- rot[4] = rot[5] = 0;
-
- trans[0] = trans[3] = 1;
- trans[1] = trans[2] = 0;
- trans[4] = -(double)w / 2.0;
- trans[5] = -(double)h / 2.0;
-
- art_affine_multiply(rot, trans, rot);
-
- trans[0] = trans[3] = 1;
- trans[1] = trans[2] = 0;
- trans[4] = (double)w / 2.0;
- trans[5] = (double)h / 2.0;
-
- art_affine_multiply(affine, rot, trans);
-/*
- g_print("Affine: %e %e %e %e %e %e\n", affine[0], affine[1], affine[2],
- affine[3], affine[4], affine[5]);
-*/
- /* rowstride = w * pixbuf->art_pixbuf->n_channels; */
- rowstride = w * 3;
-
- pixels = art_alloc (h * rowstride);
- art_rgb_pixbuf_affine (pixels, 0, 0, w, h, rowstride,
- pixbuf->art_pixbuf,
- affine, ART_FILTER_NEAREST, alphagamma);
- if (pixbuf->art_pixbuf->has_alpha)
- /* should be rgba */
- art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
- else
- art_pixbuf = art_pixbuf_new_rgb(pixels, w, h, rowstride);
-
- art_pixbuf_free (pixbuf->art_pixbuf);
- pixbuf->art_pixbuf = art_pixbuf;
-
- return pixbuf;
-}
diff --git a/gdk-pixbuf/gdk-pixbuf.c b/gdk-pixbuf/gdk-pixbuf.c
deleted file mode 100644
index 71e0c61e9a..0000000000
--- a/gdk-pixbuf/gdk-pixbuf.c
+++ /dev/null
@@ -1,732 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/* GdkPixbuf library - Basic memory management
- *
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Authors: Mark Crichton <crichton@gimp.org>
- * Miguel de Icaza <miguel@gnu.org>
- * 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 Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 <math.h>
-#include <stdlib.h>
-#include <string.h>
-#define GDK_PIXBUF_C_COMPILATION
-#include "gdk-pixbuf.h"
-#include "gdk-pixbuf-private.h"
-/* Include the marshallers */
-#include <glib-object.h>
-#include "gdk-pixbuf-marshal.c"
-#include "gdk-pixbuf-alias.h"
-
-static void gdk_pixbuf_finalize (GObject *object);
-static void gdk_pixbuf_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gdk_pixbuf_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-
-
-enum
-{
- PROP_0,
- PROP_COLORSPACE,
- PROP_N_CHANNELS,
- PROP_HAS_ALPHA,
- PROP_BITS_PER_SAMPLE,
- PROP_WIDTH,
- PROP_HEIGHT,
- PROP_ROWSTRIDE,
- PROP_PIXELS
-};
-
-G_DEFINE_TYPE (GdkPixbuf, gdk_pixbuf, G_TYPE_OBJECT)
-
-static void
-gdk_pixbuf_init (GdkPixbuf *pixbuf)
-{
-}
-
-static void
-gdk_pixbuf_class_init (GdkPixbufClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = gdk_pixbuf_finalize;
- object_class->set_property = gdk_pixbuf_set_property;
- object_class->get_property = gdk_pixbuf_get_property;
-
-#define PIXBUF_PARAM_FLAGS G_PARAM_READWRITE|G_PARAM_CONSTRUCT_ONLY|\
- G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
- /**
- * GdkPixbuf:n-channels:
- *
- * The number of samples per pixel.
- * Currently, only 3 or 4 samples per pixel are supported.
- */
- g_object_class_install_property (object_class,
- PROP_N_CHANNELS,
- g_param_spec_int ("n-channels",
- P_("Number of Channels"),
- P_("The number of samples per pixel"),
- 0,
- G_MAXINT,
- 3,
- PIXBUF_PARAM_FLAGS));
-
- g_object_class_install_property (object_class,
- PROP_COLORSPACE,
- g_param_spec_enum ("colorspace",
- P_("Colorspace"),
- P_("The colorspace in which the samples are interpreted"),
- GDK_TYPE_COLORSPACE,
- GDK_COLORSPACE_RGB,
- PIXBUF_PARAM_FLAGS));
-
- g_object_class_install_property (object_class,
- PROP_HAS_ALPHA,
- g_param_spec_boolean ("has-alpha",
- P_("Has Alpha"),
- P_("Whether the pixbuf has an alpha channel"),
- FALSE,
- PIXBUF_PARAM_FLAGS));
-
- /**
- * GdkPixbuf:bits-per-sample:
- *
- * The number of bits per sample.
- * Currently only 8 bit per sample are supported.
- */
- g_object_class_install_property (object_class,
- PROP_BITS_PER_SAMPLE,
- g_param_spec_int ("bits-per-sample",
- P_("Bits per Sample"),
- P_("The number of bits per sample"),
- 1,
- 16,
- 8,
- PIXBUF_PARAM_FLAGS));
-
- g_object_class_install_property (object_class,
- PROP_WIDTH,
- g_param_spec_int ("width",
- P_("Width"),
- P_("The number of columns of the pixbuf"),
- 1,
- G_MAXINT,
- 1,
- PIXBUF_PARAM_FLAGS));
-
- g_object_class_install_property (object_class,
- PROP_HEIGHT,
- g_param_spec_int ("height",
- P_("Height"),
- P_("The number of rows of the pixbuf"),
- 1,
- G_MAXINT,
- 1,
- PIXBUF_PARAM_FLAGS));
-
- /**
- * GdkPixbuf:rowstride:
- *
- * The number of bytes between the start of a row and
- * the start of the next row. This number must (obviously)
- * be at least as large as the width of the pixbuf.
- */
- g_object_class_install_property (object_class,
- PROP_ROWSTRIDE,
- g_param_spec_int ("rowstride",
- P_("Rowstride"),
- P_("The number of bytes between the start of a row and the start of the next row"),
- 1,
- G_MAXINT,
- 1,
- PIXBUF_PARAM_FLAGS));
-
- g_object_class_install_property (object_class,
- PROP_PIXELS,
- g_param_spec_pointer ("pixels",
- P_("Pixels"),
- P_("A pointer to the pixel data of the pixbuf"),
- PIXBUF_PARAM_FLAGS));
-}
-
-static void
-gdk_pixbuf_finalize (GObject *object)
-{
- GdkPixbuf *pixbuf = GDK_PIXBUF (object);
-
- if (pixbuf->destroy_fn)
- (* pixbuf->destroy_fn) (pixbuf->pixels, pixbuf->destroy_fn_data);
-
- G_OBJECT_CLASS (gdk_pixbuf_parent_class)->finalize (object);
-}
-
-/* Used as the destroy notification function for gdk_pixbuf_new() */
-static void
-free_buffer (guchar *pixels, gpointer data)
-{
- g_free (pixels);
-}
-
-/**
- * gdk_pixbuf_new:
- * @colorspace: Color space for image
- * @has_alpha: Whether the image should have transparency information
- * @bits_per_sample: Number of bits per color sample
- * @width: Width of image in pixels, must be > 0
- * @height: Height of image in pixels, must be > 0
- *
- * Creates a new #GdkPixbuf structure and allocates a buffer for it. The
- * buffer has an optimal rowstride. Note that the buffer is not cleared;
- * you will have to fill it completely yourself.
- *
- * Return value: A newly-created #GdkPixbuf with a reference count of 1, or
- * %NULL if not enough memory could be allocated for the image buffer.
- **/
-GdkPixbuf *
-gdk_pixbuf_new (GdkColorspace colorspace,
- gboolean has_alpha,
- int bits_per_sample,
- int width,
- int height)
-{
- guchar *buf;
- int channels;
- int rowstride;
- gsize bytes;
-
- g_return_val_if_fail (colorspace == GDK_COLORSPACE_RGB, NULL);
- g_return_val_if_fail (bits_per_sample == 8, NULL);
- g_return_val_if_fail (width > 0, NULL);
- g_return_val_if_fail (height > 0, NULL);
-
- channels = has_alpha ? 4 : 3;
- rowstride = width * channels;
- if (rowstride / channels != width || rowstride + 3 < 0) /* overflow */
- return NULL;
-
- /* Always align rows to 32-bit boundaries */
- rowstride = (rowstride + 3) & ~3;
-
- bytes = height * rowstride;
- if (bytes / rowstride != height) /* overflow */
- return NULL;
-
- buf = g_try_malloc (bytes);
- if (!buf)
- return NULL;
-
- return gdk_pixbuf_new_from_data (buf, colorspace, has_alpha, bits_per_sample,
- width, height, rowstride,
- free_buffer, NULL);
-}
-
-/**
- * gdk_pixbuf_copy:
- * @pixbuf: A pixbuf.
- *
- * Creates a new #GdkPixbuf with a copy of the information in the specified
- * @pixbuf.
- *
- * Return value: A newly-created pixbuf with a reference count of 1, or %NULL if
- * not enough memory could be allocated.
- **/
-GdkPixbuf *
-gdk_pixbuf_copy (const GdkPixbuf *pixbuf)
-{
- guchar *buf;
- int size;
-
- g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
-
- /* Calculate a semi-exact size. Here we copy with full rowstrides;
- * maybe we should copy each row individually with the minimum
- * rowstride?
- */
-
- size = ((pixbuf->height - 1) * pixbuf->rowstride +
- pixbuf->width * ((pixbuf->n_channels * pixbuf->bits_per_sample + 7) / 8));
-
- buf = g_try_malloc (size * sizeof (guchar));
- if (!buf)
- return NULL;
-
- memcpy (buf, pixbuf->pixels, size);
-
- return gdk_pixbuf_new_from_data (buf,
- pixbuf->colorspace, pixbuf->has_alpha,
- pixbuf->bits_per_sample,
- pixbuf->width, pixbuf->height,
- pixbuf->rowstride,
- free_buffer,
- NULL);
-}
-
-/**
- * gdk_pixbuf_new_subpixbuf:
- * @src_pixbuf: a #GdkPixbuf
- * @src_x: X coord in @src_pixbuf
- * @src_y: Y coord in @src_pixbuf
- * @width: width of region in @src_pixbuf
- * @height: height of region in @src_pixbuf
- *
- * Creates a new pixbuf which represents a sub-region of
- * @src_pixbuf. The new pixbuf shares its pixels with the
- * original pixbuf, so writing to one affects both.
- * The new pixbuf holds a reference to @src_pixbuf, so
- * @src_pixbuf will not be finalized until the new pixbuf
- * is finalized.
- *
- * Return value: a new pixbuf
- **/
-GdkPixbuf*
-gdk_pixbuf_new_subpixbuf (GdkPixbuf *src_pixbuf,
- int src_x,
- int src_y,
- int width,
- int height)
-{
- guchar *pixels;
- GdkPixbuf *sub;
-
- g_return_val_if_fail (GDK_IS_PIXBUF (src_pixbuf), NULL);
- g_return_val_if_fail (src_x >= 0 && src_x + width <= src_pixbuf->width, NULL);
- g_return_val_if_fail (src_y >= 0 && src_y + height <= src_pixbuf->height, NULL);
-
- pixels = (gdk_pixbuf_get_pixels (src_pixbuf)
- + src_y * src_pixbuf->rowstride
- + src_x * src_pixbuf->n_channels);
-
- sub = gdk_pixbuf_new_from_data (pixels,
- src_pixbuf->colorspace,
- src_pixbuf->has_alpha,
- src_pixbuf->bits_per_sample,
- width, height,
- src_pixbuf->rowstride,
- NULL, NULL);
-
- /* Keep a reference to src_pixbuf */
- g_object_ref (src_pixbuf);
-
- g_object_set_qdata_full (G_OBJECT (sub),
- g_quark_from_static_string ("gdk-pixbuf-subpixbuf-src"),
- src_pixbuf,
- (GDestroyNotify) g_object_unref);
-
- return sub;
-}
-
-
-
-/* Accessors */
-
-/**
- * gdk_pixbuf_get_colorspace:
- * @pixbuf: A pixbuf.
- *
- * Queries the color space of a pixbuf.
- *
- * Return value: Color space.
- **/
-GdkColorspace
-gdk_pixbuf_get_colorspace (const GdkPixbuf *pixbuf)
-{
- g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), GDK_COLORSPACE_RGB);
-
- return pixbuf->colorspace;
-}
-
-/**
- * gdk_pixbuf_get_n_channels:
- * @pixbuf: A pixbuf.
- *
- * Queries the number of channels of a pixbuf.
- *
- * Return value: Number of channels.
- **/
-int
-gdk_pixbuf_get_n_channels (const GdkPixbuf *pixbuf)
-{
- g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), -1);
-
- return pixbuf->n_channels;
-}
-
-/**
- * gdk_pixbuf_get_has_alpha:
- * @pixbuf: A pixbuf.
- *
- * Queries whether a pixbuf has an alpha channel (opacity information).
- *
- * Return value: %TRUE if it has an alpha channel, %FALSE otherwise.
- **/
-gboolean
-gdk_pixbuf_get_has_alpha (const GdkPixbuf *pixbuf)
-{
- g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), FALSE);
-
- return pixbuf->has_alpha ? TRUE : FALSE;
-}
-
-/**
- * gdk_pixbuf_get_bits_per_sample:
- * @pixbuf: A pixbuf.
- *
- * Queries the number of bits per color sample in a pixbuf.
- *
- * Return value: Number of bits per color sample.
- **/
-int
-gdk_pixbuf_get_bits_per_sample (const GdkPixbuf *pixbuf)
-{
- g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), -1);
-
- return pixbuf->bits_per_sample;
-}
-
-/**
- * gdk_pixbuf_get_pixels:
- * @pixbuf: A pixbuf.
- *
- * Queries a pointer to the pixel data of a pixbuf.
- *
- * Return value: A pointer to the pixbuf's pixel data. Please see <xref linkend="image-data"/>
- * for information about how the pixel data is stored in
- * memory.
- **/
-guchar *
-gdk_pixbuf_get_pixels (const GdkPixbuf *pixbuf)
-{
- g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
-
- return pixbuf->pixels;
-}
-
-/**
- * gdk_pixbuf_get_width:
- * @pixbuf: A pixbuf.
- *
- * Queries the width of a pixbuf.
- *
- * Return value: Width in pixels.
- **/
-int
-gdk_pixbuf_get_width (const GdkPixbuf *pixbuf)
-{
- g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), -1);
-
- return pixbuf->width;
-}
-
-/**
- * gdk_pixbuf_get_height:
- * @pixbuf: A pixbuf.
- *
- * Queries the height of a pixbuf.
- *
- * Return value: Height in pixels.
- **/
-int
-gdk_pixbuf_get_height (const GdkPixbuf *pixbuf)
-{
- g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), -1);
-
- return pixbuf->height;
-}
-
-/**
- * gdk_pixbuf_get_rowstride:
- * @pixbuf: A pixbuf.
- *
- * Queries the rowstride of a pixbuf, which is the number of bytes between the start of a row
- * and the start of the next row.
- *
- * Return value: Distance between row starts.
- **/
-int
-gdk_pixbuf_get_rowstride (const GdkPixbuf *pixbuf)
-{
- g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), -1);
-
- return pixbuf->rowstride;
-}
-
-
-
-/* General initialization hooks */
-const guint gdk_pixbuf_major_version = GDK_PIXBUF_MAJOR;
-const guint gdk_pixbuf_minor_version = GDK_PIXBUF_MINOR;
-const guint gdk_pixbuf_micro_version = GDK_PIXBUF_MICRO;
-
-const char *gdk_pixbuf_version = GDK_PIXBUF_VERSION;
-
-/* Error quark */
-GQuark
-gdk_pixbuf_error_quark (void)
-{
- return g_quark_from_static_string ("gdk-pixbuf-error-quark");
-}
-
-/**
- * gdk_pixbuf_fill:
- * @pixbuf: a #GdkPixbuf
- * @pixel: RGBA pixel to clear to
- * (0xffffffff is opaque white, 0x00000000 transparent black)
- *
- * Clears a pixbuf to the given RGBA value, converting the RGBA value into
- * the pixbuf's pixel format. The alpha will be ignored if the pixbuf
- * doesn't have an alpha channel.
- *
- **/
-void
-gdk_pixbuf_fill (GdkPixbuf *pixbuf,
- guint32 pixel)
-{
- guchar *pixels;
- guint r, g, b, a;
- guchar *p;
- guint w, h;
-
- g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
-
- if (pixbuf->width == 0 || pixbuf->height == 0)
- return;
-
- pixels = pixbuf->pixels;
-
- r = (pixel & 0xff000000) >> 24;
- g = (pixel & 0x00ff0000) >> 16;
- b = (pixel & 0x0000ff00) >> 8;
- a = (pixel & 0x000000ff);
-
- h = pixbuf->height;
-
- while (h--) {
- w = pixbuf->width;
- p = pixels;
-
- switch (pixbuf->n_channels) {
- case 3:
- while (w--) {
- p[0] = r;
- p[1] = g;
- p[2] = b;
- p += 3;
- }
- break;
- case 4:
- while (w--) {
- p[0] = r;
- p[1] = g;
- p[2] = b;
- p[3] = a;
- p += 4;
- }
- break;
- default:
- break;
- }
-
- pixels += pixbuf->rowstride;
- }
-}
-
-
-
-/**
- * gdk_pixbuf_get_option:
- * @pixbuf: a #GdkPixbuf
- * @key: a nul-terminated string.
- *
- * Looks up @key in the list of options that may have been attached to the
- * @pixbuf when it was loaded, or that may have been attached by another
- * function using gdk_pixbuf_set_option().
- *
- * For instance, the ANI loader provides "Title" and "Artist" options.
- * The ICO, XBM, and XPM loaders provide "x_hot" and "y_hot" hot-spot
- * options for cursor definitions. The PNG loader provides the tEXt ancillary
- * chunk key/value pairs as options. Since 2.12, the TIFF and JPEG loaders
- * return an "orientation" option string that corresponds to the embedded
- * TIFF/Exif orientation tag (if present).
- *
- * Return value: the value associated with @key. This is a nul-terminated
- * string that should not be freed or %NULL if @key was not found.
- **/
-G_CONST_RETURN gchar *
-gdk_pixbuf_get_option (GdkPixbuf *pixbuf,
- const gchar *key)
-{
- gchar **options;
- gint i;
-
- g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
- g_return_val_if_fail (key != NULL, NULL);
-
- options = g_object_get_qdata (G_OBJECT (pixbuf),
- g_quark_from_static_string ("gdk_pixbuf_options"));
- if (options) {
- for (i = 0; options[2*i]; i++) {
- if (strcmp (options[2*i], key) == 0)
- return options[2*i+1];
- }
- }
-
- return NULL;
-}
-
-/**
- * gdk_pixbuf_set_option:
- * @pixbuf: a #GdkPixbuf
- * @key: a nul-terminated string.
- * @value: a nul-terminated string.
- *
- * Attaches a key/value pair as an option to a #GdkPixbuf. If %key already
- * exists in the list of options attached to @pixbuf, the new value is
- * ignored and %FALSE is returned.
- *
- * Return value: %TRUE on success.
- *
- * Since: 2.2
- **/
-gboolean
-gdk_pixbuf_set_option (GdkPixbuf *pixbuf,
- const gchar *key,
- const gchar *value)
-{
- GQuark quark;
- gchar **options;
- gint n = 0;
-
- g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), FALSE);
- g_return_val_if_fail (key != NULL, FALSE);
- g_return_val_if_fail (value != NULL, FALSE);
-
- quark = g_quark_from_static_string ("gdk_pixbuf_options");
-
- options = g_object_get_qdata (G_OBJECT (pixbuf), quark);
-
- if (options) {
- for (n = 0; options[2*n]; n++) {
- if (strcmp (options[2*n], key) == 0)
- return FALSE;
- }
-
- g_object_steal_qdata (G_OBJECT (pixbuf), quark);
- options = g_renew (gchar *, options, 2*(n+1) + 1);
- } else {
- options = g_new (gchar *, 3);
- }
-
- options[2*n] = g_strdup (key);
- options[2*n+1] = g_strdup (value);
- options[2*n+2] = NULL;
-
- g_object_set_qdata_full (G_OBJECT (pixbuf), quark,
- options, (GDestroyNotify) g_strfreev);
-
- return TRUE;
-}
-
-static void
-gdk_pixbuf_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GdkPixbuf *pixbuf = GDK_PIXBUF (object);
-
- switch (prop_id)
- {
- case PROP_COLORSPACE:
- pixbuf->colorspace = g_value_get_enum (value);
- break;
- case PROP_N_CHANNELS:
- pixbuf->n_channels = g_value_get_int (value);
- break;
- case PROP_HAS_ALPHA:
- pixbuf->has_alpha = g_value_get_boolean (value);
- break;
- case PROP_BITS_PER_SAMPLE:
- pixbuf->bits_per_sample = g_value_get_int (value);
- break;
- case PROP_WIDTH:
- pixbuf->width = g_value_get_int (value);
- break;
- case PROP_HEIGHT:
- pixbuf->height = g_value_get_int (value);
- break;
- case PROP_ROWSTRIDE:
- pixbuf->rowstride = g_value_get_int (value);
- break;
- case PROP_PIXELS:
- pixbuf->pixels = (guchar *) g_value_get_pointer (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gdk_pixbuf_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GdkPixbuf *pixbuf = GDK_PIXBUF (object);
-
- switch (prop_id)
- {
- case PROP_COLORSPACE:
- g_value_set_enum (value, gdk_pixbuf_get_colorspace (pixbuf));
- break;
- case PROP_N_CHANNELS:
- g_value_set_int (value, gdk_pixbuf_get_n_channels (pixbuf));
- break;
- case PROP_HAS_ALPHA:
- g_value_set_boolean (value, gdk_pixbuf_get_has_alpha (pixbuf));
- break;
- case PROP_BITS_PER_SAMPLE:
- g_value_set_int (value, gdk_pixbuf_get_bits_per_sample (pixbuf));
- break;
- case PROP_WIDTH:
- g_value_set_int (value, gdk_pixbuf_get_width (pixbuf));
- break;
- case PROP_HEIGHT:
- g_value_set_int (value, gdk_pixbuf_get_height (pixbuf));
- break;
- case PROP_ROWSTRIDE:
- g_value_set_int (value, gdk_pixbuf_get_rowstride (pixbuf));
- break;
- case PROP_PIXELS:
- g_value_set_pointer (value, gdk_pixbuf_get_pixels (pixbuf));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-#define __GDK_PIXBUF_C__
-#include "gdk-pixbuf-aliasdef.c"
diff --git a/gdk-pixbuf/gdk-pixbuf.h b/gdk-pixbuf/gdk-pixbuf.h
deleted file mode 100644
index 9a30131fb1..0000000000
--- a/gdk-pixbuf/gdk-pixbuf.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* GdkPixbuf library - Main header file
- *
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Authors: Mark Crichton <crichton@gimp.org>
- * Miguel de Icaza <miguel@gnu.org>
- * Federico Mena-Quintero <federico@gimp.org>
- * Havoc Pennington <hp@redhat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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_H
-#define GDK_PIXBUF_H
-
-#define GDK_PIXBUF_H_INSIDE
-
-#include <glib.h>
-#include <gdk-pixbuf/gdk-pixbuf-features.h>
-#include <glib-object.h>
-
-#include <gdk-pixbuf/gdk-pixbuf-core.h>
-#include <gdk-pixbuf/gdk-pixbuf-transform.h>
-#include <gdk-pixbuf/gdk-pixbuf-animation.h>
-#include <gdk-pixbuf/gdk-pixbuf-simple-anim.h>
-#include <gdk-pixbuf/gdk-pixbuf-io.h>
-#include <gdk-pixbuf/gdk-pixbuf-loader.h>
-#include <gdk-pixbuf/gdk-pixbuf-enum-types.h>
-
-#undef GDK_PIXBUF_H_INSIDE
-
-#endif /* GDK_PIXBUF_H */
diff --git a/gdk-pixbuf/gdk-pixbuf.symbols b/gdk-pixbuf/gdk-pixbuf.symbols
deleted file mode 100644
index 93885956ea..0000000000
--- a/gdk-pixbuf/gdk-pixbuf.symbols
+++ /dev/null
@@ -1,202 +0,0 @@
-/* This file lists all exported symbols. It is used to generate
- * the gdk_pixbuf.def file used to control exports on Windows and the
- * gdk-pixbuf-alias.h/gdk-pixbuf-aliasdef.c files used to avoid PLT
- * entries for internal uses of exported functions (see makegdkpixbufalias.pl).
- *
- * Every symbol must be included in the right
- * #ifdef IN_HEADER(sym) #endif and
- * #ifdef IN_FILE(sym) #endif sections.
- */
-#ifdef ALL_FILES
-#define IN_FILE(x) 1
-#define IN_HEADER(x) 1
-#endif
-#if IN_HEADER(GDK_PIXBUF_CORE_H)
-#if IN_FILE(__GDK_PIXBUF_C__)
-gdk_pixbuf_error_quark
-gdk_pixbuf_get_type G_GNUC_CONST
-gdk_pixbuf_new
-gdk_pixbuf_get_bits_per_sample
-gdk_pixbuf_get_colorspace
-gdk_pixbuf_get_has_alpha
-gdk_pixbuf_get_height
-gdk_pixbuf_get_n_channels
-gdk_pixbuf_get_pixels
-gdk_pixbuf_get_rowstride
-gdk_pixbuf_get_width
-gdk_pixbuf_get_option
-gdk_pixbuf_copy
-gdk_pixbuf_new_subpixbuf
-gdk_pixbuf_fill
-#endif
-#endif
-
-#if IN_HEADER(GDK_PIXBUF_CORE_H)
-#if IN_FILE(__GDK_PIXBUF_DATA_C__)
-gdk_pixbuf_new_from_data
-#endif
-#endif
-
-#if IN_HEADER(GDK_PIXBUF_CORE_H)
-#if IN_FILE(__GDK_PIXBUF_IO_C__)
-gdk_pixbuf_new_from_file PRIVATE
-#ifdef G_OS_WIN32
-gdk_pixbuf_new_from_file_utf8
-#endif
-gdk_pixbuf_new_from_file_at_size PRIVATE
-#ifdef G_OS_WIN32
-gdk_pixbuf_new_from_file_at_size_utf8
-#endif
-gdk_pixbuf_new_from_file_at_scale PRIVATE
-#ifdef G_OS_WIN32
-gdk_pixbuf_new_from_file_at_scale_utf8
-#endif
-gdk_pixbuf_new_from_xpm_data
-gdk_pixbuf_new_from_stream
-gdk_pixbuf_new_from_stream_at_scale
-gdk_pixbuf_save PRIVATE G_GNUC_NULL_TERMINATED
-#ifdef G_OS_WIN32
-gdk_pixbuf_save_utf8
-#endif
-gdk_pixbuf_save_to_buffer G_GNUC_NULL_TERMINATED
-gdk_pixbuf_save_to_bufferv
-gdk_pixbuf_save_to_callback G_GNUC_NULL_TERMINATED
-gdk_pixbuf_save_to_callbackv
-gdk_pixbuf_savev PRIVATE
-#ifdef G_OS_WIN32
-gdk_pixbuf_savev_utf8
-#endif
-gdk_pixbuf_save_to_stream
-#endif
-#endif
-
-#if IN_HEADER(GDK_PIXBUF_CORE_H)
-#if IN_FILE(__GDK_PIXDATA_C__)
-gdk_pixbuf_new_from_inline
-#endif
-#endif
-
-#if IN_HEADER(GDK_PIXBUF_CORE_H)
-#if IN_FILE(__GDK_PIXBUF_UTIL_C__)
-gdk_pixbuf_add_alpha
-gdk_pixbuf_copy_area
-gdk_pixbuf_saturate_and_pixelate
-gdk_pixbuf_apply_embedded_orientation
-#endif
-#endif
-
-#if IN_HEADER(GDK_PIXBUF_TRANSFORM_H)
-#if IN_FILE(__GDK_PIXBUF_SCALE_C__)
-gdk_pixbuf_rotate_simple
-gdk_pixbuf_scale
-gdk_pixbuf_scale_simple
-gdk_pixbuf_flip
-gdk_pixbuf_composite
-gdk_pixbuf_composite_color
-gdk_pixbuf_composite_color_simple
-#endif
-#endif
-
-#if IN_HEADER(GDK_PIXBUF_ANIMATION_H)
-#if IN_FILE(__GDK_PIXBUF_ANIMATION_C__)
-gdk_pixbuf_animation_get_height
-gdk_pixbuf_animation_get_iter
-gdk_pixbuf_animation_get_static_image
-gdk_pixbuf_animation_get_type G_GNUC_CONST
-gdk_pixbuf_animation_get_width
-gdk_pixbuf_animation_is_static_image
-gdk_pixbuf_animation_iter_advance
-gdk_pixbuf_animation_iter_get_delay_time
-gdk_pixbuf_animation_iter_get_pixbuf
-gdk_pixbuf_animation_iter_get_type G_GNUC_CONST
-gdk_pixbuf_animation_iter_on_currently_loading_frame
-gdk_pixbuf_animation_new_from_file PRIVATE
-#ifdef G_OS_WIN32
-gdk_pixbuf_animation_new_from_file_utf8
-#endif
-gdk_pixbuf_non_anim_new
-gdk_pixbuf_non_anim_get_type G_GNUC_CONST
-#endif
-#endif
-
-#if IN_HEADER(GDK_PIXBUF_SIMPLE_ANIM_H)
-#if IN_FILE(__GDK_PIXBUF_SIMPLE_ANIM_C__)
-gdk_pixbuf_simple_anim_get_type G_GNUC_CONST
-gdk_pixbuf_simple_anim_iter_get_type G_GNUC_CONST
-gdk_pixbuf_simple_anim_new
-gdk_pixbuf_simple_anim_add_frame
-gdk_pixbuf_simple_anim_set_loop
-gdk_pixbuf_simple_anim_get_loop
-#endif
-#endif
-
-#if IN_HEADER(GDK_PIXBUF_SCALED_ANIM_H)
-#if IN_FILE(__GDK_PIXBUF_SCALED_ANIM_C__)
-gdk_pixbuf_scaled_anim_get_type G_GNUC_CONST
-gdk_pixbuf_scaled_anim_iter_get_type G_GNUC_CONST
-#endif
-#endif
-
-#if IN_HEADER(GDK_PIXBUF_IO_H)
-#if IN_FILE(__GDK_PIXBUF_IO_C__)
-gdk_pixbuf_get_formats
-gdk_pixbuf_format_get_description
-gdk_pixbuf_format_get_extensions
-gdk_pixbuf_format_get_license
-gdk_pixbuf_format_get_mime_types
-gdk_pixbuf_format_get_name
-gdk_pixbuf_format_is_disabled
-gdk_pixbuf_format_is_scalable
-gdk_pixbuf_format_is_writable
-gdk_pixbuf_format_set_disabled
-gdk_pixbuf_get_file_info
-#endif
-#endif
-
-#if IN_HEADER(GDK_PIXBUF_IO_H)
-#if IN_FILE(__GDK_PIXBUF_C__)
-gdk_pixbuf_set_option
-#endif
-#endif
-
-#if IN_HEADER(GDK_PIXBUF_LOADER_H)
-#if IN_FILE(__GDK_PIXBUF_LOADER_C__)
-gdk_pixbuf_loader_close
-gdk_pixbuf_loader_get_animation
-gdk_pixbuf_loader_get_format
-gdk_pixbuf_loader_get_pixbuf
-gdk_pixbuf_loader_get_type G_GNUC_CONST
-gdk_pixbuf_loader_new
-gdk_pixbuf_loader_new_with_mime_type
-gdk_pixbuf_loader_new_with_type
-gdk_pixbuf_loader_set_size
-gdk_pixbuf_loader_write
-#endif
-#endif
-
-#if IN_HEADER(__GDK_PIXBUF_ENUM_TYPES_H__)
-#if IN_FILE(__GDK_PIXBUF_ENUM_TYPES_C__)
-gdk_colorspace_get_type G_GNUC_CONST
-gdk_interp_type_get_type G_GNUC_CONST
-gdk_pixbuf_alpha_mode_get_type G_GNUC_CONST
-gdk_pixbuf_rotation_get_type G_GNUC_CONST
-gdk_pixbuf_error_get_type
-#endif
-#endif
-
-#if IN_HEADER(__GDK_PIXDATA_H__)
-#if IN_FILE(__GDK_PIXDATA_C__)
-gdk_pixbuf_from_pixdata
-gdk_pixdata_deserialize
-gdk_pixdata_from_pixbuf
-gdk_pixdata_serialize
-gdk_pixdata_to_csource
-#endif
-#endif
-
-#ifdef INCLUDE_VARIABLES
-gdk_pixbuf_major_version
-gdk_pixbuf_micro_version
-gdk_pixbuf_minor_version
-gdk_pixbuf_version
-#endif
diff --git a/gdk-pixbuf/gdk-pixdata.c b/gdk-pixbuf/gdk-pixdata.c
deleted file mode 100644
index ed60ab569e..0000000000
--- a/gdk-pixbuf/gdk-pixdata.c
+++ /dev/null
@@ -1,903 +0,0 @@
-/* GdkPixbuf library - GdkPixdata - functions for inlined pixbuf handling
- * Copyright (C) 1999, 2001 Tim Janik
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 "gdk-pixbuf-private.h"
-#include "gdk-pixdata.h"
-#include "gdk-pixbuf-alias.h"
-#include <string.h>
-
-#define APPEND g_string_append_printf
-
-/* --- functions --- */
-static guint
-pixdata_get_length (const GdkPixdata *pixdata)
-{
- guint bpp, length;
-
- if ((pixdata->pixdata_type & GDK_PIXDATA_COLOR_TYPE_MASK) == GDK_PIXDATA_COLOR_TYPE_RGB)
- bpp = 3;
- else if ((pixdata->pixdata_type & GDK_PIXDATA_COLOR_TYPE_MASK) == GDK_PIXDATA_COLOR_TYPE_RGBA)
- bpp = 4;
- else
- return 0; /* invalid format */
- switch (pixdata->pixdata_type & GDK_PIXDATA_ENCODING_MASK)
- {
- guint8 *rle_buffer;
- guint max_length;
- case GDK_PIXDATA_ENCODING_RAW:
- length = pixdata->rowstride * pixdata->height;
- break;
- case GDK_PIXDATA_ENCODING_RLE:
- /* need an RLE walk to determine size */
- max_length = pixdata->rowstride * pixdata->height;
- rle_buffer = pixdata->pixel_data;
- length = 0;
- while (length < max_length)
- {
- guint chunk_length = *(rle_buffer++);
-
- if (chunk_length & 128)
- {
- chunk_length = chunk_length - 128;
- if (!chunk_length) /* RLE data corrupted */
- return 0;
- length += chunk_length * bpp;
- rle_buffer += bpp;
- }
- else
- {
- if (!chunk_length) /* RLE data corrupted */
- return 0;
- chunk_length *= bpp;
- length += chunk_length;
- rle_buffer += chunk_length;
- }
- }
- length = rle_buffer - pixdata->pixel_data;
- break;
- default:
- length = 0;
- break;
- }
- return length;
-}
-
-/**
- * gdk_pixdata_serialize:
- * @pixdata: a valid #GdkPixdata structure to serialize.
- * @stream_length_p: location to store the resulting stream length in.
- *
- * Serializes a #GdkPixdata structure into a byte stream.
- * The byte stream consists of a straightforward writeout of the
- * #GdkPixdata fields in network byte order, plus the @pixel_data
- * bytes the structure points to.
- *
- * Return value: A newly-allocated string containing the serialized
- * #GdkPixdata structure.
- **/
-guint8* /* free result */
-gdk_pixdata_serialize (const GdkPixdata *pixdata,
- guint *stream_length_p)
-{
- guint8 *stream, *s;
- guint32 *istream;
- guint length;
-
- /* check args passing */
- g_return_val_if_fail (pixdata != NULL, NULL);
- g_return_val_if_fail (stream_length_p != NULL, NULL);
- /* check pixdata contents */
- g_return_val_if_fail (pixdata->magic == GDK_PIXBUF_MAGIC_NUMBER, NULL);
- g_return_val_if_fail (pixdata->width > 0, NULL);
- g_return_val_if_fail (pixdata->height > 0, NULL);
- g_return_val_if_fail (pixdata->rowstride >= pixdata->width, NULL);
- g_return_val_if_fail ((pixdata->pixdata_type & GDK_PIXDATA_COLOR_TYPE_MASK) == GDK_PIXDATA_COLOR_TYPE_RGB ||
- (pixdata->pixdata_type & GDK_PIXDATA_COLOR_TYPE_MASK) == GDK_PIXDATA_COLOR_TYPE_RGBA, NULL);
- g_return_val_if_fail ((pixdata->pixdata_type & GDK_PIXDATA_SAMPLE_WIDTH_MASK) == GDK_PIXDATA_SAMPLE_WIDTH_8, NULL);
- g_return_val_if_fail ((pixdata->pixdata_type & GDK_PIXDATA_ENCODING_MASK) == GDK_PIXDATA_ENCODING_RAW ||
- (pixdata->pixdata_type & GDK_PIXDATA_ENCODING_MASK) == GDK_PIXDATA_ENCODING_RLE, NULL);
- g_return_val_if_fail (pixdata->pixel_data != NULL, NULL);
-
- length = pixdata_get_length (pixdata);
-
- /* check length field */
- g_return_val_if_fail (length != 0, NULL);
-
- stream = g_malloc (GDK_PIXDATA_HEADER_LENGTH + length);
- istream = (guint32*) stream;
-
- /* store header */
- *istream++ = g_htonl (GDK_PIXBUF_MAGIC_NUMBER);
- *istream++ = g_htonl (GDK_PIXDATA_HEADER_LENGTH + length);
- *istream++ = g_htonl (pixdata->pixdata_type);
- *istream++ = g_htonl (pixdata->rowstride);
- *istream++ = g_htonl (pixdata->width);
- *istream++ = g_htonl (pixdata->height);
-
- /* copy pixel data */
- s = (guint8*) istream;
- memcpy (s, pixdata->pixel_data, length);
- s += length;
-
- *stream_length_p = GDK_PIXDATA_HEADER_LENGTH + length;
- g_assert (s - stream == *stream_length_p); /* paranoid */
-
- return stream;
-}
-
-#define return_header_corrupt(error) { \
- g_set_error_literal (error, GDK_PIXBUF_ERROR, \
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE, _("Image header corrupt")); \
- return FALSE; \
-}
-#define return_invalid_format(error) { \
- g_set_error_literal (error, GDK_PIXBUF_ERROR, \
- GDK_PIXBUF_ERROR_UNKNOWN_TYPE, _("Image format unknown")); \
- return FALSE; \
-}
-#define return_pixel_corrupt(error) { \
- g_set_error_literal (error, GDK_PIXBUF_ERROR, \
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE, _("Image pixel data corrupt")); \
- return FALSE; \
-}
-
-static inline const guint8 *
-get_uint32 (const guint8 *stream, guint *result)
-{
- *result = (stream[0] << 24) + (stream[1] << 16) + (stream[2] << 8) + stream[3];
- return stream + 4;
-}
-
-/**
- * gdk_pixdata_deserialize:
- * @pixdata: a #GdkPixdata structure to be filled in.
- * @stream_length: length of the stream used for deserialization.
- * @stream: stream of bytes containing a serialized #GdkPixdata structure.
- * @error: #GError location to indicate failures (maybe %NULL to ignore errors).
- *
- * Deserializes (reconstruct) a #GdkPixdata structure from a byte stream.
- * The byte stream consists of a straightforward writeout of the
- * #GdkPixdata fields in network byte order, plus the @pixel_data
- * bytes the structure points to.
- * The @pixdata contents are reconstructed byte by byte and are checked
- * for validity. This function may fail with %GDK_PIXBUF_CORRUPT_IMAGE
- * or %GDK_PIXBUF_ERROR_UNKNOWN_TYPE.
- *
- * Return value: Upon successful deserialization %TRUE is returned,
- * %FALSE otherwise.
- **/
-gboolean
-gdk_pixdata_deserialize (GdkPixdata *pixdata,
- guint stream_length,
- const guint8 *stream,
- GError **error)
-{
- guint color_type, sample_width, encoding;
-
- g_return_val_if_fail (pixdata != NULL, FALSE);
- if (stream_length < GDK_PIXDATA_HEADER_LENGTH)
- return_header_corrupt (error);
- g_return_val_if_fail (stream != NULL, FALSE);
-
-
- /* deserialize header */
- stream = get_uint32 (stream, &pixdata->magic);
- stream = get_uint32 (stream, (guint32 *)&pixdata->length);
- if (pixdata->magic != GDK_PIXBUF_MAGIC_NUMBER || pixdata->length < GDK_PIXDATA_HEADER_LENGTH)
- return_header_corrupt (error);
- stream = get_uint32 (stream, &pixdata->pixdata_type);
- stream = get_uint32 (stream, &pixdata->rowstride);
- stream = get_uint32 (stream, &pixdata->width);
- stream = get_uint32 (stream, &pixdata->height);
- if (pixdata->width < 1 || pixdata->height < 1 ||
- pixdata->rowstride < pixdata->width)
- return_header_corrupt (error);
- color_type = pixdata->pixdata_type & GDK_PIXDATA_COLOR_TYPE_MASK;
- sample_width = pixdata->pixdata_type & GDK_PIXDATA_SAMPLE_WIDTH_MASK;
- encoding = pixdata->pixdata_type & GDK_PIXDATA_ENCODING_MASK;
- if ((color_type != GDK_PIXDATA_COLOR_TYPE_RGB &&
- color_type != GDK_PIXDATA_COLOR_TYPE_RGBA) ||
- sample_width != GDK_PIXDATA_SAMPLE_WIDTH_8 ||
- (encoding != GDK_PIXDATA_ENCODING_RAW &&
- encoding != GDK_PIXDATA_ENCODING_RLE))
- return_invalid_format (error);
-
- /* deserialize pixel data */
- if (stream_length < pixdata->length - GDK_PIXDATA_HEADER_LENGTH)
- return_pixel_corrupt (error);
- pixdata->pixel_data = (guint8 *)stream;
-
- return TRUE;
-}
-
-static gboolean
-diff2_rgb (guint8 *ip)
-{
- return ip[0] != ip[3] || ip[1] != ip[4] || ip[2] != ip[5];
-}
-
-static gboolean
-diff2_rgba (guint8 *ip)
-{
- return ip[0] != ip[4] || ip[1] != ip[5] || ip[2] != ip[6] || ip[3] != ip[7];
-}
-
-static guint8* /* dest buffer bound */
-rl_encode_rgbx (guint8 *bp, /* dest buffer */
- guint8 *ip, /* image pointer */
- guint8 *limit, /* image upper bound */
- guint n_ch)
-{
- gboolean (*diff2_pix) (guint8 *) = n_ch > 3 ? diff2_rgba : diff2_rgb;
- guint8 *ilimit = limit - n_ch;
-
- while (ip < limit)
- {
- g_assert (ip < ilimit); /* paranoid */
-
- if (diff2_pix (ip))
- {
- guint8 *s_ip = ip;
- guint l = 1;
-
- ip += n_ch;
- while (l < 127 && ip < ilimit && diff2_pix (ip))
- { ip += n_ch; l += 1; }
- if (ip == ilimit && l < 127)
- { ip += n_ch; l += 1; }
- *(bp++) = l;
- memcpy (bp, s_ip, l * n_ch);
- bp += l * n_ch;
- }
- else
- {
- guint l = 2;
-
- ip += n_ch;
- while (l < 127 && ip < ilimit && !diff2_pix (ip))
- { ip += n_ch; l += 1; }
- *(bp++) = l | 128;
- memcpy (bp, ip, n_ch);
- ip += n_ch;
- bp += n_ch;
- }
- if (ip == ilimit)
- {
- *(bp++) = 1;
- memcpy (bp, ip, n_ch);
- ip += n_ch;
- bp += n_ch;
- }
- }
-
- return bp;
-}
-
-/* Used as the destroy notification function for gdk_pixbuf_new() */
-static void
-free_buffer (guchar *pixels, gpointer data)
-{
- g_free (pixels);
-}
-
-/**
- * gdk_pixdata_from_pixbuf:
- * @pixdata: a #GdkPixdata to fill.
- * @pixbuf: the data to fill @pixdata with.
- * @use_rle: whether to use run-length encoding for the pixel data.
- *
- * Converts a #GdkPixbuf to a #GdkPixdata. If @use_rle is %TRUE, the
- * pixel data is run-length encoded into newly-allocated memory and a
- * pointer to that memory is returned.
- *
- * Returns: If @ure_rle is %TRUE, a pointer to the newly-allocated memory
- * for the run-length encoded pixel data, otherwise %NULL.
- **/
-gpointer
-gdk_pixdata_from_pixbuf (GdkPixdata *pixdata,
- const GdkPixbuf *pixbuf,
- gboolean use_rle)
-{
- gpointer free_me = NULL;
- guint height, rowstride, encoding, bpp, length;
- guint8 *img_buffer;
-
- g_return_val_if_fail (pixdata != NULL, NULL);
- g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
- g_return_val_if_fail (pixbuf->bits_per_sample == 8, NULL);
- g_return_val_if_fail ((pixbuf->n_channels == 3 && !pixbuf->has_alpha) ||
- (pixbuf->n_channels == 4 && pixbuf->has_alpha), NULL);
- g_return_val_if_fail (pixbuf->rowstride >= pixbuf->width, NULL);
-
- height = pixbuf->height;
- rowstride = pixbuf->rowstride;
- bpp = pixbuf->has_alpha ? 4 : 3;
- encoding = use_rle && ((rowstride / bpp | height) > 1) ? GDK_PIXDATA_ENCODING_RLE : GDK_PIXDATA_ENCODING_RAW;
-
- if (encoding == GDK_PIXDATA_ENCODING_RLE)
- {
- guint pad, n_bytes = rowstride * height;
- guint8 *img_buffer_end, *data;
- GdkPixbuf *buf = NULL;
-
- if (n_bytes % bpp != 0)
- {
- rowstride = pixbuf->width * bpp;
- n_bytes = rowstride * height;
- data = g_malloc (n_bytes);
- buf = gdk_pixbuf_new_from_data (data,
- GDK_COLORSPACE_RGB,
- pixbuf->has_alpha, 8,
- pixbuf->width,
- pixbuf->height,
- rowstride,
- free_buffer, NULL);
- gdk_pixbuf_copy_area (pixbuf, 0, 0, pixbuf->width, pixbuf->height,
- buf, 0, 0);
- }
- else
- buf = (GdkPixbuf *)pixbuf;
- pad = rowstride;
- pad = MAX (pad, 130 + n_bytes / 127);
- data = g_new (guint8, pad + n_bytes);
- free_me = data;
- img_buffer = data;
- img_buffer_end = rl_encode_rgbx (img_buffer,
- buf->pixels, buf->pixels + n_bytes,
- bpp);
- length = img_buffer_end - img_buffer;
- if (buf != pixbuf)
- g_object_unref (buf);
- }
- else
- {
- img_buffer = pixbuf->pixels;
- length = rowstride * height;
- }
-
- pixdata->magic = GDK_PIXBUF_MAGIC_NUMBER;
- pixdata->length = GDK_PIXDATA_HEADER_LENGTH + length;
- pixdata->pixdata_type = pixbuf->has_alpha ? GDK_PIXDATA_COLOR_TYPE_RGBA : GDK_PIXDATA_COLOR_TYPE_RGB;
- pixdata->pixdata_type |= GDK_PIXDATA_SAMPLE_WIDTH_8;
- pixdata->pixdata_type |= encoding;
- pixdata->rowstride = rowstride;
- pixdata->width = pixbuf->width;
- pixdata->height = height;
- pixdata->pixel_data = img_buffer;
-
- return free_me;
-}
-
-/**
- * gdk_pixbuf_from_pixdata:
- * @pixdata: a #GdkPixdata to convert into a #GdkPixbuf.
- * @copy_pixels: whether to copy raw pixel data; run-length encoded
- * pixel data is always copied.
- * @error: location to store possible errors.
- *
- * Converts a #GdkPixdata to a #GdkPixbuf. If @copy_pixels is %TRUE or
- * if the pixel data is run-length-encoded, the pixel data is copied into
- * newly-allocated memory; otherwise it is reused.
- *
- * Returns: a new #GdkPixbuf.
- **/
-GdkPixbuf*
-gdk_pixbuf_from_pixdata (const GdkPixdata *pixdata,
- gboolean copy_pixels,
- GError **error)
-{
- guint encoding, bpp;
- guint8 *data = NULL;
-
- g_return_val_if_fail (pixdata != NULL, NULL);
- g_return_val_if_fail (pixdata->width > 0, NULL);
- g_return_val_if_fail (pixdata->height > 0, NULL);
- g_return_val_if_fail (pixdata->rowstride >= pixdata->width, NULL);
- g_return_val_if_fail ((pixdata->pixdata_type & GDK_PIXDATA_COLOR_TYPE_MASK) == GDK_PIXDATA_COLOR_TYPE_RGB ||
- (pixdata->pixdata_type & GDK_PIXDATA_COLOR_TYPE_MASK) == GDK_PIXDATA_COLOR_TYPE_RGBA, NULL);
- g_return_val_if_fail ((pixdata->pixdata_type & GDK_PIXDATA_SAMPLE_WIDTH_MASK) == GDK_PIXDATA_SAMPLE_WIDTH_8, NULL);
- g_return_val_if_fail ((pixdata->pixdata_type & GDK_PIXDATA_ENCODING_MASK) == GDK_PIXDATA_ENCODING_RAW ||
- (pixdata->pixdata_type & GDK_PIXDATA_ENCODING_MASK) == GDK_PIXDATA_ENCODING_RLE, NULL);
- g_return_val_if_fail (pixdata->pixel_data != NULL, NULL);
-
- bpp = (pixdata->pixdata_type & GDK_PIXDATA_COLOR_TYPE_MASK) == GDK_PIXDATA_COLOR_TYPE_RGB ? 3 : 4;
- encoding = pixdata->pixdata_type & GDK_PIXDATA_ENCODING_MASK;
- if (encoding == GDK_PIXDATA_ENCODING_RLE)
- copy_pixels = TRUE;
- if (copy_pixels)
- {
- data = g_try_malloc (pixdata->rowstride * pixdata->height);
- if (!data)
- {
- g_set_error (error, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- g_dngettext(GETTEXT_PACKAGE,
- "failed to allocate image buffer of %u byte",
- "failed to allocate image buffer of %u bytes",
- pixdata->rowstride * pixdata->height),
- pixdata->rowstride * pixdata->height);
- return NULL;
- }
- }
- if (encoding == GDK_PIXDATA_ENCODING_RLE)
- {
- const guint8 *rle_buffer = pixdata->pixel_data;
- guint8 *image_buffer = data;
- guint8 *image_limit = data + pixdata->rowstride * pixdata->height;
- gboolean check_overrun = FALSE;
-
- while (image_buffer < image_limit)
- {
- guint length = *(rle_buffer++);
-
- if (length & 128)
- {
- length = length - 128;
- check_overrun = image_buffer + length * bpp > image_limit;
- if (check_overrun)
- length = (image_limit - image_buffer) / bpp;
- if (bpp < 4) /* RGB */
- do
- {
- memcpy (image_buffer, rle_buffer, 3);
- image_buffer += 3;
- }
- while (--length);
- else /* RGBA */
- do
- {
- memcpy (image_buffer, rle_buffer, 4);
- image_buffer += 4;
- }
- while (--length);
- rle_buffer += bpp;
- }
- else
- {
- length *= bpp;
- check_overrun = image_buffer + length > image_limit;
- if (check_overrun)
- length = image_limit - image_buffer;
- memcpy (image_buffer, rle_buffer, length);
- image_buffer += length;
- rle_buffer += length;
- }
- }
- if (check_overrun)
- {
- g_free (data);
- g_set_error_literal (error, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Image pixel data corrupt"));
- return NULL;
- }
- }
- else if (copy_pixels)
- memcpy (data, pixdata->pixel_data, pixdata->rowstride * pixdata->height);
- else
- data = pixdata->pixel_data;
-
- return gdk_pixbuf_new_from_data (data, GDK_COLORSPACE_RGB,
- (pixdata->pixdata_type & GDK_PIXDATA_COLOR_TYPE_MASK) == GDK_PIXDATA_COLOR_TYPE_RGBA,
- 8, pixdata->width, pixdata->height, pixdata->rowstride,
- copy_pixels ? (GdkPixbufDestroyNotify) g_free : NULL, data);
-}
-
-typedef struct {
- /* config */
- gboolean dump_stream;
- gboolean dump_struct;
- gboolean dump_macros;
- gboolean dump_gtypes;
- gboolean dump_rle_decoder;
- const gchar *static_prefix;
- const gchar *const_prefix;
- /* runtime */
- GString *gstring;
- guint pos;
- gboolean pad;
-} CSourceData;
-
-static inline void
-save_uchar (CSourceData *cdata,
- guint8 d)
-{
- GString *gstring = cdata->gstring;
-
- if (cdata->pos > 70)
- {
- if (cdata->dump_struct || cdata->dump_stream)
- {
- g_string_append (gstring, "\"\n \"");
- cdata->pos = 3;
- cdata->pad = FALSE;
- }
- if (cdata->dump_macros)
- {
- g_string_append (gstring, "\" \\\n \"");
- cdata->pos = 3;
- cdata->pad = FALSE;
- }
- }
- if (d < 33 || d > 126 || d == '?')
- {
- APPEND (gstring, "\\%o", d);
- cdata->pos += 1 + 1 + (d > 7) + (d > 63);
- cdata->pad = d < 64;
- return;
- }
- if (d == '\\')
- {
- g_string_append (gstring, "\\\\");
- cdata->pos += 2;
- }
- else if (d == '"')
- {
- g_string_append (gstring, "\\\"");
- cdata->pos += 2;
- }
- else if (cdata->pad && d >= '0' && d <= '9')
- {
- g_string_append (gstring, "\"\"");
- g_string_append_c (gstring, d);
- cdata->pos += 3;
- }
- else
- {
- g_string_append_c (gstring, d);
- cdata->pos += 1;
- }
- cdata->pad = FALSE;
- return;
-}
-
-static inline void
-save_rle_decoder (GString *gstring,
- const gchar *macro_name,
- const gchar *s_uint,
- const gchar *s_uint_8,
- guint n_ch)
-{
- APPEND (gstring, "#define %s_RUN_LENGTH_DECODE(image_buf, rle_data, size, bpp) do \\\n",
- macro_name);
- APPEND (gstring, "{ %s __bpp; %s *__ip; const %s *__il, *__rd; \\\n", s_uint, s_uint_8, s_uint_8);
- APPEND (gstring, " __bpp = (bpp); __ip = (image_buf); __il = __ip + (size) * __bpp; \\\n");
-
- APPEND (gstring, " __rd = (rle_data); if (__bpp > 3) { /* RGBA */ \\\n");
-
- APPEND (gstring, " while (__ip < __il) { %s __l = *(__rd++); \\\n", s_uint);
- APPEND (gstring, " if (__l & 128) { __l = __l - 128; \\\n");
- APPEND (gstring, " do { memcpy (__ip, __rd, 4); __ip += 4; } while (--__l); __rd += 4; \\\n");
- APPEND (gstring, " } else { __l *= 4; memcpy (__ip, __rd, __l); \\\n");
- APPEND (gstring, " __ip += __l; __rd += __l; } } \\\n");
-
- APPEND (gstring, " } else { /* RGB */ \\\n");
-
- APPEND (gstring, " while (__ip < __il) { %s __l = *(__rd++); \\\n", s_uint);
- APPEND (gstring, " if (__l & 128) { __l = __l - 128; \\\n");
- APPEND (gstring, " do { memcpy (__ip, __rd, 3); __ip += 3; } while (--__l); __rd += 3; \\\n");
- APPEND (gstring, " } else { __l *= 3; memcpy (__ip, __rd, __l); \\\n");
- APPEND (gstring, " __ip += __l; __rd += __l; } } \\\n");
-
- APPEND (gstring, " } } while (0)\n");
-}
-
-/**
- * gdk_pixdata_to_csource:
- * @pixdata: a #GdkPixdata to convert to C source.
- * @name: used for naming generated data structures or macros.
- * @dump_type: a #GdkPixdataDumpType determining the kind of C
- * source to be generated.
- *
- * Generates C source code suitable for compiling images directly
- * into programs.
- *
- * GTK+ ships with a program called <command>gdk-pixbuf-csource</command>
- * which offers a command line interface to this function.
- *
- * Returns: a newly-allocated string containing the C source form
- * of @pixdata.
- **/
-GString*
-gdk_pixdata_to_csource (GdkPixdata *pixdata,
- const gchar *name,
- GdkPixdataDumpType dump_type)
-{
- CSourceData cdata = { 0, };
- gchar *s_uint_8;
- guint bpp, width, height, rowstride;
- gboolean rle_encoded;
- gchar *macro_name;
- guint8 *img_buffer, *img_buffer_end, *stream = NULL;
- guint stream_length;
- GString *gstring;
-
- /* check args passing */
- g_return_val_if_fail (pixdata != NULL, NULL);
- g_return_val_if_fail (name != NULL, NULL);
- /* check pixdata contents */
- g_return_val_if_fail (pixdata->magic == GDK_PIXBUF_MAGIC_NUMBER, NULL);
- g_return_val_if_fail (pixdata->width > 0, NULL);
- g_return_val_if_fail (pixdata->height > 0, NULL);
- g_return_val_if_fail (pixdata->rowstride >= pixdata->width, NULL);
- g_return_val_if_fail ((pixdata->pixdata_type & GDK_PIXDATA_COLOR_TYPE_MASK) == GDK_PIXDATA_COLOR_TYPE_RGB ||
- (pixdata->pixdata_type & GDK_PIXDATA_COLOR_TYPE_MASK) == GDK_PIXDATA_COLOR_TYPE_RGBA, NULL);
- g_return_val_if_fail ((pixdata->pixdata_type & GDK_PIXDATA_SAMPLE_WIDTH_MASK) == GDK_PIXDATA_SAMPLE_WIDTH_8, NULL);
- g_return_val_if_fail ((pixdata->pixdata_type & GDK_PIXDATA_ENCODING_MASK) == GDK_PIXDATA_ENCODING_RAW ||
- (pixdata->pixdata_type & GDK_PIXDATA_ENCODING_MASK) == GDK_PIXDATA_ENCODING_RLE, NULL);
- g_return_val_if_fail (pixdata->pixel_data != NULL, NULL);
-
- img_buffer = pixdata->pixel_data;
- if (pixdata->length < 1)
- img_buffer_end = img_buffer + pixdata_get_length (pixdata);
- else
- img_buffer_end = img_buffer + pixdata->length - GDK_PIXDATA_HEADER_LENGTH;
- g_return_val_if_fail (img_buffer < img_buffer_end, NULL);
-
- bpp = (pixdata->pixdata_type & GDK_PIXDATA_COLOR_TYPE_MASK) == GDK_PIXDATA_COLOR_TYPE_RGB ? 3 : 4;
- width = pixdata->width;
- height = pixdata->height;
- rowstride = pixdata->rowstride;
- rle_encoded = (pixdata->pixdata_type & GDK_PIXDATA_ENCODING_RLE) > 0;
- macro_name = g_ascii_strup (name, -1);
-
- cdata.dump_macros = (dump_type & GDK_PIXDATA_DUMP_MACROS) > 0;
- cdata.dump_struct = (dump_type & GDK_PIXDATA_DUMP_PIXDATA_STRUCT) > 0;
- cdata.dump_stream = !cdata.dump_macros && !cdata.dump_struct;
- g_return_val_if_fail (cdata.dump_macros + cdata.dump_struct + cdata.dump_stream == 1, NULL);
-
- cdata.dump_gtypes = (dump_type & GDK_PIXDATA_DUMP_CTYPES) == 0;
- cdata.dump_rle_decoder = (dump_type & GDK_PIXDATA_DUMP_RLE_DECODER) > 0;
- cdata.static_prefix = (dump_type & GDK_PIXDATA_DUMP_STATIC) ? "static " : "";
- cdata.const_prefix = (dump_type & GDK_PIXDATA_DUMP_CONST) ? "const " : "";
- gstring = g_string_new (NULL);
- cdata.gstring = gstring;
-
- if (!cdata.dump_macros && cdata.dump_gtypes)
- s_uint_8 = "guint8 ";
- else if (!cdata.dump_macros)
- s_uint_8 = "unsigned char";
- else if (cdata.dump_macros && cdata.dump_gtypes)
- s_uint_8 = "guint8";
- else /* cdata.dump_macros && !cdata.dump_gtypes */
- s_uint_8 = "unsigned char";
-
- /* initial comment
- */
- APPEND (gstring,
- "/* GdkPixbuf %s C-Source image dump %s*/\n\n",
- bpp > 3 ? "RGBA" : "RGB",
- rle_encoded ? "1-byte-run-length-encoded " : "");
-
- /* dump RLE decoder for structures
- */
- if (cdata.dump_rle_decoder && cdata.dump_struct)
- save_rle_decoder (gstring,
- macro_name,
- cdata.dump_gtypes ? "guint" : "unsigned int",
- cdata.dump_gtypes ? "guint8" : "unsigned char",
- bpp);
-
- /* format & size blurbs
- */
- if (cdata.dump_macros)
- {
- APPEND (gstring, "#define %s_ROWSTRIDE (%u)\n",
- macro_name, rowstride);
- APPEND (gstring, "#define %s_WIDTH (%u)\n",
- macro_name, width);
- APPEND (gstring, "#define %s_HEIGHT (%u)\n",
- macro_name, height);
- APPEND (gstring, "#define %s_BYTES_PER_PIXEL (%u) /* 3:RGB, 4:RGBA */\n",
- macro_name, bpp);
- }
- if (cdata.dump_struct)
- {
- APPEND (gstring, "%s%sGdkPixdata %s = {\n",
- cdata.static_prefix, cdata.const_prefix, name);
- APPEND (gstring, " 0x%x, /* Pixbuf magic: 'GdkP' */\n",
- GDK_PIXBUF_MAGIC_NUMBER);
- APPEND (gstring, " %d + %lu, /* header length + pixel_data length */\n",
- GDK_PIXDATA_HEADER_LENGTH,
- rle_encoded ? (glong)(img_buffer_end - img_buffer) : (glong)rowstride * height);
- APPEND (gstring, " 0x%x, /* pixdata_type */\n",
- pixdata->pixdata_type);
- APPEND (gstring, " %u, /* rowstride */\n",
- rowstride);
- APPEND (gstring, " %u, /* width */\n",
- width);
- APPEND (gstring, " %u, /* height */\n",
- height);
- APPEND (gstring, " /* pixel_data: */\n");
- }
- if (cdata.dump_stream)
- {
- guint pix_length = img_buffer_end - img_buffer;
-
- stream = gdk_pixdata_serialize (pixdata, &stream_length);
- img_buffer = stream;
- img_buffer_end = stream + stream_length;
-
- APPEND (gstring, "#ifdef __SUNPRO_C\n");
- APPEND (gstring, "#pragma align 4 (%s)\n", name);
- APPEND (gstring, "#endif\n");
-
- APPEND (gstring, "#ifdef __GNUC__\n");
- APPEND (gstring, "%s%s%s %s[] __attribute__ ((__aligned__ (4))) = \n",
- cdata.static_prefix, cdata.const_prefix,
- cdata.dump_gtypes ? "guint8" : "unsigned char",
- name);
- APPEND (gstring, "#else\n");
- APPEND (gstring, "%s%s%s %s[] = \n",
- cdata.static_prefix, cdata.const_prefix,
- cdata.dump_gtypes ? "guint8" : "unsigned char",
- name);
- APPEND (gstring, "#endif\n");
-
- APPEND (gstring, "{ \"\"\n /* Pixbuf magic (0x%x) */\n \"",
- GDK_PIXBUF_MAGIC_NUMBER);
- cdata.pos = 3;
- save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
- save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
- APPEND (gstring, "\"\n /* length: header (%d) + pixel_data (%u) */\n \"",
- GDK_PIXDATA_HEADER_LENGTH,
- rle_encoded ? pix_length : rowstride * height);
- cdata.pos = 3;
- save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
- save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
- APPEND (gstring, "\"\n /* pixdata_type (0x%x) */\n \"",
- pixdata->pixdata_type);
- cdata.pos = 3;
- save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
- save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
- APPEND (gstring, "\"\n /* rowstride (%u) */\n \"",
- rowstride);
- cdata.pos = 3;
- save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
- save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
- APPEND (gstring, "\"\n /* width (%u) */\n \"", width);
- cdata.pos = 3;
- save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
- save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
- APPEND (gstring, "\"\n /* height (%u) */\n \"", height);
- cdata.pos = 3;
- save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
- save_uchar (&cdata, *img_buffer++); save_uchar (&cdata, *img_buffer++);
- APPEND (gstring, "\"\n /* pixel_data: */\n");
- }
-
- /* pixel_data intro
- */
- if (cdata.dump_macros)
- {
- APPEND (gstring, "#define %s_%sPIXEL_DATA ((%s*) \\\n",
- macro_name,
- rle_encoded ? "RLE_" : "",
- s_uint_8);
- APPEND (gstring, " \"");
- cdata.pos = 2;
- }
- if (cdata.dump_struct)
- {
- APPEND (gstring, " \"");
- cdata.pos = 3;
- }
- if (cdata.dump_stream)
- {
- APPEND (gstring, " \"");
- cdata.pos = 3;
- }
-
- /* pixel_data
- */
- do
- save_uchar (&cdata, *img_buffer++);
- while (img_buffer < img_buffer_end);
-
- /* pixel_data trailer
- */
- if (cdata.dump_macros)
- APPEND (gstring, "\")\n\n");
- if (cdata.dump_struct)
- APPEND (gstring, "\",\n};\n\n");
- if (cdata.dump_stream)
- APPEND (gstring, "\"};\n\n");
-
- /* dump RLE decoder for macros
- */
- if (cdata.dump_rle_decoder && cdata.dump_macros)
- save_rle_decoder (gstring,
- macro_name,
- cdata.dump_gtypes ? "guint" : "unsigned int",
- cdata.dump_gtypes ? "guint8" : "unsigned char",
- bpp);
-
- /* cleanup
- */
- g_free (stream);
- g_free (macro_name);
-
- return gstring;
-}
-
-/**
- * gdk_pixbuf_new_from_inline:
- * @data_length: Length in bytes of the @data argument or -1 to
- * disable length checks
- * @data: Byte data containing a serialized #GdkPixdata structure
- * @copy_pixels: Whether to copy the pixel data, or use direct pointers
- * @data for the resulting pixbuf
- * @error: #GError return location, may be %NULL to ignore errors
- *
- * Create a #GdkPixbuf from a flat representation that is suitable for
- * storing as inline data in a program. This is useful if you want to
- * ship a program with images, but don't want to depend on any
- * external files.
- *
- * GTK+ ships with a program called <command>gdk-pixbuf-csource</command>
- * which allows for conversion of #GdkPixbufs into such a inline representation.
- * In almost all cases, you should pass the <option>--raw</option> flag to
- * <command>gdk-pixbuf-csource</command>. A sample invocation would be:
- *
- * <informalexample><programlisting>
- * gdk-pixbuf-csource --raw --name=myimage_inline myimage.png
- * </programlisting></informalexample>
- *
- * For the typical case where the inline pixbuf is read-only static data,
- * you don't need to copy the pixel data unless you intend to write to
- * it, so you can pass %FALSE for @copy_pixels. (If you pass
- * <option>--rle</option> to <command>gdk-pixbuf-csource</command>, a copy
- * will be made even if @copy_pixels is %FALSE, so using this option is
- * generally a bad idea.)
- *
- * If you create a pixbuf from const inline data compiled into your
- * program, it's probably safe to ignore errors and disable length checks,
- * since things will always succeed:
- * <informalexample><programlisting>
- * pixbuf = gdk_pixbuf_new_from_inline (-1, myimage_inline, FALSE, NULL);
- * </programlisting></informalexample>
- *
- * For non-const inline data, you could get out of memory. For untrusted
- * inline data located at runtime, you could have corrupt inline data in
- * addition.
- *
- * Return value: A newly-created #GdkPixbuf structure with a reference,
- * count of 1, or %NULL if an error occurred.
- **/
-GdkPixbuf*
-gdk_pixbuf_new_from_inline (gint data_length,
- const guint8 *data,
- gboolean copy_pixels,
- GError **error)
-{
- GdkPixdata pixdata;
-
- if (data_length != -1)
- g_return_val_if_fail (data_length > GDK_PIXDATA_HEADER_LENGTH, NULL);
- g_return_val_if_fail (data != NULL, NULL);
-
- if (!gdk_pixdata_deserialize (&pixdata, data_length, data, error))
- return NULL;
-
- return gdk_pixbuf_from_pixdata (&pixdata, copy_pixels, error);
-}
-
-#define __GDK_PIXDATA_C__
-#include "gdk-pixbuf-aliasdef.c"
diff --git a/gdk-pixbuf/gdk-pixdata.h b/gdk-pixbuf/gdk-pixdata.h
deleted file mode 100644
index eb85034be5..0000000000
--- a/gdk-pixbuf/gdk-pixdata.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/* GdkPixbuf library - GdkPixdata - functions for inlined pixbuf handling
- * Copyright (C) 1999, 2001 Tim Janik
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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_PIXDATA_H__
-#define __GDK_PIXDATA_H__
-
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-G_BEGIN_DECLS
-
-/**
- * GDK_PIXBUF_MAGIC_NUMBER:
- *
- * Magic number for #GdkPixdata structures.
- **/
-#define GDK_PIXBUF_MAGIC_NUMBER (0x47646b50) /* 'GdkP' */
-
-/**
- * GdkPixdataType:
- * @GDK_PIXDATA_COLOR_TYPE_RGB: each pixel has red, green and blue samples.
- * @GDK_PIXDATA_COLOR_TYPE_RGBA: each pixel has red, green and blue samples
- * and an alpha value.
- * @GDK_PIXDATA_COLOR_TYPE_MASK: mask for the colortype flags of the enum.
- * @GDK_PIXDATA_SAMPLE_WIDTH_8: each sample has 8 bits.
- * @GDK_PIXDATA_SAMPLE_WIDTH_MASK: mask for the sample width flags of the enum.
- * @GDK_PIXDATA_ENCODING_RAW: the pixel data is in raw form.
- * @GDK_PIXDATA_ENCODING_RLE: the pixel data is run-length encoded. Runs may
- * be up to 127 bytes long; their length is stored in a single byte
- * preceding the pixel data for the run. If a run is constant, its length
- * byte has the high bit set and the pixel data consists of a single pixel
- * which must be repeated.
- * @GDK_PIXDATA_ENCODING_MASK: mask for the encoding flags of the enum.
- *
- * An enumeration containing three sets of flags for a #GdkPixdata struct:
- * one for the used colorspace, one for the width of the samples and one
- * for the encoding of the pixel data.
- **/
-typedef enum
-{
- /* colorspace + alpha */
- GDK_PIXDATA_COLOR_TYPE_RGB = 0x01,
- GDK_PIXDATA_COLOR_TYPE_RGBA = 0x02,
- GDK_PIXDATA_COLOR_TYPE_MASK = 0xff,
- /* width, support 8bits only currently */
- GDK_PIXDATA_SAMPLE_WIDTH_8 = 0x01 << 16,
- GDK_PIXDATA_SAMPLE_WIDTH_MASK = 0x0f << 16,
- /* encoding */
- GDK_PIXDATA_ENCODING_RAW = 0x01 << 24,
- GDK_PIXDATA_ENCODING_RLE = 0x02 << 24,
- GDK_PIXDATA_ENCODING_MASK = 0x0f << 24
-} GdkPixdataType;
-
-/**
- * GdkPixdata:
- * @magic: magic number. A valid #GdkPixdata structure must have
- * #GDK_PIXBUF_MAGIC_NUMBER here.
- * @length: less than 1 to disable length checks, otherwise
- * #GDK_PIXDATA_HEADER_LENGTH + length of @pixel_data.
- * @pixdata_type: information about colorspace, sample width and
- * encoding, in a #GdkPixdataType.
- * @rowstride: Distance in bytes between rows.
- * @width: Width of the image in pixels.
- * @height: Height of the image in pixels.
- * @pixel_data: @width x @height pixels, encoded according to @pixdata_type
- * and @rowstride.
- *
- * A #GdkPixdata contains pixbuf information in a form suitable for
- * serialization and streaming.
- **/
-typedef struct _GdkPixdata GdkPixdata;
-struct _GdkPixdata
-{
- guint32 magic; /* GDK_PIXBUF_MAGIC_NUMBER */
- gint32 length; /* <1 to disable length checks, otherwise:
- * GDK_PIXDATA_HEADER_LENGTH + pixel_data length
- */
- guint32 pixdata_type; /* GdkPixdataType */
- guint32 rowstride;
- guint32 width;
- guint32 height;
- guint8 *pixel_data;
-};
-
-/**
- * GDK_PIXDATA_HEADER_LENGTH:
- *
- * The length of a #GdkPixdata structure without the @pixel_data pointer.
- **/
-#define GDK_PIXDATA_HEADER_LENGTH (4 + 4 + 4 + 4 + 4 + 4)
-
-/* the returned stream is plain htonl of GdkPixdata members + pixel_data */
-guint8* gdk_pixdata_serialize (const GdkPixdata *pixdata,
- guint *stream_length_p);
-gboolean gdk_pixdata_deserialize (GdkPixdata *pixdata,
- guint stream_length,
- const guint8 *stream,
- GError **error);
-gpointer gdk_pixdata_from_pixbuf (GdkPixdata *pixdata,
- const GdkPixbuf *pixbuf,
- gboolean use_rle);
-GdkPixbuf* gdk_pixbuf_from_pixdata (const GdkPixdata *pixdata,
- gboolean copy_pixels,
- GError **error);
-/**
- * GdkPixdataDumpType:
- * @GDK_PIXDATA_DUMP_PIXDATA_STREAM: Generate pixbuf data stream (a single
- * string containing a serialized #GdkPixdata structure in network byte
- * order).
- * @GDK_PIXDATA_DUMP_PIXDATA_STRUCT: Generate #GdkPixdata structure (needs
- * the #GdkPixdata structure definition from gdk-pixdata.h).
- * @GDK_PIXDATA_DUMP_MACROS: Generate <function>*_ROWSTRIDE</function>,
- * <function>*_WIDTH</function>, <function>*_HEIGHT</function>,
- * <function>*_BYTES_PER_PIXEL</function> and
- * <function>*_RLE_PIXEL_DATA</function> or <function>*_PIXEL_DATA</function>
- * macro definitions for the image.
- * @GDK_PIXDATA_DUMP_GTYPES: Generate GLib data types instead of
- * standard C data types.
- * @GDK_PIXDATA_DUMP_CTYPES: Generate standard C data types instead of
- * GLib data types.
- * @GDK_PIXDATA_DUMP_STATIC: Generate static symbols.
- * @GDK_PIXDATA_DUMP_CONST: Generate const symbols.
- * @GDK_PIXDATA_DUMP_RLE_DECODER: Provide a <function>*_RUN_LENGTH_DECODE(image_buf, rle_data, size, bpp)</function>
- * macro definition to decode run-length encoded image data.
- *
- * An enumeration which is used by gdk_pixdata_to_csource() to
- * determine the form of C source to be generated. The three values
- * @GDK_PIXDATA_DUMP_PIXDATA_STREAM, @GDK_PIXDATA_DUMP_PIXDATA_STRUCT
- * and @GDK_PIXDATA_DUMP_MACROS are mutually exclusive, as are
- * @GDK_PIXBUF_DUMP_GTYPES and @GDK_PIXBUF_DUMP_CTYPES. The remaining
- * elements are optional flags that can be freely added.
- **/
-typedef enum
-{
- /* type of source to save */
- GDK_PIXDATA_DUMP_PIXDATA_STREAM = 0,
- GDK_PIXDATA_DUMP_PIXDATA_STRUCT = 1,
- GDK_PIXDATA_DUMP_MACROS = 2,
- /* type of variables to use */
- GDK_PIXDATA_DUMP_GTYPES = 0,
- GDK_PIXDATA_DUMP_CTYPES = 1 << 8,
- GDK_PIXDATA_DUMP_STATIC = 1 << 9,
- GDK_PIXDATA_DUMP_CONST = 1 << 10,
- /* save RLE decoder macro? */
- GDK_PIXDATA_DUMP_RLE_DECODER = 1 << 16
-} GdkPixdataDumpType;
-
-
-GString* gdk_pixdata_to_csource (GdkPixdata *pixdata,
- const gchar *name,
- GdkPixdataDumpType dump_type);
-
-
-G_END_DECLS
-
-#endif /* __GDK_PIXDATA_H__ */
diff --git a/gdk-pixbuf/gdk_pixbuf.rc.in b/gdk-pixbuf/gdk_pixbuf.rc.in
deleted file mode 100644
index 090b1da3ea..0000000000
--- a/gdk-pixbuf/gdk_pixbuf.rc.in
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <winver.h>
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION @GTK_MAJOR_VERSION@,@GTK_MINOR_VERSION@,@GTK_MICRO_VERSION@,0
- PRODUCTVERSION @GTK_MAJOR_VERSION@,@GTK_MINOR_VERSION@,@GTK_MICRO_VERSION@,0
- FILEFLAGSMASK 0
- FILEFLAGS 0
- FILEOS VOS__WINDOWS32
- FILETYPE VFT_DLL
- FILESUBTYPE VFT2_UNKNOWN
- BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904B0"
- BEGIN
- VALUE "CompanyName", "The GTK developer community"
- VALUE "FileDescription", "GIMP Toolkit"
- VALUE "FileVersion", "@GTK_VERSION@.0"
- VALUE "InternalName", "libgdk_pixbuf-@GTK_API_VERSION@-@LT_CURRENT_MINUS_AGE@"
- VALUE "LegalCopyright", "Copyright (C) 1999 The Free Software Foundation. Modified by the GTK+ Team and others 1999-2005."
- VALUE "OriginalFilename", "libgdk_pixbuf-@GTK_API_VERSION@-@LT_CURRENT_MINUS_AGE@.dll"
- VALUE "ProductName", "GTK+"
- VALUE "ProductVersion", "@GTK_VERSION@"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
- END
diff --git a/gdk-pixbuf/gen-color-table.pl b/gdk-pixbuf/gen-color-table.pl
deleted file mode 100755
index 8b02fe5836..0000000000
--- a/gdk-pixbuf/gen-color-table.pl
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/perl -w
-
-if (@ARGV != 1) {
- die "Usage: gen-color-table.pl rgb.txt > xpm-color-table.h\n";
-}
-
-open IN, $ARGV[0] || die "Cannot open $ARGV[0]: $!\n";
-
-@colors = ();
-while (defined($_ = <IN>)) {
- next if /^!/;
- if (!/^\s*([0-9]+)\s+([0-9]+)\s+([0-9]+)\s+(.*\S)\s+$/) {
- die "Cannot parse line $_";
- }
-
- push @colors, [$1, $2, $3, $4];
-}
-
-@colors = sort { lc($a->[3]) cmp lc($b->[3]) } @colors;
-
-$offset = 0;
-
-$date = gmtime;
-
-print <<EOT;
-/* xpm-color-table.h: Generated by gen-color-table.pl from rgb.txt
- *
- * Date: $date
- *
- * Do not edit.
- */
-static const char color_names[] =
-EOT
-
-for $color (@colors) {
- $name = $color->[3];
-
- if ($offset != 0) {
- print qq(\n);
- }
- print qq( "$name\\0");
-
- $color->[4] = $offset;
- $offset += length($name) + 1;
-}
-
-print ";\n\n";
-
-print <<EOT;
-typedef struct {
- guint16 name_offset;
- guchar red;
- guchar green;
- guchar blue;
-} XPMColorEntry;
-
-static const XPMColorEntry xColors[] = {
-EOT
-
-$i = 0;
-for $color (@colors) {
- $red = $color->[0];
- $green = $color->[1];
- $blue = $color->[2];
- $offset = $color->[4];
-
- if ($i != 0) {
- print ",\n";
- }
- print " { $offset, $red, $green, $blue }";
- $i++;
-}
-
-print "\n};\n";
diff --git a/gdk-pixbuf/io-ani-animation.c b/gdk-pixbuf/io-ani-animation.c
deleted file mode 100644
index fc19b68666..0000000000
--- a/gdk-pixbuf/io-ani-animation.c
+++ /dev/null
@@ -1,347 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/* GdkPixbuf library - ani support
- *
- * Copyright (C) 2002 The Free Software Foundation
- *
- * Author: Matthias Clasen <maclas@gmx.de>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 <errno.h>
-#include "gdk-pixbuf-io.h"
-#include "gdk-pixbuf-private.h"
-#include "io-ani-animation.h"
-
-static void gdk_pixbuf_ani_anim_class_init (GdkPixbufAniAnimClass *klass);
-static void gdk_pixbuf_ani_anim_finalize (GObject *object);
-
-static gboolean gdk_pixbuf_ani_anim_is_static_image (GdkPixbufAnimation *animation);
-static GdkPixbuf* gdk_pixbuf_ani_anim_get_static_image (GdkPixbufAnimation *animation);
-static void gdk_pixbuf_ani_anim_get_size (GdkPixbufAnimation *anim,
- int *width,
- int *height);
-static GdkPixbufAnimationIter* gdk_pixbuf_ani_anim_get_iter (GdkPixbufAnimation *anim,
- const GTimeVal *start_time);
-
-
-
-
-static gpointer parent_class;
-
-GType
-gdk_pixbuf_ani_anim_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type) {
- const GTypeInfo object_info = {
- sizeof (GdkPixbufAniAnimClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gdk_pixbuf_ani_anim_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GdkPixbufAniAnim),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- };
-
- object_type = g_type_register_static (GDK_TYPE_PIXBUF_ANIMATION,
- g_intern_static_string ("GdkPixbufAniAnim"),
- &object_info, 0);
- }
-
- return object_type;
-}
-
-static void
-gdk_pixbuf_ani_anim_class_init (GdkPixbufAniAnimClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GdkPixbufAnimationClass *anim_class = GDK_PIXBUF_ANIMATION_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = gdk_pixbuf_ani_anim_finalize;
-
- anim_class->is_static_image = gdk_pixbuf_ani_anim_is_static_image;
- anim_class->get_static_image = gdk_pixbuf_ani_anim_get_static_image;
- anim_class->get_size = gdk_pixbuf_ani_anim_get_size;
- anim_class->get_iter = gdk_pixbuf_ani_anim_get_iter;
-}
-
-static void
-gdk_pixbuf_ani_anim_finalize (GObject *object)
-{
- GdkPixbufAniAnim *ani_anim = GDK_PIXBUF_ANI_ANIM (object);
- gint i;
-
- for (i = 0; i < ani_anim->n_pixbufs; i++) {
- if (ani_anim->pixbufs[i])
- g_object_unref (ani_anim->pixbufs[i]);
- }
- g_free (ani_anim->pixbufs);
- g_free (ani_anim->sequence);
- g_free (ani_anim->delay);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static gboolean
-gdk_pixbuf_ani_anim_is_static_image (GdkPixbufAnimation *animation)
-{
- GdkPixbufAniAnim *ani_anim;
-
- ani_anim = GDK_PIXBUF_ANI_ANIM (animation);
-
- return ani_anim->n_frames == 1;
-}
-
-static GdkPixbuf*
-gdk_pixbuf_ani_anim_get_static_image (GdkPixbufAnimation *animation)
-{
- GdkPixbufAniAnim *ani_anim;
-
- ani_anim = GDK_PIXBUF_ANI_ANIM (animation);
-
- if (ani_anim->pixbufs == NULL)
- return NULL;
- else
- return ani_anim->pixbufs[0];
-}
-
-static void
-gdk_pixbuf_ani_anim_get_size (GdkPixbufAnimation *anim,
- int *width,
- int *height)
-{
- GdkPixbufAniAnim *ani_anim;
-
- ani_anim = GDK_PIXBUF_ANI_ANIM (anim);
-
- if (width)
- *width = ani_anim->width;
-
- if (height)
- *height = ani_anim->height;
-}
-
-
-static void
-iter_restart (GdkPixbufAniAnimIter *iter)
-{
- iter->current_frame = 0;
- iter->position = 0;
- iter->elapsed = 0;
-}
-
-static GdkPixbufAnimationIter*
-gdk_pixbuf_ani_anim_get_iter (GdkPixbufAnimation *anim,
- const GTimeVal *start_time)
-{
- GdkPixbufAniAnimIter *iter;
-
- iter = g_object_new (GDK_TYPE_PIXBUF_ANI_ANIM_ITER, NULL);
-
- iter->ani_anim = GDK_PIXBUF_ANI_ANIM (anim);
-
- g_object_ref (iter->ani_anim);
-
- iter_restart (iter);
-
- iter->start_time = *start_time;
- iter->current_time = *start_time;
-
- return GDK_PIXBUF_ANIMATION_ITER (iter);
-}
-
-
-
-static void gdk_pixbuf_ani_anim_iter_class_init (GdkPixbufAniAnimIterClass *klass);
-static void gdk_pixbuf_ani_anim_iter_finalize (GObject *object);
-
-static int gdk_pixbuf_ani_anim_iter_get_delay_time (GdkPixbufAnimationIter *iter);
-static GdkPixbuf* gdk_pixbuf_ani_anim_iter_get_pixbuf (GdkPixbufAnimationIter *iter);
-static gboolean gdk_pixbuf_ani_anim_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter);
-static gboolean gdk_pixbuf_ani_anim_iter_advance (GdkPixbufAnimationIter *iter,
- const GTimeVal *current_time);
-
-
-
-static gpointer iter_parent_class;
-
-GType
-gdk_pixbuf_ani_anim_iter_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type) {
- const GTypeInfo object_info = {
- sizeof (GdkPixbufAniAnimIterClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gdk_pixbuf_ani_anim_iter_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GdkPixbufAniAnimIter),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- };
-
- object_type = g_type_register_static (GDK_TYPE_PIXBUF_ANIMATION_ITER,
- g_intern_static_string ("GdkPixbufAniAnimIter"),
- &object_info, 0);
- }
-
- return object_type;
-}
-
-static void
-gdk_pixbuf_ani_anim_iter_class_init (GdkPixbufAniAnimIterClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GdkPixbufAnimationIterClass *anim_iter_class =
- GDK_PIXBUF_ANIMATION_ITER_CLASS (klass);
-
- iter_parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = gdk_pixbuf_ani_anim_iter_finalize;
-
- anim_iter_class->get_delay_time = gdk_pixbuf_ani_anim_iter_get_delay_time;
- anim_iter_class->get_pixbuf = gdk_pixbuf_ani_anim_iter_get_pixbuf;
- anim_iter_class->on_currently_loading_frame = gdk_pixbuf_ani_anim_iter_on_currently_loading_frame;
- anim_iter_class->advance = gdk_pixbuf_ani_anim_iter_advance;
-}
-
-static void
-gdk_pixbuf_ani_anim_iter_finalize (GObject *object)
-{
- GdkPixbufAniAnimIter *iter = GDK_PIXBUF_ANI_ANIM_ITER (object);
-
- g_object_unref (iter->ani_anim);
-
- G_OBJECT_CLASS (iter_parent_class)->finalize (object);
-}
-
-static gboolean
-gdk_pixbuf_ani_anim_iter_advance (GdkPixbufAnimationIter *anim_iter,
- const GTimeVal *current_time)
-{
- GdkPixbufAniAnimIter *iter;
- gint elapsed;
- gint tmp;
- gint old;
-
- iter = GDK_PIXBUF_ANI_ANIM_ITER (anim_iter);
-
- iter->current_time = *current_time;
-
- /* We use milliseconds for all times */
- elapsed =
- (((iter->current_time.tv_sec - iter->start_time.tv_sec) * G_USEC_PER_SEC +
- iter->current_time.tv_usec - iter->start_time.tv_usec)) / 1000;
-
- if (elapsed < 0) {
- /* Try to compensate; probably the system clock
- * was set backwards
- */
- iter->start_time = iter->current_time;
- elapsed = 0;
- }
-
- g_assert (iter->ani_anim->total_time > 0);
-
- /* See how many times we've already played the full animation,
- * and subtract time for that.
- */
- elapsed = elapsed % iter->ani_anim->total_time;
-
- iter->position = elapsed;
-
- /* Now move to the proper frame */
-
- iter->elapsed = 0;
- for (tmp = 0; tmp < iter->ani_anim->n_frames; tmp++) {
- if (iter->position >= iter->elapsed &&
- iter->position < (iter->elapsed + iter->ani_anim->delay[tmp]))
- break;
- iter->elapsed += iter->ani_anim->delay[tmp];
- }
-
- old = iter->current_frame;
-
- iter->current_frame = tmp;
-
- return iter->current_frame != old;
-}
-
-int
-gdk_pixbuf_ani_anim_iter_get_delay_time (GdkPixbufAnimationIter *anim_iter)
-{
- GdkPixbufAniAnimIter *iter;
-
- iter = GDK_PIXBUF_ANI_ANIM_ITER (anim_iter);
-
- return iter->ani_anim->delay[iter->current_frame] - (iter->position - iter->elapsed);
-}
-
-GdkPixbuf*
-gdk_pixbuf_ani_anim_iter_get_pixbuf (GdkPixbufAnimationIter *anim_iter)
-{
- GdkPixbufAniAnimIter *iter;
- gint frame;
-
- iter = GDK_PIXBUF_ANI_ANIM_ITER (anim_iter);
-
- frame = iter->ani_anim->sequence[iter->current_frame];
-
- /* this is necessary if the animation is displayed while loading */
- while (frame > 0 && !iter->ani_anim->pixbufs[frame])
- frame--;
-
- return iter->ani_anim->pixbufs[frame];
-}
-
-static gboolean
-gdk_pixbuf_ani_anim_iter_on_currently_loading_frame (GdkPixbufAnimationIter *anim_iter)
-{
- GdkPixbufAniAnimIter *iter;
- gint frame;
-
- iter = GDK_PIXBUF_ANI_ANIM_ITER (anim_iter);
-
- if (iter->current_frame >= iter->ani_anim->n_frames - 1)
- return TRUE;
-
- frame = iter->ani_anim->sequence[iter->current_frame + 1];
-
- if (!iter->ani_anim->pixbufs[frame])
- return TRUE;
-
- return FALSE;
-}
-
-
-
-
-
-
-
-
-
-
diff --git a/gdk-pixbuf/io-ani-animation.h b/gdk-pixbuf/io-ani-animation.h
deleted file mode 100644
index 88629abf16..0000000000
--- a/gdk-pixbuf/io-ani-animation.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/* GdkPixbuf library - ANI loader declarations
- *
- * Copyright (C) 2002 The Free Software Foundation
- *
- * Author: Matthias Clasen <maclas@gmx.de>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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_ANI_ANIMATION_H
-#define GDK_PIXBUF_ANI_ANIMATION_H
-
-#include "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-animation.h"
-
-typedef struct _GdkPixbufAniAnim GdkPixbufAniAnim;
-typedef struct _GdkPixbufAniAnimClass GdkPixbufAniAnimClass;
-
-#define GDK_TYPE_PIXBUF_ANI_ANIM (gdk_pixbuf_ani_anim_get_type ())
-#define GDK_PIXBUF_ANI_ANIM(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_ANI_ANIM, GdkPixbufAniAnim))
-#define GDK_IS_PIXBUF_ANI_ANIM(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_ANI_ANIM))
-
-#define GDK_PIXBUF_ANI_ANIM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_ANI_ANIM, GdkPixbufAniAnimClass))
-#define GDK_IS_PIXBUF_ANI_ANIM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_ANI_ANIM))
-#define GDK_PIXBUF_ANI_ANIM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_ANI_ANIM, GdkPixbufAniAnimClass))
-
-/* Private part of the GdkPixbufAniAnim structure */
-struct _GdkPixbufAniAnim {
- GdkPixbufAnimation parent_instance;
-
- /* Total length of animation */
- int total_time;
-
- /* Number of frames */
- int n_frames;
-
- /* Number of pixbufs */
- int n_pixbufs;
-
- GdkPixbuf **pixbufs;
-
- /* Maps frame number to pixbuf */
- int *sequence;
-
- /* The duration of each frame, in milliseconds */
- int *delay;
-
- /* bounding box size */
- int width, height;
-};
-
-struct _GdkPixbufAniAnimClass {
- GdkPixbufAnimationClass parent_class;
-
-};
-
-GType gdk_pixbuf_ani_anim_get_type (void) G_GNUC_CONST;
-
-
-
-typedef struct _GdkPixbufAniAnimIter GdkPixbufAniAnimIter;
-typedef struct _GdkPixbufAniAnimIterClass GdkPixbufAniAnimIterClass;
-
-
-#define GDK_TYPE_PIXBUF_ANI_ANIM_ITER (gdk_pixbuf_ani_anim_iter_get_type ())
-#define GDK_PIXBUF_ANI_ANIM_ITER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_ANI_ANIM_ITER, GdkPixbufAniAnimIter))
-#define GDK_IS_PIXBUF_ANI_ANIM_ITER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_ANI_ANIM_ITER))
-
-#define GDK_PIXBUF_ANI_ANIM_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_ANI_ANIM_ITER, GdkPixbufAniAnimIterClass))
-#define GDK_IS_PIXBUF_ANI_ANIM_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_ANI_ANIM_ITER))
-#define GDK_PIXBUF_ANI_ANIM_ITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_ANI_ANIM_ITER, GdkPixbufAniAnimIterClass))
-
-struct _GdkPixbufAniAnimIter {
- GdkPixbufAnimationIter parent_instance;
-
- GdkPixbufAniAnim *ani_anim;
-
- GTimeVal start_time;
- GTimeVal current_time;
-
- /* Time in milliseconds into this run of the animation */
- gint position;
-
- /* Index of the current frame */
- gint current_frame;
-
- /* Time in milliseconds from the start of the animation till the
- begin of the current frame */
- gint elapsed;
-};
-
-struct _GdkPixbufAniAnimIterClass {
- GdkPixbufAnimationIterClass parent_class;
-
-};
-
-GType gdk_pixbuf_ani_anim_iter_get_type (void) G_GNUC_CONST;
-
-#endif
diff --git a/gdk-pixbuf/io-ani.c b/gdk-pixbuf/io-ani.c
deleted file mode 100644
index 0f42868523..0000000000
--- a/gdk-pixbuf/io-ani.c
+++ /dev/null
@@ -1,720 +0,0 @@
-/* -*- mode: C; c-file-style: "linux" -*- */
-/* GdkPixbuf library - ANI image loader
- *
- * Copyright (C) 2002 The Free Software Foundation
- *
- * Authors: Matthias Clasen <maclas@gmx.de>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.
- */
-
-#undef DEBUG_ANI
-
-#include "config.h"
-#include <stdlib.h>
-#include <string.h>
-#include "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-io.h"
-#include "io-ani-animation.h"
-
-static int
-lsb_32 (guchar *src)
-{
- return src[0] | (src[1] << 8) | (src[2] << 16) | (src[3] << 24);
-}
-
-#define MAKE_TAG(a,b,c,d) ( (guint32)d << 24 | \
- (guint32)c << 16 | \
- (guint32)b << 8 | \
- (guint32)a )
-
-#define TAG_RIFF MAKE_TAG('R','I','F','F')
-#define TAG_ACON MAKE_TAG('A','C','O','N')
-#define TAG_LIST MAKE_TAG('L','I','S','T')
-#define TAG_INAM MAKE_TAG('I','N','A','M')
-#define TAG_IART MAKE_TAG('I','A','R','T')
-#define TAG_anih MAKE_TAG('a','n','i','h')
-#define TAG_seq MAKE_TAG('s','e','q',' ')
-#define TAG_rate MAKE_TAG('r','a','t','e')
-#define TAG_icon MAKE_TAG('i','c','o','n')
-
-typedef struct _AniLoaderContext
-{
- guint32 cp;
-
- guchar *buffer;
- guchar *byte;
- guint n_bytes;
- guint buffer_size;
-
- GdkPixbufModulePreparedFunc prepared_func;
- GdkPixbufModuleUpdatedFunc updated_func;
- gpointer user_data;
-
- guint32 data_size;
-
- guint32 HeaderSize;
- guint32 NumFrames;
- guint32 NumSteps;
- guint32 Width;
- guint32 Height;
- guint32 BitCount;
- guint32 NumPlanes;
- guint32 DisplayRate;
- guint32 Flags;
-
- guint32 chunk_id;
- guint32 chunk_size;
-
- gchar *title;
- gchar *author;
-
- GdkPixbufAniAnim *animation;
- GdkPixbufLoader *loader;
-
- int pos;
-} AniLoaderContext;
-
-
-#define BYTES_LEFT(context) \
- ((context)->n_bytes - ((context)->byte - (context)->buffer))
-
-static void
-read_int8 (AniLoaderContext *context,
- guchar *data,
- int count)
-{
- int total = MIN (count, BYTES_LEFT (context));
- memcpy (data, context->byte, total);
- context->byte += total;
- context->cp += total;
-}
-
-
-static guint32
-read_int32 (AniLoaderContext *context)
-{
- guint32 result;
-
- read_int8 (context, (guchar*) &result, 4);
- return lsb_32 ((guchar *) &result);
-}
-
-static void
-context_free (AniLoaderContext *context)
-{
- if (!context)
- return;
-
- if (context->loader)
- {
- gdk_pixbuf_loader_close (context->loader, NULL);
- g_object_unref (context->loader);
- }
- if (context->animation)
- g_object_unref (context->animation);
- g_free (context->buffer);
- g_free (context->title);
- g_free (context->author);
-
- g_free (context);
-}
-
-static void
-prepared_callback (GdkPixbufLoader *loader,
- gpointer data)
-{
- AniLoaderContext *context = (AniLoaderContext*)data;
-
-#ifdef DEBUG_ANI
- g_print ("%d pixbuf prepared\n", context->pos);
-#endif
-
- GdkPixbuf *pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
- if (!pixbuf)
- return;
-
- if (gdk_pixbuf_get_width (pixbuf) > context->animation->width)
- context->animation->width = gdk_pixbuf_get_width (pixbuf);
-
- if (gdk_pixbuf_get_height (pixbuf) > context->animation->height)
- context->animation->height = gdk_pixbuf_get_height (pixbuf);
-
- if (context->title != NULL)
- gdk_pixbuf_set_option (pixbuf, "Title", context->title);
-
- if (context->author != NULL)
- gdk_pixbuf_set_option (pixbuf, "Author", context->author);
-
- g_object_ref (pixbuf);
- context->animation->pixbufs[context->pos] = pixbuf;
-
- if (context->pos == 0)
- {
- if (context->prepared_func)
- (* context->prepared_func) (pixbuf,
- GDK_PIXBUF_ANIMATION (context->animation),
- context->user_data);
- }
- else {
- /* FIXME - this is necessary for nice display of loading
- animations because GtkImage ignores
- gdk_pixbuf_animation_iter_on_currently_loading_frame()
- and always exposes the full frame */
- GdkPixbuf *last = context->animation->pixbufs[context->pos - 1];
- gint width = MIN (gdk_pixbuf_get_width (last), gdk_pixbuf_get_width (pixbuf));
- gint height = MIN (gdk_pixbuf_get_height (last), gdk_pixbuf_get_height (pixbuf));
- gdk_pixbuf_copy_area (last, 0, 0, width, height, pixbuf, 0, 0);
- }
-
- context->pos++;
-}
-
-static void
-updated_callback (GdkPixbufLoader* loader,
- gint x, gint y, gint width, gint height,
- gpointer data)
-{
- AniLoaderContext *context = (AniLoaderContext*)data;
-
- GdkPixbuf *pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
-
- if (context->updated_func)
- (* context->updated_func) (pixbuf,
- x, y, width, height,
- context->user_data);
-}
-
-static gboolean
-ani_load_chunk (AniLoaderContext *context, GError **error)
-{
- int i;
-
- if (context->chunk_id == 0x0) {
- if (BYTES_LEFT (context) < 8)
- return FALSE;
- context->chunk_id = read_int32 (context);
- context->chunk_size = read_int32 (context);
- /* Pad it up to word length */
- if (context->chunk_size % 2)
- context->chunk_size += (2 - (context->chunk_size % 2));
-
- }
-
- while (context->chunk_id == TAG_LIST)
- {
- if (BYTES_LEFT (context) < 12)
- return FALSE;
-
- read_int32 (context);
- context->chunk_id = read_int32 (context);
- context->chunk_size = read_int32 (context);
- /* Pad it up to word length */
- if (context->chunk_size % 2)
- context->chunk_size += (2 - (context->chunk_size % 2));
-
- }
-
- if (context->chunk_id == TAG_icon)
- {
- GError *loader_error = NULL;
- guchar *data;
- guint32 towrite;
-
- if (context->loader == NULL)
- {
- if (context->pos >= context->NumFrames)
- {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Unexpected icon chunk in animation"));
- return FALSE;
- }
-
-#ifdef DEBUG_ANI
- g_print ("opening loader\n");
-#endif
- context->loader = gdk_pixbuf_loader_new_with_type ("ico", &loader_error);
- if (loader_error)
- {
- g_propagate_error (error, loader_error);
- return FALSE;
- }
- g_signal_connect (context->loader, "area_prepared",
- G_CALLBACK (prepared_callback), context);
- g_signal_connect (context->loader, "area_updated",
- G_CALLBACK (updated_callback), context);
- }
-
- towrite = MIN (context->chunk_size, BYTES_LEFT (context));
- data = context->byte;
- context->byte += towrite;
- context->cp += towrite;
-#ifdef DEBUG_ANI
- g_print ("miss %d, get %d, leftover %d\n", context->chunk_size, towrite, BYTES_LEFT (context));
-#endif
- context->chunk_size -= towrite;
- if (!gdk_pixbuf_loader_write (context->loader, data, towrite, &loader_error))
- {
- g_propagate_error (error, loader_error);
- gdk_pixbuf_loader_close (context->loader, NULL);
- g_object_unref (context->loader);
- context->loader = NULL;
- return FALSE;
- }
- if (context->chunk_size == 0)
- {
-#ifdef DEBUG_ANI
- g_print ("closing loader\n");
-#endif
- if (!gdk_pixbuf_loader_close (context->loader, &loader_error))
- {
- g_propagate_error (error, loader_error);
- g_object_unref (context->loader);
- context->loader = NULL;
- return FALSE;
- }
- g_object_unref (context->loader);
- context->loader = NULL;
- context->chunk_id = 0x0;
- }
- return BYTES_LEFT (context) > 0;
- }
-
- if (BYTES_LEFT (context) < context->chunk_size)
- return FALSE;
-
- if (context->chunk_id == TAG_anih)
- {
- context->HeaderSize = read_int32 (context);
- context->NumFrames = read_int32 (context);
- context->NumSteps = read_int32 (context);
- context->Width = read_int32 (context);
- context->Height = read_int32 (context);
- context->BitCount = read_int32 (context);
- context->NumPlanes = read_int32 (context);
- context->DisplayRate = read_int32 (context);
- context->Flags = read_int32 (context);
-
-#ifdef DEBUG_ANI
- g_print ("HeaderSize \t%" G_GUINT32_FORMAT
- "\nNumFrames \t%" G_GUINT32_FORMAT
- "\nNumSteps \t%" G_GUINT32_FORMAT
- "\nWidth \t%" G_GUINT32_FORMAT
- "\nHeight \t%" G_GUINT32_FORMAT
- "\nBitCount \t%" G_GUINT32_FORMAT
- "\nNumPlanes \t%" G_GUINT32_FORMAT
- "\nDisplayRate \t%" G_GUINT32_FORMAT
- "\nSequenceFlag \t%d"
- "\nIconFlag \t%d"
- "\n",
- context->HeaderSize, context->NumFrames,
- context->NumSteps, context->Width,
- context->Height, context->BitCount,
- context->NumPlanes, context->DisplayRate,
- (context->Flags & 0x2) != 0,
- (context->Flags & 0x1) != 0);
-#endif
- if (!(context->Flags & 0x2))
- {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Unsupported animation type"));
- return FALSE;
- }
- if (context->NumFrames == 0 ||
- context->NumFrames >= 1024 ||
- context->NumSteps == 0 ||
- context->NumSteps >= 1024)
- {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Invalid header in animation"));
- return FALSE;
- }
-
- context->animation = g_object_new (GDK_TYPE_PIXBUF_ANI_ANIM, NULL);
- if (!context->animation)
- {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Not enough memory to load animation"));
- return FALSE;
- }
-
- context->animation->n_pixbufs = context->NumFrames;
- context->animation->n_frames = context->NumSteps;
-
- context->animation->total_time = context->NumSteps * (context->DisplayRate * 1000 / 60);
- context->animation->width = 0;
- context->animation->height = 0;
-
- context->animation->pixbufs = g_try_new0 (GdkPixbuf*, context->NumFrames);
- context->animation->delay = g_try_new (gint, context->NumSteps);
- context->animation->sequence = g_try_new (gint, context->NumSteps);
-
- if (!context->animation->pixbufs ||
- !context->animation->delay ||
- !context->animation->sequence)
- {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Not enough memory to load animation"));
- return FALSE;
- }
-
- for (i = 0; i < context->NumSteps; i++)
- {
- /* default values if the corresponding chunks are absent */
- context->animation->delay[i] = context->DisplayRate * 1000 / 60;
- context->animation->sequence[i] = MIN (i, context->NumFrames - 1);
- }
- }
- else if (context->chunk_id == TAG_rate)
- {
- if (context->chunk_size != 4 * context->NumSteps)
- {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Malformed chunk in animation"));
- return FALSE;
- }
- if (!context->animation)
- {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Invalid header in animation"));
- return FALSE;
- }
-
- context->animation->total_time = 0;
- for (i = 0; i < context->NumSteps; i++)
- {
- context->animation->delay[i] = read_int32 (context) * 1000 / 60;
- context->animation->total_time += context->animation->delay[i];
- }
- }
- else if (context->chunk_id == TAG_seq)
- {
- if (context->chunk_size != 4 * context->NumSteps)
- {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Malformed chunk in animation"));
- return FALSE;
- }
- if (!context->animation)
- {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Invalid header in animation"));
- return FALSE;
- }
- for (i = 0; i < context->NumSteps; i++)
- {
- context->animation->sequence[i] = read_int32 (context);
- if (context->animation->sequence[i] >= context->NumFrames)
- {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Malformed chunk in animation"));
- return FALSE;
- }
- }
- }
- else if (context->chunk_id == TAG_INAM)
- {
- if (!context->animation)
- {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Invalid header in animation"));
- return FALSE;
- }
- context->title = g_try_malloc (context->chunk_size + 1);
- if (!context->title)
- {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Not enough memory to load animation"));
- return FALSE;
- }
- context->title[context->chunk_size] = 0;
- read_int8 (context, (guchar *)context->title, context->chunk_size);
-#ifdef DEBUG_ANI
- g_print ("INAM %s\n", context->title);
-#endif
- for (i = 0; i < context->pos; i++)
- gdk_pixbuf_set_option (context->animation->pixbufs[i], "Title", context->title);
- }
- else if (context->chunk_id == TAG_IART)
- {
- if (!context->animation)
- {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Invalid header in animation"));
- return FALSE;
- }
- context->author = g_try_malloc (context->chunk_size + 1);
- if (!context->author)
- {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Not enough memory to load animation"));
- return FALSE;
- }
- context->author[context->chunk_size] = 0;
- read_int8 (context, (guchar *)context->author, context->chunk_size);
-#ifdef DEBUG_ANI
- g_print ("IART %s\n", context->author);
-#endif
- for (i = 0; i < context->pos; i++)
- gdk_pixbuf_set_option (context->animation->pixbufs[i], "Author", context->author);
- }
-
-#ifdef DEBUG_ANI
- {
- gint32 dummy = lsb_32 ((guchar *)&context->chunk_id);
-
- g_print ("Loaded chunk with ID '%c%c%c%c' and length %" G_GUINT32_FORMAT "\n",
- ((char*)&dummy)[0], ((char*)&dummy)[1],
- ((char*)&dummy)[2], ((char*)&dummy)[3],
- context->chunk_size);
- }
-#endif
-
- context->chunk_id = 0x0;
- return TRUE;
-}
-
-static gboolean
-gdk_pixbuf__ani_image_load_increment (gpointer data,
- const guchar *buf, guint size,
- GError **error)
-{
- AniLoaderContext *context = (AniLoaderContext *)data;
-
- if (context->n_bytes + size >= context->buffer_size) {
- int drop = context->byte - context->buffer;
- memmove (context->buffer, context->byte, context->n_bytes - drop);
- context->n_bytes -= drop;
- context->byte = context->buffer;
- if (context->n_bytes + size >= context->buffer_size) {
- guchar *tmp;
- context->buffer_size = MAX (context->n_bytes + size, context->buffer_size + 4096);
-#ifdef DEBUG_ANI
- g_print ("growing buffer to %" G_GUINT32_FORMAT "\n", context->buffer_size);
-#endif
- tmp = g_try_realloc (context->buffer, context->buffer_size);
- if (!tmp)
- {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Not enough memory to load animation"));
- return FALSE;
- }
- context->byte = context->buffer = tmp;
- }
- }
- memcpy (context->buffer + context->n_bytes, buf, size);
- context->n_bytes += size;
-
- if (context->data_size == 0)
- {
- guint32 riff_id, chunk_id;
-
- if (BYTES_LEFT (context) < 12)
- return TRUE;
-
- riff_id = read_int32 (context);
- context->data_size = read_int32 (context);
- chunk_id = read_int32 (context);
-
- if (riff_id != TAG_RIFF ||
- context->data_size == 0 ||
- chunk_id != TAG_ACON)
- {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Invalid header in animation"));
- return FALSE;
- }
- }
-
- if (context->cp < context->data_size + 8)
- {
- GError *chunk_error = NULL;
-
- while (ani_load_chunk (context, &chunk_error)) ;
- if (chunk_error)
- {
- g_propagate_error (error, chunk_error);
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-static gpointer
-gdk_pixbuf__ani_image_begin_load (GdkPixbufModuleSizeFunc size_func,
- GdkPixbufModulePreparedFunc prepared_func,
- GdkPixbufModuleUpdatedFunc updated_func,
- gpointer user_data,
- GError **error)
-{
- AniLoaderContext *context;
-
- context = g_new0 (AniLoaderContext, 1);
-
- context->prepared_func = prepared_func;
- context->updated_func = updated_func;
- context->user_data = user_data;
-
- context->pos = 0;
-
- context->buffer_size = 4096;
- context->buffer = g_try_malloc (context->buffer_size);
- if (!context->buffer)
- {
- context_free (context);
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Not enough memory to load animation"));
- return NULL;
- }
-
- context->byte = context->buffer;
- context->n_bytes = 0;
-
- return (gpointer) context;
-}
-
-static gboolean
-gdk_pixbuf__ani_image_stop_load (gpointer data,
- GError **error)
-{
- AniLoaderContext *context = (AniLoaderContext *) data;
-
- g_return_val_if_fail (context != NULL, TRUE);
- context_free (context);
-
- return TRUE;
-}
-
-static void
-prepared_notify (GdkPixbuf *pixbuf,
- GdkPixbufAnimation *anim,
- gpointer user_data)
-{
- if (anim != NULL)
- g_object_ref (anim);
- *((GdkPixbufAnimation **)user_data) = anim;
-}
-
-static GdkPixbufAnimation *
-gdk_pixbuf__ani_image_load_animation (FILE *f, GError **error)
-{
- guchar buffer[4096];
- size_t length;
- GdkPixbufAnimation *anim = NULL;
- gpointer context;
-
- context = gdk_pixbuf__ani_image_begin_load (NULL, prepared_notify,
- NULL, &anim, error);
-
- if (!context)
- return NULL;
-
- while (!feof (f) && !ferror (f)) {
- length = fread (buffer, 1, sizeof (buffer), f);
- if (length > 0)
- if (!gdk_pixbuf__ani_image_load_increment (context, buffer, length, error)) {
- gdk_pixbuf__ani_image_stop_load (context, NULL);
- if (anim != NULL)
- g_object_unref (anim);
- return NULL;
- }
- }
-
- if (!gdk_pixbuf__ani_image_stop_load (context, error)) {
- if (anim != NULL)
- g_object_unref (anim);
- return NULL;
- }
-
- return anim;
-}
-
-#ifndef INCLUDE_ani
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__ani_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
-{
- module->load_animation = gdk_pixbuf__ani_image_load_animation;
- module->begin_load = gdk_pixbuf__ani_image_begin_load;
- module->stop_load = gdk_pixbuf__ani_image_stop_load;
- module->load_increment = gdk_pixbuf__ani_image_load_increment;
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
-{
- static GdkPixbufModulePattern signature[] = {
- { "RIFF ACON", " xxxx ", 100 },
- { NULL, NULL, 0 }
- };
- static gchar * mime_types[] = {
- "application/x-navi-animation",
- NULL
- };
- static gchar * extensions[] = {
- "ani",
- NULL
- };
-
- info->name = "ani";
- info->signature = signature;
- info->description = N_("The ANI image format");
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "LGPL";
-}
-
-
-
-
diff --git a/gdk-pixbuf/io-bmp.c b/gdk-pixbuf/io-bmp.c
deleted file mode 100644
index e654d1f7d5..0000000000
--- a/gdk-pixbuf/io-bmp.c
+++ /dev/null
@@ -1,1429 +0,0 @@
-/* -*- mode: C; c-file-style: "linux" -*- */
-/* GdkPixbuf library - Windows Bitmap image loader
- *
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Authors: Arjan van de Ven <arjan@fenrus.demon.nl>
- * Federico Mena-Quintero <federico@gimp.org>
- *
- * Based on io-ras.c
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 <stdio.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <string.h>
-#include "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-io.h"
-
-#define DUMPBIH 0
-
-
-
-#if 0
-/* If these structures were unpacked, they would define the two headers of the
- * BMP file. After them comes the palette, and then the image data.
- *
- * We do not use these structures; we just keep them here for reference.
- */
-struct BitmapFileHeader {
- guint16 magic;
- guint32 file_size;
- guint32 reserved;
- guint32 data_offset;
-};
-
-struct BitmapInfoHeader {
- guint32 header_size;
- guint32 width;
- guint32 height;
- guint16 planes;
- guint16 bpp;
- guint32 compression;
- guint32 data_size;
- guint32 x_ppm;
- guint32 y_ppm;
- guint32 n_colors;
- guint32 n_important_colors;
-};
-#endif
-
-/* Compression values */
-
-#define BI_RGB 0
-#define BI_RLE8 1
-#define BI_RLE4 2
-#define BI_BITFIELDS 3
-
-/* State machine */
-typedef enum {
- READ_STATE_HEADERS, /* Reading the bitmap file header and bitmap info header */
- READ_STATE_PALETTE, /* Reading the palette */
- READ_STATE_BITMASKS, /* Reading the bitmasks for BI_BITFIELDS */
- READ_STATE_DATA, /* Reading the actual image data */
- READ_STATE_ERROR, /* An error occurred; further data will be ignored */
- READ_STATE_DONE /* Done reading the image; further data will be ignored */
-} ReadState;
-
-/*
-
-DumpBIH printf's the values in a BitmapInfoHeader to the screen, for
-debugging purposes.
-
-*/
-#if DUMPBIH
-static void DumpBIH(unsigned char *BIH)
-{
- printf("biSize = %i \n",
- (int) (BIH[3] << 24) + (BIH[2] << 16) + (BIH[1] << 8) +
- (BIH[0]));
- printf("biWidth = %i \n",
- (int) (BIH[7] << 24) + (BIH[6] << 16) + (BIH[5] << 8) +
- (BIH[4]));
- printf("biHeight = %i \n",
- (int) (BIH[11] << 24) + (BIH[10] << 16) + (BIH[9] << 8) +
- (BIH[8]));
- printf("biPlanes = %i \n", (int) (BIH[13] << 8) + (BIH[12]));
- printf("biBitCount = %i \n", (int) (BIH[15] << 8) + (BIH[14]));
- printf("biCompress = %i \n",
- (int) (BIH[19] << 24) + (BIH[18] << 16) + (BIH[17] << 8) +
- (BIH[16]));
- printf("biSizeImage = %i \n",
- (int) (BIH[23] << 24) + (BIH[22] << 16) + (BIH[21] << 8) +
- (BIH[20]));
- printf("biXPels = %i \n",
- (int) (BIH[27] << 24) + (BIH[26] << 16) + (BIH[25] << 8) +
- (BIH[24]));
- printf("biYPels = %i \n",
- (int) (BIH[31] << 24) + (BIH[30] << 16) + (BIH[29] << 8) +
- (BIH[28]));
- printf("biClrUsed = %i \n",
- (int) (BIH[35] << 24) + (BIH[34] << 16) + (BIH[33] << 8) +
- (BIH[32]));
- printf("biClrImprtnt= %i \n",
- (int) (BIH[39] << 24) + (BIH[38] << 16) + (BIH[37] << 8) +
- (BIH[36]));
-}
-#endif
-/* struct headerpair contains the decoded width/height/depth info for
- the current bitmap */
-
-struct headerpair {
- guint32 size;
- gint32 width;
- gint32 height;
- guint depth;
- guint Negative; /* Negative = 1 -> top down BMP,
- Negative = 0 -> bottom up BMP */
- guint n_colors;
-};
-
-/* Data needed for the "state" during decompression */
-struct bmp_compression_state {
- gint phase;
- gint run;
- gint count;
- gint x, y;
- guchar *p;
-};
-
-/* Progressive loading */
-
-struct bmp_progressive_state {
- GdkPixbufModuleSizeFunc size_func;
- GdkPixbufModulePreparedFunc prepared_func;
- GdkPixbufModuleUpdatedFunc updated_func;
- gpointer user_data;
-
- ReadState read_state;
-
- guint LineWidth;
- guint Lines; /* # of finished lines */
-
- guchar *buff;
- guint BufferSize;
- guint BufferPadding;
- guint BufferDone;
-
- guchar (*Colormap)[3];
-
- gint Type; /*
- 32 = RGB + alpha
- 24 = RGB
- 16 = RGB
- 4 = 4 bpp colormapped
- 8 = 8 bpp colormapped
- 1 = 1 bit bitonal
- */
- guint Compressed;
- struct bmp_compression_state compr;
-
-
- struct headerpair Header; /* Decoded (BE->CPU) header */
-
- /* Bit masks, shift amounts, and significant bits for BI_BITFIELDS coding */
- int r_mask, r_shift, r_bits;
- int g_mask, g_shift, g_bits;
- int b_mask, b_shift, b_bits;
- int a_mask, a_shift, a_bits;
-
- GdkPixbuf *pixbuf; /* Our "target" */
-};
-
-static gpointer
-gdk_pixbuf__bmp_image_begin_load(GdkPixbufModuleSizeFunc size_func,
- GdkPixbufModulePreparedFunc prepared_func,
- GdkPixbufModuleUpdatedFunc updated_func,
- gpointer user_data,
- GError **error);
-
-static gboolean gdk_pixbuf__bmp_image_stop_load(gpointer data, GError **error);
-static gboolean gdk_pixbuf__bmp_image_load_increment(gpointer data,
- const guchar * buf,
- guint size,
- GError **error);
-
-
-/* Picks up a 32-bit little-endian integer starting at the specified location.
- * Does it by hand instead of dereferencing a simple (gint *) cast due to
- * alignment constraints many platforms.
- */
-static int
-lsb_32 (guchar *src)
-{
- return src[0] | (src[1] << 8) | (src[2] << 16) | (src[3] << 24);
-}
-
-/* Same as above, but for 16-bit little-endian integers. */
-static short
-lsb_16 (guchar *src)
-{
- return src[0] | (src[1] << 8);
-}
-
-static gboolean grow_buffer (struct bmp_progressive_state *State,
- GError **error)
-{
- guchar *tmp;
-
- if (State->BufferSize == 0) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("BMP image has bogus header data"));
- State->read_state = READ_STATE_ERROR;
- return FALSE;
- }
-
- tmp = g_try_realloc (State->buff, State->BufferSize);
-
- if (!tmp) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Not enough memory to load bitmap image"));
- State->read_state = READ_STATE_ERROR;
- return FALSE;
- }
-
- State->buff = tmp;
- return TRUE;
-}
-
-static gboolean
-decode_bitmasks (guchar *buf,
- struct bmp_progressive_state *State,
- GError **error);
-
-static gboolean DecodeHeader(unsigned char *BFH, unsigned char *BIH,
- struct bmp_progressive_state *State,
- GError **error)
-{
- gint clrUsed;
-
- /* First check for the two first bytes content. A sane
- BMP file must start with bytes 0x42 0x4D. */
- if (*BFH != 0x42 || *(BFH + 1) != 0x4D) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("BMP image has bogus header data"));
- State->read_state = READ_STATE_ERROR;
- return FALSE;
- }
-
- /* FIXME this is totally unrobust against bogus image data. */
- if (State->BufferSize < lsb_32 (&BIH[0]) + 14) {
- State->BufferSize = lsb_32 (&BIH[0]) + 14;
- if (!grow_buffer (State, error))
- return FALSE;
- return TRUE;
- }
-
-#if DUMPBIH
- DumpBIH(BIH);
-#endif
-
- State->Header.size = lsb_32 (&BIH[0]);
- if (State->Header.size == 124) {
- /* BMP v5 */
- State->Header.width = lsb_32 (&BIH[4]);
- State->Header.height = lsb_32 (&BIH[8]);
- State->Header.depth = lsb_16 (&BIH[14]);
- State->Compressed = lsb_32 (&BIH[16]);
- } else if (State->Header.size == 108) {
- /* BMP v4 */
- State->Header.width = lsb_32 (&BIH[4]);
- State->Header.height = lsb_32 (&BIH[8]);
- State->Header.depth = lsb_16 (&BIH[14]);
- State->Compressed = lsb_32 (&BIH[16]);
- } else if (State->Header.size == 64) {
- /* BMP OS/2 v2 */
- State->Header.width = lsb_32 (&BIH[4]);
- State->Header.height = lsb_32 (&BIH[8]);
- State->Header.depth = lsb_16 (&BIH[14]);
- State->Compressed = lsb_32 (&BIH[16]);
- } else if (State->Header.size == 40) {
- /* BMP v3 */
- State->Header.width = lsb_32 (&BIH[4]);
- State->Header.height = lsb_32 (&BIH[8]);
- State->Header.depth = lsb_16 (&BIH[14]);
- State->Compressed = lsb_32 (&BIH[16]);
- } else if (State->Header.size == 12) {
- /* BMP OS/2 */
- State->Header.width = lsb_16 (&BIH[4]);
- State->Header.height = lsb_16 (&BIH[6]);
- State->Header.depth = lsb_16 (&BIH[10]);
- State->Compressed = BI_RGB;
- } else {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("BMP image has unsupported header size"));
- State->read_state = READ_STATE_ERROR;
- return FALSE;
- }
-
- if (State->Header.size == 12)
- clrUsed = 1 << State->Header.depth;
- else
- clrUsed = (int) (BIH[35] << 24) + (BIH[34] << 16) + (BIH[33] << 8) + (BIH[32]);
-
- if (clrUsed != 0)
- State->Header.n_colors = clrUsed;
- else
- State->Header.n_colors = (1 << State->Header.depth);
-
- if (State->Header.n_colors > (1 << State->Header.depth)) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("BMP image has bogus header data"));
- State->read_state = READ_STATE_ERROR;
- return FALSE;
- }
-
- State->Type = State->Header.depth; /* This may be less trivial someday */
-
- /* Negative heights indicates bottom-down pixelorder */
- if (State->Header.height < 0) {
- State->Header.height = -State->Header.height;
- State->Header.Negative = 1;
- }
-
- if (State->Header.Negative &&
- (State->Compressed != BI_RGB && State->Compressed != BI_BITFIELDS))
- {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Topdown BMP images cannot be compressed"));
- State->read_state = READ_STATE_ERROR;
- return FALSE;
- }
-
- if (State->Header.width <= 0 || State->Header.height == 0 ||
- (State->Compressed == BI_RLE4 && State->Type != 4) ||
- (State->Compressed == BI_RLE8 && State->Type != 8) ||
- (State->Compressed == BI_BITFIELDS && !(State->Type == 16 || State->Type == 32)) ||
- (State->Compressed > BI_BITFIELDS)) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("BMP image has bogus header data"));
- State->read_state = READ_STATE_ERROR;
- return FALSE;
- }
-
- if (State->Type == 32)
- State->LineWidth = State->Header.width * 4;
- else if (State->Type == 24)
- State->LineWidth = State->Header.width * 3;
- else if (State->Type == 16)
- State->LineWidth = State->Header.width * 2;
- else if (State->Type == 8)
- State->LineWidth = State->Header.width * 1;
- else if (State->Type == 4)
- State->LineWidth = (State->Header.width + 1) / 2;
- else if (State->Type == 1) {
- State->LineWidth = State->Header.width / 8;
- if ((State->Header.width & 7) != 0)
- State->LineWidth++;
- } else {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("BMP image has bogus header data"));
- State->read_state = READ_STATE_ERROR;
- return FALSE;
- }
-
- /* Pad to a 32 bit boundary */
- if (((State->LineWidth % 4) > 0)
- && (State->Compressed == BI_RGB || State->Compressed == BI_BITFIELDS))
- State->LineWidth = (State->LineWidth / 4) * 4 + 4;
-
- if (State->pixbuf == NULL) {
- if (State->size_func) {
- gint width = State->Header.width;
- gint height = State->Header.height;
-
- (*State->size_func) (&width, &height, State->user_data);
- if (width == 0 || height == 0) {
- State->read_state = READ_STATE_DONE;
- State->BufferSize = 0;
- return TRUE;
- }
- }
-
- if (State->Type == 32 ||
- State->Compressed == BI_RLE4 ||
- State->Compressed == BI_RLE8)
- State->pixbuf =
- gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8,
- (gint) State->Header.width,
- (gint) State->Header.height);
- else
- State->pixbuf =
- gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8,
- (gint) State->Header.width,
- (gint) State->Header.height);
-
- if (State->pixbuf == NULL) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Not enough memory to load bitmap image"));
- State->read_state = READ_STATE_ERROR;
- return FALSE;
- }
-
- if (State->prepared_func != NULL)
- /* Notify the client that we are ready to go */
- (*State->prepared_func) (State->pixbuf, NULL, State->user_data);
-
- /* make all pixels initially transparent */
- if (State->Compressed == BI_RLE4 || State->Compressed == BI_RLE8) {
- memset (State->pixbuf->pixels, 0, State->pixbuf->rowstride * State->Header.height);
- State->compr.p = State->pixbuf->pixels
- + State->pixbuf->rowstride * (State->Header.height- 1);
- }
- }
-
- State->BufferDone = 0;
- if (State->Type <= 8) {
- gint samples;
-
- State->read_state = READ_STATE_PALETTE;
-
- /* Allocate enough to hold the palette */
- samples = (State->Header.size == 12 ? 3 : 4);
- State->BufferSize = State->Header.n_colors * samples;
-
- /* Skip over everything between the palette and the data.
- This protects us against a malicious BFH[10] value.
- */
- State->BufferPadding = (lsb_32 (&BFH[10]) - 14 - State->Header.size) - State->BufferSize;
-
- } else if (State->Compressed == BI_RGB) {
- if (State->BufferSize < lsb_32 (&BFH[10]))
- {
- /* skip over padding between headers and image data */
- State->read_state = READ_STATE_HEADERS;
- State->BufferDone = State->BufferSize;
- State->BufferSize = lsb_32 (&BFH[10]);
- }
- else
- {
- State->read_state = READ_STATE_DATA;
- State->BufferSize = State->LineWidth;
- }
- } else if (State->Compressed == BI_BITFIELDS) {
- if (State->Header.size == 108 || State->Header.size == 124)
- {
- /* v4 and v5 have the bitmasks in the header */
- if (!decode_bitmasks (&BIH[40], State, error)) {
- State->read_state = READ_STATE_ERROR;
- return FALSE;
- }
- }
- else
- {
- State->read_state = READ_STATE_BITMASKS;
- State->BufferSize = 12;
- }
- } else {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("BMP image has bogus header data"));
- State->read_state = READ_STATE_ERROR;
- return FALSE;
- }
-
- if (!grow_buffer (State, error))
- return FALSE;
-
- return TRUE;
-}
-
-static gboolean DecodeColormap (guchar *buff,
- struct bmp_progressive_state *State,
- GError **error)
-{
- gint i;
- gint samples;
-
- g_assert (State->read_state == READ_STATE_PALETTE);
-
- samples = (State->Header.size == 12 ? 3 : 4);
- if (State->BufferSize < State->Header.n_colors * samples) {
- State->BufferSize = State->Header.n_colors * samples;
- if (!grow_buffer (State, error))
- return FALSE;
- return TRUE;
- }
-
- State->Colormap = g_malloc0 ((1 << State->Header.depth) * sizeof (*State->Colormap));
- for (i = 0; i < State->Header.n_colors; i++)
-
- {
- State->Colormap[i][0] = buff[i * samples];
- State->Colormap[i][1] = buff[i * samples + 1];
- State->Colormap[i][2] = buff[i * samples + 2];
-#ifdef DUMPCMAP
- g_print ("color %d %x %x %x\n", i,
- State->Colormap[i][0],
- State->Colormap[i][1],
- State->Colormap[i][2]);
-#endif
- }
-
- State->read_state = READ_STATE_DATA;
-
- State->BufferDone = 0;
- if (!(State->Compressed == BI_RGB || State->Compressed == BI_BITFIELDS))
- State->BufferSize = 2;
- else
- State->BufferSize = State->LineWidth;
-
- if (!grow_buffer (State, error))
- return FALSE;
-
- return TRUE;
-}
-
-/* Finds the lowest set bit and the number of set bits */
-static void
-find_bits (int n, int *lowest, int *n_set)
-{
- int i;
-
- *n_set = 0;
-
- for (i = 31; i >= 0; i--)
- if (n & (1 << i)) {
- *lowest = i;
- (*n_set)++;
- }
-}
-
-/* Decodes the bitmasks for BI_BITFIELDS coding */
-static gboolean
-decode_bitmasks (guchar *buf,
- struct bmp_progressive_state *State,
- GError **error)
-{
- State->a_mask = State->a_shift = State->a_bits = 0;
- State->r_mask = buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24);
- buf += 4;
-
- State->g_mask = buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24);
- buf += 4;
-
- State->b_mask = buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24);
-
- find_bits (State->r_mask, &State->r_shift, &State->r_bits);
- find_bits (State->g_mask, &State->g_shift, &State->g_bits);
- find_bits (State->b_mask, &State->b_shift, &State->b_bits);
-
- /* v4 and v5 have an alpha mask */
- if (State->Header.size == 108 || State->Header.size == 124) {
- buf += 4;
- State->a_mask = buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24);
- find_bits (State->a_mask, &State->a_shift, &State->a_bits);
- }
-
- if (State->r_bits == 0 || State->g_bits == 0 || State->b_bits == 0) {
- if (State->Type == 16) {
- State->r_mask = 0x7c00;
- State->r_shift = 10;
- State->g_mask = 0x03e0;
- State->g_shift = 5;
- State->b_mask = 0x001f;
- State->b_shift = 0;
-
- State->r_bits = State->g_bits = State->b_bits = 5;
- }
- else {
- State->r_mask = 0x00ff0000;
- State->r_shift = 16;
- State->g_mask = 0x0000ff00;
- State->g_shift = 8;
- State->b_mask = 0x000000ff;
- State->b_shift = 0;
- State->a_mask = 0xff000000;
- State->a_shift = 24;
-
- State->r_bits = State->g_bits = State->b_bits = State->a_bits = 8;
- }
- }
-
- if (State->r_bits > 8) {
- State->r_shift += State->r_bits - 8;
- State->r_bits = 8;
- }
- if (State->g_bits > 8) {
- State->g_shift += State->g_bits - 8;
- State->g_bits = 8;
- }
- if (State->b_bits > 8) {
- State->b_shift += State->b_bits - 8;
- State->b_bits = 8;
- }
- if (State->a_bits > 8) {
- State->a_shift += State->a_bits - 8;
- State->a_bits = 8;
- }
-
- State->read_state = READ_STATE_DATA;
- State->BufferDone = 0;
- State->BufferSize = State->LineWidth;
- if (!grow_buffer (State, error))
- return FALSE;
-
- return TRUE;
-}
-
-/*
- * func - called when we have pixmap created (but no image data)
- * user_data - passed as arg 1 to func
- * return context (opaque to user)
- */
-
-static gpointer
-gdk_pixbuf__bmp_image_begin_load(GdkPixbufModuleSizeFunc size_func,
- GdkPixbufModulePreparedFunc prepared_func,
- GdkPixbufModuleUpdatedFunc updated_func,
- gpointer user_data,
- GError **error)
-{
- struct bmp_progressive_state *context;
-
- context = g_new0(struct bmp_progressive_state, 1);
- context->size_func = size_func;
- context->prepared_func = prepared_func;
- context->updated_func = updated_func;
- context->user_data = user_data;
-
- context->read_state = READ_STATE_HEADERS;
-
- context->BufferSize = 26;
- context->BufferPadding = 0;
- context->buff = g_malloc(26);
- context->BufferDone = 0;
- /* 14 for the BitmapFileHeader, 12 for the BitmapImageHeader */
-
- context->Colormap = NULL;
-
- context->Lines = 0;
-
- context->Type = 0;
-
- memset(&context->Header, 0, sizeof(struct headerpair));
- memset(&context->compr, 0, sizeof(struct bmp_compression_state));
-
-
- context->pixbuf = NULL;
-
- return (gpointer) context;
-}
-
-/*
- * context - returned from image_begin_load
- *
- * free context, unref gdk_pixbuf
- */
-static gboolean gdk_pixbuf__bmp_image_stop_load(gpointer data, GError **error)
-{
- gboolean retval = TRUE;
-
- struct bmp_progressive_state *context =
- (struct bmp_progressive_state *) data;
-
- /* FIXME this thing needs to report errors if
- * we have unused image data
- */
-
- g_return_val_if_fail(context != NULL, TRUE);
-
- g_free(context->Colormap);
-
- if (context->pixbuf)
- g_object_unref(context->pixbuf);
-
- if (context->read_state == READ_STATE_HEADERS) {
- if (error && *error == NULL) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Premature end-of-file encountered"));
- }
- retval = FALSE;
- }
-
- g_free(context->buff);
- g_free(context);
-
- return retval;
-}
-
-
-/*
-The OneLineXX functions are called when 1 line worth of data is present.
-OneLine24 is the 24 bpp-version.
-*/
-static void OneLine32(struct bmp_progressive_state *context)
-{
- int i;
- guchar *pixels;
- guchar *src;
-
- if (!context->Header.Negative)
- pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride * (context->Header.height - context->Lines - 1));
- else
- pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride * context->Lines);
-
- src = context->buff;
-
- if (context->Compressed == BI_BITFIELDS) {
- int r_lshift, r_rshift;
- int g_lshift, g_rshift;
- int b_lshift, b_rshift;
- int a_lshift, a_rshift;
-
- r_lshift = 8 - context->r_bits;
- g_lshift = 8 - context->g_bits;
- b_lshift = 8 - context->b_bits;
- a_lshift = 8 - context->a_bits;
-
- r_rshift = context->r_bits - r_lshift;
- g_rshift = context->g_bits - g_lshift;
- b_rshift = context->b_bits - b_lshift;
- a_rshift = context->a_bits - a_lshift;
-
- for (i = 0; i < context->Header.width; i++) {
- unsigned int v, r, g, b, a;
-
- v = src[0] | (src[1] << 8) | (src[2] << 16) | (src[3] << 24);
-
- r = (v & context->r_mask) >> context->r_shift;
- g = (v & context->g_mask) >> context->g_shift;
- b = (v & context->b_mask) >> context->b_shift;
- a = (v & context->a_mask) >> context->a_shift;
-
- *pixels++ = (r << r_lshift) | (r >> r_rshift);
- *pixels++ = (g << g_lshift) | (g >> g_rshift);
- *pixels++ = (b << b_lshift) | (b >> b_rshift);
- if (context->a_bits)
- *pixels++ = (a << a_lshift) | (a >> a_rshift);
- else
- *pixels++ = 0xff;
-
- src += 4;
- }
- } else
- for (i = 0; i < context->Header.width; i++) {
- *pixels++ = src[2];
- *pixels++ = src[1];
- *pixels++ = src[0];
- *pixels++ = 0xff;
-
- src += 4;
- }
-}
-
-static void OneLine24(struct bmp_progressive_state *context)
-{
- gint X;
- guchar *Pixels;
-
- X = 0;
- if (context->Header.Negative == 0)
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- (context->Header.height - context->Lines - 1));
- else
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- context->Lines);
- while (X < context->Header.width) {
- Pixels[X * 3 + 0] = context->buff[X * 3 + 2];
- Pixels[X * 3 + 1] = context->buff[X * 3 + 1];
- Pixels[X * 3 + 2] = context->buff[X * 3 + 0];
- X++;
- }
-
-}
-
-static void OneLine16(struct bmp_progressive_state *context)
-{
- int i;
- guchar *pixels;
- guchar *src;
-
- if (!context->Header.Negative)
- pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride * (context->Header.height - context->Lines - 1));
- else
- pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride * context->Lines);
-
- src = context->buff;
-
- if (context->Compressed == BI_BITFIELDS) {
- int r_lshift, r_rshift;
- int g_lshift, g_rshift;
- int b_lshift, b_rshift;
-
- r_lshift = 8 - context->r_bits;
- g_lshift = 8 - context->g_bits;
- b_lshift = 8 - context->b_bits;
-
- r_rshift = context->r_bits - r_lshift;
- g_rshift = context->g_bits - g_lshift;
- b_rshift = context->b_bits - b_lshift;
-
- for (i = 0; i < context->Header.width; i++) {
- int v, r, g, b;
-
- v = (int) src[0] | ((int) src[1] << 8);
-
- r = (v & context->r_mask) >> context->r_shift;
- g = (v & context->g_mask) >> context->g_shift;
- b = (v & context->b_mask) >> context->b_shift;
-
- *pixels++ = (r << r_lshift) | (r >> r_rshift);
- *pixels++ = (g << g_lshift) | (g >> g_rshift);
- *pixels++ = (b << b_lshift) | (b >> b_rshift);
-
- src += 2;
- }
- } else
- for (i = 0; i < context->Header.width; i++) {
- int v, r, g, b;
-
- v = src[0] | (src[1] << 8);
-
- r = (v >> 10) & 0x1f;
- g = (v >> 5) & 0x1f;
- b = v & 0x1f;
-
- *pixels++ = (r << 3) | (r >> 2);
- *pixels++ = (g << 3) | (g >> 2);
- *pixels++ = (b << 3) | (b >> 2);
-
- src += 2;
- }
-}
-
-static void OneLine8(struct bmp_progressive_state *context)
-{
- gint X;
- guchar *Pixels;
-
- X = 0;
- if (context->Header.Negative == 0)
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- (context->Header.height - context->Lines - 1));
- else
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- context->Lines);
- while (X < context->Header.width) {
- Pixels[X * 3 + 0] =
- context->Colormap[context->buff[X]][2];
- Pixels[X * 3 + 1] =
- context->Colormap[context->buff[X]][1];
- Pixels[X * 3 + 2] =
- context->Colormap[context->buff[X]][0];
- X++;
- }
-}
-
-static void OneLine4(struct bmp_progressive_state *context)
-{
- gint X;
- guchar *Pixels;
-
- X = 0;
- if (context->Header.Negative == 0)
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- (context->Header.height - context->Lines - 1));
- else
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- context->Lines);
-
- while (X < context->Header.width) {
- guchar Pix;
-
- Pix = context->buff[X / 2];
-
- Pixels[X * 3 + 0] =
- context->Colormap[Pix >> 4][2];
- Pixels[X * 3 + 1] =
- context->Colormap[Pix >> 4][1];
- Pixels[X * 3 + 2] =
- context->Colormap[Pix >> 4][0];
- X++;
- if (X < context->Header.width) {
- /* Handle the other 4 bit pixel only when there is one */
- Pixels[X * 3 + 0] =
- context->Colormap[Pix & 15][2];
- Pixels[X * 3 + 1] =
- context->Colormap[Pix & 15][1];
- Pixels[X * 3 + 2] =
- context->Colormap[Pix & 15][0];
- X++;
- }
- }
-
-}
-
-static void OneLine1(struct bmp_progressive_state *context)
-{
- gint X;
- guchar *Pixels;
-
- X = 0;
- if (context->Header.Negative == 0)
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- (context->Header.height - context->Lines - 1));
- else
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- context->Lines);
- while (X < context->Header.width) {
- gint Bit;
-
- Bit = (context->buff[X / 8]) >> (7 - (X & 7));
- Bit = Bit & 1;
- Pixels[X * 3 + 0] = context->Colormap[Bit][2];
- Pixels[X * 3 + 1] = context->Colormap[Bit][1];
- Pixels[X * 3 + 2] = context->Colormap[Bit][0];
- X++;
- }
-}
-
-
-static void OneLine(struct bmp_progressive_state *context)
-{
- context->BufferDone = 0;
- if (context->Lines >= context->Header.height)
- return;
-
- if (context->Type == 32)
- OneLine32(context);
- else if (context->Type == 24)
- OneLine24(context);
- else if (context->Type == 16)
- OneLine16(context);
- else if (context->Type == 8)
- OneLine8(context);
- else if (context->Type == 4)
- OneLine4(context);
- else if (context->Type == 1)
- OneLine1(context);
- else
- g_assert_not_reached ();
-
- context->Lines++;
-
- if (context->updated_func != NULL) {
- (*context->updated_func) (context->pixbuf,
- 0,
- (context->Header.Negative ?
- (context->Lines - 1) :
- (context->Header.height - context->Lines)),
- context->Header.width,
- 1,
- context->user_data);
-
- }
-}
-
-#define NEUTRAL 0
-#define ENCODED 1
-#define ESCAPE 2
-#define DELTA_X 3
-#define DELTA_Y 4
-#define ABSOLUTE 5
-#define SKIP 6
-
-#define END_OF_LINE 0
-#define END_OF_BITMAP 1
-#define DELTA 2
-
-static gboolean
-DoCompressed(struct bmp_progressive_state *context, GError **error)
-{
- gint i, j;
- gint y;
- guchar c;
- gint idx;
-
- /* context->compr.y might be past the last line because we are
- * on padding past the end of a valid data, or we might have hit
- * out-of-bounds data. Either way we just eat-and-ignore the
- * rest of the file. Doing the check only here and not when
- * we change y below is fine since BufferSize is always 2 here
- * and the BMP file format always starts new data on 16-bit
- * boundaries.
- */
- if (context->compr.y >= context->Header.height) {
- context->BufferDone = 0;
- return TRUE;
- }
-
- y = context->compr.y;
-
- for (i = 0; i < context->BufferSize; i++) {
- c = context->buff[i];
- switch (context->compr.phase) {
- case NEUTRAL:
- if (c) {
- context->compr.run = c;
- context->compr.phase = ENCODED;
- }
- else
- context->compr.phase = ESCAPE;
- break;
- case ENCODED:
- for (j = 0; j < context->compr.run; j++) {
- if (context->Compressed == BI_RLE8)
- idx = c;
- else if (j & 1)
- idx = c & 0x0f;
- else
- idx = (c >> 4) & 0x0f;
- if (context->compr.x < context->Header.width) {
- *context->compr.p++ = context->Colormap[idx][2];
- *context->compr.p++ = context->Colormap[idx][1];
- *context->compr.p++ = context->Colormap[idx][0];
- *context->compr.p++ = 0xff;
- context->compr.x++;
- }
- }
- context->compr.phase = NEUTRAL;
- break;
- case ESCAPE:
- switch (c) {
- case END_OF_LINE:
- context->compr.x = 0;
- context->compr.y++;
- context->compr.p = context->pixbuf->pixels
- + (context->pixbuf->rowstride * (context->Header.height - context->compr.y - 1))
- + (4 * context->compr.x);
- context->compr.phase = NEUTRAL;
- break;
- case END_OF_BITMAP:
- context->compr.x = 0;
- context->compr.y = context->Header.height;
- context->compr.phase = NEUTRAL;
- break;
- case DELTA:
- context->compr.phase = DELTA_X;
- break;
- default:
- context->compr.run = c;
- context->compr.count = 0;
- context->compr.phase = ABSOLUTE;
- break;
- }
- break;
- case DELTA_X:
- context->compr.x += c;
- context->compr.phase = DELTA_Y;
- break;
- case DELTA_Y:
- context->compr.y += c;
- context->compr.p = context->pixbuf->pixels
- + (context->pixbuf->rowstride * (context->Header.height - context->compr.y - 1))
- + (4 * context->compr.x);
- context->compr.phase = NEUTRAL;
- break;
- case ABSOLUTE:
- if (context->Compressed == BI_RLE8) {
- idx = c;
- if (context->compr.x < context->Header.width) {
- *context->compr.p++ = context->Colormap[idx][2];
- *context->compr.p++ = context->Colormap[idx][1];
- *context->compr.p++ = context->Colormap[idx][0];
- *context->compr.p++ = 0xff;
- context->compr.x++;
- }
- context->compr.count++;
-
- if (context->compr.count == context->compr.run) {
- if (context->compr.run & 1)
- context->compr.phase = SKIP;
- else
- context->compr.phase = NEUTRAL;
- }
- }
- else {
- for (j = 0; j < 2; j++) {
- if (context->compr.count & 1)
- idx = c & 0x0f;
- else
- idx = (c >> 4) & 0x0f;
- if (context->compr.x < context->Header.width) {
- *context->compr.p++ = context->Colormap[idx][2];
- *context->compr.p++ = context->Colormap[idx][1];
- *context->compr.p++ = context->Colormap[idx][0];
- *context->compr.p++ = 0xff;
- context->compr.x++;
- }
- context->compr.count++;
-
- if (context->compr.count == context->compr.run) {
- if ((context->compr.run & 3) == 1
- || (context->compr.run & 3) == 2)
- context->compr.phase = SKIP;
- else
- context->compr.phase = NEUTRAL;
- break;
- }
- }
- }
- break;
- case SKIP:
- context->compr.phase = NEUTRAL;
- break;
- }
- }
- if (context->updated_func != NULL) {
- if (context->compr.y > y)
- {
- gint new_y = MIN (context->compr.y, context->Header.height);
- (*context->updated_func) (context->pixbuf,
- 0,
- context->Header.height - new_y,
- context->Header.width,
- new_y - y,
- context->user_data);
- }
-
- }
-
- context->BufferDone = 0;
- return TRUE;
-}
-
-/*
- * context - from image_begin_load
- * buf - new image data
- * size - length of new image data
- *
- * append image data onto incrementally built output image
- */
-static gboolean
-gdk_pixbuf__bmp_image_load_increment(gpointer data,
- const guchar * buf,
- guint size,
- GError **error)
-{
- struct bmp_progressive_state *context =
- (struct bmp_progressive_state *) data;
-
- gint BytesToCopy;
- gint BytesToRemove;
-
- if (context->read_state == READ_STATE_DONE)
- return TRUE;
- else if (context->read_state == READ_STATE_ERROR)
- return FALSE;
-
- while (size > 0) {
- if (context->BufferDone < context->BufferSize) { /* We still
- have headerbytes to do */
- BytesToCopy =
- context->BufferSize - context->BufferDone;
- if (BytesToCopy > size)
- BytesToCopy = size;
-
- memmove(context->buff + context->BufferDone,
- buf, BytesToCopy);
-
- size -= BytesToCopy;
- buf += BytesToCopy;
- context->BufferDone += BytesToCopy;
-
- if (context->BufferDone != context->BufferSize)
- break;
- }
-
- /* context->buff is full. Now we discard all "padding" */
- if (context->BufferPadding != 0) {
- BytesToRemove = context->BufferPadding - size;
- if (BytesToRemove > size) {
- BytesToRemove = size;
- }
- size -= BytesToRemove;
- context->BufferPadding -= BytesToRemove;
-
- if (context->BufferPadding != 0)
- break;
- }
-
- switch (context->read_state) {
- case READ_STATE_HEADERS:
- if (!DecodeHeader (context->buff,
- context->buff + 14, context,
- error))
- return FALSE;
-
- break;
-
- case READ_STATE_PALETTE:
- if (!DecodeColormap (context->buff, context, error))
- return FALSE;
- break;
-
- case READ_STATE_BITMASKS:
- if (!decode_bitmasks (context->buff, context, error))
- return FALSE;
- break;
-
- case READ_STATE_DATA:
- if (context->Compressed == BI_RGB || context->Compressed == BI_BITFIELDS)
- OneLine (context);
- else if (!DoCompressed (context, error))
- return FALSE;
-
- break;
- case READ_STATE_DONE:
- return TRUE;
- break;
-
- default:
- g_assert_not_reached ();
- }
- }
-
- return TRUE;
-}
-
-/* for our convenience when filling file header */
-#define put16(buf,data) { guint16 x; \
- x = GUINT16_TO_LE (data); \
- memcpy(buf, &x, 2); \
- buf += 2; }
-#define put32(buf,data) { guint32 x; \
- x = GUINT32_TO_LE (data); \
- memcpy(buf, &x, 4); \
- buf += 4; }
-
-static gboolean
-gdk_pixbuf__bmp_image_save_to_callback (GdkPixbufSaveFunc save_func,
- gpointer user_data,
- GdkPixbuf *pixbuf,
- gchar **keys,
- gchar **values,
- GError **error)
-{
- guint width, height, channel, size, stride, src_stride, x, y;
- guchar BFH_BIH[54], *pixels, *buf, *src, *dst, *dst_line;
- gboolean ret;
-
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
- channel = gdk_pixbuf_get_n_channels (pixbuf);
- pixels = gdk_pixbuf_get_pixels (pixbuf);
- src_stride = gdk_pixbuf_get_rowstride (pixbuf);
- stride = (width * 3 + 3) & ~3;
- size = stride * height;
-
- /* filling BFH */
- dst = BFH_BIH;
- *dst++ = 'B'; /* bfType */
- *dst++ = 'M';
- put32 (dst, size + 14 + 40); /* bfSize */
- put32 (dst, 0); /* bfReserved1 + bfReserved2 */
- put32 (dst, 14 + 40); /* bfOffBits */
-
- /* filling BIH */
- put32 (dst, 40); /* biSize */
- put32 (dst, width); /* biWidth */
- put32 (dst, height); /* biHeight */
- put16 (dst, 1); /* biPlanes */
- put16 (dst, 24); /* biBitCount */
- put32 (dst, BI_RGB); /* biCompression */
- put32 (dst, size); /* biSizeImage */
- put32 (dst, 0); /* biXPelsPerMeter */
- put32 (dst, 0); /* biYPelsPerMeter */
- put32 (dst, 0); /* biClrUsed */
- put32 (dst, 0); /* biClrImportant */
-
- if (!save_func ((gchar *)BFH_BIH, 14 + 40, error, user_data))
- return FALSE;
-
- dst_line = buf = g_try_malloc (size);
- if (!buf) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Couldn't allocate memory for saving BMP file"));
- return FALSE;
- }
-
- /* saving as a bottom-up bmp */
- pixels += (height - 1) * src_stride;
- for (y = 0; y < height; ++y, pixels -= src_stride, dst_line += stride) {
- dst = dst_line;
- src = pixels;
- for (x = 0; x < width; ++x, dst += 3, src += channel) {
- dst[0] = src[2];
- dst[1] = src[1];
- dst[2] = src[0];
- }
- }
- ret = save_func ((gchar *)buf, size, error, user_data);
- g_free (buf);
-
- return ret;
-}
-
-static gboolean
-save_to_file_cb (const gchar *buf,
- gsize count,
- GError **error,
- gpointer data)
-{
- gint bytes;
-
- while (count > 0) {
- bytes = fwrite (buf, sizeof (gchar), count, (FILE *) data);
- if (bytes <= 0)
- break;
- count -= bytes;
- buf += bytes;
- }
-
- if (count) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_FAILED,
- _("Couldn't write to BMP file"));
- return FALSE;
- }
-
- return TRUE;
-}
-
-static gboolean
-gdk_pixbuf__bmp_image_save (FILE *f,
- GdkPixbuf *pixbuf,
- gchar **keys,
- gchar **values,
- GError **error)
-{
- return gdk_pixbuf__bmp_image_save_to_callback (save_to_file_cb,
- f, pixbuf, keys,
- values, error);
-}
-
-#ifndef INCLUDE_bmp
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__bmp_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
-{
- module->begin_load = gdk_pixbuf__bmp_image_begin_load;
- module->stop_load = gdk_pixbuf__bmp_image_stop_load;
- module->load_increment = gdk_pixbuf__bmp_image_load_increment;
- module->save = gdk_pixbuf__bmp_image_save;
- module->save_to_callback = gdk_pixbuf__bmp_image_save_to_callback;
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
-{
- static GdkPixbufModulePattern signature[] = {
- { "BM", NULL, 100 },
- { NULL, NULL, 0 }
- };
- static gchar * mime_types[] = {
- "image/bmp",
- "image/x-bmp",
- "image/x-MS-bmp",
- NULL
- };
- static gchar * extensions[] = {
- "bmp",
- NULL
- };
-
- info->name = "bmp";
- info->signature = signature;
- info->description = N_("The BMP image format");
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_WRITABLE | GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "LGPL";
-}
-
diff --git a/gdk-pixbuf/io-gdip-animation.c b/gdk-pixbuf/io-gdip-animation.c
deleted file mode 100644
index 7281b6d115..0000000000
--- a/gdk-pixbuf/io-gdip-animation.c
+++ /dev/null
@@ -1,383 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* GdkPixbuf library - animated gdip support
- *
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Authors: Jonathan Blandford <jrb@redhat.com>
- * Havoc Pennington <hp@redhat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 <errno.h>
-#include "io-gdip-native.h"
-#include "io-gdip-animation.h"
-
-static void gdk_pixbuf_gdip_anim_class_init (GdkPixbufGdipAnimClass *klass);
-static void gdk_pixbuf_gdip_anim_finalize (GObject *object);
-
-static gboolean gdk_pixbuf_gdip_anim_is_static_image (GdkPixbufAnimation *animation);
-static GdkPixbuf* gdk_pixbuf_gdip_anim_get_static_image (GdkPixbufAnimation *animation);
-
-static void gdk_pixbuf_gdip_anim_get_size (GdkPixbufAnimation *anim,
- int *width,
- int *height);
-static GdkPixbufAnimationIter* gdk_pixbuf_gdip_anim_get_iter (GdkPixbufAnimation *anim,
- const GTimeVal *start_time);
-
-static gpointer parent_class;
-
-GType
-gdk_pixbuf_gdip_anim_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type) {
- const GTypeInfo object_info = {
- sizeof (GdkPixbufGdipAnimClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gdk_pixbuf_gdip_anim_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GdkPixbufGdipAnim),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- };
-
- object_type = g_type_from_name ("GdkPixbufGdipAnim");
- if (object_type == 0) {
- object_type = g_type_register_static (GDK_TYPE_PIXBUF_ANIMATION,
- g_intern_static_string ("GdkPixbufGdipAnim"),
- &object_info, 0);
- }
- }
-
- return object_type;
-}
-
-static void
-gdk_pixbuf_gdip_anim_class_init (GdkPixbufGdipAnimClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GdkPixbufAnimationClass *anim_class = GDK_PIXBUF_ANIMATION_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = gdk_pixbuf_gdip_anim_finalize;
-
- anim_class->is_static_image = gdk_pixbuf_gdip_anim_is_static_image;
- anim_class->get_static_image = gdk_pixbuf_gdip_anim_get_static_image;
- anim_class->get_size = gdk_pixbuf_gdip_anim_get_size;
- anim_class->get_iter = gdk_pixbuf_gdip_anim_get_iter;
-}
-
-static void
-gdk_pixbuf_gdip_anim_finalize (GObject *object)
-{
- GdkPixbufGdipAnim *gdip_anim = GDK_PIXBUF_GDIP_ANIM (object);
-
- GList *l;
- GdkPixbufFrame *frame;
-
- for (l = gdip_anim->frames; l; l = l->next) {
- frame = l->data;
- g_object_unref (frame->pixbuf);
- g_free (frame);
- }
-
- g_list_free (gdip_anim->frames);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static gboolean
-gdk_pixbuf_gdip_anim_is_static_image (GdkPixbufAnimation *animation)
-{
- GdkPixbufGdipAnim *gdip_anim;
-
- gdip_anim = GDK_PIXBUF_GDIP_ANIM (animation);
-
- return (gdip_anim->frames != NULL &&
- gdip_anim->frames->next == NULL);
-}
-
-static GdkPixbuf*
-gdk_pixbuf_gdip_anim_get_static_image (GdkPixbufAnimation *animation)
-{
- GdkPixbufGdipAnim *gdip_anim;
-
- gdip_anim = GDK_PIXBUF_GDIP_ANIM (animation);
-
- if (gdip_anim->frames == NULL)
- return NULL;
- else
- return GDK_PIXBUF (((GdkPixbufFrame*)gdip_anim->frames->data)->pixbuf);
-}
-
-static void
-gdk_pixbuf_gdip_anim_get_size (GdkPixbufAnimation *anim,
- int *width,
- int *height)
-{
- GdkPixbufGdipAnim *gdip_anim;
-
- gdip_anim = GDK_PIXBUF_GDIP_ANIM (anim);
-
- if (width)
- *width = gdip_anim->width;
-
- if (height)
- *height = gdip_anim->height;
-}
-
-
-static void
-iter_clear (GdkPixbufGdipAnimIter *iter)
-{
- iter->current_frame = NULL;
-}
-
-static void
-iter_restart (GdkPixbufGdipAnimIter *iter)
-{
- iter_clear (iter);
-
- iter->current_frame = iter->gdip_anim->frames;
-}
-
-static GdkPixbufAnimationIter*
-gdk_pixbuf_gdip_anim_get_iter (GdkPixbufAnimation *anim,
- const GTimeVal *start_time)
-{
- GdkPixbufGdipAnimIter *iter;
-
- iter = g_object_new (GDK_TYPE_PIXBUF_GDIP_ANIM_ITER, NULL);
-
- iter->gdip_anim = GDK_PIXBUF_GDIP_ANIM (anim);
-
- g_object_ref (iter->gdip_anim);
-
- iter_restart (iter);
-
- iter->start_time = *start_time;
- iter->current_time = *start_time;
- iter->first_loop_slowness = 0;
-
- return GDK_PIXBUF_ANIMATION_ITER (iter);
-}
-
-static void gdk_pixbuf_gdip_anim_iter_class_init (GdkPixbufGdipAnimIterClass *klass);
-static void gdk_pixbuf_gdip_anim_iter_finalize (GObject *object);
-
-static int gdk_pixbuf_gdip_anim_iter_get_delay_time (GdkPixbufAnimationIter *iter);
-static GdkPixbuf* gdk_pixbuf_gdip_anim_iter_get_pixbuf (GdkPixbufAnimationIter *iter);
-static gboolean gdk_pixbuf_gdip_anim_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter);
-static gboolean gdk_pixbuf_gdip_anim_iter_advance (GdkPixbufAnimationIter *iter,
- const GTimeVal *current_time);
-
-static gpointer iter_parent_class;
-
-GType
-gdk_pixbuf_gdip_anim_iter_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type) {
- const GTypeInfo object_info = {
- sizeof (GdkPixbufGdipAnimIterClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gdk_pixbuf_gdip_anim_iter_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GdkPixbufGdipAnimIter),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- };
-
- object_type = g_type_from_name ("GdkPixbufGdipAnimIter");
- if (object_type == 0) {
- object_type = g_type_register_static (GDK_TYPE_PIXBUF_ANIMATION_ITER,
- g_intern_static_string ("GdkPixbufGdipAnimIter"),
- &object_info, 0);
- }
- }
-
- return object_type;
-}
-
-static void
-gdk_pixbuf_gdip_anim_iter_class_init (GdkPixbufGdipAnimIterClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GdkPixbufAnimationIterClass *anim_iter_class =
- GDK_PIXBUF_ANIMATION_ITER_CLASS (klass);
-
- iter_parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = gdk_pixbuf_gdip_anim_iter_finalize;
-
- anim_iter_class->get_delay_time = gdk_pixbuf_gdip_anim_iter_get_delay_time;
- anim_iter_class->get_pixbuf = gdk_pixbuf_gdip_anim_iter_get_pixbuf;
- anim_iter_class->on_currently_loading_frame = gdk_pixbuf_gdip_anim_iter_on_currently_loading_frame;
- anim_iter_class->advance = gdk_pixbuf_gdip_anim_iter_advance;
-}
-
-static void
-gdk_pixbuf_gdip_anim_iter_finalize (GObject *object)
-{
- GdkPixbufGdipAnimIter *iter = GDK_PIXBUF_GDIP_ANIM_ITER (object);
-
- iter_clear (iter);
-
- g_object_unref (iter->gdip_anim);
-
- G_OBJECT_CLASS (iter_parent_class)->finalize (object);
-}
-
-static gboolean
-gdk_pixbuf_gdip_anim_iter_advance (GdkPixbufAnimationIter *anim_iter,
- const GTimeVal *current_time)
-{
- GdkPixbufGdipAnimIter *iter;
- gint elapsed;
- gint loop;
- GList *tmp;
- GList *old;
-
- iter = GDK_PIXBUF_GDIP_ANIM_ITER (anim_iter);
-
- iter->current_time = *current_time;
-
- /* We use milliseconds for all times */
- elapsed =
- (((iter->current_time.tv_sec - iter->start_time.tv_sec) * G_USEC_PER_SEC +
- iter->current_time.tv_usec - iter->start_time.tv_usec)) / 1000;
-
- if (elapsed < 0) {
- /* Try to compensate; probably the system clock
- * was set backwards
- */
- iter->start_time = iter->current_time;
- elapsed = 0;
- }
-
- g_assert (iter->gdip_anim->total_time > 0);
-
- /* See how many times we've already played the full animation,
- * and subtract time for that.
- */
-
- if (iter->gdip_anim->loading)
- loop = 0;
- else {
- /* If current_frame is NULL at this point, we have loaded the
- * animation from a source which fell behind the speed of the
- * display. We remember how much slower the first loop was due
- * to this and correct the position calculation in order to not
- * jump in the middle of the second loop.
- */
- if (iter->current_frame == NULL)
- iter->first_loop_slowness = MAX(0, elapsed - iter->gdip_anim->total_time);
-
- loop = (elapsed - iter->first_loop_slowness) / iter->gdip_anim->total_time;
- elapsed = (elapsed - iter->first_loop_slowness) % iter->gdip_anim->total_time;
- }
-
- iter->position = elapsed;
-
- /* Now move to the proper frame */
- if (iter->gdip_anim->loop == 0 || loop < iter->gdip_anim->loop)
- tmp = iter->gdip_anim->frames;
- else
- tmp = NULL;
- while (tmp != NULL) {
- GdkPixbufFrame *frame = tmp->data;
-
- if (iter->position >= frame->elapsed &&
- iter->position < (frame->elapsed + frame->delay_time))
- break;
-
- tmp = tmp->next;
- }
-
- old = iter->current_frame;
-
- iter->current_frame = tmp;
-
- return iter->current_frame != old;
-}
-
-int
-gdk_pixbuf_gdip_anim_iter_get_delay_time (GdkPixbufAnimationIter *anim_iter)
-{
- GdkPixbufFrame *frame;
- GdkPixbufGdipAnimIter *iter;
-
- iter = GDK_PIXBUF_GDIP_ANIM_ITER (anim_iter);
-
- if (iter->current_frame) {
- frame = iter->current_frame->data;
-
-#if 0
- g_print ("frame start: %d pos: %d frame len: %d frame remaining: %d\n",
- frame->elapsed,
- iter->position,
- frame->delay_time,
- frame->delay_time - (iter->position - frame->elapsed));
-#endif
-
- return frame->delay_time - (iter->position - frame->elapsed);
- } else
- return -1; /* show last frame forever */
-}
-
-GdkPixbuf*
-gdk_pixbuf_gdip_anim_iter_get_pixbuf (GdkPixbufAnimationIter *anim_iter)
-{
- GdkPixbufGdipAnimIter *iter;
- GdkPixbufFrame *frame;
-
- iter = GDK_PIXBUF_GDIP_ANIM_ITER (anim_iter);
-
- frame = iter->current_frame ? iter->current_frame->data : g_list_last (iter->gdip_anim->frames)->data;
-
-#if 0
- if (FALSE && frame)
- g_print ("current frame %d dispose mode %d %d x %d\n",
- g_list_index (iter->gdip_anim->frames,
- frame),
- frame->action,
- gdk_pixbuf_get_width (frame->pixbuf),
- gdk_pixbuf_get_height (frame->pixbuf));
-#endif
-
- if (frame == NULL)
- return NULL;
-
- return frame->pixbuf;
-}
-
-static gboolean
-gdk_pixbuf_gdip_anim_iter_on_currently_loading_frame (GdkPixbufAnimationIter *anim_iter)
-{
- GdkPixbufGdipAnimIter *iter;
-
- iter = GDK_PIXBUF_GDIP_ANIM_ITER (anim_iter);
-
- return iter->current_frame == NULL || iter->current_frame->next == NULL;
-}
diff --git a/gdk-pixbuf/io-gdip-animation.h b/gdk-pixbuf/io-gdip-animation.h
deleted file mode 100644
index 01e827876d..0000000000
--- a/gdk-pixbuf/io-gdip-animation.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/* GdkPixbuf library - GDIP loader declarations
- *
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Authors: Mark Crichton <crichton@gimp.org>
- * Miguel de Icaza <miguel@gnu.org>
- * Federico Mena-Quintero <federico@gimp.org>
- * Havoc Pennington <hp@redhat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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_GDIP_H
-#define GDK_PIXBUF_GDIP_H
-
-#include <gdk-pixbuf/gdk-pixbuf-animation.h>
-
-typedef struct _GdkPixbufGdipAnim GdkPixbufGdipAnim;
-typedef struct _GdkPixbufGdipAnimClass GdkPixbufGdipAnimClass;
-typedef struct _GdkPixbufFrame GdkPixbufFrame;
-
-#define GDK_TYPE_PIXBUF_GDIP_ANIM (gdk_pixbuf_gdip_anim_get_type ())
-#define GDK_PIXBUF_GDIP_ANIM(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_GDIP_ANIM, GdkPixbufGdipAnim))
-#define GDK_IS_PIXBUF_GDIP_ANIM(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_GDIP_ANIM))
-
-#define GDK_PIXBUF_GDIP_ANIM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_GDIP_ANIM, GdkPixbufGdipAnimClass))
-#define GDK_IS_PIXBUF_GDIP_ANIM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_GDIP_ANIM))
-#define GDK_PIXBUF_GDIP_ANIM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_GDIP_ANIM, GdkPixbufGdipAnimClass))
-
-/* Private part of the GdkPixbufGdipAnim structure */
-struct _GdkPixbufGdipAnim {
- GdkPixbufAnimation parent_instance;
-
- /* Number of frames */
- int n_frames;
-
- /* Total length of animation */
- int total_time;
-
- /* List of GdkPixbufFrame structures */
- GList *frames;
-
- /* bounding box size */
- int width, height;
-
- int loop;
- gboolean loading;
-};
-
-struct _GdkPixbufGdipAnimClass {
- GdkPixbufAnimationClass parent_class;
-
-};
-
-GType gdk_pixbuf_gdip_anim_get_type (void) G_GNUC_CONST;
-
-typedef struct _GdkPixbufGdipAnimIter GdkPixbufGdipAnimIter;
-typedef struct _GdkPixbufGdipAnimIterClass GdkPixbufGdipAnimIterClass;
-
-
-#define GDK_TYPE_PIXBUF_GDIP_ANIM_ITER (gdk_pixbuf_gdip_anim_iter_get_type ())
-#define GDK_PIXBUF_GDIP_ANIM_ITER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_GDIP_ANIM_ITER, GdkPixbufGdipAnimIter))
-#define GDK_IS_PIXBUF_GDIP_ANIM_ITER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_GDIP_ANIM_ITER))
-
-#define GDK_PIXBUF_GDIP_ANIM_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_GDIP_ANIM_ITER, GdkPixbufGdipAnimIterClass))
-#define GDK_IS_PIXBUF_GDIP_ANIM_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_GDIP_ANIM_ITER))
-#define GDK_PIXBUF_GDIP_ANIM_ITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_GDIP_ANIM_ITER, GdkPixbufGdipAnimIterClass))
-
-struct _GdkPixbufGdipAnimIter {
- GdkPixbufAnimationIter parent_instance;
-
- GdkPixbufGdipAnim *gdip_anim;
-
- GTimeVal start_time;
- GTimeVal current_time;
-
- /* Time in milliseconds into this run of the animation */
- gint position;
-
- GList *current_frame;
-
- gint first_loop_slowness;
-};
-
-struct _GdkPixbufGdipAnimIterClass {
- GdkPixbufAnimationIterClass parent_class;
-
-};
-
-GType gdk_pixbuf_gdip_anim_iter_get_type (void) G_GNUC_CONST;
-
-struct _GdkPixbufFrame {
- /* The pixbuf with this frame's image data */
- GdkPixbuf *pixbuf;
-
- /* Frame duration in ms */
- int delay_time;
-
- /* Sum of preceding delay times */
- int elapsed;
-};
-
-#endif
diff --git a/gdk-pixbuf/io-gdip-bmp.c b/gdk-pixbuf/io-gdip-bmp.c
deleted file mode 100644
index 40f6a5f536..0000000000
--- a/gdk-pixbuf/io-gdip-bmp.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* GdkPixbuf library - Win32 GDI+ Pixbuf Loader
- *
- * Copyright (C) 2008 Dominic Lachowicz
- * Copyright (C) 2008 Alberto Ruiz
- *
- * Authors: Dominic Lachowicz <domlachowicz@gmail.com>
- * Alberto Ruiz <aruiz@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more * You should have received a copy of the GNU Lesser 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 "io-gdip-utils.h"
-
-static gboolean
-gdk_pixbuf__gdip_image_save_BMP_to_callback (GdkPixbufSaveFunc save_func,
- gpointer user_data,
- GdkPixbuf *pixbuf,
- gchar **keys,
- gchar **values,
- GError **error)
-{
- return gdip_save_pixbuf (pixbuf, L"image/bmp", NULL, save_func, user_data, error);
-}
-
-static gboolean
-gdk_pixbuf__gdip_image_save_BMP (FILE *f,
- GdkPixbuf *pixbuf,
- gchar **keys,
- gchar **values,
- GError **error)
-{
- return gdk_pixbuf__gdip_image_save_BMP_to_callback (gdip_save_to_file_callback, f, pixbuf, keys, values, error);
-}
-
-#ifndef INCLUDE_gdiplus
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__gdip_bmp_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
-{
- gdip_fill_vtable (module);
-
- module->save_to_callback = gdk_pixbuf__gdip_image_save_BMP_to_callback;
- module->save = gdk_pixbuf__gdip_image_save_BMP; /* for gtk < 2.14, you need to implement both. otherwise gdk-pixbuf-queryloaders fails */
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
-{
- static GdkPixbufModulePattern signature[] = {
- { "BM", NULL, 100 }, /* BMP */
- { NULL, NULL, 0 }
- };
-
- static gchar *mime_types[] = {
- "image/bmp",
- "image/x-bmp",
- "image/x-MS-bmp",
- NULL
- };
-
- static gchar *extensions[] = {
- "bmp",
- NULL
- };
-
- info->name = "bmp";
- info->signature = signature;
- info->description = _("The BMP image format");
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_WRITABLE | GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "LGPL";
-}
diff --git a/gdk-pixbuf/io-gdip-emf.c b/gdk-pixbuf/io-gdip-emf.c
deleted file mode 100644
index 07ee0b0200..0000000000
--- a/gdk-pixbuf/io-gdip-emf.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* GdkPixbuf library - Win32 GDI+ Pixbuf Loader
- *
- * Copyright (C) 2008 Dominic Lachowicz
- * Copyright (C) 2008 Alberto Ruiz
- *
- * Authors: Dominic Lachowicz <domlachowicz@gmail.com>
- * Alberto Ruiz <aruiz@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more * You should have received a copy of the GNU Lesser 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 "io-gdip-utils.h"
-
-#ifndef INCLUDE_gdiplus
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__gdip_emf_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
-{
- gdip_fill_vector_vtable (module);
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
-{
- static GdkPixbufModulePattern signature[] = {
- { "\x01\x00\x00\x00", NULL, 100 }, /* EMF */
- { NULL, NULL, 0 }
- };
-
- static gchar *mime_types[] = {
- "application/emf",
- "application/x-emf",
- "image/x-emf",
- "image/x-mgx-emf",
- NULL
- };
-
- static gchar *extensions[] = {
- "emf",
- NULL
- };
-
- info->name = "emf";
- info->signature = signature;
- info->description = _("The EMF image format");
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "LGPL";
-}
diff --git a/gdk-pixbuf/io-gdip-gif.c b/gdk-pixbuf/io-gdip-gif.c
deleted file mode 100644
index f991a9d3de..0000000000
--- a/gdk-pixbuf/io-gdip-gif.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* GdkPixbuf library - Win32 GDI+ Pixbuf Loader
- *
- * Copyright (C) 2008 Dominic Lachowicz
- * Copyright (C) 2008 Alberto Ruiz
- *
- * Authors: Dominic Lachowicz <domlachowicz@gmail.com>
- * Alberto Ruiz <aruiz@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more * You should have received a copy of the GNU Lesser 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 "io-gdip-utils.h"
-
-static gboolean
-gdk_pixbuf__gdip_image_save_GIF_to_callback (GdkPixbufSaveFunc save_func,
- gpointer user_data,
- GdkPixbuf *pixbuf,
- gchar **keys,
- gchar **values,
- GError **error)
-{
- return gdip_save_pixbuf (pixbuf, L"image/gif", NULL, save_func, user_data, error);
-}
-
-static gboolean
-gdk_pixbuf__gdip_image_save_GIF (FILE *f,
- GdkPixbuf *pixbuf,
- gchar **keys,
- gchar **values,
- GError **error)
-{
- return gdk_pixbuf__gdip_image_save_GIF_to_callback (gdip_save_to_file_callback, f, pixbuf, keys, values, error);
-}
-
-#ifndef INCLUDE_gdiplus
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__gdip_gif_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
-{
- gdip_fill_vtable (module);
-
- module->save_to_callback = gdk_pixbuf__gdip_image_save_GIF_to_callback;
- module->save = gdk_pixbuf__gdip_image_save_GIF; /* for gtk < 2.14, you need to implement both. otherwise gdk-pixbuf-queryloaders fails */
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
-{
- static GdkPixbufModulePattern signature[] = {
- { "GIF8", NULL, 100 }, /* GIF */
- { NULL, NULL, 0 }
- };
-
- static gchar *mime_types[] = {
- "image/gif",
- NULL
- };
-
- static gchar *extensions[] = {
- "gif",
- NULL
- };
-
- info->name = "gif";
- info->signature = signature;
- info->description = _("The GIF image format");
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_WRITABLE | GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "LGPL";
-}
diff --git a/gdk-pixbuf/io-gdip-ico.c b/gdk-pixbuf/io-gdip-ico.c
deleted file mode 100644
index 8538b58111..0000000000
--- a/gdk-pixbuf/io-gdip-ico.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* GdkPixbuf library - Win32 GDI+ Pixbuf Loader
- *
- * Copyright (C) 2008 Dominic Lachowicz
- * Copyright (C) 2008 Alberto Ruiz
- *
- * Authors: Dominic Lachowicz <domlachowicz@gmail.com>
- * Alberto Ruiz <aruiz@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more * You should have received a copy of the GNU Lesser 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 "io-gdip-utils.h"
-
-#ifndef INCLUDE_gdiplus
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__gdip_ico_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
-{
- gdip_fill_vtable (module);
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
-{
- static GdkPixbufModulePattern signature[] = {
- { " \x1 ", "zz znz", 100 }, /* ICO */
- { " \x2 ", "zz znz", 100 }, /* ICO */
- { NULL, NULL, 0 }
- };
-
- static gchar *mime_types[] = {
- "image/x-icon",
- "image/x-ico",
- NULL
- };
-
- static gchar *extensions[] = {
- "ico",
- "cur",
- NULL
- };
-
- info->name = "ico";
- info->signature = signature;
- info->description = _("The ICO image format");
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "LGPL";
-}
diff --git a/gdk-pixbuf/io-gdip-jpeg.c b/gdk-pixbuf/io-gdip-jpeg.c
deleted file mode 100644
index 8bd3058606..0000000000
--- a/gdk-pixbuf/io-gdip-jpeg.c
+++ /dev/null
@@ -1,141 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* GdkPixbuf library - Win32 GDI+ Pixbuf Loader
- *
- * Copyright (C) 2008 Dominic Lachowicz
- * Copyright (C) 2008 Alberto Ruiz
- *
- * Authors: Dominic Lachowicz <domlachowicz@gmail.com>
- * Alberto Ruiz <aruiz@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more * You should have received a copy of the GNU Lesser 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.
- */
-
-#define INITGUID
-#include "io-gdip-utils.h"
-
-DEFINE_GUID(EncoderQuality, 0x1d5be4b5,0xfa4a,0x452d,0x9c,0xdd,0x5d,0xb3,0x51,0x05,0xe7,0xeb);
-
-static gboolean
-gdk_pixbuf__gdip_image_save_JPEG_to_callback (GdkPixbufSaveFunc save_func,
- gpointer user_data,
- GdkPixbuf *pixbuf,
- gchar **keys,
- gchar **values,
- GError **error)
-{
- EncoderParameters encoder_params;
- LONG quality = 75; /* default; must be between 0 and 100 */
-
- if (keys && *keys) {
- gchar **kiter = keys;
- gchar **viter = values;
-
- while (*kiter) {
- if (strcmp (*kiter, "quality") == 0) {
- char *endptr = NULL;
- quality = strtol (*viter, &endptr, 10);
-
- if (endptr == *viter) {
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_BAD_OPTION,
- _("JPEG quality must be a value between 0 and 100; value '%s' could not be parsed."),
- *viter);
-
- return FALSE;
- }
-
- if (quality < 0 ||
- quality > 100) {
- /* This is a user-visible error;
- * lets people skip the range-checking
- * in their app.
- */
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_BAD_OPTION,
- _("JPEG quality must be a value between 0 and 100; value '%d' is not allowed."),
- (int)quality);
-
- return FALSE;
- }
- } else {
- g_warning ("Unrecognized parameter (%s) passed to JPEG saver.", *kiter);
- }
-
- ++kiter;
- ++viter;
- }
- }
-
- encoder_params.Count = 1;
- encoder_params.Parameter[0].Guid = EncoderQuality;
- encoder_params.Parameter[0].Type = EncoderParameterValueTypeLong;
- encoder_params.Parameter[0].NumberOfValues = 1;
- encoder_params.Parameter[0].Value = &quality;
-
- return gdip_save_pixbuf (pixbuf, L"image/jpeg", &encoder_params, save_func, user_data, error);
-}
-
-static gboolean
-gdk_pixbuf__gdip_image_save_JPEG (FILE *f,
- GdkPixbuf *pixbuf,
- gchar **keys,
- gchar **values,
- GError **error)
-{
- return gdk_pixbuf__gdip_image_save_JPEG_to_callback (gdip_save_to_file_callback, f, pixbuf, keys, values, error);
-}
-
-#ifndef INCLUDE_gdiplus
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__gdip_jpeg_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
-{
- gdip_fill_vtable (module);
-
- module->save_to_callback = gdk_pixbuf__gdip_image_save_JPEG_to_callback;
- module->save = gdk_pixbuf__gdip_image_save_JPEG; /* for gtk < 2.14, you need to implement both. otherwise gdk-pixbuf-queryloaders fails */
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
-{
- static GdkPixbufModulePattern signature[] = {
- { "\xff\xd8", NULL, 100 }, /* JPEG */
- { NULL, NULL, 0 }
- };
-
- static gchar *mime_types[] = {
- "image/jpeg",
- NULL
- };
-
- static gchar *extensions[] = {
- "jpeg",
- "jpe",
- "jpg",
- NULL
- };
-
- info->name = "jpeg";
- info->signature = signature;
- info->description = _("The JPEG image format");
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_WRITABLE | GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "LGPL";
-}
diff --git a/gdk-pixbuf/io-gdip-native.h b/gdk-pixbuf/io-gdip-native.h
deleted file mode 100644
index 24ea824f46..0000000000
--- a/gdk-pixbuf/io-gdip-native.h
+++ /dev/null
@@ -1,264 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/* GdkPixbuf library - Win32 GDI+ Pixbuf Loader
- *
- * Copyright (C) 2007 Google (Evan Stade)
- * Copyright (C) 2008 Alberto Ruiz <aruiz@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-#ifndef _HAVE_IO_GDIP_NATIVE_H
-#define _HAVE_IO_GDIP_NATIVE_H
-
-#include <windows.h>
-
-#include <glib.h>
-
-/* //////////// Native API ///////////// */
-
-#define WINGDIPAPI __stdcall
-
-typedef gulong ARGB;
-typedef gint PixelFormat;
-
-typedef enum {
- EncoderParameterValueTypeByte = 1,
- EncoderParameterValueTypeASCII = 2,
- EncoderParameterValueTypeShort = 3,
- EncoderParameterValueTypeLong = 4,
- EncoderParameterValueTypeRational = 5,
- EncoderParameterValueTypeLongRange = 6,
- EncoderParameterValueTypeUndefined = 7,
- EncoderParameterValueTypeRationalRange = 8,
- EncoderParameterValueTypePointer = 9
-} EncoderParameterValueType;
-
-#define PixelFormatIndexed 0x00010000
-#define PixelFormatGDI 0x00020000
-#define PixelFormatAlpha 0x00040000
-#define PixelFormatPAlpha 0x00080000
-#define PixelFormatExtended 0x00100000
-#define PixelFormatCanonical 0x00200000
-
-#define PixelFormatUndefined 0
-#define PixelFormatDontCare 0
-
-#define PixelFormat1bppIndexed (1 | ( 1 << 8) | PixelFormatIndexed | PixelFormatGDI)
-#define PixelFormat4bppIndexed (2 | ( 4 << 8) | PixelFormatIndexed | PixelFormatGDI)
-#define PixelFormat8bppIndexed (3 | ( 8 << 8) | PixelFormatIndexed | PixelFormatGDI)
-#define PixelFormat16bppGrayScale (4 | (16 << 8) | PixelFormatExtended)
-#define PixelFormat16bppRGB555 (5 | (16 << 8) | PixelFormatGDI)
-#define PixelFormat16bppRGB565 (6 | (16 << 8) | PixelFormatGDI)
-#define PixelFormat16bppARGB1555 (7 | (16 << 8) | PixelFormatAlpha | PixelFormatGDI)
-#define PixelFormat24bppRGB (8 | (24 << 8) | PixelFormatGDI)
-#define PixelFormat32bppRGB (9 | (32 << 8) | PixelFormatGDI)
-#define PixelFormat32bppARGB (10 | (32 << 8) | PixelFormatAlpha | PixelFormatGDI | PixelFormatCanonical)
-#define PixelFormat32bppPARGB (11 | (32 << 8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatGDI)
-#define PixelFormat48bppRGB (12 | (48 << 8) | PixelFormatExtended)
-#define PixelFormat64bppARGB (13 | (64 << 8) | PixelFormatAlpha | PixelFormatCanonical | PixelFormatExtended)
-#define PixelFormat64bppPARGB (14 | (64 << 8) | PixelFormatAlpha | PixelFormatPAlpha | PixelFormatExtended)
-#define PixelFormatMax 15
-
-enum _Status
-{
- Ok = 0,
- GenericError = 1,
- InvalidParameter = 2,
- OutOfMemory = 3,
- ObjectBusy = 4,
- InsufficientBuffer = 5,
- NotImplemented = 6,
- Win32Error = 7,
- WrongState = 8,
- Aborted = 9,
- FileNotFound = 10,
- ValueOverflow = 11,
- AccessDenied = 12,
- UnknownImageFormat = 13,
- FontFamilyNotFound = 14,
- FontStyleNotFound = 15,
- NotTrueTypeFont = 16,
- UnsupportedGdiplusVersion = 17,
- GdiplusNotInitialized = 18,
- PropertyNotFound = 19,
- PropertyNotSupported = 20,
- ProfileNotFound = 21
-};
-typedef enum _Status Status;
-typedef enum _Status GpStatus;
-
-typedef enum {
- ImageFlagsNone = 0,
- ImageFlagsScalable = 0x0001,
- ImageFlagsHasAlpha = 0x0002,
- ImageFlagsHasTranslucent = 0x0004,
- ImageFlagsPartiallyScalable = 0x0008,
- ImageFlagsColorSpaceRGB = 0x0010,
- ImageFlagsColorSpaceCMYK = 0x0020,
- ImageFlagsColorSpaceGRAY = 0x0040,
- ImageFlagsColorSpaceYCBCR = 0x0080,
- ImageFlagsColorSpaceYCCK = 0x0100,
- ImageFlagsHasRealDPI = 0x1000,
- ImageFlagsHasRealPixelSize = 0x2000,
- ImageFlagsReadOnly = 0x00010000,
- ImageFlagsCaching = 0x00020000
-} ImageFlags;
-
-enum _ImageLockMode
-{
- ImageLockModeRead = 1,
- ImageLockModeWrite = 2,
- ImageLockModeUserInputBuf = 4
-};
-typedef enum _ImageLockMode ImageLockMode;
-
-enum _ImageType
-{
- ImageTypeUnknown,
- ImageTypeBitmap,
- ImageTypeMetafile
-};
-typedef enum _ImageType ImageType;
-
-typedef struct _GpImage GpImage;
-typedef struct _GpBitmap GpBitmap;
-typedef struct _GpGraphics GpGraphics;
-
-struct _GdiplusStartupInput
-{
- UINT32 GdiplusVersion;
- gpointer DebugEventCallback;
- BOOL SuppressBackgroundThread;
- BOOL SuppressExternalCodecs;
-};
-typedef struct _GdiplusStartupInput GdiplusStartupInput;
-
-struct _PropItem
-{
- ULONG id;
- ULONG length;
- WORD type;
- VOID *value;
-};
-typedef struct _PropItem PropertyItem;
-
-struct _EncoderParameter
-{
- GUID Guid;
- ULONG NumberOfValues;
- ULONG Type;
- VOID* Value;
-};
-typedef struct _EncoderParameter EncoderParameter;
-
-struct _EncoderParameters
-{
- UINT Count; /* Number of parameters in this structure */
- EncoderParameter Parameter[1]; /* Parameter values */
-};
-typedef struct _EncoderParameters EncoderParameters;
-
-struct _ImageCodecInfo
-{
- CLSID Clsid;
- GUID FormatID;
- const WCHAR* CodecName;
- const WCHAR* DllName;
- const WCHAR* FormatDescription;
- const WCHAR* FilenameExtension;
- const WCHAR* MimeType;
- DWORD Flags;
- DWORD Version;
- DWORD SigCount;
- DWORD SigSize;
- const BYTE* SigPattern;
- const BYTE* SigMask;
-};
-typedef struct _ImageCodecInfo ImageCodecInfo;
-
-struct _BitmapData
-{
- UINT Width;
- UINT Height;
- INT Stride;
- PixelFormat PixelFormat;
- VOID* Scan0;
- UINT_PTR Reserved;
-};
-typedef struct _BitmapData BitmapData;
-
-struct _GpRect
-{
- INT X;
- INT Y;
- INT Width;
- INT Height;
-};
-typedef struct _GpRect GpRect;
-
-#ifndef IStream_Release
-#define IStream_Release(This) (This)->lpVtbl->Release(This)
-#endif
-
-#ifndef IStream_Seek
-#define IStream_Seek(This,dlibMove,dwOrigin,plibNewPosition) (This)->lpVtbl->Seek(This,dlibMove,dwOrigin,plibNewPosition)
-#endif
-
-#ifndef IStream_Read
-#define IStream_Read(This,pv,cb,pcbRead) (This)->lpVtbl->Read(This,pv,cb,pcbRead)
-#endif
-
-#ifndef IStream_SetSize
-#define IStream_SetSize(This,size) (This)->lpVtbl->SetSize(This,size)
-#endif
-
-typedef GpStatus (WINGDIPAPI* GdiplusStartupFunc) (gpointer, const gpointer, gpointer);
-typedef GpStatus (WINGDIPAPI* GdipCreateBitmapFromStreamFunc) (gpointer, GpBitmap**);
-typedef GpStatus (WINGDIPAPI* GdipBitmapGetPixelFunc) (GpBitmap*, gint x, gint y, ARGB*);
-typedef GpStatus (WINGDIPAPI* GdipGetImageWidthFunc) (GpImage*, guint*);
-typedef GpStatus (WINGDIPAPI* GdipGetImageHeightFunc) (GpImage*, guint*);
-typedef GpStatus (WINGDIPAPI* GdipDisposeImageFunc) (GpImage*);
-typedef GpStatus (WINGDIPAPI* GdipGetImageFlagsFunc) (GpImage *, guint*);
-typedef GpStatus (WINGDIPAPI* GdipImageGetFrameCountFunc) (GpImage *image, const GUID* dimensionID, UINT* count);
-typedef GpStatus (WINGDIPAPI* GdipImageSelectActiveFrameFunc) (GpImage *image, const GUID* dimensionID, UINT frameIndex);
-typedef GpStatus (WINGDIPAPI* GdipGetPropertyItemSizeFunc) (GpImage *image, int propId, guint* size);
-typedef GpStatus (WINGDIPAPI* GdipGetPropertyItemFunc) (GpImage *image, int propId, guint propSize, PropertyItem* buffer);
-typedef GpStatus (WINGDIPAPI* GdipGetPropertyCountFunc) (GpImage *image, guint* numOfProperty);
-typedef GpStatus (WINGDIPAPI* GdipGetPropertyIdListFunc) (GpImage *image, guint numOfProperty, PROPID* list);
-typedef GpStatus (WINGDIPAPI* GdipCreateBitmapFromScan0Func) (INT width, INT height, INT stride, PixelFormat format, BYTE* scan0,
- GpBitmap** bitmap);
-typedef GpStatus (WINGDIPAPI* GdipSaveImageToStreamFunc) (GpImage *image, IStream* stream, const CLSID* clsidEncoder,
- const EncoderParameters* encoderParams);
-
-typedef GpStatus (WINGDIPAPI* GdipGetImageEncodersFunc) (UINT numEncoders, UINT size, ImageCodecInfo *encoders);
-typedef GpStatus (WINGDIPAPI* GdipGetImageEncodersSizeFunc) (UINT *numEncoders, UINT *size);
-typedef GpStatus (WINGDIPAPI* GdipBitmapSetPixelFunc) (GpBitmap* bitmap, INT x, INT y, ARGB color);
-
-typedef GpStatus (WINGDIPAPI* GdipDrawImageIFunc) (GpGraphics *graphics, GpImage *image, INT x, INT y);
-typedef GpStatus (WINGDIPAPI* GdipGetImageGraphicsContextFunc) (GpImage *image, GpGraphics **graphics);
-typedef GpStatus (WINGDIPAPI* GdipFlushFunc) (GpGraphics *graphics, INT intention);
-typedef GpStatus (WINGDIPAPI* GdipGraphicsClearFunc) (GpGraphics *graphics, ARGB color);
-typedef GpStatus (WINGDIPAPI* GdipBitmapSetResolutionFunc) (GpBitmap* bitmap, float xdpi, float ydpi);
-typedef GpStatus (WINGDIPAPI* GdipGetImageHorizontalResolutionFunc) (GpImage *image, float *resolution);
-typedef GpStatus (WINGDIPAPI* GdipGetImageVerticalResolutionFunc) (GpImage *image, float *resolution);
-typedef GpStatus (WINGDIPAPI* GdipLoadImageFromStreamFunc) (IStream* stream, GpImage **image);
-typedef GpStatus (WINGDIPAPI* GdipDeleteGraphicsFunc) (GpGraphics *graphics);
-
-typedef GpStatus (WINGDIPAPI* GdipBitmapLockBitsFunc) (GpBitmap* bitmap, const GpRect* rect, UINT flags, PixelFormat format, BitmapData* lockedBitmapData);
-typedef GpStatus (WINGDIPAPI* GdipBitmapUnlockBitsFunc) (GpBitmap* bitmap, BitmapData* lockedBitmapData);
-typedef GpStatus (WINGDIPAPI* GdipGetImagePixelFormatFunc) (GpImage *image, PixelFormat *format);
-typedef GpStatus (WINGDIPAPI* GdipCloneBitmapAreaIFunc) (INT x, INT y, INT width, INT height, PixelFormat format, GpBitmap *srcBitmap, GpBitmap **dstBitmap);
-
-#endif
diff --git a/gdk-pixbuf/io-gdip-png.c b/gdk-pixbuf/io-gdip-png.c
deleted file mode 100644
index 8b094bfca4..0000000000
--- a/gdk-pixbuf/io-gdip-png.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* GdkPixbuf library - Win32 GDI+ Pixbuf Loader
- *
- * Copyright (C) 2008 Dominic Lachowicz
- * Copyright (C) 2008 Alberto Ruiz
- *
- * Authors: Dominic Lachowicz <domlachowicz@gmail.com>
- * Alberto Ruiz <aruiz@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more * You should have received a copy of the GNU Lesser 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.
- */
-
-#define INITGUID
-#include "io-gdip-utils.h"
-
-DEFINE_GUID(EncoderCompression, 0xe09d739d,0xccd4,0x44ee,0x8e,0xba,0x3f,0xbf,0x8b,0xe4,0xfc,0x58);
-
-static gboolean
-gdk_pixbuf__gdip_image_save_PNG_to_callback (GdkPixbufSaveFunc save_func,
- gpointer user_data,
- GdkPixbuf *pixbuf,
- gchar **keys,
- gchar **values,
- GError **error)
-{
- EncoderParameters encoder_params;
- LONG compression = 5;
-
- if (keys && *keys) {
- gchar **kiter = keys;
- gchar **viter = values;
-
- while (*kiter) {
- if (strncmp (*kiter, "tEXt::", 6) == 0) {
- /* TODO: support exif data and the like */
- }
- else if (strcmp (*kiter, "compression") == 0) {
- char *endptr = NULL;
- compression = strtol (*viter, &endptr, 10);
-
- if (endptr == *viter) {
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_BAD_OPTION,
- _("PNG compression level must be a value between 0 and 9; value '%s' could not be parsed."),
- *viter);
- return FALSE;
- }
- if (compression < 0 || compression > 9) {
- /* This is a user-visible error;
- * lets people skip the range-checking
- * in their app.
- */
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_BAD_OPTION,
- _("PNG compression level must be a value between 0 and 9; value '%d' is not allowed."),
- (int)compression);
- return FALSE;
- }
- } else {
- g_warning ("Unrecognized parameter (%s) passed to PNG saver.", *kiter);
- }
-
- ++kiter;
- ++viter;
- }
- }
-
- encoder_params.Count = 1;
- encoder_params.Parameter[0].Guid = EncoderCompression;
- encoder_params.Parameter[0].Type = EncoderParameterValueTypeLong;
- encoder_params.Parameter[0].NumberOfValues = 1;
- encoder_params.Parameter[0].Value = &compression;
-
- return gdip_save_pixbuf (pixbuf, L"image/png", &encoder_params, save_func, user_data, error);
-}
-
-static gboolean
-gdk_pixbuf__gdip_image_save_PNG (FILE *f,
- GdkPixbuf *pixbuf,
- gchar **keys,
- gchar **values,
- GError **error)
-{
- return gdk_pixbuf__gdip_image_save_PNG_to_callback (gdip_save_to_file_callback, f, pixbuf, keys, values, error);
-}
-
-#ifndef INCLUDE_gdip_png
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__gdip_png_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
-{
- gdip_fill_vtable (module);
-
- module->save_to_callback = gdk_pixbuf__gdip_image_save_PNG_to_callback;
- module->save = gdk_pixbuf__gdip_image_save_PNG; /* for gtk < 2.14, you need to implement both. otherwise gdk-pixbuf-queryloaders fails */
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
-{
- static GdkPixbufModulePattern signature[] = {
- { "\x89PNG\r\n\x1a\x0a", NULL, 100 }, /* PNG */
- { NULL, NULL, 0 }
- };
-
- static gchar *mime_types[] = {
- "image/png",
- NULL
- };
-
- static gchar *extensions[] = {
- "png",
- NULL
- };
-
- info->name = "png";
- info->signature = signature;
- info->description = _("The PNG image format");
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_WRITABLE | GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "LGPL";
-}
diff --git a/gdk-pixbuf/io-gdip-propertytags.h b/gdk-pixbuf/io-gdip-propertytags.h
deleted file mode 100644
index 95243bfe1a..0000000000
--- a/gdk-pixbuf/io-gdip-propertytags.h
+++ /dev/null
@@ -1,228 +0,0 @@
-#ifndef HAVE_IO_GDIP_PROPERTIES_H
-#define HAVE_IO_GDIP_PROPERTIES_H
-
-#define PropertyTagTypeByte 1
-#define PropertyTagTypeASCII 2
-#define PropertyTagTypeShort 3
-#define PropertyTagTypeLong 4
-#define PropertyTagTypeRational 5
-#define PropertyTagTypeUndefined 7
-#define PropertyTagTypeSLONG 9
-#define PropertyTagTypeSRational 10
-
-#define PropertyTagExifIFD 0x8769
-#define PropertyTagGpsIFD 0x8825
-#define PropertyTagNewSubfileType 0x00FE
-#define PropertyTagSubfileType 0x00FF
-#define PropertyTagImageWidth 0x0100
-#define PropertyTagImageHeight 0x0101
-#define PropertyTagBitsPerSample 0x0102
-#define PropertyTagCompression 0x0103
-#define PropertyTagPhotometricInterp 0x0106
-#define PropertyTagThreshHolding 0x0107
-#define PropertyTagCellWidth 0x0108
-#define PropertyTagCellHeight 0x0109
-#define PropertyTagFillOrder 0x010A
-#define PropertyTagDocumentName 0x010D
-#define PropertyTagImageDescription 0x010E
-#define PropertyTagEquipMake 0x010F
-#define PropertyTagEquipModel 0x0110
-#define PropertyTagStripOffsets 0x0111
-#define PropertyTagOrientation 0x0112
-#define PropertyTagSamplesPerPixel 0x0115
-#define PropertyTagRowsPerStrip 0x0116
-#define PropertyTagStripBytesCount 0x0117
-#define PropertyTagMinSampleValue 0x0118
-#define PropertyTagMaxSampleValue 0x0119
-#define PropertyTagXResolution 0x011A
-#define PropertyTagYResolution 0x011B
-#define PropertyTagPlanarConfig 0x011C
-#define PropertyTagPageName 0x011D
-#define PropertyTagXPosition 0x011E
-#define PropertyTagYPosition 0x011F
-#define PropertyTagFreeOffset 0x0120
-#define PropertyTagFreeByteCounts 0x0121
-#define PropertyTagGrayResponseUnit 0x0122
-#define PropertyTagGrayResponseCurve 0x0123
-#define PropertyTagT4Option 0x0124
-#define PropertyTagT6Option 0x0125
-#define PropertyTagResolutionUnit 0x0128
-#define PropertyTagPageNumber 0x0129
-#define PropertyTagTransferFuncition 0x012D
-#define PropertyTagSoftwareUsed 0x0131
-#define PropertyTagDateTime 0x0132
-#define PropertyTagArtist 0x013B
-#define PropertyTagHostComputer 0x013C
-#define PropertyTagPredictor 0x013D
-#define PropertyTagWhitePoint 0x013E
-#define PropertyTagPrimaryChromaticities 0x013F
-#define PropertyTagColorMap 0x0140
-#define PropertyTagHalftoneHints 0x0141
-#define PropertyTagTileWidth 0x0142
-#define PropertyTagTileLength 0x0143
-#define PropertyTagTileOffset 0x0144
-#define PropertyTagTileByteCounts 0x0145
-#define PropertyTagInkSet 0x014C
-#define PropertyTagInkNames 0x014D
-#define PropertyTagNumberOfInks 0x014E
-#define PropertyTagDotRange 0x0150
-#define PropertyTagTargetPrinter 0x0151
-#define PropertyTagExtraSamples 0x0152
-#define PropertyTagSampleFormat 0x0153
-#define PropertyTagSMinSampleValue 0x0154
-#define PropertyTagSMaxSampleValue 0x0155
-#define PropertyTagTransferRange 0x0156
-#define PropertyTagJPEGProc 0x0200
-#define PropertyTagJPEGInterFormat 0x0201
-#define PropertyTagJPEGInterLength 0x0202
-#define PropertyTagJPEGRestartInterval 0x0203
-#define PropertyTagJPEGLosslessPredictors 0x0205
-#define PropertyTagJPEGPointTransforms 0x0206
-#define PropertyTagJPEGQTables 0x0207
-#define PropertyTagJPEGDCTables 0x0208
-#define PropertyTagJPEGACTables 0x0209
-#define PropertyTagYCbCrCoefficients 0x0211
-#define PropertyTagYCbCrSubsampling 0x0212
-#define PropertyTagYCbCrPositioning 0x0213
-#define PropertyTagREFBlackWhite 0x0214
-#define PropertyTagICCProfile 0x8773
-#define PropertyTagGamma 0x0301
-#define PropertyTagICCProfileDescriptor 0x0302
-#define PropertyTagSRGBRenderingIntent 0x0303
-#define PropertyTagImageTitle 0x0320
-#define PropertyTagCopyright 0x8298
-#define PropertyTagResolutionXUnit 0x5001
-#define PropertyTagResolutionYUnit 0x5002
-#define PropertyTagResolutionXLengthUnit 0x5003
-#define PropertyTagResolutionYLengthUnit 0x5004
-#define PropertyTagPrintFlags 0x5005
-#define PropertyTagPrintFlagsVersion 0x5006
-#define PropertyTagPrintFlagsCrop 0x5007
-#define PropertyTagPrintFlagsBleedWidth 0x5008
-#define PropertyTagPrintFlagsBleedWidthScale 0x5009
-#define PropertyTagHalftoneLPI 0x500A
-#define PropertyTagHalftoneLPIUnit 0x500B
-#define PropertyTagHalftoneDegree 0x500C
-#define PropertyTagHalftoneShape 0x500D
-#define PropertyTagHalftoneMisc 0x500E
-#define PropertyTagHalftoneScreen 0x500F
-#define PropertyTagJPEGQuality 0x5010
-#define PropertyTagGridSize 0x5011
-#define PropertyTagThumbnailFormat 0x5012
-#define PropertyTagThumbnailWidth 0x5013
-#define PropertyTagThumbnailHeight 0x5014
-#define PropertyTagThumbnailColorDepth 0x5015
-#define PropertyTagThumbnailPlanes 0x5016
-#define PropertyTagThumbnailRawBytes 0x5017
-#define PropertyTagThumbnailSize 0x5018
-#define PropertyTagThumbnailCompressedSize 0x5019
-#define PropertyTagColorTransferFunction 0x501A
-#define PropertyTagThumbnailData 0x501B
-#define PropertyTagThumbnailImageWidth 0x5020
-#define PropertyTagThumbnailImageHeight 0x5021
-#define PropertyTagThumbnailBitsPerSample 0x5022
-#define PropertyTagThumbnailCompression 0x5023
-#define PropertyTagThumbnailPhotometricInterp 0x5024
-#define PropertyTagThumbnailImageDescription 0x5025
-#define PropertyTagThumbnailEquipMake 0x5026
-#define PropertyTagThumbnailEquipModel 0x5027
-#define PropertyTagThumbnailStripOffsets 0x5028
-#define PropertyTagThumbnailOrientation 0x5029
-#define PropertyTagThumbnailSamplesPerPixel 0x502A
-#define PropertyTagThumbnailRowsPerStrip 0x502B
-#define PropertyTagThumbnailStripBytesCount 0x502C
-#define PropertyTagThumbnailResolutionX 0x502D
-#define PropertyTagThumbnailResolutionY 0x502E
-#define PropertyTagThumbnailPlanarConfig 0x502F
-#define PropertyTagThumbnailResolutionUnit 0x5030
-#define PropertyTagThumbnailTransferFunction 0x5031
-#define PropertyTagThumbnailSoftwareUsed 0x5032
-#define PropertyTagThumbnailDateTime 0x5033
-#define PropertyTagThumbnailArtist 0x5034
-#define PropertyTagThumbnailWhitePoint 0x5035
-#define PropertyTagThumbnailPrimaryChromaticities 0x5036
-#define PropertyTagThumbnailYCbCrCoefficients 0x5037
-#define PropertyTagThumbnailYCbCrSubsampling 0x5038
-#define PropertyTagThumbnailYCbCrPositioning 0x5039
-#define PropertyTagThumbnailRefBlackWhite 0x503A
-#define PropertyTagThumbnailCopyRight 0x503B
-#define PropertyTagLuminanceTable 0x5090
-#define PropertyTagChrominanceTable 0x5091
-#define PropertyTagFrameDelay 0x5100
-#define PropertyTagLoopCount 0x5101
-#define PropertyTagPixelUnit 0x5110
-#define PropertyTagPixelPerUnitX 0x5111
-#define PropertyTagPixelPerUnitY 0x5112
-#define PropertyTagPaletteHistogram 0x5113
-#define PropertyTagExifExposureTime 0x829A
-#define PropertyTagExifFNumber 0x829D
-#define PropertyTagExifExposureProg 0x8822
-#define PropertyTagExifSpectralSense 0x8824
-#define PropertyTagExifISOSpeed 0x8827
-#define PropertyTagExifOECF 0x8828
-#define PropertyTagExifVer 0x9000
-#define PropertyTagExifDTOrig 0x9003
-#define PropertyTagExifDTDigitized 0x9004
-#define PropertyTagExifCompConfig 0x9101
-#define PropertyTagExifCompBPP 0x9102
-#define PropertyTagExifShutterSpeed 0x9201
-#define PropertyTagExifAperture 0x9202
-#define PropertyTagExifBrightness 0x9203
-#define PropertyTagExifExposureBias 0x9204
-#define PropertyTagExifMaxAperture 0x9205
-#define PropertyTagExifSubjectDist 0x9206
-#define PropertyTagExifMeteringMode 0x9207
-#define PropertyTagExifLightSource 0x9208
-#define PropertyTagExifFlash 0x9209
-#define PropertyTagExifFocalLength 0x920A
-#define PropertyTagExifMakerNote 0x927C
-#define PropertyTagExifUserComment 0x9286
-#define PropertyTagExifDTSubsec 0x9290
-#define PropertyTagExifDTOrigSS 0x9291
-#define PropertyTagExifDTDigSS 0x9292
-#define PropertyTagExifFPXVer 0xA000
-#define PropertyTagExifColorSpace 0xA001
-#define PropertyTagExifPixXDim 0xA002
-#define PropertyTagExifPixYDim 0xA003
-#define PropertyTagExifRelatedWav 0xA004
-#define PropertyTagExifInterop 0xA005
-#define PropertyTagExifFlashEnergy 0xA20B
-#define PropertyTagExifSpatialFR 0xA20C
-#define PropertyTagExifFocalXRes 0xA20E
-#define PropertyTagExifFocalYRes 0xA20F
-#define PropertyTagExifFocalResUnit 0xA210
-#define PropertyTagExifSubjectLoc 0xA214
-#define PropertyTagExifExposureIndex 0xA215
-#define PropertyTagExifSensingMethod 0xA217
-#define PropertyTagExifFileSource 0xA300
-#define PropertyTagExifSceneType 0xA301
-#define PropertyTagExifCfaPattern 0xA302
-#define PropertyTagGpsVer 0x0000
-#define PropertyTagGpsLatitudeRef 0x0001
-#define PropertyTagGpsLatitude 0x0002
-#define PropertyTagGpsLongitudeRef 0x0003
-#define PropertyTagGpsLongitude 0x0004
-#define PropertyTagGpsAltitudeRef 0x0005
-#define PropertyTagGpsAltitude 0x0006
-#define PropertyTagGpsGpsTime 0x0007
-#define PropertyTagGpsGpsSatellites 0x0008
-#define PropertyTagGpsGpsStatus 0x0009
-#define PropertyTagGpsGpsMeasureMode 0x00A
-#define PropertyTagGpsGpsDop 0x000B
-#define PropertyTagGpsSpeedRef 0x000C
-#define PropertyTagGpsSpeed 0x000D
-#define PropertyTagGpsTrackRef 0x000E
-#define PropertyTagGpsTrack 0x000F
-#define PropertyTagGpsImgDirRef 0x0010
-#define PropertyTagGpsImgDir 0x0011
-#define PropertyTagGpsMapDatum 0x0012
-#define PropertyTagGpsDestLatRef 0x0013
-#define PropertyTagGpsDestLat 0x0014
-#define PropertyTagGpsDestLongRef 0x0015
-#define PropertyTagGpsDestLong 0x0016
-#define PropertyTagGpsDestBearRef 0x0017
-#define PropertyTagGpsDestBear 0x0018
-#define PropertyTagGpsDestDistRef 0x0019
-#define PropertyTagGpsDestDist 0x001A
-
-#endif
diff --git a/gdk-pixbuf/io-gdip-tiff.c b/gdk-pixbuf/io-gdip-tiff.c
deleted file mode 100644
index 7e0a1898ea..0000000000
--- a/gdk-pixbuf/io-gdip-tiff.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* GdkPixbuf library - Win32 GDI+ Pixbuf Loader
- *
- * Copyright (C) 2008 Dominic Lachowicz
- * Copyright (C) 2008 Alberto Ruiz
- *
- * Authors: Dominic Lachowicz <domlachowicz@gmail.com>
- * Alberto Ruiz <aruiz@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more * You should have received a copy of the GNU Lesser 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 "io-gdip-utils.h"
-
-static gboolean
-gdk_pixbuf__gdip_image_save_TIFF_to_callback (GdkPixbufSaveFunc save_func,
- gpointer user_data,
- GdkPixbuf *pixbuf,
- gchar **keys,
- gchar **values,
- GError **error)
-{
- return gdip_save_pixbuf (pixbuf, L"image/tiff", NULL, save_func, user_data, error);
-}
-
-static gboolean
-gdk_pixbuf__gdip_image_save_TIFF (FILE *f,
- GdkPixbuf *pixbuf,
- gchar **keys,
- gchar **values,
- GError **error)
-{
- return gdk_pixbuf__gdip_image_save_TIFF_to_callback (gdip_save_to_file_callback, f, pixbuf, keys, values, error);
-}
-
-#ifndef INCLUDE_gdiplus
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__gdip_tiff_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
-{
- gdip_fill_vtable (module);
-
- module->save_to_callback = gdk_pixbuf__gdip_image_save_TIFF_to_callback;
- module->save = gdk_pixbuf__gdip_image_save_TIFF; /* for gtk < 2.14, you need to implement both. otherwise gdk-pixbuf-queryloaders fails */
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
-{
- static GdkPixbufModulePattern signature[] = {
- { "MM \x2a", " z ", 100 }, /* TIFF */
- { "II\x2a ", " z", 100 }, /* TIFF */
- { NULL, NULL, 0 }
- };
-
- static gchar *mime_types[] = {
- "image/tiff",
- NULL
- };
-
- static gchar *extensions[] = {
- "tiff",
- "tif",
- NULL
- };
-
- info->name = "tiff";
- info->signature = signature;
- info->description = "The TIFF image format";
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_WRITABLE | GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "LGPL";
-}
diff --git a/gdk-pixbuf/io-gdip-utils.c b/gdk-pixbuf/io-gdip-utils.c
deleted file mode 100644
index b8fa72bea1..0000000000
--- a/gdk-pixbuf/io-gdip-utils.c
+++ /dev/null
@@ -1,1022 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* GdkPixbuf library - Win32 GDI+ Pixbuf Loader
- *
- * Copyright (C) 2008 Dominic Lachowicz
- * Copyright (C) 2008 Alberto Ruiz
- *
- * Authors: Dominic Lachowicz <domlachowicz@gmail.com>
- * Alberto Ruiz <aruiz@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more * You should have received a copy of the GNU Lesser 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.
- */
-
-#define INITGUID
-#include <ole2.h>
-
-#include "io-gdip-utils.h"
-#include "io-gdip-native.h"
-#include "io-gdip-propertytags.h"
-#include "io-gdip-animation.h"
-
-#define LOAD_BUFFER_SIZE 65536
-
-struct _GdipContext {
- GdkPixbufModuleUpdatedFunc updated_func;
- GdkPixbufModulePreparedFunc prepared_func;
- GdkPixbufModuleSizeFunc size_func;
-
- gpointer user_data;
- GByteArray *buffer;
- IStream *stream;
- HGLOBAL hg;
-};
-typedef struct _GdipContext GdipContext;
-
-static GdiplusStartupFunc GdiplusStartup;
-static GdipCreateBitmapFromStreamFunc GdipCreateBitmapFromStream;
-static GdipBitmapGetPixelFunc GdipBitmapGetPixel;
-static GdipGetImageHeightFunc GdipGetImageHeight;
-static GdipDisposeImageFunc GdipDisposeImage;
-static GdipGetImageFlagsFunc GdipGetImageFlags;
-static GdipGetImageWidthFunc GdipGetImageWidth;
-static GdipImageGetFrameCountFunc GdipImageGetFrameCount;
-static GdipImageSelectActiveFrameFunc GdipImageSelectActiveFrame;
-static GdipGetPropertyItemSizeFunc GdipGetPropertyItemSize;
-static GdipGetPropertyItemFunc GdipGetPropertyItem;
-static GdipGetPropertyCountFunc GdipGetPropertyCount;
-static GdipGetPropertyIdListFunc GdipGetPropertyIdList;
-static GdipCreateBitmapFromScan0Func GdipCreateBitmapFromScan0;
-static GdipSaveImageToStreamFunc GdipSaveImageToStream;
-static GdipBitmapSetPixelFunc GdipBitmapSetPixel;
-static GdipDrawImageIFunc GdipDrawImageI;
-static GdipGetImageGraphicsContextFunc GdipGetImageGraphicsContext;
-static GdipFlushFunc GdipFlush;
-static GdipGraphicsClearFunc GdipGraphicsClear;
-static GdipBitmapSetResolutionFunc GdipBitmapSetResolution;
-static GdipGetImageHorizontalResolutionFunc GdipGetImageHorizontalResolution;
-static GdipGetImageVerticalResolutionFunc GdipGetImageVerticalResolution;
-static GdipLoadImageFromStreamFunc GdipLoadImageFromStream;
-static GdipDeleteGraphicsFunc GdipDeleteGraphics;
-static GdipGetImageEncodersFunc GdipGetImageEncoders;
-static GdipGetImageEncodersSizeFunc GdipGetImageEncodersSize;
-static GdipBitmapLockBitsFunc GdipBitmapLockBits;
-static GdipBitmapUnlockBitsFunc GdipBitmapUnlockBits;
-static GdipGetImagePixelFormatFunc GdipGetImagePixelFormat;
-static GdipCloneBitmapAreaIFunc GdipCloneBitmapAreaI;
-
-DEFINE_GUID(FrameDimensionTime, 0x6aedbd6d,0x3fb5,0x418a,0x83,0xa6,0x7f,0x45,0x22,0x9d,0xc8,0x72);
-DEFINE_GUID(FrameDimensionPage, 0x7462dc86,0x6180,0x4c7e,0x8e,0x3f,0xee,0x73,0x33,0xa7,0xa4,0x83);
-
-static void
-gdip_set_error_from_hresult (GError **error, gint code, HRESULT hr, const char *format)
-{
- gchar *msg;
-
- msg = g_win32_error_message (hr);
-
- if (msg) {
- g_set_error (error, GDK_PIXBUF_ERROR, code, format, msg);
- g_free (msg);
- }
-}
-
-static void
-gdip_set_error_from_gpstatus (GError **error, gint code, GpStatus status)
-{
- const char *msg;
-
- switch (status)
- {
-#define CASE(x) case x: msg = #x; break
- CASE (GenericError);
- CASE (InvalidParameter);
- CASE (OutOfMemory);
- CASE (ObjectBusy);
- CASE (InsufficientBuffer);
- CASE (NotImplemented);
- CASE (Win32Error);
- CASE (WrongState);
- CASE (Aborted);
- CASE (FileNotFound);
- CASE (ValueOverflow);
- CASE (AccessDenied);
- CASE (UnknownImageFormat);
- CASE (FontFamilyNotFound);
- CASE (FontStyleNotFound);
- CASE (NotTrueTypeFont);
- CASE (UnsupportedGdiplusVersion);
- CASE (GdiplusNotInitialized);
- CASE (PropertyNotFound);
- CASE (PropertyNotSupported);
- CASE (ProfileNotFound);
- default:
- msg = "Unknown error";
- }
- g_set_error_literal (error, GDK_PIXBUF_ERROR, code, msg);
-}
-
-static gboolean
-gdip_init (void)
-{
- GdiplusStartupInput input;
- ULONG_PTR gdiplusToken = 0;
- static HINSTANCE gdipluslib = NULL;
-
- if (!gdipluslib)
- gdipluslib = LoadLibrary ("gdiplus.dll");
- else
- return TRUE; /* gdip_init() is idempotent */
-
- if (!gdipluslib)
- return FALSE;
-
-#define LOOKUP(func) \
- G_STMT_START { \
- func = (func##Func) GetProcAddress (gdipluslib, #func); \
- if (!func) {\
- g_warning ("Couldn't find GDI+ function %s\n", #func); \
- return FALSE; \
- } \
- } G_STMT_END
-
- LOOKUP (GdiplusStartup);
- LOOKUP (GdipCreateBitmapFromStream);
- LOOKUP (GdipBitmapGetPixel);
- LOOKUP (GdipGetImageHeight);
- LOOKUP (GdipDisposeImage);
- LOOKUP (GdipGetImageFlags);
- LOOKUP (GdipGetImageWidth);
- LOOKUP (GdipImageGetFrameCount);
- LOOKUP (GdipImageSelectActiveFrame);
- LOOKUP (GdipGetPropertyItemSize);
- LOOKUP (GdipGetPropertyItem);
- LOOKUP (GdipGetPropertyCount);
- LOOKUP (GdipGetPropertyIdList);
- LOOKUP (GdipCreateBitmapFromScan0);
- LOOKUP (GdipSaveImageToStream);
- LOOKUP (GdipBitmapSetPixel);
- LOOKUP (GdipDrawImageI);
- LOOKUP (GdipGetImageGraphicsContext);
- LOOKUP (GdipFlush);
- LOOKUP (GdipGraphicsClear);
- LOOKUP (GdipBitmapSetResolution);
- LOOKUP (GdipGetImageHorizontalResolution);
- LOOKUP (GdipGetImageVerticalResolution);
- LOOKUP (GdipLoadImageFromStream);
- LOOKUP (GdipDeleteGraphics);
- LOOKUP (GdipGetImageEncoders);
- LOOKUP (GdipGetImageEncodersSize);
- LOOKUP (GdipBitmapLockBits);
- LOOKUP (GdipBitmapUnlockBits);
- LOOKUP (GdipGetImagePixelFormat);
- LOOKUP (GdipCloneBitmapAreaI);
-
-#undef LOOKUP
-
- input.GdiplusVersion = 1;
- input.DebugEventCallback = NULL;
- input.SuppressBackgroundThread = input.SuppressExternalCodecs = FALSE;
-
- return (GdiplusStartup (&gdiplusToken, &input, NULL) == 0 ? TRUE : FALSE);
-}
-
-static gboolean
-GetEncoderClsid (const WCHAR *format, CLSID *pClsid)
-{
- UINT num, size;
- int j;
- ImageCodecInfo *pImageCodecInfo;
-
- if (Ok != GdipGetImageEncodersSize (&num, &size))
- return FALSE;
-
- pImageCodecInfo = (ImageCodecInfo *) g_malloc (size);
-
- if (Ok != GdipGetImageEncoders (num, size, pImageCodecInfo)) {
- g_free (pImageCodecInfo);
- return FALSE;
- }
-
- for (j = 0; j < num; j++) {
- if (wcscmp (pImageCodecInfo[j].MimeType, format) == 0) {
- *pClsid = pImageCodecInfo[j].Clsid;
- g_free (pImageCodecInfo);
- return TRUE;
- }
- }
-
- g_free (pImageCodecInfo);
-
- return FALSE;
-}
-
-static HGLOBAL
-gdip_buffer_to_hglobal (const gchar *buffer, size_t size, GError **error)
-{
- HGLOBAL hg = NULL;
-
- hg = GlobalAlloc (GPTR, size);
-
- if (!hg) {
- gdip_set_error_from_hresult (error, GDK_PIXBUF_ERROR_FAILED, GetLastError (), _("Could not allocate memory: %s"));
- return NULL;
- }
-
- CopyMemory (hg, buffer, size);
-
- return hg;
-}
-
-static gboolean
-gdip_save_bitmap_to_callback (GpBitmap *bitmap,
- const CLSID *format,
- const EncoderParameters *encoder_params,
- GdkPixbufSaveFunc save_func,
- gpointer user_data,
- GError **error)
-{
- HRESULT hr;
- IStream *streamOut = NULL;
- gboolean success = FALSE;
- guint64 zero = 0;
- GpStatus status;
-
- hr = CreateStreamOnHGlobal (NULL, TRUE, &streamOut);
- if (!SUCCEEDED (hr)) {
- gdip_set_error_from_hresult (error, GDK_PIXBUF_ERROR_FAILED, hr, _("Could not create stream: %s"));
- return FALSE;
- }
-
- status = GdipSaveImageToStream ((GpImage *)bitmap, streamOut, format, encoder_params);
- if (Ok != status) {
- gdip_set_error_from_gpstatus (error, GDK_PIXBUF_ERROR_FAILED, status);
- IStream_Release (streamOut);
- return FALSE;
- }
-
- /* seek back to the beginning of the stream */
- hr = IStream_Seek (streamOut, *(LARGE_INTEGER *)&zero, STREAM_SEEK_SET, NULL);
- if (!SUCCEEDED (hr)) {
- gdip_set_error_from_hresult (error, GDK_PIXBUF_ERROR_FAILED, hr, _("Could not seek stream: %s"));
- IStream_Release (streamOut);
- return FALSE;
- }
-
- for (;;) {
- char buffer[LOAD_BUFFER_SIZE];
- ULONG nread;
-
- hr = IStream_Read (streamOut, buffer, sizeof(buffer), &nread);
- if (!SUCCEEDED (hr))
- {
- gdip_set_error_from_hresult (error, GDK_PIXBUF_ERROR_FAILED, hr, _("Could not read from stream: %s"));
- break;
- }
- else if (0 == nread) {
- success = TRUE; /* EOF */
- break;
- }
- else if (!(*save_func) (buffer, nread, error, user_data))
- break;
- }
-
- IStream_Release (streamOut);
-
- return success;
-}
-
-static GpBitmap *
-gdip_pixbuf_to_bitmap (GdkPixbuf *pixbuf)
-{
- GpBitmap *bitmap = NULL;
-
- int width, height, stride, n_channels;
- guint8 *pixels;
-
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
- stride = gdk_pixbuf_get_rowstride (pixbuf);
- n_channels = gdk_pixbuf_get_n_channels (pixbuf);
- pixels = gdk_pixbuf_get_pixels (pixbuf);
-
- if (n_channels == 3 || n_channels == 4) {
- /* rgbX. need to convert to argb. pass a null data to get an empty bitmap */
- GdipCreateBitmapFromScan0 (width, height, 0, PixelFormat32bppARGB, NULL, &bitmap);
-
- if (bitmap) {
- int x, y;
-
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- ARGB p;
- guint8 alpha;
- guchar *base = pixels + (y * stride + (x * n_channels));
-
- if (n_channels == 4)
- alpha = base[3];
- else
- alpha = 0xff;
-
- if (alpha == 0)
- p = 0;
- else {
- guint8 red = base[0];
- guint8 green = base[1];
- guint8 blue = base[2];
-
- p = (alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
- }
-
- GdipBitmapSetPixel (bitmap, x, y, p);
- }
- }
- }
- }
- else {
- g_warning ("Unsupported number of channels: %d\n", n_channels);
- }
-
- return bitmap;
-}
-
-static GpBitmap *
-gdip_buffer_to_bitmap (GdipContext *context, GError **error)
-{
- HRESULT hr;
- HGLOBAL hg = NULL;
- GpBitmap *bitmap = NULL;
- IStream *stream = NULL;
- GpStatus status;
- guint64 size64 = context->buffer->len;
-
- hg = gdip_buffer_to_hglobal (context->buffer->data, context->buffer->len, error);
-
- if (!hg)
- return NULL;
-
- hr = CreateStreamOnHGlobal (hg, FALSE, (LPSTREAM *)&stream);
-
- if (!SUCCEEDED (hr)) {
- gdip_set_error_from_hresult (error, GDK_PIXBUF_ERROR_FAILED, hr, _("Could not create stream: %s"));
- GlobalFree (hg);
- return NULL;
- }
-
- IStream_SetSize (stream, *(ULARGE_INTEGER *)&size64);
-
- status = GdipCreateBitmapFromStream (stream, &bitmap);
-
- if (Ok != status) {
- gdip_set_error_from_gpstatus (error, GDK_PIXBUF_ERROR_FAILED, status);
- IStream_Release (stream);
- GlobalFree (hg);
- return NULL;
- }
-
- context->stream = stream;
- context->hg = hg;
-
- return bitmap;
-}
-
-static GpImage *
-gdip_buffer_to_image (GdipContext *context, GError **error)
-{
- HRESULT hr;
- HGLOBAL hg = NULL;
- GpImage *image = NULL;
- IStream *stream = NULL;
- GpStatus status;
- guint64 size64 = context->buffer->len;
-
- hg = gdip_buffer_to_hglobal (context->buffer->data, context->buffer->len, error);
-
- if (!hg)
- return NULL;
-
- hr = CreateStreamOnHGlobal (hg, FALSE, (LPSTREAM *)&stream);
-
- if (!SUCCEEDED (hr)) {
- gdip_set_error_from_hresult (error, GDK_PIXBUF_ERROR_FAILED, hr, _("Could not create stream: %s"));
- GlobalFree (hg);
- return NULL;
- }
-
- IStream_SetSize (stream, *(ULARGE_INTEGER *)&size64);
- status = GdipLoadImageFromStream (stream, &image);
-
- if (Ok != status) {
- gdip_set_error_from_gpstatus (error, GDK_PIXBUF_ERROR_FAILED, status);
- IStream_Release (stream);
- GlobalFree (hg);
- return NULL;
- }
-
- context->stream = stream;
- context->hg = hg;
-
- return image;
-}
-
-static void
-gdip_bitmap_get_size (GpBitmap *bitmap, guint *width, guint *height)
-{
- if (bitmap == NULL || width == NULL || height == NULL)
- return;
-
- *width = *height = 0;
-
- GdipGetImageWidth ((GpImage *) bitmap, width);
- GdipGetImageHeight ((GpImage *) bitmap, height);
-}
-
-static void
-gdip_bitmap_get_has_alpha (GpBitmap *bitmap, gboolean *has_alpha)
-{
- guint flags = 0;
-
- if (bitmap == NULL || has_alpha == NULL)
- return;
-
- GdipGetImageFlags ((GpImage *) bitmap, &flags);
- *has_alpha = (flags & ImageFlagsHasAlpha);
-}
-
-static gboolean
-gdip_bitmap_get_n_frames (GpBitmap *bitmap, guint *n_frames, gboolean timeDimension)
-{
- if (bitmap == NULL || n_frames == NULL)
- return FALSE;
-
- *n_frames = 1;
-
- return (Ok == GdipImageGetFrameCount ((GpImage *) bitmap, (timeDimension ? &FrameDimensionTime : &FrameDimensionPage), n_frames));
-}
-
-static gboolean
-gdip_bitmap_select_frame (GpBitmap *bitmap, guint frame, gboolean timeDimension)
-{
- if (bitmap == NULL)
- return FALSE;
-
- return (Ok == GdipImageSelectActiveFrame ((GpImage *)bitmap, (timeDimension ? &FrameDimensionTime : &FrameDimensionPage), frame));
-}
-
-static gboolean
-gdip_bitmap_get_property_as_string (GpBitmap *bitmap, guint propertyId, gchar **str)
-{
- guint item_size;
- gboolean success = FALSE;
-
- if (bitmap == NULL || str == NULL)
- return FALSE;
-
- *str = 0;
-
- if (Ok == GdipGetPropertyItemSize ((GpImage *)bitmap, propertyId, &item_size)) {
- PropertyItem *item;
-
- item = (PropertyItem *)g_try_malloc (item_size);
- if (Ok == GdipGetPropertyItem ((GpImage *)bitmap, propertyId, item_size, item)) {
- GString *gstr;
- int i;
-
- gstr = g_string_new (NULL);
-
- success = TRUE;
- switch (item->type) {
- case PropertyTagTypeByte:
- for (i = 0; i < item->length / sizeof(guint8); i++) {
- guint8 *bytes = (guint8 *)item->value;
-
- if (gstr->len != 0)
- g_string_append_c(gstr, ',');
- g_string_append_printf (gstr, "%u", (guint32)bytes[i]);
- }
- break;
-
- case PropertyTagTypeASCII:
- g_string_append_len (gstr, (const char *)item->value, item->length);
- break;
-
- case PropertyTagTypeShort:
- for (i = 0; i < item->length / sizeof(guint16); i++) {
- guint16 *shorts = (guint16 *)item->value;
-
- if (gstr->len != 0)
- g_string_append_c (gstr, ',');
- g_string_append_printf (gstr, "%u", (guint32)shorts[i]);
- }
- break;
-
- case PropertyTagTypeLong:
- for (i = 0; i < item->length / sizeof(guint32); i++) {
- guint32 *longs = (guint32 *)item->value;
-
- if (gstr->len != 0)
- g_string_append_c (gstr, ',');
- g_string_append_printf (gstr, "%u", longs[i]);
- }
- break;
-
- case PropertyTagTypeSLONG:
- for (i = 0; i < item->length / sizeof(guint32); i++) {
- gint32 *longs = (gint32 *)item->value;
-
- if (gstr->len != 0)
- g_string_append_c (gstr, ',');
- g_string_append_printf (gstr, "%d", longs[i]);
- }
- break;
-
- default:
- success = FALSE;
- break;
- }
-
- if (gstr->len > 0)
- *str = g_string_free (gstr, FALSE);
- else
- g_string_free (gstr, TRUE);
- }
-
- g_free (item);
- }
-
- return success;
-}
-
-static gboolean
-gdip_bitmap_get_frame_delay (GpBitmap *bitmap, guint *delay)
-{
- guint item_size;
- gboolean success = FALSE;
-
- if (bitmap == NULL || delay == NULL)
- return FALSE;
-
- *delay = 0;
-
- if (Ok == GdipGetPropertyItemSize ((GpImage *)bitmap, PropertyTagFrameDelay, &item_size)) {
- PropertyItem *item;
-
- item = (PropertyItem *)g_try_malloc (item_size);
- if (Ok == GdipGetPropertyItem ((GpImage *)bitmap, PropertyTagFrameDelay, item_size, item)) {
- /* PropertyTagFrameDelay. Time delay, in hundredths of a second, between two frames in an animated GIF image. */
- *delay = *((long *)item->value);
- success = TRUE;
- }
-
- g_free (item);
- }
-
- return success;
-}
-
-static gboolean
-gdip_bitmap_get_n_loops (GpBitmap *bitmap, guint *loops)
-{
- guint item_size;
- gboolean success = FALSE;
-
- if (bitmap == NULL || loops == NULL)
- return FALSE;
-
- *loops = 1;
-
- /* PropertyTagLoopCount. 0 == infinitely */
- if (Ok == GdipGetPropertyItemSize ((GpImage *)bitmap, PropertyTagLoopCount, &item_size)) {
- PropertyItem *item;
-
- item = (PropertyItem *)g_try_malloc (item_size);
- if (Ok == GdipGetPropertyItem ((GpImage *)bitmap, PropertyTagLoopCount, item_size, item)) {
- *loops = *((short *)item->value);
- success = TRUE;
- }
-
- g_free (item);
- }
-
- return success;
-}
-
-static void
-destroy_gdipcontext (GdipContext *context)
-{
- if (context != NULL) {
- if (context->stream != NULL) {
- IStream_Release(context->stream);
- GlobalFree (context->hg);
- }
- g_byte_array_free (context->buffer, TRUE);
- g_free (context);
- }
-}
-
-static void
-emit_updated (GdipContext *context, GdkPixbuf *pixbuf)
-{
- if (context->updated_func)
- (*context->updated_func) (pixbuf,
- 0, 0,
- gdk_pixbuf_get_width (pixbuf),
- gdk_pixbuf_get_height (pixbuf),
- context->user_data);
-}
-
-static void
-emit_prepared (GdipContext *context, GdkPixbuf *pixbuf, GdkPixbufAnimation *anim)
-{
- if (context->prepared_func)
- (*context->prepared_func) (pixbuf, anim, context->user_data);
-}
-
-static gpointer
-gdk_pixbuf__gdip_image_begin_load (GdkPixbufModuleSizeFunc size_func,
- GdkPixbufModulePreparedFunc prepared_func,
- GdkPixbufModuleUpdatedFunc updated_func,
- gpointer user_data,
- GError **error)
-{
- GdipContext *context = g_new0 (GdipContext, 1);
-
- context->size_func = size_func;
- context->prepared_func = prepared_func;
- context->updated_func = updated_func;
- context->user_data = user_data;
- context->buffer = g_byte_array_new ();
-
- return context;
-}
-
-static gboolean
-gdk_pixbuf__gdip_image_load_increment (gpointer data,
- const guchar *buf, guint size,
- GError **error)
-{
- GdipContext *context = (GdipContext *)data;
- GByteArray *image_buffer = context->buffer;
-
- g_byte_array_append (image_buffer, (guint8 *)buf, size);
-
- return TRUE;
-}
-
-static GdkPixbuf *
-gdip_bitmap_to_pixbuf (GpBitmap *bitmap, GError **error)
-{
- GdkPixbuf *pixbuf = NULL;
- guchar *cursor = NULL;
- gint rowstride;
- gboolean has_alpha = FALSE;
- gint n_channels = 0;
- gchar *option;
-
- guint width = 0, height = 0, x, y;
-
- gdip_bitmap_get_size (bitmap, &width, &height);
- gdip_bitmap_get_has_alpha (bitmap, &has_alpha);
-
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, has_alpha, 8, width, height);
-
- if (!pixbuf) {
- g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't load bitmap"));
- return NULL;
- }
-
- rowstride = gdk_pixbuf_get_rowstride (pixbuf);
- cursor = gdk_pixbuf_get_pixels (pixbuf);
- n_channels = gdk_pixbuf_get_n_channels (pixbuf);
-
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
- ARGB pixel;
- GpStatus status;
- guchar *b = cursor + (y * rowstride + (x * n_channels));
-
- if (Ok != (status = GdipBitmapGetPixel (bitmap, x, y, &pixel))) {
- gdip_set_error_from_gpstatus (error, GDK_PIXBUF_ERROR_FAILED, status);
- g_object_unref (pixbuf);
- return NULL;
- }
-
- b[0] = (pixel & 0xff0000) >> 16;
- b[1] = (pixel & 0x00ff00) >> 8;
- b[2] = (pixel & 0x0000ff) >> 0;
-
- if (has_alpha)
- b[3] = (pixel & 0xff000000) >> 24;
- }
- }
-
- if (gdip_bitmap_get_property_as_string (bitmap, PropertyTagOrientation, &option)) {
- gdk_pixbuf_set_option (pixbuf, "orientation", option);
- g_free (option);
- }
-
- if (gdip_bitmap_get_property_as_string (bitmap, PropertyTagArtist, &option)) {
- gdk_pixbuf_set_option (pixbuf, "Author", option);
- g_free (option);
- }
-
- if (gdip_bitmap_get_property_as_string (bitmap, PropertyTagImageTitle, &option)) {
- gdk_pixbuf_set_option (pixbuf, "Title", option);
- g_free (option);
- }
-
- return pixbuf;
-}
-
-static gboolean
-stop_load (GpBitmap *bitmap, GdipContext *context, GError **error)
-{
- guint n_frames = 1, i;
- GdkPixbufGdipAnim *animation = NULL;
-
- gdip_bitmap_get_n_frames (bitmap, &n_frames, TRUE);
-
- for (i = 0; i < n_frames; i++) {
- GdkPixbuf *pixbuf = NULL;
- GdkPixbufFrame *frame;
- guint frame_delay = 0;
-
- gdip_bitmap_select_frame (bitmap, i, TRUE);
-
- pixbuf = gdip_bitmap_to_pixbuf (bitmap, error);
-
- if (!pixbuf) {
- if (animation != NULL)
- g_object_unref (G_OBJECT (animation));
-
- GdipDisposeImage ((GpImage *)bitmap);
- destroy_gdipcontext (context);
- return FALSE;
- }
-
- if (animation == NULL) {
- guint n_loops = 1;
-
- animation = g_object_new (GDK_TYPE_PIXBUF_GDIP_ANIM, NULL);
- gdip_bitmap_get_n_loops (bitmap, &n_loops);
- animation->loop = n_loops;
- }
-
- frame = g_new (GdkPixbufFrame, 1);
- frame->pixbuf = pixbuf;
-
- gdip_bitmap_get_frame_delay (bitmap, &frame_delay);
-
- animation->n_frames++;
- animation->frames = g_list_append (animation->frames, frame);
-
- animation->width = gdk_pixbuf_get_width (pixbuf);
- animation->height = gdk_pixbuf_get_height (pixbuf);
-
- /* GIF delay is in hundredths, we want thousandths */
- frame->delay_time = frame_delay * 10;
- frame->elapsed = animation->total_time;
-
- /* Some GIFs apparently have delay time of 0,
- * that crashes everything so set it to "fast".
- * Also, timeouts less than 20 or so just lock up
- * the app or make the animation choppy, so fix them.
- */
- if (frame->delay_time < 20)
- frame->delay_time = 20; /* 20 = "fast" */
-
- animation->total_time += frame->delay_time;
-
- if (i == 0)
- emit_prepared (context, pixbuf, GDK_PIXBUF_ANIMATION (animation));
-
- emit_updated (context, pixbuf);
- }
-
- if (animation != NULL)
- g_object_unref (G_OBJECT (animation));
-
- GdipDisposeImage ((GpImage *)bitmap);
- destroy_gdipcontext (context);
-
- return TRUE;
-}
-
-static gboolean
-gdk_pixbuf__gdip_image_stop_load (gpointer data, GError **error)
-{
- GdipContext *context = (GdipContext *)data;
- GpBitmap *bitmap = NULL;
-
- bitmap = gdip_buffer_to_bitmap (context, error);
-
- if (!bitmap) {
- destroy_gdipcontext (context);
- g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE, _("Couldn't load bitmap"));
- return FALSE;
- }
-
- return stop_load (bitmap, context, error);
-}
-
-static gboolean
-gdk_pixbuf__gdip_image_stop_vector_load (gpointer data, GError **error)
-{
- GdipContext *context = (GdipContext *)data;
-
- GpImage *metafile;
- GpGraphics *graphics;
- GpBitmap *bitmap;
- GpStatus status;
- float metafile_xres, metafile_yres;
- guint width, height;
-
- metafile = gdip_buffer_to_image (context, error);
- if (!metafile) {
- destroy_gdipcontext (context);
- g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE, _("Couldn't load metafile"));
- return FALSE;
- }
-
- GdipGetImageWidth (metafile, &width);
- GdipGetImageHeight (metafile, &height);
-
- status = GdipCreateBitmapFromScan0 (width, height, 0, PixelFormat32bppARGB, NULL, &bitmap);
- if (Ok != status) {
- gdip_set_error_from_gpstatus (error, GDK_PIXBUF_ERROR_FAILED, status);
- GdipDisposeImage (metafile);
-
- return FALSE;
- }
-
- GdipGetImageHorizontalResolution (metafile, &metafile_xres);
- GdipGetImageVerticalResolution (metafile, &metafile_yres);
- GdipBitmapSetResolution (bitmap, metafile_xres, metafile_yres);
-
- status = GdipGetImageGraphicsContext ((GpImage *)bitmap, &graphics);
- if (Ok != status) {
- gdip_set_error_from_gpstatus (error, GDK_PIXBUF_ERROR_FAILED, status);
- GdipDisposeImage ((GpImage *)bitmap);
- GdipDisposeImage (metafile);
-
- return FALSE;
- }
-
- /* gotta clear the bitmap */
- GdipGraphicsClear (graphics, 0xffffffff);
-
- status = GdipDrawImageI (graphics, metafile, 0, 0);
- if (Ok != status) {
- gdip_set_error_from_gpstatus (error, GDK_PIXBUF_ERROR_FAILED, status);
- GdipDeleteGraphics (graphics);
- GdipDisposeImage ((GpImage *)bitmap);
- GdipDisposeImage (metafile);
-
- return FALSE;
- }
-
- GdipFlush (graphics, 1);
-
- GdipDeleteGraphics (graphics);
- GdipDisposeImage (metafile);
-
- return stop_load (bitmap, context, error);
-}
-
-static void
-gdip_animation_prepare (GdkPixbuf *pixbuf,
- GdkPixbufAnimation *animation,
- gpointer user_data)
-{
- GdkPixbufAnimation **anim;
-
- anim = (GdkPixbufAnimation **)user_data;
-
- /* save a reference to the animation */
- g_object_ref (animation);
- *anim = animation;
-}
-
-static GdkPixbufAnimation *
-gdk_pixbuf__gdip_image_load_animation (FILE *file,
- GError **error)
-{
- GdkPixbufAnimation *animation = NULL;
-
- gpointer context;
- char buffer[LOAD_BUFFER_SIZE];
- size_t length;
-
- context = gdk_pixbuf__gdip_image_begin_load (NULL, gdip_animation_prepare, NULL, &animation, error);
-
- while (!feof (file) && !ferror (file)) {
- length = fread (buffer, 1, sizeof (buffer), file);
- if (length > 0) {
- if (!gdk_pixbuf__gdip_image_load_increment (context, buffer, length, error)) {
- gdk_pixbuf__gdip_image_stop_load (context, NULL);
-
- if (animation)
- g_object_unref (animation);
-
- return NULL;
- }
- }
- }
-
- if (!gdk_pixbuf__gdip_image_stop_load(context, error)) {
- if (animation)
- g_object_unref (animation);
-
- return NULL;
- }
-
- return animation;
-}
-
-gboolean
-gdip_save_to_file_callback (const gchar *buf,
- gsize count,
- GError **error,
- gpointer data)
-{
- FILE *filehandle = data;
- gsize n;
-
- n = fwrite (buf, 1, count, filehandle);
- if (n != count) {
- gint save_errno = errno;
- g_set_error (error,
- G_FILE_ERROR,
- g_file_error_from_errno (save_errno),
- _("Error writing to image file: %s"),
- g_strerror (save_errno));
- return FALSE;
- }
-
- return TRUE;
-}
-
-void
-gdip_fill_vtable (GdkPixbufModule *module)
-{
- if (gdip_init ()) {
- module->begin_load = gdk_pixbuf__gdip_image_begin_load;
- module->stop_load = gdk_pixbuf__gdip_image_stop_load;
- module->load_increment = gdk_pixbuf__gdip_image_load_increment;
-
- /* this is the only way to get gtk_image_new_from_file() to load animations. it regrettably
- does not use the GdkPixbufLoader interface. */
- module->load_animation = gdk_pixbuf__gdip_image_load_animation;
- }
-}
-
-void
-gdip_fill_vector_vtable (GdkPixbufModule *module)
-{
- if (gdip_init ()) {
- module->begin_load = gdk_pixbuf__gdip_image_begin_load;
- module->stop_load = gdk_pixbuf__gdip_image_stop_vector_load;
- module->load_increment = gdk_pixbuf__gdip_image_load_increment;
- }
-}
-
-gboolean
-gdip_save_pixbuf (GdkPixbuf *pixbuf,
- const WCHAR *format,
- const EncoderParameters *encoder_params,
- GdkPixbufSaveFunc save_func,
- gpointer user_data,
- GError **error)
-{
- GpBitmap *image;
- CLSID clsid;
- gboolean success;
-
- if (!GetEncoderClsid (format, &clsid)) {
- g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED, _("Unsupported image format for GDI+"));
- return FALSE;
- }
-
- image = gdip_pixbuf_to_bitmap (pixbuf);
-
- if (image == NULL) {
- g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED, _("Couldn't save"));
- return FALSE;
- }
-
- success = gdip_save_bitmap_to_callback (image, &clsid, encoder_params, save_func, user_data, error);
-
- GdipDisposeImage ((GpImage *)image);
-
- return success;
-}
diff --git a/gdk-pixbuf/io-gdip-utils.h b/gdk-pixbuf/io-gdip-utils.h
deleted file mode 100644
index 14681c1e26..0000000000
--- a/gdk-pixbuf/io-gdip-utils.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/* GdkPixbuf library - Win32 GDI+ Pixbuf Loader
- *
- * Copyright (C) 2008 Dominic Lachowicz
- * Copyright (C) 2008 Alberto Ruiz
- *
- * Authors: Dominic Lachowicz <domlachowicz@gmail.com>
- * Alberto Ruiz <aruiz@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more * You should have received a copy of the GNU Lesser 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 _HAVE_IO_GDIP_UTILS_H
-#define _HAVE_IO_GDIP_UTILS_H
-
-#include "gdk-pixbuf.h"
-#include "gdk-pixbuf-i18n.h"
-
-#include "io-gdip-native.h"
-
-gboolean
-gdip_save_to_file_callback (const gchar *buf,
- gsize count,
- GError **error,
- gpointer data);
-
-void
-gdip_fill_vtable (GdkPixbufModule *module);
-
-void
-gdip_fill_vector_vtable (GdkPixbufModule *module);
-
-gboolean
-gdip_save_pixbuf (GdkPixbuf *pixbuf,
- const WCHAR *format,
- const EncoderParameters *encoder_params,
- GdkPixbufSaveFunc save_func,
- gpointer user_data,
- GError **error);
-
-#endif
diff --git a/gdk-pixbuf/io-gdip-wmf.c b/gdk-pixbuf/io-gdip-wmf.c
deleted file mode 100644
index 3c89d4a3d7..0000000000
--- a/gdk-pixbuf/io-gdip-wmf.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* GdkPixbuf library - Win32 GDI+ Pixbuf Loader
- *
- * Copyright (C) 2008 Dominic Lachowicz
- * Copyright (C) 2008 Alberto Ruiz
- *
- * Authors: Dominic Lachowicz <domlachowicz@gmail.com>
- * Alberto Ruiz <aruiz@gnome.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more * You should have received a copy of the GNU Lesser 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 "io-gdip-utils.h"
-
-#ifndef INCLUDE_gdiplus
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__gdip_wmf_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
-{
- gdip_fill_vector_vtable (module);
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
-{
- static GdkPixbufModulePattern signature[] = {
- { "\xd7\xcd\xc6\x9a", NULL, 100 }, /* WMF */
- { "\x01\x00\x09\x00", NULL, 100 }, /* WMF */
- { NULL, NULL, 0 }
- };
-
- static gchar *mime_types[] = {
- "image/x-wmf",
- NULL
- };
-
- static gchar *extensions[] = {
- "wmf",
- "apm",
- NULL
- };
-
- info->name = "wmf";
- info->signature = signature;
- info->description = _("The WMF image format");
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "LGPL";
-}
diff --git a/gdk-pixbuf/io-gif-animation.c b/gdk-pixbuf/io-gif-animation.c
deleted file mode 100644
index 391e928503..0000000000
--- a/gdk-pixbuf/io-gif-animation.c
+++ /dev/null
@@ -1,602 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/* GdkPixbuf library - animated gif support
- *
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Authors: Jonathan Blandford <jrb@redhat.com>
- * Havoc Pennington <hp@redhat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 <errno.h>
-#include "gdk-pixbuf-private.h"
-#include "io-gif-animation.h"
-
-static void gdk_pixbuf_gif_anim_class_init (GdkPixbufGifAnimClass *klass);
-static void gdk_pixbuf_gif_anim_finalize (GObject *object);
-
-static gboolean gdk_pixbuf_gif_anim_is_static_image (GdkPixbufAnimation *animation);
-static GdkPixbuf* gdk_pixbuf_gif_anim_get_static_image (GdkPixbufAnimation *animation);
-
-static void gdk_pixbuf_gif_anim_get_size (GdkPixbufAnimation *anim,
- int *width,
- int *height);
-static GdkPixbufAnimationIter* gdk_pixbuf_gif_anim_get_iter (GdkPixbufAnimation *anim,
- const GTimeVal *start_time);
-
-
-
-
-static gpointer parent_class;
-
-GType
-gdk_pixbuf_gif_anim_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type) {
- const GTypeInfo object_info = {
- sizeof (GdkPixbufGifAnimClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gdk_pixbuf_gif_anim_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GdkPixbufGifAnim),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- };
-
- object_type = g_type_register_static (GDK_TYPE_PIXBUF_ANIMATION,
- g_intern_static_string ("GdkPixbufGifAnim"),
- &object_info, 0);
- }
-
- return object_type;
-}
-
-static void
-gdk_pixbuf_gif_anim_class_init (GdkPixbufGifAnimClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GdkPixbufAnimationClass *anim_class = GDK_PIXBUF_ANIMATION_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = gdk_pixbuf_gif_anim_finalize;
-
- anim_class->is_static_image = gdk_pixbuf_gif_anim_is_static_image;
- anim_class->get_static_image = gdk_pixbuf_gif_anim_get_static_image;
- anim_class->get_size = gdk_pixbuf_gif_anim_get_size;
- anim_class->get_iter = gdk_pixbuf_gif_anim_get_iter;
-}
-
-static void
-gdk_pixbuf_gif_anim_finalize (GObject *object)
-{
- GdkPixbufGifAnim *gif_anim = GDK_PIXBUF_GIF_ANIM (object);
-
- GList *l;
- GdkPixbufFrame *frame;
-
- for (l = gif_anim->frames; l; l = l->next) {
- frame = l->data;
- g_object_unref (frame->pixbuf);
- if (frame->composited)
- g_object_unref (frame->composited);
- if (frame->revert)
- g_object_unref (frame->revert);
- g_free (frame);
- }
-
- g_list_free (gif_anim->frames);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static gboolean
-gdk_pixbuf_gif_anim_is_static_image (GdkPixbufAnimation *animation)
-{
- GdkPixbufGifAnim *gif_anim;
-
- gif_anim = GDK_PIXBUF_GIF_ANIM (animation);
-
- return (gif_anim->frames != NULL &&
- gif_anim->frames->next == NULL);
-}
-
-static GdkPixbuf*
-gdk_pixbuf_gif_anim_get_static_image (GdkPixbufAnimation *animation)
-{
- GdkPixbufGifAnim *gif_anim;
-
- gif_anim = GDK_PIXBUF_GIF_ANIM (animation);
-
- if (gif_anim->frames == NULL)
- return NULL;
- else
- return GDK_PIXBUF (((GdkPixbufFrame*)gif_anim->frames->data)->pixbuf);
-}
-
-static void
-gdk_pixbuf_gif_anim_get_size (GdkPixbufAnimation *anim,
- int *width,
- int *height)
-{
- GdkPixbufGifAnim *gif_anim;
-
- gif_anim = GDK_PIXBUF_GIF_ANIM (anim);
-
- if (width)
- *width = gif_anim->width;
-
- if (height)
- *height = gif_anim->height;
-}
-
-
-static void
-iter_clear (GdkPixbufGifAnimIter *iter)
-{
- iter->current_frame = NULL;
-}
-
-static void
-iter_restart (GdkPixbufGifAnimIter *iter)
-{
- iter_clear (iter);
-
- iter->current_frame = iter->gif_anim->frames;
-}
-
-static GdkPixbufAnimationIter*
-gdk_pixbuf_gif_anim_get_iter (GdkPixbufAnimation *anim,
- const GTimeVal *start_time)
-{
- GdkPixbufGifAnimIter *iter;
-
- iter = g_object_new (GDK_TYPE_PIXBUF_GIF_ANIM_ITER, NULL);
-
- iter->gif_anim = GDK_PIXBUF_GIF_ANIM (anim);
-
- g_object_ref (iter->gif_anim);
-
- iter_restart (iter);
-
- iter->start_time = *start_time;
- iter->current_time = *start_time;
- iter->first_loop_slowness = 0;
-
- return GDK_PIXBUF_ANIMATION_ITER (iter);
-}
-
-
-
-static void gdk_pixbuf_gif_anim_iter_class_init (GdkPixbufGifAnimIterClass *klass);
-static void gdk_pixbuf_gif_anim_iter_finalize (GObject *object);
-
-static int gdk_pixbuf_gif_anim_iter_get_delay_time (GdkPixbufAnimationIter *iter);
-static GdkPixbuf* gdk_pixbuf_gif_anim_iter_get_pixbuf (GdkPixbufAnimationIter *iter);
-static gboolean gdk_pixbuf_gif_anim_iter_on_currently_loading_frame (GdkPixbufAnimationIter *iter);
-static gboolean gdk_pixbuf_gif_anim_iter_advance (GdkPixbufAnimationIter *iter,
- const GTimeVal *current_time);
-
-
-
-static gpointer iter_parent_class;
-
-GType
-gdk_pixbuf_gif_anim_iter_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type) {
- const GTypeInfo object_info = {
- sizeof (GdkPixbufGifAnimIterClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gdk_pixbuf_gif_anim_iter_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GdkPixbufGifAnimIter),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- };
-
- object_type = g_type_register_static (GDK_TYPE_PIXBUF_ANIMATION_ITER,
- g_intern_static_string ("GdkPixbufGifAnimIter"),
- &object_info, 0);
- }
-
- return object_type;
-}
-
-static void
-gdk_pixbuf_gif_anim_iter_class_init (GdkPixbufGifAnimIterClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GdkPixbufAnimationIterClass *anim_iter_class =
- GDK_PIXBUF_ANIMATION_ITER_CLASS (klass);
-
- iter_parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = gdk_pixbuf_gif_anim_iter_finalize;
-
- anim_iter_class->get_delay_time = gdk_pixbuf_gif_anim_iter_get_delay_time;
- anim_iter_class->get_pixbuf = gdk_pixbuf_gif_anim_iter_get_pixbuf;
- anim_iter_class->on_currently_loading_frame = gdk_pixbuf_gif_anim_iter_on_currently_loading_frame;
- anim_iter_class->advance = gdk_pixbuf_gif_anim_iter_advance;
-}
-
-static void
-gdk_pixbuf_gif_anim_iter_finalize (GObject *object)
-{
- GdkPixbufGifAnimIter *iter = GDK_PIXBUF_GIF_ANIM_ITER (object);
-
- iter_clear (iter);
-
- g_object_unref (iter->gif_anim);
-
- G_OBJECT_CLASS (iter_parent_class)->finalize (object);
-}
-
-static gboolean
-gdk_pixbuf_gif_anim_iter_advance (GdkPixbufAnimationIter *anim_iter,
- const GTimeVal *current_time)
-{
- GdkPixbufGifAnimIter *iter;
- gint elapsed;
- gint loop;
- GList *tmp;
- GList *old;
-
- iter = GDK_PIXBUF_GIF_ANIM_ITER (anim_iter);
-
- iter->current_time = *current_time;
-
- /* We use milliseconds for all times */
- elapsed =
- (((iter->current_time.tv_sec - iter->start_time.tv_sec) * G_USEC_PER_SEC +
- iter->current_time.tv_usec - iter->start_time.tv_usec)) / 1000;
-
- if (elapsed < 0) {
- /* Try to compensate; probably the system clock
- * was set backwards
- */
- iter->start_time = iter->current_time;
- elapsed = 0;
- }
-
- g_assert (iter->gif_anim->total_time > 0);
-
- /* See how many times we've already played the full animation,
- * and subtract time for that.
- */
-
- if (iter->gif_anim->loading)
- loop = 0;
- else {
- /* If current_frame is NULL at this point, we have loaded the
- * animation from a source which fell behind the speed of the
- * display. We remember how much slower the first loop was due
- * to this and correct the position calculation in order to not
- * jump in the middle of the second loop.
- */
- if (iter->current_frame == NULL)
- iter->first_loop_slowness = MAX(0, elapsed - iter->gif_anim->total_time);
-
- loop = (elapsed - iter->first_loop_slowness) / iter->gif_anim->total_time;
- elapsed = (elapsed - iter->first_loop_slowness) % iter->gif_anim->total_time;
- }
-
- iter->position = elapsed;
-
- /* Now move to the proper frame */
- if (iter->gif_anim->loop == 0 || loop < iter->gif_anim->loop)
- tmp = iter->gif_anim->frames;
- else
- tmp = NULL;
- while (tmp != NULL) {
- GdkPixbufFrame *frame = tmp->data;
-
- if (iter->position >= frame->elapsed &&
- iter->position < (frame->elapsed + frame->delay_time))
- break;
-
- tmp = tmp->next;
- }
-
- old = iter->current_frame;
-
- iter->current_frame = tmp;
-
- return iter->current_frame != old;
-}
-
-int
-gdk_pixbuf_gif_anim_iter_get_delay_time (GdkPixbufAnimationIter *anim_iter)
-{
- GdkPixbufFrame *frame;
- GdkPixbufGifAnimIter *iter;
-
- iter = GDK_PIXBUF_GIF_ANIM_ITER (anim_iter);
-
- if (iter->current_frame) {
- frame = iter->current_frame->data;
-
-#if 0
- g_print ("frame start: %d pos: %d frame len: %d frame remaining: %d\n",
- frame->elapsed,
- iter->position,
- frame->delay_time,
- frame->delay_time - (iter->position - frame->elapsed));
-#endif
-
- return frame->delay_time - (iter->position - frame->elapsed);
- } else
- return -1; /* show last frame forever */
-}
-
-void
-gdk_pixbuf_gif_anim_frame_composite (GdkPixbufGifAnim *gif_anim,
- GdkPixbufFrame *frame)
-{
- GList *link;
- GList *tmp;
-
- link = g_list_find (gif_anim->frames, frame);
-
- if (frame->need_recomposite || frame->composited == NULL) {
- /* For now, to composite we start with the last
- * composited frame and composite everything up to
- * here.
- */
-
- /* Rewind to last composited frame. */
- tmp = link;
- while (tmp != NULL) {
- GdkPixbufFrame *f = tmp->data;
-
- if (f->need_recomposite) {
- if (f->composited) {
- g_object_unref (f->composited);
- f->composited = NULL;
- }
- }
-
- if (f->composited != NULL)
- break;
-
- tmp = tmp->prev;
- }
-
- /* Go forward, compositing all frames up to the current frame */
- if (tmp == NULL)
- tmp = gif_anim->frames;
-
- while (tmp != NULL) {
- GdkPixbufFrame *f = tmp->data;
- gint clipped_width, clipped_height;
-
- if (f->pixbuf == NULL)
- return;
-
- clipped_width = MIN (gif_anim->width - f->x_offset, gdk_pixbuf_get_width (f->pixbuf));
- clipped_height = MIN (gif_anim->height - f->y_offset, gdk_pixbuf_get_height (f->pixbuf));
-
- if (f->need_recomposite) {
- if (f->composited) {
- g_object_unref (f->composited);
- f->composited = NULL;
- }
- }
-
- if (f->composited != NULL)
- goto next;
-
- if (tmp->prev == NULL) {
- /* First frame may be smaller than the whole image;
- * if so, we make the area outside it full alpha if the
- * image has alpha, and background color otherwise.
- * GIF spec doesn't actually say what to do about this.
- */
- f->composited = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
- TRUE,
- 8, gif_anim->width, gif_anim->height);
-
- if (f->composited == NULL)
- return;
-
- /* alpha gets dumped if f->composited has no alpha */
-
- gdk_pixbuf_fill (f->composited,
- (gif_anim->bg_red << 24) |
- (gif_anim->bg_green << 16) |
- (gif_anim->bg_blue << 8));
-
- if (clipped_width > 0 && clipped_height > 0)
- gdk_pixbuf_composite (f->pixbuf,
- f->composited,
- f->x_offset,
- f->y_offset,
- clipped_width,
- clipped_height,
- f->x_offset, f->y_offset,
- 1.0, 1.0,
- GDK_INTERP_BILINEAR,
- 255);
-
- if (f->action == GDK_PIXBUF_FRAME_REVERT)
- g_warning ("First frame of GIF has bad dispose mode, GIF loader should not have loaded this image");
-
- f->need_recomposite = FALSE;
- } else {
- GdkPixbufFrame *prev_frame;
- gint prev_clipped_width;
- gint prev_clipped_height;
-
- prev_frame = tmp->prev->data;
-
- prev_clipped_width = MIN (gif_anim->width - prev_frame->x_offset, gdk_pixbuf_get_width (prev_frame->pixbuf));
- prev_clipped_height = MIN (gif_anim->height - prev_frame->y_offset, gdk_pixbuf_get_height (prev_frame->pixbuf));
-
- /* Init f->composited with what we should have after the previous
- * frame
- */
-
- if (prev_frame->action == GDK_PIXBUF_FRAME_RETAIN) {
- f->composited = gdk_pixbuf_copy (prev_frame->composited);
-
- if (f->composited == NULL)
- return;
-
- } else if (prev_frame->action == GDK_PIXBUF_FRAME_DISPOSE) {
- f->composited = gdk_pixbuf_copy (prev_frame->composited);
-
- if (f->composited == NULL)
- return;
-
- if (prev_clipped_width > 0 && prev_clipped_height > 0) {
- /* Clear area of previous frame to background */
- GdkPixbuf *area;
-
- area = gdk_pixbuf_new_subpixbuf (f->composited,
- prev_frame->x_offset,
- prev_frame->y_offset,
- prev_clipped_width,
- prev_clipped_height);
-
- if (area == NULL)
- return;
-
- gdk_pixbuf_fill (area,
- (gif_anim->bg_red << 24) |
- (gif_anim->bg_green << 16) |
- (gif_anim->bg_blue << 8));
-
- g_object_unref (area);
- }
- } else if (prev_frame->action == GDK_PIXBUF_FRAME_REVERT) {
- f->composited = gdk_pixbuf_copy (prev_frame->composited);
-
- if (f->composited == NULL)
- return;
-
- if (prev_frame->revert != NULL &&
- prev_clipped_width > 0 && prev_clipped_height > 0) {
- /* Copy in the revert frame */
- gdk_pixbuf_copy_area (prev_frame->revert,
- 0, 0,
- gdk_pixbuf_get_width (prev_frame->revert),
- gdk_pixbuf_get_height (prev_frame->revert),
- f->composited,
- prev_frame->x_offset,
- prev_frame->y_offset);
- }
- } else {
- g_warning ("Unknown revert action for GIF frame");
- }
-
- if (f->revert == NULL &&
- f->action == GDK_PIXBUF_FRAME_REVERT) {
- if (clipped_width > 0 && clipped_height > 0) {
- /* We need to save the contents before compositing */
- GdkPixbuf *area;
-
- area = gdk_pixbuf_new_subpixbuf (f->composited,
- f->x_offset,
- f->y_offset,
- clipped_width,
- clipped_height);
-
- if (area == NULL)
- return;
-
- f->revert = gdk_pixbuf_copy (area);
-
- g_object_unref (area);
-
- if (f->revert == NULL)
- return;
- }
- }
-
- if (clipped_width > 0 && clipped_height > 0 &&
- f->pixbuf != NULL && f->composited != NULL) {
- /* Put current frame onto f->composited */
- gdk_pixbuf_composite (f->pixbuf,
- f->composited,
- f->x_offset,
- f->y_offset,
- clipped_width,
- clipped_height,
- f->x_offset, f->y_offset,
- 1.0, 1.0,
- GDK_INTERP_NEAREST,
- 255);
- }
-
- f->need_recomposite = FALSE;
- }
-
- next:
- if (tmp == link)
- break;
-
- tmp = tmp->next;
- }
- }
-}
-
-GdkPixbuf*
-gdk_pixbuf_gif_anim_iter_get_pixbuf (GdkPixbufAnimationIter *anim_iter)
-{
- GdkPixbufGifAnimIter *iter;
- GdkPixbufFrame *frame;
-
- iter = GDK_PIXBUF_GIF_ANIM_ITER (anim_iter);
-
- frame = iter->current_frame ? iter->current_frame->data : g_list_last (iter->gif_anim->frames)->data;
-
-#if 0
- if (FALSE && frame)
- g_print ("current frame %d dispose mode %d %d x %d\n",
- g_list_index (iter->gif_anim->frames,
- frame),
- frame->action,
- gdk_pixbuf_get_width (frame->pixbuf),
- gdk_pixbuf_get_height (frame->pixbuf));
-#endif
-
- if (frame == NULL)
- return NULL;
-
- gdk_pixbuf_gif_anim_frame_composite (iter->gif_anim, frame);
-
- return frame->composited;
-}
-
-static gboolean
-gdk_pixbuf_gif_anim_iter_on_currently_loading_frame (GdkPixbufAnimationIter *anim_iter)
-{
- GdkPixbufGifAnimIter *iter;
-
- iter = GDK_PIXBUF_GIF_ANIM_ITER (anim_iter);
-
- return iter->current_frame == NULL || iter->current_frame->next == NULL;
-}
diff --git a/gdk-pixbuf/io-gif-animation.h b/gdk-pixbuf/io-gif-animation.h
deleted file mode 100644
index 3e8e52287b..0000000000
--- a/gdk-pixbuf/io-gif-animation.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/* GdkPixbuf library - GIF loader declarations
- *
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Authors: Mark Crichton <crichton@gimp.org>
- * Miguel de Icaza <miguel@gnu.org>
- * Federico Mena-Quintero <federico@gimp.org>
- * Havoc Pennington <hp@redhat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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_GIF_H
-#define GDK_PIXBUF_GIF_H
-
-#include "gdk-pixbuf-animation.h"
-
-typedef enum {
- /* Keep this frame and composite next frame over it */
- /* (GIF disposal method 1) */
- GDK_PIXBUF_FRAME_RETAIN,
- /* Revert to background color before compositing next frame */
- /* (GIF disposal method 2) */
- GDK_PIXBUF_FRAME_DISPOSE,
- /* Revert to previously-displayed composite image after
- * displaying this frame
- */
- /* (GIF disposal method 3) */
- GDK_PIXBUF_FRAME_REVERT
-} GdkPixbufFrameAction;
-
-
-
-typedef struct _GdkPixbufGifAnim GdkPixbufGifAnim;
-typedef struct _GdkPixbufGifAnimClass GdkPixbufGifAnimClass;
-typedef struct _GdkPixbufFrame GdkPixbufFrame;
-
-#define GDK_TYPE_PIXBUF_GIF_ANIM (gdk_pixbuf_gif_anim_get_type ())
-#define GDK_PIXBUF_GIF_ANIM(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_GIF_ANIM, GdkPixbufGifAnim))
-#define GDK_IS_PIXBUF_GIF_ANIM(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_GIF_ANIM))
-
-#define GDK_PIXBUF_GIF_ANIM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_GIF_ANIM, GdkPixbufGifAnimClass))
-#define GDK_IS_PIXBUF_GIF_ANIM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_GIF_ANIM))
-#define GDK_PIXBUF_GIF_ANIM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_GIF_ANIM, GdkPixbufGifAnimClass))
-
-/* Private part of the GdkPixbufGifAnim structure */
-struct _GdkPixbufGifAnim {
- GdkPixbufAnimation parent_instance;
-
- /* Number of frames */
- int n_frames;
-
- /* Total length of animation */
- int total_time;
-
- /* List of GdkPixbufFrame structures */
- GList *frames;
-
- /* bounding box size */
- int width, height;
-
- guchar bg_red;
- guchar bg_green;
- guchar bg_blue;
-
- int loop;
- gboolean loading;
-};
-
-struct _GdkPixbufGifAnimClass {
- GdkPixbufAnimationClass parent_class;
-
-};
-
-GType gdk_pixbuf_gif_anim_get_type (void) G_GNUC_CONST;
-
-
-
-typedef struct _GdkPixbufGifAnimIter GdkPixbufGifAnimIter;
-typedef struct _GdkPixbufGifAnimIterClass GdkPixbufGifAnimIterClass;
-
-
-#define GDK_TYPE_PIXBUF_GIF_ANIM_ITER (gdk_pixbuf_gif_anim_iter_get_type ())
-#define GDK_PIXBUF_GIF_ANIM_ITER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_PIXBUF_GIF_ANIM_ITER, GdkPixbufGifAnimIter))
-#define GDK_IS_PIXBUF_GIF_ANIM_ITER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_PIXBUF_GIF_ANIM_ITER))
-
-#define GDK_PIXBUF_GIF_ANIM_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_PIXBUF_GIF_ANIM_ITER, GdkPixbufGifAnimIterClass))
-#define GDK_IS_PIXBUF_GIF_ANIM_ITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_PIXBUF_GIF_ANIM_ITER))
-#define GDK_PIXBUF_GIF_ANIM_ITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_PIXBUF_GIF_ANIM_ITER, GdkPixbufGifAnimIterClass))
-
-struct _GdkPixbufGifAnimIter {
- GdkPixbufAnimationIter parent_instance;
-
- GdkPixbufGifAnim *gif_anim;
-
- GTimeVal start_time;
- GTimeVal current_time;
-
- /* Time in milliseconds into this run of the animation */
- gint position;
-
- GList *current_frame;
-
- gint first_loop_slowness;
-};
-
-struct _GdkPixbufGifAnimIterClass {
- GdkPixbufAnimationIterClass parent_class;
-
-};
-
-GType gdk_pixbuf_gif_anim_iter_get_type (void) G_GNUC_CONST;
-
-
-
-struct _GdkPixbufFrame {
- /* The pixbuf with this frame's image data */
- GdkPixbuf *pixbuf;
-
- /* Offsets for overlaying onto the GIF graphic area */
- int x_offset;
- int y_offset;
-
- /* Frame duration in ms */
- int delay_time;
-
- /* Sum of preceding delay times */
- int elapsed;
-
- /* Overlay mode */
- GdkPixbufFrameAction action;
-
- /* TRUE if the pixbuf has been modified since
- * the last frame composite operation
- */
- gboolean need_recomposite;
-
- /* TRUE if the background for this frame is transparent */
- gboolean bg_transparent;
-
- /* The below reflects the "use hell of a lot of RAM"
- * philosophy of coding
- */
-
- /* Cached composite image (the image you actually display
- * for this frame)
- */
- GdkPixbuf *composited;
-
- /* Cached revert image (the contents of the area
- * covered by the frame prior to compositing;
- * same size as pixbuf, not as the composite image; only
- * used for FRAME_REVERT frames)
- */
- GdkPixbuf *revert;
-};
-
-void gdk_pixbuf_gif_anim_frame_composite (GdkPixbufGifAnim *gif_anim,
- GdkPixbufFrame *frame);
-
-#endif
diff --git a/gdk-pixbuf/io-gif.c b/gdk-pixbuf/io-gif.c
deleted file mode 100644
index d414d78201..0000000000
--- a/gdk-pixbuf/io-gif.c
+++ /dev/null
@@ -1,1698 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/* GdkPixbuf library - GIF image loader
- *
- * Copyright (C) 1999 Mark Crichton
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Authors: Jonathan Blandford <jrb@redhat.com>
- * Adapted from the gimp gif filter written by Adam Moss <adam@gimp.org>
- * Gimp work based on earlier work.
- * Permission to relicense under the LGPL obtained.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.
- */
-
-/* This loader is very hairy code.
- *
- * The main loop was not designed for incremental loading, so when it was hacked
- * in it got a bit messy. Basicly, every function is written to expect a failed
- * read_gif, and lets you call it again assuming that the bytes are there.
- *
- * Return vals.
- * Unless otherwise specified, these are the return vals for most functions:
- *
- * 0 -> success
- * -1 -> more bytes needed.
- * -2 -> failure; abort the load
- * -3 -> control needs to be passed back to the main loop
- * \_ (most of the time returning 0 will get this, but not always)
- *
- * >1 -> for functions that get a guchar, the char will be returned.
- *
- * -jrb (11/03/1999)
- */
-
-/*
- * If you have any images that crash this code, please, please let me know and
- * send them to me.
- * <jrb@redhat.com>
- */
-
-
-
-#include "config.h"
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-io.h"
-#include "io-gif-animation.h"
-
-
-
-#undef DUMP_IMAGE_DETAILS
-#undef IO_GIFDEBUG
-
-#define MAXCOLORMAPSIZE 256
-#define MAX_LZW_BITS 12
-
-#define INTERLACE 0x40
-#define LOCALCOLORMAP 0x80
-#define BitSet(byte, bit) (((byte) & (bit)) == (bit))
-#define LM_to_uint(a,b) (((b)<<8)|(a))
-
-
-
-typedef unsigned char CMap[3][MAXCOLORMAPSIZE];
-
-/* Possible states we can be in. */
-enum {
- GIF_START,
- GIF_GET_COLORMAP,
- GIF_GET_NEXT_STEP,
- GIF_GET_FRAME_INFO,
- GIF_GET_EXTENSION,
- GIF_GET_COLORMAP2,
- GIF_PREPARE_LZW,
- GIF_LZW_FILL_BUFFER,
- GIF_LZW_CLEAR_CODE,
- GIF_GET_LZW,
- GIF_DONE
-};
-
-
-typedef struct _Gif89 Gif89;
-struct _Gif89
-{
- int transparent;
- int delay_time;
- int input_flag;
- int disposal;
-};
-
-typedef struct _GifContext GifContext;
-struct _GifContext
-{
- int state; /* really only relevant for progressive loading */
- unsigned int width;
- unsigned int height;
-
- gboolean has_global_cmap;
-
- CMap global_color_map;
- gint global_colormap_size;
- unsigned int global_bit_pixel;
- unsigned int global_color_resolution;
- unsigned int background_index;
- gboolean stop_after_first_frame;
-
- gboolean frame_cmap_active;
- CMap frame_color_map;
- gint frame_colormap_size;
- unsigned int frame_bit_pixel;
-
- unsigned int aspect_ratio;
- GdkPixbufGifAnim *animation;
- GdkPixbufFrame *frame;
- Gif89 gif89;
-
- /* stuff per frame. */
- int frame_len;
- int frame_height;
- int frame_interlace;
- int x_offset;
- int y_offset;
-
- /* Static read only */
- FILE *file;
-
- /* progressive read, only. */
- GdkPixbufModulePreparedFunc prepare_func;
- GdkPixbufModuleUpdatedFunc update_func;
- gpointer user_data;
- guchar *buf;
- guint ptr;
- guint size;
- guint amount_needed;
-
- /* extension context */
- guchar extension_label;
- guchar extension_flag;
- gboolean in_loop_extension;
-
- /* get block context */
- guchar block_count;
- guchar block_buf[280];
- gint block_ptr;
-
- int old_state; /* used by lzw_fill buffer */
- /* get_code context */
- int code_curbit;
- int code_lastbit;
- int code_done;
- int code_last_byte;
- int lzw_code_pending;
-
- /* lzw context */
- gint lzw_fresh;
- gint lzw_code_size;
- guchar lzw_set_code_size;
- gint lzw_max_code;
- gint lzw_max_code_size;
- gint lzw_firstcode;
- gint lzw_oldcode;
- gint lzw_clear_code;
- gint lzw_end_code;
- gint *lzw_sp;
-
- gint lzw_table[2][(1 << MAX_LZW_BITS)];
- gint lzw_stack[(1 << (MAX_LZW_BITS)) * 2 + 1];
-
- /* painting context */
- gint draw_xpos;
- gint draw_ypos;
- gint draw_pass;
-
- /* error pointer */
- GError **error;
-};
-
-static int GetDataBlock (GifContext *, unsigned char *);
-
-
-
-#ifdef IO_GIFDEBUG
-static int count = 0;
-#endif
-
-/* Returns TRUE if read is OK,
- * FALSE if more memory is needed. */
-static gboolean
-gif_read (GifContext *context, guchar *buffer, size_t len)
-{
- gboolean retval;
-#ifdef IO_GIFDEBUG
- gint i;
-#endif
- if (context->file) {
-#ifdef IO_GIFDEBUG
- count += len;
- g_print ("Fsize :%d\tcount :%d\t", len, count);
-#endif
- retval = (fread(buffer, len, 1, context->file) != 0);
-
- if (!retval && ferror (context->file)) {
- gint save_errno = errno;
- g_set_error (context->error,
- G_FILE_ERROR,
- g_file_error_from_errno (save_errno),
- _("Failure reading GIF: %s"),
- g_strerror (save_errno));
- }
-
-#ifdef IO_GIFDEBUG
- if (len < 100) {
- for (i = 0; i < len; i++)
- g_print ("%d ", buffer[i]);
- }
- g_print ("\n");
-#endif
-
- return retval;
- } else {
-#ifdef IO_GIFDEBUG
-/* g_print ("\tlooking for %d bytes. size == %d, ptr == %d\n", len, context->size, context->ptr); */
-#endif
- if ((context->size - context->ptr) >= len) {
-#ifdef IO_GIFDEBUG
- count += len;
-#endif
- memcpy (buffer, context->buf + context->ptr, len);
- context->ptr += len;
- context->amount_needed = 0;
-#ifdef IO_GIFDEBUG
- g_print ("Psize :%d\tcount :%d\t", len, count);
- if (len < 100) {
- for (i = 0; i < len; i++)
- g_print ("%d ", buffer[i]);
- }
- g_print ("\n");
-#endif
- return TRUE;
- }
- context->amount_needed = len - (context->size - context->ptr);
- }
- return FALSE;
-}
-
-/* Changes the stage to be GIF_GET_COLORMAP */
-static void
-gif_set_get_colormap (GifContext *context)
-{
- context->global_colormap_size = 0;
- context->state = GIF_GET_COLORMAP;
-}
-
-static void
-gif_set_get_colormap2 (GifContext *context)
-{
- context->frame_colormap_size = 0;
- context->state = GIF_GET_COLORMAP2;
-}
-
-static gint
-gif_get_colormap (GifContext *context)
-{
- unsigned char rgb[3];
-
- while (context->global_colormap_size < context->global_bit_pixel) {
- if (!gif_read (context, rgb, sizeof (rgb))) {
- return -1;
- }
-
- context->global_color_map[0][context->global_colormap_size] = rgb[0];
- context->global_color_map[1][context->global_colormap_size] = rgb[1];
- context->global_color_map[2][context->global_colormap_size] = rgb[2];
-
- if (context->global_colormap_size == context->background_index) {
- context->animation->bg_red = rgb[0];
- context->animation->bg_green = rgb[1];
- context->animation->bg_blue = rgb[2];
- }
-
- context->global_colormap_size ++;
- }
-
- return 0;
-}
-
-
-static gint
-gif_get_colormap2 (GifContext *context)
-{
- unsigned char rgb[3];
-
- while (context->frame_colormap_size < context->frame_bit_pixel) {
- if (!gif_read (context, rgb, sizeof (rgb))) {
- return -1;
- }
-
- context->frame_color_map[0][context->frame_colormap_size] = rgb[0];
- context->frame_color_map[1][context->frame_colormap_size] = rgb[1];
- context->frame_color_map[2][context->frame_colormap_size] = rgb[2];
-
- context->frame_colormap_size ++;
- }
-
- return 0;
-}
-
-/*
- * in order for this function to work, we need to perform some black magic.
- * We want to return -1 to let the calling function know, as before, that it needs
- * more bytes. If we return 0, we were able to successfully read all block->count bytes.
- * Problem is, we don't want to reread block_count every time, so we check to see if
- * context->block_count is 0 before we read in the function.
- *
- * As a result, context->block_count MUST be 0 the first time the get_data_block is called
- * within a context, and cannot be 0 the second time it's called.
- */
-
-static int
-get_data_block (GifContext *context,
- unsigned char *buf,
- gint *empty_block)
-{
-
- if (context->block_count == 0) {
- if (!gif_read (context, &context->block_count, 1)) {
- return -1;
- }
- }
-
- if (context->block_count == 0)
- if (empty_block) {
- *empty_block = TRUE;
- return 0;
- }
-
- if (!gif_read (context, buf, context->block_count)) {
- return -1;
- }
-
- return 0;
-}
-
-static void
-gif_set_get_extension (GifContext *context)
-{
- context->state = GIF_GET_EXTENSION;
- context->extension_flag = TRUE;
- context->extension_label = 0;
- context->block_count = 0;
- context->block_ptr = 0;
-}
-
-static int
-gif_get_extension (GifContext *context)
-{
- gint retval;
- gint empty_block = FALSE;
-
- if (context->extension_flag) {
- if (context->extension_label == 0) {
- /* I guess bad things can happen if we have an extension of 0 )-: */
- /* I should look into this sometime */
- if (!gif_read (context, & context->extension_label , 1)) {
- return -1;
- }
- }
-
- switch (context->extension_label) {
- case 0xf9: /* Graphic Control Extension */
- retval = get_data_block (context, (unsigned char *) context->block_buf, NULL);
- if (retval != 0)
- return retval;
-
- if (context->frame == NULL) {
- /* I only want to set the transparency if I haven't
- * created the frame yet.
- */
- context->gif89.disposal = (context->block_buf[0] >> 2) & 0x7;
- context->gif89.input_flag = (context->block_buf[0] >> 1) & 0x1;
- context->gif89.delay_time = LM_to_uint (context->block_buf[1], context->block_buf[2]);
-
- if ((context->block_buf[0] & 0x1) != 0) {
- context->gif89.transparent = context->block_buf[3];
- } else {
- context->gif89.transparent = -1;
- }
- }
-
- /* Now we've successfully loaded this one, we continue on our way */
- context->block_count = 0;
- context->extension_flag = FALSE;
- break;
- case 0xff: /* application extension */
- if (!context->in_loop_extension) {
- retval = get_data_block (context, (unsigned char *) context->block_buf, NULL);
- if (retval != 0)
- return retval;
- if (!strncmp ((gchar *)context->block_buf, "NETSCAPE2.0", 11) ||
- !strncmp ((gchar *)context->block_buf, "ANIMEXTS1.0", 11)) {
- context->in_loop_extension = TRUE;
- }
- context->block_count = 0;
- }
- if (context->in_loop_extension) {
- do {
- retval = get_data_block (context, (unsigned char *) context->block_buf, &empty_block);
- if (retval != 0)
- return retval;
- if (context->block_buf[0] == 0x01) {
- context->animation->loop = context->block_buf[1] + (context->block_buf[2] << 8);
- if (context->animation->loop != 0)
- context->animation->loop++;
- }
- context->block_count = 0;
- }
- while (!empty_block);
- context->in_loop_extension = FALSE;
- context->extension_flag = FALSE;
- return 0;
- }
- break;
- default:
- /* Unhandled extension */
- break;
- }
- }
- /* read all blocks, until I get an empty block, in case there was an extension I didn't know about. */
- do {
- retval = get_data_block (context, (unsigned char *) context->block_buf, &empty_block);
- if (retval != 0)
- return retval;
- context->block_count = 0;
- } while (!empty_block);
-
- return 0;
-}
-
-static int ZeroDataBlock = FALSE;
-
-static int
-GetDataBlock (GifContext *context,
- unsigned char *buf)
-{
-/* unsigned char count; */
-
- if (!gif_read (context, &context->block_count, 1)) {
- /*g_message (_("GIF: error in getting DataBlock size\n"));*/
- return -1;
- }
-
- ZeroDataBlock = context->block_count == 0;
-
- if ((context->block_count != 0) && (!gif_read (context, buf, context->block_count))) {
- /*g_message (_("GIF: error in reading DataBlock\n"));*/
- return -1;
- }
-
- return context->block_count;
-}
-
-
-static void
-gif_set_lzw_fill_buffer (GifContext *context)
-{
- context->block_count = 0;
- context->old_state = context->state;
- context->state = GIF_LZW_FILL_BUFFER;
-}
-
-static int
-gif_lzw_fill_buffer (GifContext *context)
-{
- gint retval;
-
- if (context->code_done) {
- if (context->code_curbit >= context->code_lastbit) {
- g_set_error_literal (context->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("GIF file was missing some data (perhaps it was truncated somehow?)"));
-
- return -2;
- }
- /* Is this supposed to be an error or what? */
- /* g_message ("trying to read more data after we've done stuff\n"); */
- g_set_error (context->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_FAILED,
- _("Internal error in the GIF loader (%s)"),
- G_STRLOC);
-
- return -2;
- }
-
- context->block_buf[0] = context->block_buf[context->code_last_byte - 2];
- context->block_buf[1] = context->block_buf[context->code_last_byte - 1];
-
- retval = get_data_block (context, &context->block_buf[2], NULL);
-
- if (retval == -1)
- return -1;
-
- if (context->block_count == 0)
- context->code_done = TRUE;
-
- context->code_last_byte = 2 + context->block_count;
- context->code_curbit = (context->code_curbit - context->code_lastbit) + 16;
- context->code_lastbit = (2 + context->block_count) * 8;
-
- context->state = context->old_state;
- return 0;
-}
-
-static int
-get_code (GifContext *context,
- int code_size)
-{
- int i, j, ret;
-
- if ((context->code_curbit + code_size) >= context->code_lastbit){
- gif_set_lzw_fill_buffer (context);
- return -3;
- }
-
- ret = 0;
- for (i = context->code_curbit, j = 0; j < code_size; ++i, ++j)
- ret |= ((context->block_buf[i / 8] & (1 << (i % 8))) != 0) << j;
-
- context->code_curbit += code_size;
-
- return ret;
-}
-
-
-static void
-set_gif_lzw_clear_code (GifContext *context)
-{
- context->state = GIF_LZW_CLEAR_CODE;
- context->lzw_code_pending = -1;
-}
-
-static int
-gif_lzw_clear_code (GifContext *context)
-{
- gint code;
-
- code = get_code (context, context->lzw_code_size);
- if (code == -3)
- return -0;
-
- context->lzw_firstcode = context->lzw_oldcode = code;
- context->lzw_code_pending = code;
- context->state = GIF_GET_LZW;
- return 0;
-}
-
-#define CHECK_LZW_SP() G_STMT_START { \
- if ((guchar *)context->lzw_sp >= \
- (guchar *)context->lzw_stack + sizeof (context->lzw_stack)) { \
- g_set_error_literal (context->error, \
- GDK_PIXBUF_ERROR, \
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE, \
- _("Stack overflow")); \
- return -2; \
- } \
-} G_STMT_END
-
-static int
-lzw_read_byte (GifContext *context)
-{
- int code, incode;
- gint retval;
- gint my_retval;
- register int i;
-
- if (context->lzw_code_pending != -1) {
- retval = context->lzw_code_pending;
- context->lzw_code_pending = -1;
- return retval;
- }
-
- if (context->lzw_fresh) {
- context->lzw_fresh = FALSE;
- do {
- retval = get_code (context, context->lzw_code_size);
- if (retval < 0) {
- return retval;
- }
-
- context->lzw_firstcode = context->lzw_oldcode = retval;
- } while (context->lzw_firstcode == context->lzw_clear_code);
- return context->lzw_firstcode;
- }
-
- if (context->lzw_sp > context->lzw_stack) {
- my_retval = *--(context->lzw_sp);
- return my_retval;
- }
-
- while ((code = get_code (context, context->lzw_code_size)) >= 0) {
- if (code == context->lzw_clear_code) {
- for (i = 0; i < context->lzw_clear_code; ++i) {
- context->lzw_table[0][i] = 0;
- context->lzw_table[1][i] = i;
- }
- for (; i < (1 << MAX_LZW_BITS); ++i)
- context->lzw_table[0][i] = context->lzw_table[1][i] = 0;
- context->lzw_code_size = context->lzw_set_code_size + 1;
- context->lzw_max_code_size = 2 * context->lzw_clear_code;
- context->lzw_max_code = context->lzw_clear_code + 2;
- context->lzw_sp = context->lzw_stack;
-
- set_gif_lzw_clear_code (context);
- return -3;
- } else if (code == context->lzw_end_code) {
- int count;
- unsigned char buf[260];
-
- /* FIXME - we should handle this case */
- g_set_error_literal (context->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_FAILED,
- _("GIF image loader cannot understand this image."));
- return -2;
-
- if (ZeroDataBlock) {
- return -2;
- }
-
- while ((count = GetDataBlock (context, buf)) > 0)
- ;
-
- if (count != 0) {
- /*g_print (_("GIF: missing EOD in data stream (common occurence)"));*/
- return -2;
- }
- }
-
- incode = code;
-
- if (code >= context->lzw_max_code) {
- CHECK_LZW_SP ();
- *(context->lzw_sp)++ = context->lzw_firstcode;
- code = context->lzw_oldcode;
- }
-
- while (code >= context->lzw_clear_code) {
- if (code >= (1 << MAX_LZW_BITS)) {
- g_set_error_literal (context->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Bad code encountered"));
- return -2;
- }
- CHECK_LZW_SP ();
- *(context->lzw_sp)++ = context->lzw_table[1][code];
-
- if (code == context->lzw_table[0][code]) {
- g_set_error_literal (context->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Circular table entry in GIF file"));
- return -2;
- }
- code = context->lzw_table[0][code];
- }
-
- CHECK_LZW_SP ();
- *(context->lzw_sp)++ = context->lzw_firstcode = context->lzw_table[1][code];
-
- if ((code = context->lzw_max_code) < (1 << MAX_LZW_BITS)) {
- context->lzw_table[0][code] = context->lzw_oldcode;
- context->lzw_table[1][code] = context->lzw_firstcode;
- ++context->lzw_max_code;
- if ((context->lzw_max_code >= context->lzw_max_code_size) &&
- (context->lzw_max_code_size < (1 << MAX_LZW_BITS))) {
- context->lzw_max_code_size *= 2;
- ++context->lzw_code_size;
- }
- }
-
- context->lzw_oldcode = incode;
-
- if (context->lzw_sp > context->lzw_stack) {
- my_retval = *--(context->lzw_sp);
- return my_retval;
- }
- }
- return code;
-}
-
-static void
-gif_set_get_lzw (GifContext *context)
-{
- context->state = GIF_GET_LZW;
- context->draw_xpos = 0;
- context->draw_ypos = 0;
- context->draw_pass = 0;
-}
-
-static void
-gif_fill_in_pixels (GifContext *context, guchar *dest, gint offset, guchar v)
-{
- guchar *pixel = NULL;
- guchar (*cmap)[MAXCOLORMAPSIZE];
-
- if (context->frame_cmap_active)
- cmap = context->frame_color_map;
- else
- cmap = context->global_color_map;
-
- if (context->gif89.transparent != -1) {
- pixel = dest + (context->draw_ypos + offset) * gdk_pixbuf_get_rowstride (context->frame->pixbuf) + context->draw_xpos * 4;
- *pixel = cmap [0][(guchar) v];
- *(pixel+1) = cmap [1][(guchar) v];
- *(pixel+2) = cmap [2][(guchar) v];
- *(pixel+3) = (guchar) ((v == context->gif89.transparent) ? 0 : 255);
- } else {
- pixel = dest + (context->draw_ypos + offset) * gdk_pixbuf_get_rowstride (context->frame->pixbuf) + context->draw_xpos * 3;
- *pixel = cmap [0][(guchar) v];
- *(pixel+1) = cmap [1][(guchar) v];
- *(pixel+2) = cmap [2][(guchar) v];
- }
-}
-
-
-/* only called if progressive and interlaced */
-static void
-gif_fill_in_lines (GifContext *context, guchar *dest, guchar v)
-{
- switch (context->draw_pass) {
- case 0:
- if (context->draw_ypos > 4) {
- gif_fill_in_pixels (context, dest, -4, v);
- gif_fill_in_pixels (context, dest, -3, v);
- }
- if (context->draw_ypos < (context->frame_height - 4)) {
- gif_fill_in_pixels (context, dest, 3, v);
- gif_fill_in_pixels (context, dest, 4, v);
- }
- /* we don't need a break here. We draw the outer pixels first, then the
- * inner ones, then the innermost ones. case 0 needs to draw all 3 bands.
- * case 1, just the last two, and case 2 just draws the last one*/
- case 1:
- if (context->draw_ypos > 2)
- gif_fill_in_pixels (context, dest, -2, v);
- if (context->draw_ypos < (context->frame_height - 2))
- gif_fill_in_pixels (context, dest, 2, v);
- /* no break as above. */
- case 2:
- if (context->draw_ypos > 1)
- gif_fill_in_pixels (context, dest, -1, v);
- if (context->draw_ypos < (context->frame_height - 1))
- gif_fill_in_pixels (context, dest, 1, v);
- case 3:
- default:
- break;
- }
-}
-
-/* Clips a rectancle to the base dimensions. Returns TRUE if the clipped rectangle is non-empty. */
-static gboolean
-clip_frame (GifContext *context,
- gint *x,
- gint *y,
- gint *width,
- gint *height)
-{
- gint orig_x, orig_y;
-
- orig_x = *x;
- orig_y = *y;
- *x = MAX (0, *x);
- *y = MAX (0, *y);
- *width = MIN (context->width, orig_x + *width) - *x;
- *height = MIN (context->height, orig_y + *height) - *y;
-
- if (*width > 0 && *height > 0)
- return TRUE;
-
- /* The frame is completely off-bounds */
-
- *x = 0;
- *y = 0;
- *width = 0;
- *height = 0;
-
- return FALSE;
-}
-
-/* Call update_func on the given rectangle, unless it is completely off-bounds */
-static void
-maybe_update (GifContext *context,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- if (clip_frame (context, &x, &y, &width, &height))
- (*context->update_func) (context->frame->pixbuf,
- x, y, width, height,
- context->user_data);
-}
-
-static int
-gif_get_lzw (GifContext *context)
-{
- guchar *dest, *temp;
- gint lower_bound, upper_bound; /* bounds for emitting the area_updated signal */
- gboolean bound_flag;
- gint first_pass; /* bounds for emitting the area_updated signal */
- gint v;
-
- if (context->frame == NULL) {
- context->frame = g_new (GdkPixbufFrame, 1);
-
- context->frame->composited = NULL;
- context->frame->revert = NULL;
-
- if (context->frame_len == 0 || context->frame_height == 0) {
- /* An empty frame, we just output a single transparent
- * pixel at (0, 0).
- */
- context->x_offset = 0;
- context->y_offset = 0;
- context->frame_len = 1;
- context->frame_height = 1;
- context->frame->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, 1, 1);
- if (context->frame->pixbuf) {
- guchar *pixels;
-
- pixels = gdk_pixbuf_get_pixels (context->frame->pixbuf);
- pixels[0] = 0;
- pixels[1] = 0;
- pixels[2] = 0;
- pixels[3] = 0;
- }
- } else
- context->frame->pixbuf =
- gdk_pixbuf_new (GDK_COLORSPACE_RGB,
- TRUE,
- 8,
- context->frame_len,
- context->frame_height);
- if (!context->frame->pixbuf) {
- g_free (context->frame);
- g_set_error_literal (context->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Not enough memory to load GIF file"));
- return -2;
- }
-
- context->frame->x_offset = context->x_offset;
- context->frame->y_offset = context->y_offset;
- context->frame->need_recomposite = TRUE;
-
- /* GIF delay is in hundredths, we want thousandths */
- context->frame->delay_time = context->gif89.delay_time * 10;
-
- /* GIFs with delay time 0 are mostly broken, but they
- * just want a default, "not that fast" delay.
- */
- if (context->frame->delay_time == 0)
- context->frame->delay_time = 100;
-
- /* No GIFs gets to play faster than 50 fps. They just
- * lock up poor gtk.
- */
- if (context->frame->delay_time < 20)
- context->frame->delay_time = 20; /* 20 = "fast" */
-
- context->frame->elapsed = context->animation->total_time;
- context->animation->total_time += context->frame->delay_time;
-
- switch (context->gif89.disposal) {
- case 0:
- case 1:
- context->frame->action = GDK_PIXBUF_FRAME_RETAIN;
- break;
- case 2:
- context->frame->action = GDK_PIXBUF_FRAME_DISPOSE;
- break;
- case 3:
- context->frame->action = GDK_PIXBUF_FRAME_REVERT;
- break;
- default:
- context->frame->action = GDK_PIXBUF_FRAME_RETAIN;
- break;
- }
-
- context->frame->bg_transparent = (context->gif89.transparent == context->background_index);
-
- context->animation->n_frames ++;
- context->animation->frames = g_list_append (context->animation->frames, context->frame);
-
- /* Only call prepare_func for the first frame */
- if (context->animation->frames->next == NULL) {
- if (context->animation->width == 0 )
- context->animation->width = gdk_pixbuf_get_width(context->frame->pixbuf);
- if (context->animation->height == 0)
- context->animation->height = gdk_pixbuf_get_height (context->frame->pixbuf);
-
- if (context->prepare_func)
- (* context->prepare_func) (context->frame->pixbuf,
- GDK_PIXBUF_ANIMATION (context->animation),
- context->user_data);
- } else {
- /* Otherwise init frame with last frame */
- GList *link;
- GdkPixbufFrame *prev_frame;
- gint x, y, w, h;
-
- link = g_list_find (context->animation->frames, context->frame);
-
- prev_frame = link->prev->data;
-
- gdk_pixbuf_gif_anim_frame_composite (context->animation, prev_frame);
-
- /* Composite failed */
- if (prev_frame->composited == NULL) {
- GdkPixbufFrame *frame = NULL;
- link = g_list_first (context->animation->frames);
- while (link != NULL) {
- frame = (GdkPixbufFrame *)link->data;
- if (frame != NULL) {
- if (frame->pixbuf != NULL)
- g_object_unref (frame->pixbuf);
- if (frame->composited != NULL)
- g_object_unref (frame->composited);
- if (frame->revert != NULL)
- g_object_unref (frame->revert);
- g_free (frame);
- }
- link = link->next;
- }
-
- g_list_free (context->animation->frames);
- context->animation->frames = NULL;
-
- g_set_error_literal (context->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Not enough memory to composite a frame in GIF file"));
- return -2;
- }
-
- x = context->frame->x_offset;
- y = context->frame->y_offset;
- w = gdk_pixbuf_get_width (context->frame->pixbuf);
- h = gdk_pixbuf_get_height (context->frame->pixbuf);
- if (clip_frame (context, &x, &y, &w, &h))
- gdk_pixbuf_copy_area (prev_frame->composited,
- x, y, w, h,
- context->frame->pixbuf,
- 0, 0);
- }
- }
-
- dest = gdk_pixbuf_get_pixels (context->frame->pixbuf);
-
- bound_flag = FALSE;
- lower_bound = upper_bound = context->draw_ypos;
- first_pass = context->draw_pass;
-
- while (TRUE) {
- guchar (*cmap)[MAXCOLORMAPSIZE];
-
- if (context->frame_cmap_active)
- cmap = context->frame_color_map;
- else
- cmap = context->global_color_map;
-
- v = lzw_read_byte (context);
- if (v < 0) {
- goto finished_data;
- }
- bound_flag = TRUE;
-
- g_assert (gdk_pixbuf_get_has_alpha (context->frame->pixbuf));
-
- temp = dest + context->draw_ypos * gdk_pixbuf_get_rowstride (context->frame->pixbuf) + context->draw_xpos * 4;
- *temp = cmap [0][(guchar) v];
- *(temp+1) = cmap [1][(guchar) v];
- *(temp+2) = cmap [2][(guchar) v];
- *(temp+3) = (guchar) ((v == context->gif89.transparent) ? 0 : 255);
-
- if (context->prepare_func && context->frame_interlace)
- gif_fill_in_lines (context, dest, v);
-
- context->draw_xpos++;
-
- if (context->draw_xpos == context->frame_len) {
- context->draw_xpos = 0;
- if (context->frame_interlace) {
- switch (context->draw_pass) {
- case 0:
- case 1:
- context->draw_ypos += 8;
- break;
- case 2:
- context->draw_ypos += 4;
- break;
- case 3:
- context->draw_ypos += 2;
- break;
- }
-
- if (context->draw_ypos >= context->frame_height) {
- context->draw_pass++;
- switch (context->draw_pass) {
- case 1:
- context->draw_ypos = 4;
- break;
- case 2:
- context->draw_ypos = 2;
- break;
- case 3:
- context->draw_ypos = 1;
- break;
- default:
- goto done;
- }
- }
- } else {
- context->draw_ypos++;
- }
- if (context->draw_pass != first_pass) {
- if (context->draw_ypos > lower_bound) {
- lower_bound = 0;
- upper_bound = context->frame_height;
- } else {
-
- }
- } else
- upper_bound = context->draw_ypos;
- }
- if (context->draw_ypos >= context->frame_height)
- break;
- }
-
- done:
-
- context->state = GIF_GET_NEXT_STEP;
-
- v = 0;
-
- finished_data:
-
- if (bound_flag)
- context->frame->need_recomposite = TRUE;
-
- if (bound_flag && context->update_func) {
- if (lower_bound <= upper_bound && first_pass == context->draw_pass) {
- maybe_update (context,
- context->frame->x_offset,
- context->frame->y_offset + lower_bound,
- gdk_pixbuf_get_width (context->frame->pixbuf),
- upper_bound - lower_bound);
- } else {
- if (lower_bound <= upper_bound) {
- maybe_update (context,
- context->frame->x_offset,
- context->frame->y_offset,
- gdk_pixbuf_get_width (context->frame->pixbuf),
- gdk_pixbuf_get_height (context->frame->pixbuf));
- } else {
- maybe_update (context,
- context->frame->x_offset,
- context->frame->y_offset,
- gdk_pixbuf_get_width (context->frame->pixbuf),
- upper_bound);
- maybe_update (context,
- context->frame->x_offset,
- context->frame->y_offset + lower_bound,
- gdk_pixbuf_get_width (context->frame->pixbuf),
- gdk_pixbuf_get_height (context->frame->pixbuf) - lower_bound);
- }
- }
- }
-
- if (context->state == GIF_GET_NEXT_STEP) {
- /* Will be freed with context->animation, we are just
- * marking that we're done with it (no current frame)
- */
- context->frame = NULL;
- context->frame_cmap_active = FALSE;
-
- if (context->stop_after_first_frame)
- context->state = GIF_DONE;
- }
-
- return v;
-}
-
-static void
-gif_set_prepare_lzw (GifContext *context)
-{
- context->state = GIF_PREPARE_LZW;
- context->lzw_code_pending = -1;
-}
-static int
-gif_prepare_lzw (GifContext *context)
-{
- gint i;
-
- if (!gif_read (context, &(context->lzw_set_code_size), 1)) {
- /*g_message (_("GIF: EOF / read error on image data\n"));*/
- return -1;
- }
-
- if (context->lzw_set_code_size > MAX_LZW_BITS) {
- g_set_error_literal (context->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("GIF image is corrupt (incorrect LZW compression)"));
- return -2;
- }
-
- context->lzw_code_size = context->lzw_set_code_size + 1;
- context->lzw_clear_code = 1 << context->lzw_set_code_size;
- context->lzw_end_code = context->lzw_clear_code + 1;
- context->lzw_max_code_size = 2 * context->lzw_clear_code;
- context->lzw_max_code = context->lzw_clear_code + 2;
- context->lzw_fresh = TRUE;
- context->code_curbit = 0;
- context->code_lastbit = 0;
- context->code_last_byte = 0;
- context->code_done = FALSE;
-
- g_assert (context->lzw_clear_code <=
- G_N_ELEMENTS (context->lzw_table[0]));
-
- for (i = 0; i < context->lzw_clear_code; ++i) {
- context->lzw_table[0][i] = 0;
- context->lzw_table[1][i] = i;
- }
- for (; i < (1 << MAX_LZW_BITS); ++i)
- context->lzw_table[0][i] = context->lzw_table[1][0] = 0;
-
- context->lzw_sp = context->lzw_stack;
- gif_set_get_lzw (context);
-
- return 0;
-}
-
-/* needs 13 bytes to proceed. */
-static gint
-gif_init (GifContext *context)
-{
- unsigned char buf[16];
- char version[4];
-
- if (!gif_read (context, buf, 6)) {
- /* Unable to read magic number,
- * gif_read() should have set error
- */
- return -1;
- }
-
- if (strncmp ((char *) buf, "GIF", 3) != 0) {
- /* Not a GIF file */
- g_set_error_literal (context->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("File does not appear to be a GIF file"));
- return -2;
- }
-
- strncpy (version, (char *) buf + 3, 3);
- version[3] = '\0';
-
- if ((strcmp (version, "87a") != 0) && (strcmp (version, "89a") != 0)) {
- /* bad version number, not '87a' or '89a' */
- g_set_error (context->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Version %s of the GIF file format is not supported"),
- version);
- return -2;
- }
-
- /* read the screen descriptor */
- if (!gif_read (context, buf, 7)) {
- /* Failed to read screen descriptor, error set */
- return -1;
- }
-
- context->width = LM_to_uint (buf[0], buf[1]);
- context->height = LM_to_uint (buf[2], buf[3]);
- /* The 4th byte is
- * high bit: whether to use the background index
- * next 3: color resolution
- * next: whether colormap is sorted by priority of allocation
- * last 3: size of colormap
- */
- context->global_bit_pixel = 2 << (buf[4] & 0x07);
- context->global_color_resolution = (((buf[4] & 0x70) >> 3) + 1);
- context->has_global_cmap = (buf[4] & 0x80) != 0;
- context->background_index = buf[5];
- context->aspect_ratio = buf[6];
-
- /* Use background of transparent black as default, though if
- * one isn't set explicitly no one should ever use it.
- */
- context->animation->bg_red = 0;
- context->animation->bg_green = 0;
- context->animation->bg_blue = 0;
-
- context->animation->width = context->width;
- context->animation->height = context->height;
-
- if (context->has_global_cmap) {
- gif_set_get_colormap (context);
- } else {
- context->state = GIF_GET_NEXT_STEP;
- }
-
-#ifdef DUMP_IMAGE_DETAILS
- g_print (">Image width: %d height: %d global_cmap: %d background: %d\n",
- context->width, context->height, context->has_global_cmap, context->background_index);
-#endif
-
- return 0;
-}
-
-static void
-gif_set_get_frame_info (GifContext *context)
-{
- context->state = GIF_GET_FRAME_INFO;
-}
-
-static gint
-gif_get_frame_info (GifContext *context)
-{
- unsigned char buf[9];
-
- if (!gif_read (context, buf, 9)) {
- return -1;
- }
-
- /* Okay, we got all the info we need. Lets record it */
- context->frame_len = LM_to_uint (buf[4], buf[5]);
- context->frame_height = LM_to_uint (buf[6], buf[7]);
- context->x_offset = LM_to_uint (buf[0], buf[1]);
- context->y_offset = LM_to_uint (buf[2], buf[3]);
-
- if (context->animation->frames == NULL &&
- context->gif89.disposal == 3) {
- /* First frame can't have "revert to previous" as its
- * dispose mode. Silently use "retain" instead.
- */
- context->gif89.disposal = 0;
- }
-
- context->frame_interlace = BitSet (buf[8], INTERLACE);
-
-#ifdef DUMP_IMAGE_DETAILS
- g_print (">width: %d height: %d xoffset: %d yoffset: %d disposal: %d delay: %d transparent: %d interlace: %d\n",
- context->frame_len, context->frame_height, context->x_offset, context->y_offset,
- context->gif89.disposal, context->gif89.delay_time, context->gif89.transparent, context->frame_interlace);
-#endif
-
- if (BitSet (buf[8], LOCALCOLORMAP)) {
-
-#ifdef DUMP_IMAGE_DETAILS
- g_print (">has local colormap\n");
-#endif
-
- /* Does this frame have it's own colormap. */
- /* really only relevant when looking at the first frame
- * of an animated gif. */
- /* if it does, we need to re-read in the colormap,
- * the gray_scale, and the bit_pixel */
- context->frame_cmap_active = TRUE;
- context->frame_bit_pixel = 1 << ((buf[8] & 0x07) + 1);
- gif_set_get_colormap2 (context);
- return 0;
- }
-
- if (!context->has_global_cmap) {
- context->state = GIF_DONE;
-
- g_set_error_literal (context->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("GIF image has no global colormap, and a frame inside it has no local colormap."));
-
- return -2;
- }
-
- gif_set_prepare_lzw (context);
- return 0;
-
-}
-
-static gint
-gif_get_next_step (GifContext *context)
-{
- unsigned char c;
- while (TRUE) {
- if (!gif_read (context, &c, 1)) {
- return -1;
- }
- if (c == ';') {
- /* GIF terminator */
- /* hmm. Not 100% sure what to do about this. Should
- * i try to return a blank image instead? */
- context->state = GIF_DONE;
- return 0;
- }
-
- if (c == '!') {
- /* Check the extension */
- gif_set_get_extension (context);
- return 0;
- }
-
- /* look for frame */
- if (c != ',') {
- /* Not a valid start character */
- continue;
- }
- /* load the frame */
- gif_set_get_frame_info (context);
- return 0;
- }
-}
-
-
-#define LOG(x) /* g_print ("%s: %s\n", G_STRLOC, x); */
-
-static gint
-gif_main_loop (GifContext *context)
-{
- gint retval = 0;
-
- do {
- switch (context->state) {
- case GIF_START:
- LOG("start\n");
- retval = gif_init (context);
- break;
-
- case GIF_GET_COLORMAP:
- LOG("get_colormap\n");
- retval = gif_get_colormap (context);
- if (retval == 0)
- context->state = GIF_GET_NEXT_STEP;
- break;
-
- case GIF_GET_NEXT_STEP:
- LOG("next_step\n");
- retval = gif_get_next_step (context);
- break;
-
- case GIF_GET_FRAME_INFO:
- LOG("frame_info\n");
- retval = gif_get_frame_info (context);
- break;
-
- case GIF_GET_EXTENSION:
- LOG("get_extension\n");
- retval = gif_get_extension (context);
- if (retval == 0)
- context->state = GIF_GET_NEXT_STEP;
- break;
-
- case GIF_GET_COLORMAP2:
- LOG("get_colormap2\n");
- retval = gif_get_colormap2 (context);
- if (retval == 0)
- gif_set_prepare_lzw (context);
- break;
-
- case GIF_PREPARE_LZW:
- LOG("prepare_lzw\n");
- retval = gif_prepare_lzw (context);
- break;
-
- case GIF_LZW_FILL_BUFFER:
- LOG("fill_buffer\n");
- retval = gif_lzw_fill_buffer (context);
- break;
-
- case GIF_LZW_CLEAR_CODE:
- LOG("clear_code\n");
- retval = gif_lzw_clear_code (context);
- break;
-
- case GIF_GET_LZW:
- LOG("get_lzw\n");
- retval = gif_get_lzw (context);
- break;
-
- case GIF_DONE:
- LOG("done\n");
- default:
- retval = 0;
- goto done;
- };
- } while ((retval == 0) || (retval == -3));
- done:
- return retval;
-}
-
-static GifContext *
-new_context (void)
-{
- GifContext *context;
-
- context = g_try_malloc (sizeof (GifContext));
- if (context == NULL)
- return NULL;
-
- memset (context, 0, sizeof (GifContext));
-
- context->animation = g_object_new (GDK_TYPE_PIXBUF_GIF_ANIM, NULL);
- context->frame = NULL;
- context->file = NULL;
- context->state = GIF_START;
- context->prepare_func = NULL;
- context->update_func = NULL;
- context->user_data = NULL;
- context->buf = NULL;
- context->amount_needed = 0;
- context->gif89.transparent = -1;
- context->gif89.delay_time = -1;
- context->gif89.input_flag = -1;
- context->gif89.disposal = -1;
- context->animation->loop = 1;
- context->in_loop_extension = FALSE;
- context->stop_after_first_frame = FALSE;
-
- return context;
-}
-/* Shared library entry point */
-static GdkPixbuf *
-gdk_pixbuf__gif_image_load (FILE *file, GError **error)
-{
- GifContext *context;
- GdkPixbuf *pixbuf;
-
- g_return_val_if_fail (file != NULL, NULL);
-
- context = new_context ();
-
- if (context == NULL) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Not enough memory to load GIF file"));
- return NULL;
- }
-
- context->file = file;
- context->error = error;
- context->stop_after_first_frame = TRUE;
-
- if (gif_main_loop (context) == -1 || context->animation->frames == NULL) {
- if (context->error && *(context->error) == NULL)
- g_set_error_literal (context->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("GIF file was missing some data (perhaps it was truncated somehow?)"));
- }
-
- pixbuf = gdk_pixbuf_animation_get_static_image (GDK_PIXBUF_ANIMATION (context->animation));
-
- if (pixbuf)
- g_object_ref (pixbuf);
-
- g_object_unref (context->animation);
-
- g_free (context->buf);
- g_free (context);
-
- return pixbuf;
-}
-
-static gpointer
-gdk_pixbuf__gif_image_begin_load (GdkPixbufModuleSizeFunc size_func,
- GdkPixbufModulePreparedFunc prepare_func,
- GdkPixbufModuleUpdatedFunc update_func,
- gpointer user_data,
- GError **error)
-{
- GifContext *context;
-
-#ifdef IO_GIFDEBUG
- count = 0;
-#endif
- context = new_context ();
-
- if (context == NULL) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Not enough memory to load GIF file"));
- return NULL;
- }
-
- context->error = error;
- context->prepare_func = prepare_func;
- context->update_func = update_func;
- context->user_data = user_data;
-
- return (gpointer) context;
-}
-
-static gboolean
-gdk_pixbuf__gif_image_stop_load (gpointer data, GError **error)
-{
- GifContext *context = (GifContext *) data;
- gboolean retval = TRUE;
-
- if (context->state != GIF_DONE || context->animation->frames == NULL) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("GIF image was truncated or incomplete."));
-
- retval = FALSE;
- }
-
- g_object_unref (context->animation);
-
- g_free (context->buf);
- g_free (context);
-
- return retval;
-}
-
-static gboolean
-gdk_pixbuf__gif_image_load_increment (gpointer data,
- const guchar *buf, guint size,
- GError **error)
-{
- gint retval;
- GifContext *context = (GifContext *) data;
-
- context->error = error;
-
- if (context->amount_needed == 0) {
- /* we aren't looking for some bytes. */
- /* we can use buf now, but we don't want to keep it around at all.
- * it will be gone by the end of the call. */
- context->buf = (guchar*) buf; /* very dubious const cast */
- context->ptr = 0;
- context->size = size;
- } else {
- /* we need some bytes */
- if (size < context->amount_needed) {
- context->amount_needed -= size;
- /* copy it over and return */
- memcpy (context->buf + context->size, buf, size);
- context->size += size;
- return TRUE;
- } else if (size == context->amount_needed) {
- memcpy (context->buf + context->size, buf, size);
- context->size += size;
- } else {
- context->buf = g_realloc (context->buf, context->size + size);
- memcpy (context->buf + context->size, buf, size);
- context->size += size;
- }
- }
-
- retval = gif_main_loop (context);
-
- if (retval == -2) {
- if (context->buf == buf)
- context->buf = NULL;
- return FALSE;
- }
- if (retval == -1) {
- /* we didn't have enough memory */
- /* prepare for the next image_load_increment */
- if (context->buf == buf) {
- g_assert (context->size == size);
- context->buf = g_new (guchar, context->amount_needed + (context->size - context->ptr));
- memcpy (context->buf, buf + context->ptr, context->size - context->ptr);
- } else {
- /* copy the left overs to the begining of the buffer */
- /* and realloc the memory */
- memmove (context->buf, context->buf + context->ptr, context->size - context->ptr);
- context->buf = g_realloc (context->buf, context->amount_needed + (context->size - context->ptr));
- }
- context->size = context->size - context->ptr;
- context->ptr = 0;
- } else {
- /* we are prolly all done */
- if (context->buf == buf)
- context->buf = NULL;
- }
- return TRUE;
-}
-
-static GdkPixbufAnimation *
-gdk_pixbuf__gif_image_load_animation (FILE *file,
- GError **error)
-{
- GifContext *context;
- GdkPixbufAnimation *animation;
-
- g_return_val_if_fail (file != NULL, NULL);
-
- context = new_context ();
-
- if (context == NULL) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Not enough memory to load GIF file"));
- return NULL;
- }
-
- context->error = error;
- context->file = file;
-
- if (gif_main_loop (context) == -1 || context->animation->frames == NULL) {
- if (context->error && *(context->error) == NULL)
- g_set_error_literal (context->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("GIF file was missing some data (perhaps it was truncated somehow?)"));
-
- g_object_unref (context->animation);
- context->animation = NULL;
- }
-
- if (context->animation)
- animation = GDK_PIXBUF_ANIMATION (context->animation);
- else
- animation = NULL;
-
- if (context->error && *(context->error))
- g_print ("%s\n", (*(context->error))->message);
-
- g_free (context->buf);
- g_free (context);
- return animation;
-}
-
-#ifndef INCLUDE_gif
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__gif_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
-{
- module->load = gdk_pixbuf__gif_image_load;
- module->begin_load = gdk_pixbuf__gif_image_begin_load;
- module->stop_load = gdk_pixbuf__gif_image_stop_load;
- module->load_increment = gdk_pixbuf__gif_image_load_increment;
- module->load_animation = gdk_pixbuf__gif_image_load_animation;
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
-{
- static GdkPixbufModulePattern signature[] = {
- { "GIF8", NULL, 100 },
- { NULL, NULL, 0 }
- };
- static gchar * mime_types[] = {
- "image/gif",
- NULL
- };
- static gchar * extensions[] = {
- "gif",
- NULL
- };
-
- info->name = "gif";
- info->signature = signature;
- info->description = N_("The GIF image format");
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "LGPL";
-}
diff --git a/gdk-pixbuf/io-icns.c b/gdk-pixbuf/io-icns.c
deleted file mode 100644
index eee7dcc849..0000000000
--- a/gdk-pixbuf/io-icns.c
+++ /dev/null
@@ -1,404 +0,0 @@
-/* Mac OS X .icns icons loader
- *
- * Copyright (c) 2007 Lyonel Vincent <lyonel@ezix.org>
- * Copyright (c) 2007 Bastien Nocera <hadess@hadess.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 _WIN32
-#define _GNU_SOURCE
-#endif
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-#include "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-io.h"
-
-G_MODULE_EXPORT void fill_vtable (GdkPixbufModule * module);
-G_MODULE_EXPORT void fill_info (GdkPixbufFormat * info);
-
-#define IN /**/
-#define OUT /**/
-#define INOUT /**/
-
-struct IcnsBlockHeader
-{
- char id[4];
- guint32 size; /* caution: bigendian */
-};
-typedef struct IcnsBlockHeader IcnsBlockHeader;
-
-/*
- * load raw icon data from 'icns' resource
- *
- * returns TRUE when successful
- */
-static gboolean
-load_resources (unsigned size, IN gpointer data, gsize datalen,
- OUT guchar ** picture, OUT gsize * plen,
- OUT guchar ** mask, OUT gsize * mlen)
-{
- IcnsBlockHeader *header = NULL;
- const char *bytes = NULL;
- const char *current = NULL;
- guint32 blocklen = 0;
- guint32 icnslen = 0;
- gboolean needs_mask = TRUE;
-
- if (datalen < 2 * sizeof (guint32))
- return FALSE;
- if (!data)
- return FALSE;
-
- *picture = *mask = NULL;
- *plen = *mlen = 0;
-
- bytes = data;
- header = (IcnsBlockHeader *) data;
- if (memcmp (header->id, "icns", 4) != 0)
- return FALSE;
-
- icnslen = GUINT32_FROM_BE (header->size);
- if ((icnslen > datalen) || (icnslen < 2 * sizeof (guint32)))
- return FALSE;
-
- current = bytes + sizeof (IcnsBlockHeader);
- while ((current - bytes < icnslen) && (icnslen - (current - bytes) >= sizeof (IcnsBlockHeader)))
- {
- header = (IcnsBlockHeader *) current;
- blocklen = GUINT32_FROM_BE (header->size);
-
- /* Check that blocklen isn't garbage */
- if (blocklen > icnslen - (current - bytes))
- return FALSE;
-
- switch (size)
- {
- case 256:
- case 512:
- if (memcmp (header->id, "ic08", 4) == 0 /* 256x256 icon */
- || memcmp (header->id, "ic09", 4) == 0) /* 512x512 icon */
- {
- *picture = (gpointer) (current + sizeof (IcnsBlockHeader));
- *plen = blocklen - sizeof (IcnsBlockHeader);
- }
- needs_mask = FALSE;
- break;
- case 128:
- if (memcmp (header->id, "it32", 4) == 0) /* 128x128 icon */
- {
- *picture = (gpointer) (current + sizeof (IcnsBlockHeader));
- *plen = blocklen - sizeof (IcnsBlockHeader);
- if (memcmp (*picture, "\0\0\0\0", 4) == 0)
- {
- *picture += 4;
- *plen -= 4;
- }
- }
- if (memcmp (header->id, "t8mk", 4) == 0) /* 128x128 mask */
- {
- *mask = (gpointer) (current + sizeof (IcnsBlockHeader));
- *mlen = blocklen - sizeof (IcnsBlockHeader);
- }
- break;
- case 48:
- if (memcmp (header->id, "ih32", 4) == 0) /* 48x48 icon */
- {
- *picture = (gpointer) (current + sizeof (IcnsBlockHeader));
- *plen = blocklen - sizeof (IcnsBlockHeader);
- }
- if (memcmp (header->id, "h8mk", 4) == 0) /* 48x48 mask */
- {
- *mask = (gpointer) (current + sizeof (IcnsBlockHeader));
- *mlen = blocklen - sizeof (IcnsBlockHeader);
- }
- break;
- case 32:
- if (memcmp (header->id, "il32", 4) == 0) /* 32x32 icon */
- {
- *picture = (gpointer) (current + sizeof (IcnsBlockHeader));
- *plen = blocklen - sizeof (IcnsBlockHeader);
- }
- if (memcmp (header->id, "l8mk", 4) == 0) /* 32x32 mask */
- {
- *mask = (gpointer) (current + sizeof (IcnsBlockHeader));
- *mlen = blocklen - sizeof (IcnsBlockHeader);
- }
- break;
- case 16:
- if (memcmp (header->id, "is32", 4) == 0) /* 16x16 icon */
- {
- *picture = (gpointer) (current + sizeof (IcnsBlockHeader));
- *plen = blocklen - sizeof (IcnsBlockHeader);
- }
- if (memcmp (header->id, "s8mk", 4) == 0) /* 16x16 mask */
- {
- *mask = (gpointer) (current + sizeof (IcnsBlockHeader));
- *mlen = blocklen - sizeof (IcnsBlockHeader);
- }
- break;
- default:
- return FALSE;
- }
-
- current += blocklen;
- }
-
- if (!*picture)
- return FALSE;
- if (needs_mask && !*mask)
- return FALSE;
- return TRUE;
-}
-
-/*
- * uncompress RLE-encoded bytes into RGBA scratch zone:
- * if firstbyte >= 0x80, it indicates the number of identical bytes + 125
- * (repeated value is stored next: 1 byte)
- * otherwise, it indicates the number of non-repeating bytes - 1
- * (non-repeating values are stored next: n bytes)
- */
-static gboolean
-uncompress (unsigned size, INOUT guchar ** source, OUT guchar * target, INOUT gsize * _remaining)
-{
- guchar *data = *source;
- gsize remaining;
- gsize i = 0;
-
- /* The first time we're called, set remaining */
- if (*_remaining == 0) {
- remaining = size * size;
- } else {
- remaining = *_remaining;
- }
-
- while (remaining > 0)
- {
- guint8 count = 0;
-
- if (data[0] & 0x80) /* repeating byte */
- {
- count = data[0] - 125;
-
- if (count > remaining)
- return FALSE;
-
- for (i = 0; i < count; i++)
- {
- *target = data[1];
- target += 4;
- }
-
- data += 2;
- }
- else /* non-repeating bytes */
- {
- count = data[0] + 1;
-
- if (count > remaining)
- return FALSE;
-
- for (i = 0; i < count; i++)
- {
- *target = data[i + 1];
- target += 4;
- }
- data += count + 1;
- }
-
- remaining -= count;
- }
-
- *source = data;
- *_remaining = remaining;
- return TRUE;
-}
-
-static GdkPixbuf *
-load_icon (unsigned size, IN gpointer data, gsize datalen)
-{
- guchar *icon = NULL;
- guchar *mask = NULL;
- gsize isize = 0, msize = 0, i;
- guchar *image = NULL;
-
- if (!load_resources (size, data, datalen, &icon, &isize, &mask, &msize))
- return NULL;
-
- /* 256x256 icons don't use RLE or uncompressed data,
- * They're usually JPEG 2000 images */
- if (size == 256)
- {
- GdkPixbufLoader *loader;
- GdkPixbuf *pixbuf;
-
- loader = gdk_pixbuf_loader_new ();
- if (!gdk_pixbuf_loader_write (loader, icon, isize, NULL)
- || !gdk_pixbuf_loader_close (loader, NULL))
- {
- g_object_unref (loader);
- return NULL;
- }
-
- pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
- g_object_ref (pixbuf);
- g_object_unref (loader);
-
- return pixbuf;
- }
-
- g_assert (mask);
-
- if (msize != size * size) /* wrong mask size */
- return NULL;
-
- image = (guchar *) g_try_malloc0 (size * size * 4); /* 4 bytes/pixel = RGBA */
-
- if (!image)
- return NULL;
-
- if (isize == size * size * 4) /* icon data is uncompressed */
- for (i = 0; i < size * size; i++) /* 4 bytes/pixel = ARGB (A: ignored) */
- {
- image[i * 4] = icon[4 * i + 1]; /* R */
- image[i * 4 + 1] = icon[4 * i + 2]; /* G */
- image[i * 4 + 2] = icon[4 * i + 3]; /* B */
- }
- else
- {
- guchar *data = icon;
- gsize remaining = 0;
-
- /* R */
- if (!uncompress (size, &data, image, &remaining))
- goto bail;
- /* G */
- if (!uncompress (size, &data, image + 1, &remaining))
- goto bail;
- /* B */
- if (!uncompress (size, &data, image + 2, &remaining))
- goto bail;
- }
-
- for (i = 0; i < size * size; i++) /* copy mask to alpha channel */
- image[i * 4 + 3] = mask[i];
-
- return gdk_pixbuf_new_from_data ((guchar *) image, GDK_COLORSPACE_RGB, /* RGB image */
- TRUE, /* with alpha channel */
- 8, /* 8 bits per sample */
- size, /* width */
- size, /* height */
- size * 4, /* no gap between rows */
- (GdkPixbufDestroyNotify)g_free, /* free() function */
- NULL); /* param to free() function */
-
-bail:
- g_free (image);
- return NULL;
-}
-
-static int sizes[] = {
- 256, /* late-Tiger icons */
- 128, /* Standard OS X */
- 48, /* Not very common */
- 32, /* Standard Mac OS Classic (8 & 9) */
- 24, /* OS X toolbars */
- 16 /* used in Mac OS Classic and dialog boxes */
-};
-
-static GdkPixbuf *
-icns_image_load (FILE *f, GError ** error)
-{
- GByteArray *data;
- GdkPixbuf *pixbuf = NULL;
- guint i;
-
- data = g_byte_array_new ();
- while (!feof (f))
- {
- gint save_errno;
- guchar buf[4096];
- gsize bytes;
-
- bytes = fread (buf, 1, sizeof (buf), f);
- save_errno = errno;
- data = g_byte_array_append (data, buf, bytes);
-
- if (ferror (f))
- {
- g_set_error (error,
- G_FILE_ERROR,
- g_file_error_from_errno (save_errno),
- _("Error reading ICNS image: %s"),
- g_strerror (save_errno));
-
- g_byte_array_free (data, TRUE);
-
- return NULL;
- }
- }
-
- for (i = 0; i < G_N_ELEMENTS(sizes) && !pixbuf; i++)
- pixbuf = load_icon (sizes[i], data->data, data->len);
-
- g_byte_array_free (data, TRUE);
-
- if (!pixbuf)
- g_set_error_literal (error, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Could not decode ICNS file"));
-
- return pixbuf;
-}
-
-#ifndef INCLUDE_icns
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__icns_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule * module)
-{
- module->load = icns_image_load;
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat * info)
-{
- static GdkPixbufModulePattern signature[] = {
- {"icns", NULL, 100}, /* file begins with 'icns' */
- {NULL, NULL, 0}
- };
- static gchar *mime_types[] = {
- "image/x-icns",
- NULL
- };
- static gchar *extensions[] = {
- "icns",
- NULL
- };
-
- info->name = "icns";
- info->signature = signature;
- info->description = N_("The ICNS image format");
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "GPL";
- info->disabled = FALSE;
-}
-
diff --git a/gdk-pixbuf/io-ico.c b/gdk-pixbuf/io-ico.c
deleted file mode 100644
index e7fedb9295..0000000000
--- a/gdk-pixbuf/io-ico.c
+++ /dev/null
@@ -1,1254 +0,0 @@
-/* -*- mode: C; c-file-style: "linux" -*- */
-/* GdkPixbuf library - Windows Icon/Cursor image loader
- *
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Authors: Arjan van de Ven <arjan@fenrus.demon.nl>
- * Federico Mena-Quintero <federico@gimp.org>
- *
- * Based on io-bmp.c
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.
- */
-
-#undef DUMPBIH
-/*
-
-Icons are just like BMP's, except for the header.
-
-Known bugs:
- * bi-tonal files aren't tested
-
-*/
-
-#include "config.h"
-#include <stdio.h>
-#include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <string.h>
-#include "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-io.h"
-#include <errno.h>
-
-
-
-/*
-
-These structures are actually dummies. These are according to
-the "Windows API reference guide volume II" as written by
-Borland International, but GCC fiddles with the alignment of
-the internal members.
-
-*/
-
-struct BitmapFileHeader {
- gushort bfType;
- guint bfSize;
- guint reserverd;
- guint bfOffbits;
-};
-
-struct BitmapInfoHeader {
- guint biSize;
- guint biWidth;
- guint biHeight;
- gushort biPlanes;
- gushort biBitCount;
- guint biCompression;
- guint biSizeImage;
- guint biXPelsPerMeter;
- guint biYPelsPerMeter;
- guint biClrUsed;
- guint biClrImportant;
-};
-
-#ifdef DUMPBIH
-/*
-
-DumpBIH printf's the values in a BitmapInfoHeader to the screen, for
-debugging purposes.
-
-*/
-static void DumpBIH(unsigned char *BIH)
-{
- printf("biSize = %i \n",
- (int)(BIH[3] << 24) + (BIH[2] << 16) + (BIH[1] << 8) + (BIH[0]));
- printf("biWidth = %i \n",
- (int)(BIH[7] << 24) + (BIH[6] << 16) + (BIH[5] << 8) + (BIH[4]));
- printf("biHeight = %i \n",
- (int)(BIH[11] << 24) + (BIH[10] << 16) + (BIH[9] << 8) +
- (BIH[8]));
- printf("biPlanes = %i \n", (int)(BIH[13] << 8) + (BIH[12]));
- printf("biBitCount = %i \n", (int)(BIH[15] << 8) + (BIH[14]));
- printf("biCompress = %i \n",
- (int)(BIH[19] << 24) + (BIH[18] << 16) + (BIH[17] << 8) +
- (BIH[16]));
- printf("biSizeImage = %i \n",
- (int)(BIH[23] << 24) + (BIH[22] << 16) + (BIH[21] << 8) +
- (BIH[20]));
- printf("biXPels = %i \n",
- (int)(BIH[27] << 24) + (BIH[26] << 16) + (BIH[25] << 8) +
- (BIH[24]));
- printf("biYPels = %i \n",
- (int)(BIH[31] << 24) + (BIH[30] << 16) + (BIH[29] << 8) +
- (BIH[28]));
- printf("biClrUsed = %i \n",
- (int)(BIH[35] << 24) + (BIH[34] << 16) + (BIH[33] << 8) +
- (BIH[32]));
- printf("biClrImprtnt= %i \n",
- (int)(BIH[39] << 24) + (BIH[38] << 16) + (BIH[37] << 8) +
- (BIH[36]));
-}
-#endif
-
-/* Progressive loading */
-struct headerpair {
- gint width;
- gint height;
- guint depth;
- guint Negative; /* Negative = 1 -> top down BMP,
- Negative = 0 -> bottom up BMP */
-};
-
-struct ico_progressive_state {
- GdkPixbufModuleSizeFunc size_func;
- GdkPixbufModulePreparedFunc prepared_func;
- GdkPixbufModuleUpdatedFunc updated_func;
- gpointer user_data;
-
- gint HeaderSize; /* The size of the header-part (incl colormap) */
- guchar *HeaderBuf; /* The buffer for the header (incl colormap) */
- gint BytesInHeaderBuf; /* The size of the allocated HeaderBuf */
- gint HeaderDone; /* The nr of bytes actually in HeaderBuf */
-
- gint LineWidth; /* The width of a line in bytes */
- guchar *LineBuf; /* Buffer for 1 line */
- gint LineDone; /* # of bytes in LineBuf */
- gint Lines; /* # of finished lines */
-
- gint Type; /*
- 32 = RGBA
- 24 = RGB
- 16 = 555 RGB
- 8 = 8 bit colormapped
- 4 = 4 bpp colormapped
- 1 = 1 bit bitonal
- */
- gboolean cursor;
- gint x_hot;
- gint y_hot;
-
- struct headerpair Header; /* Decoded (BE->CPU) header */
-
- gint DIBoffset;
- gint ImageScore;
-
-
- GdkPixbuf *pixbuf; /* Our "target" */
-};
-
-static gpointer
-gdk_pixbuf__ico_image_begin_load(GdkPixbufModuleSizeFunc size_func,
- GdkPixbufModulePreparedFunc prepared_func,
- GdkPixbufModuleUpdatedFunc updated_func,
- gpointer user_data,
- GError **error);
-static gboolean gdk_pixbuf__ico_image_stop_load(gpointer data, GError **error);
-static gboolean gdk_pixbuf__ico_image_load_increment(gpointer data,
- const guchar * buf, guint size,
- GError **error);
-
-static void
-context_free (struct ico_progressive_state *context)
-{
- g_free (context->LineBuf);
- context->LineBuf = NULL;
- g_free (context->HeaderBuf);
-
- if (context->pixbuf)
- g_object_unref (context->pixbuf);
-
- g_free (context);
-}
-
-static void DecodeHeader(guchar *Data, gint Bytes,
- struct ico_progressive_state *State,
- GError **error)
-{
-/* For ICO's we have to be very clever. There are multiple images possible
- in an .ICO. As a simple heuristic, we select the image which occupies the
- largest number of bytes.
- */
-
- gint IconCount = 0; /* The number of icon-versions in the file */
- guchar *BIH; /* The DIB for the used icon */
- guchar *Ptr;
- gint I;
- guint16 imgtype; /* 1 = icon, 2 = cursor */
-
- /* Step 1: The ICO header */
-
- /* First word should be 0 according to specs */
- if (((Data[1] << 8) + Data[0]) != 0) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Invalid header in icon"));
- return;
-
- }
-
- imgtype = (Data[3] << 8) + Data[2];
-
- State->cursor = (imgtype == 2) ? TRUE : FALSE;
-
- /* If it is not a cursor make sure it is actually an icon */
- if (!State->cursor && imgtype != 1) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Invalid header in icon"));
- return;
- }
-
-
- IconCount = (Data[5] << 8) + (Data[4]);
-
- State->HeaderSize = 6 + IconCount*16;
-
- if (State->HeaderSize>State->BytesInHeaderBuf) {
- guchar *tmp=g_try_realloc(State->HeaderBuf,State->HeaderSize);
- if (!tmp) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Not enough memory to load icon"));
- return;
- }
- State->HeaderBuf = tmp;
- State->BytesInHeaderBuf = State->HeaderSize;
- }
- if (Bytes < State->HeaderSize)
- return;
-
- /* We now have all the "short-specs" of the versions
- So we iterate through them and select the best one */
-
- State->ImageScore = 0;
- State->DIBoffset = 0;
- Ptr = Data + 6;
- for (I=0;I<IconCount;I++) {
- int ThisScore;
-
- ThisScore = (Ptr[11] << 24) + (Ptr[10] << 16) + (Ptr[9] << 8) + (Ptr[8]);
-
- if (ThisScore>=State->ImageScore) {
- State->ImageScore = ThisScore;
- State->x_hot = (Ptr[5] << 8) + Ptr[4];
- State->y_hot = (Ptr[7] << 8) + Ptr[6];
- State->DIBoffset = (Ptr[15]<<24)+(Ptr[14]<<16)+
- (Ptr[13]<<8) + (Ptr[12]);
-
- }
-
-
- Ptr += 16;
- }
-
- if (State->DIBoffset < 0) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Invalid header in icon"));
- return;
- }
-
- /* We now have a winner, pointed to in State->DIBoffset,
- so we know how many bytes are in the "header" part. */
-
- State->HeaderSize = State->DIBoffset + 40; /* 40 = sizeof(InfoHeader) */
-
- if (State->HeaderSize < 0) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Invalid header in icon"));
- return;
- }
-
- if (State->HeaderSize>State->BytesInHeaderBuf) {
- guchar *tmp=g_try_realloc(State->HeaderBuf,State->HeaderSize);
- if (!tmp) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Not enough memory to load icon"));
- return;
- }
- State->HeaderBuf = tmp;
- State->BytesInHeaderBuf = State->HeaderSize;
- }
- if (Bytes<State->HeaderSize)
- return;
-
- BIH = Data+State->DIBoffset;
-
-#ifdef DUMPBIH
- DumpBIH(BIH);
-#endif
- /* Add the palette to the headersize */
-
- State->Header.width =
- (int)(BIH[7] << 24) + (BIH[6] << 16) + (BIH[5] << 8) + (BIH[4]);
- if (State->Header.width == 0) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Icon has zero width"));
- return;
- }
- State->Header.height =
- (int)((BIH[11] << 24) + (BIH[10] << 16) + (BIH[9] << 8) + (BIH[8]))/2;
- /* /2 because the BIH height includes the transparency mask */
- if (State->Header.height == 0) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Icon has zero height"));
- return;
- }
- State->Header.depth = (BIH[15] << 8) + (BIH[14]);
-
- State->Type = State->Header.depth;
- if (State->Lines>=State->Header.height)
- State->Type = 1; /* The transparency mask is 1 bpp */
-
- /* Determine the palette size. If the header indicates 0, it
- is actually the maximum for the bpp. You have to love the
- guys who made the spec. */
- I = (int)(BIH[35] << 24) + (BIH[34] << 16) + (BIH[33] << 8) + (BIH[32]);
- I = I*4;
- if ((I==0)&&(State->Type==1))
- I = 2*4;
- if ((I==0)&&(State->Type==4))
- I = 16*4;
- if ((I==0)&&(State->Type==8))
- I = 256*4;
-
- State->HeaderSize+=I;
-
- if (State->HeaderSize < 0) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Invalid header in icon"));
- return;
- }
-
- if (State->HeaderSize>State->BytesInHeaderBuf) {
- guchar *tmp=g_try_realloc(State->HeaderBuf,State->HeaderSize);
- if (!tmp) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Not enough memory to load icon"));
- return;
- }
- State->HeaderBuf = tmp;
- State->BytesInHeaderBuf = State->HeaderSize;
- }
- if (Bytes < State->HeaderSize)
- return;
-
- if ((BIH[16] != 0) || (BIH[17] != 0) || (BIH[18] != 0)
- || (BIH[19] != 0)) {
- /* FIXME: is this the correct message? */
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Compressed icons are not supported"));
- return;
- }
-
- /* Negative heights mean top-down pixel-order */
- if (State->Header.height < 0) {
- State->Header.height = -State->Header.height;
- State->Header.Negative = 1;
- }
- if (State->Header.width < 0) {
- State->Header.width = -State->Header.width;
- }
- g_assert (State->Header.width > 0);
- g_assert (State->Header.height > 0);
-
- if (State->Type == 32)
- State->LineWidth = State->Header.width * 4;
- else if (State->Type == 24)
- State->LineWidth = State->Header.width * 3;
- else if (State->Type == 16)
- State->LineWidth = State->Header.width * 2;
- else if (State->Type == 8)
- State->LineWidth = State->Header.width * 1;
- else if (State->Type == 4)
- State->LineWidth = (State->Header.width+1)/2;
- else if (State->Type == 1) {
- State->LineWidth = State->Header.width / 8;
- if ((State->Header.width & 7) != 0)
- State->LineWidth++;
- } else {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Unsupported icon type"));
- return;
- }
-
- /* Pad to a 32 bit boundary */
- if (((State->LineWidth % 4) > 0))
- State->LineWidth = (State->LineWidth / 4) * 4 + 4;
-
-
- if (State->LineBuf == NULL) {
- State->LineBuf = g_try_malloc(State->LineWidth);
- if (!State->LineBuf) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Not enough memory to load icon"));
- return;
- }
- }
-
- g_assert(State->LineBuf != NULL);
-
-
- if (State->pixbuf == NULL) {
-#if 1
- if (State->size_func) {
- gint width = State->Header.width;
- gint height = State->Header.height;
-
- (*State->size_func) (&width, &height, State->user_data);
- if (width == 0 || height == 0) {
- State->LineWidth = 0;
- return;
- }
- }
-#endif
-
- State->pixbuf =
- gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8,
- State->Header.width,
- State->Header.height);
- if (!State->pixbuf) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Not enough memory to load icon"));
- return;
- }
- if (State->cursor) {
- gchar hot[10];
- g_snprintf (hot, 10, "%d", State->x_hot);
- gdk_pixbuf_set_option (State->pixbuf, "x_hot", hot);
- g_snprintf (hot, 10, "%d", State->y_hot);
- gdk_pixbuf_set_option (State->pixbuf, "y_hot", hot);
- }
-
- if (State->prepared_func != NULL)
- /* Notify the client that we are ready to go */
- (*State->prepared_func) (State->pixbuf,
- NULL,
- State->user_data);
-
- }
-
-}
-
-/*
- * func - called when we have pixmap created (but no image data)
- * user_data - passed as arg 1 to func
- * return context (opaque to user)
- */
-
-static gpointer
-gdk_pixbuf__ico_image_begin_load(GdkPixbufModuleSizeFunc size_func,
- GdkPixbufModulePreparedFunc prepared_func,
- GdkPixbufModuleUpdatedFunc updated_func,
- gpointer user_data,
- GError **error)
-{
- struct ico_progressive_state *context;
-
- context = g_new0(struct ico_progressive_state, 1);
- context->size_func = size_func;
- context->prepared_func = prepared_func;
- context->updated_func = updated_func;
- context->user_data = user_data;
-
- context->HeaderSize = 54;
- context->HeaderBuf = g_try_malloc(14 + 40 + 4*256 + 512);
- if (!context->HeaderBuf) {
- g_free (context);
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Not enough memory to load ICO file"));
- return NULL;
- }
- /* 4*256 for the colormap */
- context->BytesInHeaderBuf = 14 + 40 + 4*256 + 512 ;
- context->HeaderDone = 0;
-
- context->LineWidth = 0;
- context->LineBuf = NULL;
- context->LineDone = 0;
- context->Lines = 0;
-
- context->Type = 0;
-
- memset(&context->Header, 0, sizeof(struct headerpair));
-
-
- context->pixbuf = NULL;
-
-
- return (gpointer) context;
-}
-
-/*
- * context - returned from image_begin_load
- *
- * free context, unref gdk_pixbuf
- */
-static gboolean
-gdk_pixbuf__ico_image_stop_load(gpointer data,
- GError **error)
-{
- struct ico_progressive_state *context =
- (struct ico_progressive_state *) data;
-
- /* FIXME this thing needs to report errors if
- * we have unused image data
- */
-
- g_return_val_if_fail(context != NULL, TRUE);
-
- context_free (context);
- return TRUE;
-}
-
-static void
-OneLine32 (struct ico_progressive_state *context)
-{
- gint X;
- guchar *Pixels;
-
- X = 0;
- if (context->Header.Negative == 0)
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- (context->Header.height - context->Lines - 1));
- else
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- context->Lines);
- while (X < context->Header.width) {
- Pixels[X * 4 + 0] = context->LineBuf[X * 4 + 2];
- Pixels[X * 4 + 1] = context->LineBuf[X * 4 + 1];
- Pixels[X * 4 + 2] = context->LineBuf[X * 4 + 0];
- Pixels[X * 4 + 3] = context->LineBuf[X * 4 + 3];
- X++;
- }
-}
-
-static void OneLine24(struct ico_progressive_state *context)
-{
- gint X;
- guchar *Pixels;
-
- X = 0;
- if (context->Header.Negative == 0)
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- (context->Header.height - context->Lines - 1));
- else
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- context->Lines);
- while (X < context->Header.width) {
- Pixels[X * 4 + 0] = context->LineBuf[X * 3 + 2];
- Pixels[X * 4 + 1] = context->LineBuf[X * 3 + 1];
- Pixels[X * 4 + 2] = context->LineBuf[X * 3 + 0];
- X++;
- }
-
-}
-
-static void
-OneLine16 (struct ico_progressive_state *context)
-{
- int i;
- guchar *pixels;
- guchar *src;
-
- if (context->Header.Negative == 0)
- pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride * (context->Header.height - context->Lines - 1));
- else
- pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride * context->Lines);
-
- src = context->LineBuf;
-
- for (i = 0; i < context->Header.width; i++) {
- int v, r, g, b;
-
- v = (int) src[0] | ((int) src[1] << 8);
- src += 2;
-
- /* Extract 5-bit RGB values */
-
- r = (v >> 10) & 0x1f;
- g = (v >> 5) & 0x1f;
- b = v & 0x1f;
-
- /* Fill the rightmost bits to form 8-bit values */
-
- *pixels++ = (r << 3) | (r >> 2);
- *pixels++ = (g << 3) | (g >> 2);
- *pixels++ = (b << 3) | (b >> 2);
- pixels++; /* skip alpha channel */
- }
-}
-
-
-static void OneLine8(struct ico_progressive_state *context)
-{
- gint X;
- guchar *Pixels;
-
- X = 0;
- if (context->Header.Negative == 0)
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- (context->Header.height - context->Lines - 1));
- else
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- context->Lines);
- while (X < context->Header.width) {
- /* The joys of having a BGR byteorder */
- Pixels[X * 4 + 0] =
- context->HeaderBuf[4 * context->LineBuf[X] + 42+context->DIBoffset];
- Pixels[X * 4 + 1] =
- context->HeaderBuf[4 * context->LineBuf[X] + 41+context->DIBoffset];
- Pixels[X * 4 + 2] =
- context->HeaderBuf[4 * context->LineBuf[X] + 40+context->DIBoffset];
- X++;
- }
-}
-static void OneLine4(struct ico_progressive_state *context)
-{
- gint X;
- guchar *Pixels;
-
- X = 0;
- if (context->Header.Negative == 0)
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- (context->Header.height - context->Lines - 1));
- else
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- context->Lines);
-
- while (X < context->Header.width) {
- guchar Pix;
-
- Pix = context->LineBuf[X/2];
-
- Pixels[X * 4 + 0] =
- context->HeaderBuf[4 * (Pix>>4) + 42+context->DIBoffset];
- Pixels[X * 4 + 1] =
- context->HeaderBuf[4 * (Pix>>4) + 41+context->DIBoffset];
- Pixels[X * 4 + 2] =
- context->HeaderBuf[4 * (Pix>>4) + 40+context->DIBoffset];
- X++;
- if (X<context->Header.width) {
- /* Handle the other 4 bit pixel only when there is one */
- Pixels[X * 4 + 0] =
- context->HeaderBuf[4 * (Pix&15) + 42+context->DIBoffset];
- Pixels[X * 4 + 1] =
- context->HeaderBuf[4 * (Pix&15) + 41+context->DIBoffset];
- Pixels[X * 4 + 2] =
- context->HeaderBuf[4 * (Pix&15) + 40+context->DIBoffset];
- X++;
- }
- }
-
-}
-
-static void OneLine1(struct ico_progressive_state *context)
-{
- gint X;
- guchar *Pixels;
-
- X = 0;
- if (context->Header.Negative == 0)
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- (context->Header.height - context->Lines - 1));
- else
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- context->Lines);
- while (X < context->Header.width) {
- int Bit;
-
- Bit = (context->LineBuf[X / 8]) >> (7 - (X & 7));
- Bit = Bit & 1;
- /* The joys of having a BGR byteorder */
- Pixels[X * 4 + 0] = Bit*255;
- Pixels[X * 4 + 1] = Bit*255;
- Pixels[X * 4 + 2] = Bit*255;
- X++;
- }
-}
-
-static void OneLineTransp(struct ico_progressive_state *context)
-{
- gint X;
- guchar *Pixels;
-
- /* Ignore the XOR mask for XP style 32-bpp icons with alpha */
- if (context->Header.depth == 32)
- return;
-
- X = 0;
- if (context->Header.Negative == 0)
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- (2*context->Header.height - context->Lines - 1));
- else
- Pixels = (context->pixbuf->pixels +
- context->pixbuf->rowstride *
- (context->Lines-context->Header.height));
- while (X < context->Header.width) {
- int Bit;
-
- Bit = (context->LineBuf[X / 8]) >> (7 - (X & 7));
- Bit = Bit & 1;
- /* The joys of having a BGR byteorder */
- Pixels[X * 4 + 3] = 255-Bit*255;
-#if 0
- if (Bit){
- Pixels[X*4+0] = 255;
- Pixels[X*4+1] = 255;
- } else {
- Pixels[X*4+0] = 0;
- Pixels[X*4+1] = 0;
- }
-#endif
- X++;
- }
-}
-
-
-static void OneLine(struct ico_progressive_state *context)
-{
- context->LineDone = 0;
-
- if (context->Lines >= context->Header.height*2) {
- return;
- }
-
- if (context->Lines <context->Header.height) {
- if (context->Type == 32)
- OneLine32 (context);
- else if (context->Type == 24)
- OneLine24(context);
- else if (context->Type == 16)
- OneLine16 (context);
- else if (context->Type == 8)
- OneLine8(context);
- else if (context->Type == 4)
- OneLine4(context);
- else if (context->Type == 1)
- OneLine1(context);
- else
- g_assert_not_reached ();
- } else
- OneLineTransp(context);
-
- context->Lines++;
- if (context->Lines>=context->Header.height) {
- context->Type = 1;
- context->LineWidth = context->Header.width / 8;
- if ((context->Header.width & 7) != 0)
- context->LineWidth++;
- /* Pad to a 32 bit boundary */
- if (((context->LineWidth % 4) > 0))
- context->LineWidth = (context->LineWidth / 4) * 4 + 4;
-
- }
-
-
- if (context->updated_func != NULL) {
- (*context->updated_func) (context->pixbuf,
- 0,
- context->Lines % context->Header.height,
- context->Header.width,
- 1,
- context->user_data);
-
- }
-}
-
-/*
- * context - from image_begin_load
- * buf - new image data
- * size - length of new image data
- *
- * append image data onto inrecrementally built output image
- */
-static gboolean
-gdk_pixbuf__ico_image_load_increment(gpointer data,
- const guchar * buf,
- guint size,
- GError **error)
-{
- struct ico_progressive_state *context =
- (struct ico_progressive_state *) data;
-
- gint BytesToCopy;
-
- while (size > 0) {
- g_assert(context->LineDone >= 0);
- if (context->HeaderDone < context->HeaderSize) { /* We still
- have headerbytes to do */
- BytesToCopy =
- context->HeaderSize - context->HeaderDone;
- if (BytesToCopy > size)
- BytesToCopy = size;
-
- memmove(context->HeaderBuf + context->HeaderDone,
- buf, BytesToCopy);
-
- size -= BytesToCopy;
- buf += BytesToCopy;
- context->HeaderDone += BytesToCopy;
- }
- else {
- BytesToCopy =
- context->LineWidth - context->LineDone;
- if (BytesToCopy > size)
- BytesToCopy = size;
-
- if (BytesToCopy > 0) {
- memmove(context->LineBuf +
- context->LineDone, buf,
- BytesToCopy);
-
- size -= BytesToCopy;
- buf += BytesToCopy;
- context->LineDone += BytesToCopy;
- }
- if ((context->LineDone >= context->LineWidth) &&
- (context->LineWidth > 0))
- OneLine(context);
-
-
- }
-
- if (context->HeaderDone >= 6 && context->pixbuf == NULL) {
- GError *decode_err = NULL;
- DecodeHeader(context->HeaderBuf,
- context->HeaderDone, context, &decode_err);
- if (context->LineBuf != NULL && context->LineWidth == 0)
- return TRUE;
-
- if (decode_err) {
- g_propagate_error (error, decode_err);
- return FALSE;
- }
- }
- }
-
- return TRUE;
-}
-
-/* saving ICOs */
-
-static gint
-write8 (FILE *f,
- guint8 *data,
- gint count)
-{
- gint bytes;
- gint written;
-
- written = 0;
- while (count > 0)
- {
- bytes = fwrite ((char*) data, sizeof (char), count, f);
- if (bytes <= 0)
- break;
- count -= bytes;
- data += bytes;
- written += bytes;
- }
-
- return written;
-}
-
-static gint
-write16 (FILE *f,
- guint16 *data,
- gint count)
-{
- gint i;
-
- for (i = 0; i < count; i++)
- data[i] = GUINT16_TO_LE (data[i]);
-
- return write8 (f, (guint8*) data, count * 2);
-}
-
-static gint
-write32 (FILE *f,
- guint32 *data,
- gint count)
-{
- gint i;
-
- for (i = 0; i < count; i++)
- data[i] = GUINT32_TO_LE (data[i]);
-
- return write8 (f, (guint8*) data, count * 4);
-}
-
-typedef struct _IconEntry IconEntry;
-struct _IconEntry {
- gint width;
- gint height;
- gint depth;
- gint hot_x;
- gint hot_y;
-
- guint8 n_colors;
- guint32 *colors;
- guint xor_rowstride;
- guint8 *xor;
- guint and_rowstride;
- guint8 *and;
-};
-
-static gboolean
-fill_entry (IconEntry *icon,
- GdkPixbuf *pixbuf,
- gint hot_x,
- gint hot_y,
- GError **error)
- {
- guchar *p, *pixels, *and, *xor;
- gint n_channels, v, x, y;
-
- if (icon->width > 255 || icon->height > 255) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_BAD_OPTION,
- _("Image too large to be saved as ICO"));
- return FALSE;
- }
-
- if (hot_x > -1 && hot_y > -1) {
- icon->hot_x = hot_x;
- icon->hot_y = hot_y;
- if (icon->hot_x >= icon->width || icon->hot_y >= icon->height) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_BAD_OPTION,
- _("Cursor hotspot outside image"));
- return FALSE;
- }
- }
- else {
- icon->hot_x = -1;
- icon->hot_y = -1;
- }
-
- switch (icon->depth) {
- case 32:
- icon->xor_rowstride = icon->width * 4;
- break;
- case 24:
- icon->xor_rowstride = icon->width * 3;
- break;
- case 16:
- icon->xor_rowstride = icon->width * 2;
- break;
- default:
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_BAD_OPTION,
- _("Unsupported depth for ICO file: %d"), icon->depth);
- return FALSE;
- }
-
- if ((icon->xor_rowstride % 4) != 0)
- icon->xor_rowstride = 4 * ((icon->xor_rowstride / 4) + 1);
- icon->xor = g_new0 (guchar, icon->xor_rowstride * icon->height);
-
- icon->and_rowstride = (icon->width + 7) / 8;
- if ((icon->and_rowstride % 4) != 0)
- icon->and_rowstride = 4 * ((icon->and_rowstride / 4) + 1);
- icon->and = g_new0 (guchar, icon->and_rowstride * icon->height);
-
- pixels = gdk_pixbuf_get_pixels (pixbuf);
- n_channels = gdk_pixbuf_get_n_channels (pixbuf);
- for (y = 0; y < icon->height; y++) {
- p = pixels + gdk_pixbuf_get_rowstride (pixbuf) * (icon->height - 1 - y);
- and = icon->and + icon->and_rowstride * y;
- xor = icon->xor + icon->xor_rowstride * y;
- for (x = 0; x < icon->width; x++) {
- switch (icon->depth) {
- case 32:
- xor[0] = p[2];
- xor[1] = p[1];
- xor[2] = p[0];
- xor[3] = 0xff;
- if (n_channels == 4) {
- xor[3] = p[3];
- if (p[3] < 0x80)
- *and |= 1 << (7 - x % 8);
- }
- xor += 4;
- break;
- case 24:
- xor[0] = p[2];
- xor[1] = p[1];
- xor[2] = p[0];
- if (n_channels == 4 && p[3] < 0x80)
- *and |= 1 << (7 - x % 8);
- xor += 3;
- break;
- case 16:
- v = ((p[0] >> 3) << 10) | ((p[1] >> 3) << 5) | (p[2] >> 3);
- xor[0] = v & 0xff;
- xor[1] = v >> 8;
- if (n_channels == 4 && p[3] < 0x80)
- *and |= 1 << (7 - x % 8);
- xor += 2;
- break;
- }
-
- p += n_channels;
- if (x % 8 == 7)
- and++;
- }
- }
-
- return TRUE;
-}
-
-static void
-free_entry (IconEntry *icon)
-{
- g_free (icon->colors);
- g_free (icon->and);
- g_free (icon->xor);
- g_free (icon);
-}
-
-static void
-write_icon (FILE *f, GSList *entries)
-{
- IconEntry *icon;
- GSList *entry;
- guint8 bytes[4];
- guint16 words[4];
- guint32 dwords[6];
- gint type;
- gint n_entries;
- gint offset;
- gint size;
-
- if (((IconEntry *)entries->data)->hot_x > -1)
- type = 2;
- else
- type = 1;
- n_entries = g_slist_length (entries);
-
- /* header */
- words[0] = 0;
- words[1] = type;
- words[2] = n_entries;
- write16 (f, words, 3);
-
- offset = 6 + 16 * n_entries;
-
- for (entry = entries; entry; entry = entry->next) {
- icon = (IconEntry *)entry->data;
- size = 40 + icon->height * (icon->and_rowstride + icon->xor_rowstride);
-
- /* directory entry */
- bytes[0] = icon->width;
- bytes[1] = icon->height;
- bytes[2] = icon->n_colors;
- bytes[3] = 0;
- write8 (f, bytes, 4);
- if (type == 1) {
- words[0] = 1;
- words[1] = icon->depth;
- }
- else {
- words[0] = icon->hot_x;
- words[1] = icon->hot_y;
- }
- write16 (f, words, 2);
- dwords[0] = size;
- dwords[1] = offset;
- write32 (f, dwords, 2);
-
- offset += size;
- }
-
- for (entry = entries; entry; entry = entry->next) {
- icon = (IconEntry *)entry->data;
-
- /* bitmap header */
- dwords[0] = 40;
- dwords[1] = icon->width;
- dwords[2] = icon->height * 2;
- write32 (f, dwords, 3);
- words[0] = 1;
- words[1] = icon->depth;
- write16 (f, words, 2);
- dwords[0] = 0;
- dwords[1] = 0;
- dwords[2] = 0;
- dwords[3] = 0;
- dwords[4] = 0;
- dwords[5] = 0;
- write32 (f, dwords, 6);
-
- /* image data */
- write8 (f, icon->xor, icon->xor_rowstride * icon->height);
- write8 (f, icon->and, icon->and_rowstride * icon->height);
- }
-}
-
-static gboolean
-gdk_pixbuf__ico_image_save (FILE *f,
- GdkPixbuf *pixbuf,
- gchar **keys,
- gchar **values,
- GError **error)
-{
- gint hot_x, hot_y;
- IconEntry *icon;
- GSList *entries = NULL;
-
- /* support only single-image ICOs for now */
- icon = g_new0 (IconEntry, 1);
- icon->width = gdk_pixbuf_get_width (pixbuf);
- icon->height = gdk_pixbuf_get_height (pixbuf);
- icon->depth = gdk_pixbuf_get_has_alpha (pixbuf) ? 32 : 24;
- hot_x = -1;
- hot_y = -1;
-
- /* parse options */
- if (keys && *keys) {
- gchar **kiter;
- gchar **viter;
-
- for (kiter = keys, viter = values; *kiter && *viter; kiter++, viter++) {
- char *endptr;
- if (strcmp (*kiter, "depth") == 0) {
- sscanf (*viter, "%d", &icon->depth);
- }
- else if (strcmp (*kiter, "x_hot") == 0) {
- hot_x = strtol (*viter, &endptr, 10);
- }
- else if (strcmp (*kiter, "y_hot") == 0) {
- hot_y = strtol (*viter, &endptr, 10);
- }
-
- }
- }
-
- if (!fill_entry (icon, pixbuf, hot_x, hot_y, error)) {
- free_entry (icon);
- return FALSE;
- }
-
- entries = g_slist_append (entries, icon);
- write_icon (f, entries);
-
- g_slist_foreach (entries, (GFunc)free_entry, NULL);
- g_slist_free (entries);
-
- return TRUE;
-}
-
-#ifndef INCLUDE_ico
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__ico_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
-{
- module->begin_load = gdk_pixbuf__ico_image_begin_load;
- module->stop_load = gdk_pixbuf__ico_image_stop_load;
- module->load_increment = gdk_pixbuf__ico_image_load_increment;
- module->save = gdk_pixbuf__ico_image_save;
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
-{
- static GdkPixbufModulePattern signature[] = {
- { " \x1 ", "zz znz", 100 },
- { " \x2 ", "zz znz", 100 },
- { NULL, NULL, 0 }
- };
- static gchar * mime_types[] = {
- "image/x-icon",
- "image/x-ico",
- "image/x-win-bitmap",
- NULL
- };
- static gchar * extensions[] = {
- "ico",
- "cur",
- NULL
- };
-
- info->name = "ico";
- info->signature = signature;
- info->description = N_("The ICO image format");
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_WRITABLE | GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "LGPL";
-}
-
-
-
-
diff --git a/gdk-pixbuf/io-jasper.c b/gdk-pixbuf/io-jasper.c
deleted file mode 100644
index e60a7c82e9..0000000000
--- a/gdk-pixbuf/io-jasper.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/* JPEG 2000 loader
- *
- * Copyright (c) 2007 Bastien Nocera <hadess@hadess.net>
- * Inspired by work by Ben Karel <web+moz@eschew.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-#include "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-io.h"
-
-#include <jasper/jasper.h>
-
-G_MODULE_EXPORT void fill_vtable (GdkPixbufModule * module);
-G_MODULE_EXPORT void fill_info (GdkPixbufFormat * info);
-
-struct jasper_context {
- GdkPixbuf *pixbuf;
-
- GdkPixbufModuleSizeFunc size_func;
- GdkPixbufModuleUpdatedFunc updated_func;
- GdkPixbufModulePreparedFunc prepared_func;
- gpointer user_data;
-
- jas_stream_t *stream;
-
- int width, height;
-};
-
-static void
-free_jasper_context (struct jasper_context *context)
-{
- if (!context)
- return;
-
- if (context->stream) {
- jas_stream_close (context->stream);
- context->stream = NULL;
- }
-
- g_free (context);
-}
-
-static gpointer
-jasper_image_begin_load (GdkPixbufModuleSizeFunc size_func,
- GdkPixbufModulePreparedFunc prepared_func,
- GdkPixbufModuleUpdatedFunc updated_func,
- gpointer user_data, GError **error)
-{
- struct jasper_context *context;
- jas_stream_t *stream;
-
- jas_init ();
-
- stream = jas_stream_memopen (NULL, -1);
- if (!stream) {
- g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Couldn't allocate memory for stream"));
- return NULL;
- }
-
- context = g_new0 (struct jasper_context, 1);
- if (!context)
- return NULL;
-
- context->size_func = size_func;
- context->updated_func = updated_func;
- context->prepared_func = prepared_func;
- context->user_data = user_data;
- context->width = context->height = -1;
-
- context->stream = stream;
-
- return context;
-}
-
-static gboolean
-jasper_image_try_load (struct jasper_context *context, GError **error)
-{
- jas_image_t *raw_image, *image;
- int num_components, colourspace_family;
- int i, rowstride, shift;
- guchar *pixels;
-
- raw_image = jas_image_decode (context->stream, -1, 0);
- if (!raw_image) {
- g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Couldn't decode image"));
- return FALSE;
- }
-
- if (context->width == -1 && context->height == -1) {
- int width, height;
-
- context->width = width = jas_image_cmptwidth (raw_image, 0);
- context->height = height = jas_image_cmptheight (raw_image, 0);
-
- if (context->size_func) {
- (*context->size_func) (&width, &height, context->user_data);
-
- if (width == 0 || height == 0) {
- jas_image_destroy(raw_image);
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Transformed JPEG2000 has zero width or height"));
- return FALSE;
- }
- }
- }
-
- /* We only know how to handle grayscale and RGB images */
- num_components = jas_image_numcmpts (raw_image);
- colourspace_family = jas_clrspc_fam (jas_image_clrspc (raw_image));
-
- if ((num_components != 3 && num_components != 4 && num_components != 1) ||
- (colourspace_family != JAS_CLRSPC_FAM_RGB && colourspace_family != JAS_CLRSPC_FAM_GRAY)) {
- jas_image_destroy (raw_image);
- g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
- _("Image type currently not supported"));
- return FALSE;
- }
-
- /* Apply the colour profile to the image, creating a new one */
- if (jas_image_clrspc (raw_image) != JAS_CLRSPC_SRGB) {
- jas_cmprof_t *profile;
-
- profile = jas_cmprof_createfromclrspc (JAS_CLRSPC_SRGB);
- if (!profile) {
- jas_image_destroy (raw_image);
- g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Couldn't allocate memory for color profile"));
- return FALSE;
- }
-
- image = jas_image_chclrspc (raw_image, profile, JAS_CMXFORM_INTENT_PER);
- if (!image) {
- jas_image_destroy (raw_image);
- g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Couldn't allocate memory for color profile"));
- return FALSE;
- }
- } else {
- image = raw_image;
- }
-
- if (!context->pixbuf) {
- int bits_per_sample;
-
- /* Unfortunately, gdk-pixbuf doesn't support 16 bpp images
- * bits_per_sample = jas_image_cmptprec (image, 0);
- if (bits_per_sample < 8)
- bits_per_sample = 8;
- else if (bits_per_sample > 8)
- bits_per_sample = 16;
- */
- bits_per_sample = 8;
-
- context->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
- FALSE, bits_per_sample,
- context->width, context->height);
- if (context->pixbuf == NULL) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Insufficient memory to open JPEG 2000 file"));
- return FALSE;
- }
- if (context->prepared_func)
- context->prepared_func (context->pixbuf, NULL, context->user_data);
- }
-
- /* We calculate how much we should shift the pixel
- * data by to make it fit into our pixbuf */
- shift = MAX (jas_image_cmptprec (image, 0) - gdk_pixbuf_get_bits_per_sample (context->pixbuf), 0);
-
- /* Loop over the 3 colourspaces */
- rowstride = gdk_pixbuf_get_rowstride (context->pixbuf);
- pixels = gdk_pixbuf_get_pixels (context->pixbuf);
-
- for (i = 0; i < num_components; i++) {
- jas_matrix_t *matrix;
- int j;
-
- matrix = jas_matrix_create (context->height, context->width);
-
- /* in libjasper, R is 0, G is 1, etc. we're lucky :)
- * but we need to handle the "opacity" channel ourselves */
- if (i != 4) {
- jas_image_readcmpt (image, i, 0, 0, context->width, context->height, matrix);
- } else {
- jas_image_readcmpt (image, JAS_IMAGE_CT_OPACITY, 0, 0, context->width, context->height, matrix);
- }
-
- for (j = 0; j < context->height; j++) {
- int k;
-
- for (k = 0; k < context->width; k++) {
- if (num_components == 3 || num_components == 4) {
- pixels[j * rowstride + k * 3 + i] = jas_matrix_get (matrix, j, k) >> shift;
- } else {
- pixels[j * rowstride + k * 3] =
- pixels[j * rowstride + k * 3 + 1] =
- pixels[j * rowstride + k * 3 + 2] = jas_matrix_get (matrix, j, k) >> shift;
- }
- }
- /* Update once per line for the last component, otherwise
- * we might contain garbage */
- if (context->updated_func && (i == num_components - 1) && k != 0) {
- context->updated_func (context->pixbuf, 0, j, k, 1, context->user_data);
- }
- }
-
- jas_matrix_destroy (matrix);
- }
-
- if (image != raw_image)
- jas_image_destroy (image);
- jas_image_destroy (raw_image);
-
- return TRUE;
-}
-
-static gboolean
-jasper_image_stop_load (gpointer data, GError **error)
-{
- struct jasper_context *context = (struct jasper_context *) data;
- gboolean ret;
-
- jas_stream_rewind (context->stream);
- ret = jasper_image_try_load (context, error);
-
- free_jasper_context (context);
-
- return ret;
-}
-
-static gboolean
-jasper_image_load_increment (gpointer data, const guchar *buf, guint size, GError **error)
-{
- struct jasper_context *context = (struct jasper_context *) data;
-
- if (jas_stream_write (context->stream, buf, size) < 0) {
- g_set_error_literal (error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Couldn't allocate memory to buffer image data"));
- return FALSE;
- }
-
- return TRUE;
-}
-
-#ifndef INCLUDE_jasper
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__jasper_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule * module)
-{
- module->begin_load = jasper_image_begin_load;
- module->stop_load = jasper_image_stop_load;
- module->load_increment = jasper_image_load_increment;
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat * info)
-{
- static GdkPixbufModulePattern signature[] = {
- { " jP", "!!!! ", 100 }, /* file begins with 'jP' at offset 4 */
- { "\xff\x4f\xff\x51\x00", NULL, 100 }, /* file starts with FF 4F FF 51 00 */
- { NULL, NULL, 0 }
- };
- static gchar *mime_types[] = {
- "image/jp2",
- "image/jpeg2000",
- "image/jpx",
- NULL
- };
- static gchar *extensions[] = {
- "jp2",
- "jpc",
- "jpx",
- "j2k",
- "jpf",
- NULL
- };
-
- info->name = "jpeg2000";
- info->signature = signature;
- info->description = N_("The JPEG 2000 image format");
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "LGPL";
- info->disabled = FALSE;
-}
-
diff --git a/gdk-pixbuf/io-jpeg.c b/gdk-pixbuf/io-jpeg.c
deleted file mode 100644
index cc1db97e6d..0000000000
--- a/gdk-pixbuf/io-jpeg.c
+++ /dev/null
@@ -1,1315 +0,0 @@
-/* -*- mode: C; c-file-style: "linux" -*- */
-/* GdkPixbuf library - JPEG image loader
- *
- * Copyright (C) 1999 Michael Zucchi
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Progressive loading code Copyright (C) 1999 Red Hat, Inc.
- *
- * Authors: Michael Zucchi <zucchi@zedzone.mmc.com.au>
- * Federico Mena-Quintero <federico@gimp.org>
- * Michael Fulbright <drmike@redhat.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <setjmp.h>
-#include <jpeglib.h>
-#include <jerror.h>
-#include "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-io.h"
-
-#ifndef HAVE_SIGSETJMP
-#define sigjmp_buf jmp_buf
-#define sigsetjmp(jb, x) setjmp(jb)
-#define siglongjmp longjmp
-#endif
-
-
-/* we are a "source manager" as far as libjpeg is concerned */
-#define JPEG_PROG_BUF_SIZE 65536
-
-typedef struct {
- struct jpeg_source_mgr pub; /* public fields */
-
- JOCTET buffer[JPEG_PROG_BUF_SIZE]; /* start of buffer */
- long skip_next; /* number of bytes to skip next read */
-
-} my_source_mgr;
-
-typedef my_source_mgr * my_src_ptr;
-
-/* error handler data */
-struct error_handler_data {
- struct jpeg_error_mgr pub;
- sigjmp_buf setjmp_buffer;
- GError **error;
-};
-
-/* progressive loader context */
-typedef struct {
- GdkPixbufModuleSizeFunc size_func;
- GdkPixbufModuleUpdatedFunc updated_func;
- GdkPixbufModulePreparedFunc prepared_func;
- gpointer user_data;
-
- GdkPixbuf *pixbuf;
- guchar *dptr; /* current position in pixbuf */
-
- gboolean did_prescan; /* are we in image data yet? */
- gboolean got_header; /* have we loaded jpeg header? */
- gboolean src_initialized;/* TRUE when jpeg lib initialized */
- gboolean in_output; /* did we get suspended in an output pass? */
- struct jpeg_decompress_struct cinfo;
- struct error_handler_data jerr;
-} JpegProgContext;
-
-static GdkPixbuf *gdk_pixbuf__jpeg_image_load (FILE *f, GError **error);
-static gpointer gdk_pixbuf__jpeg_image_begin_load (GdkPixbufModuleSizeFunc func0,
- GdkPixbufModulePreparedFunc func1,
- GdkPixbufModuleUpdatedFunc func2,
- gpointer user_data,
- GError **error);
-static gboolean gdk_pixbuf__jpeg_image_stop_load (gpointer context, GError **error);
-static gboolean gdk_pixbuf__jpeg_image_load_increment(gpointer context,
- const guchar *buf, guint size,
- GError **error);
-
-
-static void
-fatal_error_handler (j_common_ptr cinfo)
-{
- struct error_handler_data *errmgr;
- char buffer[JMSG_LENGTH_MAX];
-
- errmgr = (struct error_handler_data *) cinfo->err;
-
- /* Create the message */
- (* cinfo->err->format_message) (cinfo, buffer);
-
- /* broken check for *error == NULL for robustness against
- * crappy JPEG library
- */
- if (errmgr->error && *errmgr->error == NULL) {
- g_set_error (errmgr->error,
- GDK_PIXBUF_ERROR,
- cinfo->err->msg_code == JERR_OUT_OF_MEMORY
- ? GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY
- : GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Error interpreting JPEG image file (%s)"),
- buffer);
- }
-
- siglongjmp (errmgr->setjmp_buffer, 1);
-
- g_assert_not_reached ();
-}
-
-static void
-output_message_handler (j_common_ptr cinfo)
-{
- /* This method keeps libjpeg from dumping crap to stderr */
-
- /* do nothing */
-}
-
-/* explode gray image data from jpeg library into rgb components in pixbuf */
-static void
-explode_gray_into_buf (struct jpeg_decompress_struct *cinfo,
- guchar **lines)
-{
- gint i, j;
- guint w;
-
- g_return_if_fail (cinfo != NULL);
- g_return_if_fail (cinfo->output_components == 1);
- g_return_if_fail (cinfo->out_color_space == JCS_GRAYSCALE);
-
- /* Expand grey->colour. Expand from the end of the
- * memory down, so we can use the same buffer.
- */
- w = cinfo->output_width;
- for (i = cinfo->rec_outbuf_height - 1; i >= 0; i--) {
- guchar *from, *to;
-
- from = lines[i] + w - 1;
- to = lines[i] + (w - 1) * 3;
- for (j = w - 1; j >= 0; j--) {
- to[0] = from[0];
- to[1] = from[0];
- to[2] = from[0];
- to -= 3;
- from--;
- }
- }
-}
-
-
-static void
-convert_cmyk_to_rgb (struct jpeg_decompress_struct *cinfo,
- guchar **lines)
-{
- gint i, j;
-
- g_return_if_fail (cinfo != NULL);
- g_return_if_fail (cinfo->output_components == 4);
- g_return_if_fail (cinfo->out_color_space == JCS_CMYK);
-
- for (i = cinfo->rec_outbuf_height - 1; i >= 0; i--) {
- guchar *p;
-
- p = lines[i];
- for (j = 0; j < cinfo->output_width; j++) {
- int c, m, y, k;
- c = p[0];
- m = p[1];
- y = p[2];
- k = p[3];
- if (cinfo->saw_Adobe_marker) {
- p[0] = k*c / 255;
- p[1] = k*m / 255;
- p[2] = k*y / 255;
- }
- else {
- p[0] = (255 - k)*(255 - c) / 255;
- p[1] = (255 - k)*(255 - m) / 255;
- p[2] = (255 - k)*(255 - y) / 255;
- }
- p[3] = 255;
- p += 4;
- }
- }
-}
-
-typedef struct {
- struct jpeg_source_mgr pub; /* public fields */
-
- FILE * infile; /* source stream */
- JOCTET * buffer; /* start of buffer */
- boolean start_of_file; /* have we gotten any data yet? */
-} stdio_source_mgr;
-
-typedef stdio_source_mgr * stdio_src_ptr;
-
-static void
-stdio_init_source (j_decompress_ptr cinfo)
-{
- stdio_src_ptr src = (stdio_src_ptr)cinfo->src;
- src->start_of_file = FALSE;
-}
-
-static boolean
-stdio_fill_input_buffer (j_decompress_ptr cinfo)
-{
- stdio_src_ptr src = (stdio_src_ptr) cinfo->src;
- size_t nbytes;
-
- nbytes = fread (src->buffer, 1, JPEG_PROG_BUF_SIZE, src->infile);
-
- if (nbytes <= 0) {
-#if 0
- if (src->start_of_file) /* Treat empty input file as fatal error */
- ERREXIT(cinfo, JERR_INPUT_EMPTY);
- WARNMS(cinfo, JWRN_JPEG_EOF);
-#endif
- /* Insert a fake EOI marker */
- src->buffer[0] = (JOCTET) 0xFF;
- src->buffer[1] = (JOCTET) JPEG_EOI;
- nbytes = 2;
- }
-
- src->pub.next_input_byte = src->buffer;
- src->pub.bytes_in_buffer = nbytes;
- src->start_of_file = FALSE;
-
- return TRUE;
-}
-
-static void
-stdio_skip_input_data (j_decompress_ptr cinfo, long num_bytes)
-{
- stdio_src_ptr src = (stdio_src_ptr) cinfo->src;
-
- if (num_bytes > 0) {
- while (num_bytes > (long) src->pub.bytes_in_buffer) {
- num_bytes -= (long) src->pub.bytes_in_buffer;
- (void)stdio_fill_input_buffer(cinfo);
- }
- src->pub.next_input_byte += (size_t) num_bytes;
- src->pub.bytes_in_buffer -= (size_t) num_bytes;
- }
-}
-
-static void
-stdio_term_source (j_decompress_ptr cinfo)
-{
-}
-
-static gchar *
-colorspace_name (const J_COLOR_SPACE jpeg_color_space)
-{
- switch (jpeg_color_space) {
- case JCS_UNKNOWN: return "UNKNOWN";
- case JCS_GRAYSCALE: return "GRAYSCALE";
- case JCS_RGB: return "RGB";
- case JCS_YCbCr: return "YCbCr";
- case JCS_CMYK: return "CMYK";
- case JCS_YCCK: return "YCCK";
- default: return "invalid";
- }
-}
-
-
-const char leth[] = {0x49, 0x49, 0x2a, 0x00}; // Little endian TIFF header
-const char beth[] = {0x4d, 0x4d, 0x00, 0x2a}; // Big endian TIFF header
-const char types[] = {0x00, 0x01, 0x01, 0x02, 0x04, 0x08, 0x00,
- 0x08, 0x00, 0x04, 0x08}; // size in bytes for EXIF types
-
-#define DE_ENDIAN16(val) endian == G_BIG_ENDIAN ? GUINT16_FROM_BE(val) : GUINT16_FROM_LE(val)
-#define DE_ENDIAN32(val) endian == G_BIG_ENDIAN ? GUINT32_FROM_BE(val) : GUINT32_FROM_LE(val)
-
-#define ENDIAN16_IT(val) endian == G_BIG_ENDIAN ? GUINT16_TO_BE(val) : GUINT16_TO_LE(val)
-#define ENDIAN32_IT(val) endian == G_BIG_ENDIAN ? GUINT32_TO_BE(val) : GUINT32_TO_LE(val)
-
-#define EXIF_JPEG_MARKER JPEG_APP0+1
-#define EXIF_IDENT_STRING "Exif\000\000"
-
-static unsigned short de_get16(void *ptr, guint endian)
-{
- unsigned short val;
-
- memcpy(&val, ptr, sizeof(val));
- val = DE_ENDIAN16(val);
-
- return val;
-}
-
-static unsigned int de_get32(void *ptr, guint endian)
-{
- unsigned int val;
-
- memcpy(&val, ptr, sizeof(val));
- val = DE_ENDIAN32(val);
-
- return val;
-}
-
-static gint
-get_orientation (j_decompress_ptr cinfo)
-{
- /* This function looks through the meta data in the libjpeg decompress structure to
- determine if an EXIF Orientation tag is present and if so return its value (1-8).
- If no EXIF Orientation tag is found 0 (zero) is returned. */
-
- guint i; /* index into working buffer */
- guint orient_tag_id; /* endianed version of orientation tag ID */
- guint ret; /* Return value */
- guint offset; /* de-endianed offset in various situations */
- guint tags; /* number of tags in current ifd */
- guint type; /* de-endianed type of tag used as index into types[] */
- guint count; /* de-endianed count of elements in a tag */
- guint tiff = 0; /* offset to active tiff header */
- guint endian = 0; /* detected endian of data */
-
- jpeg_saved_marker_ptr exif_marker; /* Location of the Exif APP1 marker */
- jpeg_saved_marker_ptr cmarker; /* Location to check for Exif APP1 marker */
-
- /* check for Exif marker (also called the APP1 marker) */
- exif_marker = NULL;
- cmarker = cinfo->marker_list;
- while (cmarker) {
- if (cmarker->marker == EXIF_JPEG_MARKER) {
- /* The Exif APP1 marker should contain a unique
- identification string ("Exif\0\0"). Check for it. */
- if (!memcmp (cmarker->data, EXIF_IDENT_STRING, 6)) {
- exif_marker = cmarker;
- }
- }
- cmarker = cmarker->next;
- }
-
- /* Did we find the Exif APP1 marker? */
- if (exif_marker == NULL)
- return 0;
-
- /* Do we have enough data? */
- if (exif_marker->data_length < 32)
- return 0;
-
- /* Check for TIFF header and catch endianess */
- i = 0;
-
- /* Just skip data until TIFF header - it should be within 16 bytes from marker start.
- Normal structure relative to APP1 marker -
- 0x0000: APP1 marker entry = 2 bytes
- 0x0002: APP1 length entry = 2 bytes
- 0x0004: Exif Identifier entry = 6 bytes
- 0x000A: Start of TIFF header (Byte order entry) - 4 bytes
- - This is what we look for, to determine endianess.
- 0x000E: 0th IFD offset pointer - 4 bytes
-
- exif_marker->data points to the first data after the APP1 marker
- and length entries, which is the exif identification string.
- The TIFF header should thus normally be found at i=6, below,
- and the pointer to IFD0 will be at 6+4 = 10.
- */
-
- while (i < 16) {
-
- /* Little endian TIFF header */
- if (memcmp (&exif_marker->data[i], leth, 4) == 0){
- endian = G_LITTLE_ENDIAN;
- }
-
- /* Big endian TIFF header */
- else if (memcmp (&exif_marker->data[i], beth, 4) == 0){
- endian = G_BIG_ENDIAN;
- }
-
- /* Keep looking through buffer */
- else {
- i++;
- continue;
- }
- /* We have found either big or little endian TIFF header */
- tiff = i;
- break;
- }
-
- /* So did we find a TIFF header or did we just hit end of buffer? */
- if (tiff == 0)
- return 0;
-
- /* Endian the orientation tag ID, to locate it more easily */
- orient_tag_id = ENDIAN16_IT(0x112);
-
- /* Read out the offset pointer to IFD0 */
- offset = de_get32(&exif_marker->data[i] + 4, endian);
- i = i + offset;
-
- /* Check that we still are within the buffer and can read the tag count */
- if ((i + 2) > exif_marker->data_length)
- return 0;
-
- /* Find out how many tags we have in IFD0. As per the TIFF spec, the first
- two bytes of the IFD contain a count of the number of tags. */
- tags = de_get16(&exif_marker->data[i], endian);
- i = i + 2;
-
- /* Check that we still have enough data for all tags to check. The tags
- are listed in consecutive 12-byte blocks. The tag ID, type, size, and
- a pointer to the actual value, are packed into these 12 byte entries. */
- if ((i + tags * 12) > exif_marker->data_length)
- return 0;
-
- /* Check through IFD0 for tags of interest */
- while (tags--){
- type = de_get16(&exif_marker->data[i + 2], endian);
- count = de_get32(&exif_marker->data[i + 4], endian);
-
- /* Is this the orientation tag? */
- if (memcmp (&exif_marker->data[i], (char *) &orient_tag_id, 2) == 0){
-
- /* Check that type and count fields are OK. The orientation field
- will consist of a single (count=1) 2-byte integer (type=3). */
- if (type != 3 || count != 1) return 0;
-
- /* Return the orientation value. Within the 12-byte block, the
- pointer to the actual data is at offset 8. */
- ret = de_get16(&exif_marker->data[i + 8], endian);
- return ret <= 8 ? ret : 0;
- }
- /* move the pointer to the next 12-byte tag field. */
- i = i + 12;
- }
-
- return 0; /* No EXIF Orientation tag found */
-}
-
-
-/* Shared library entry point */
-static GdkPixbuf *
-gdk_pixbuf__jpeg_image_load (FILE *f, GError **error)
-{
- gint i;
- int is_otag;
- char otag_str[5];
- GdkPixbuf * volatile pixbuf = NULL;
- guchar *dptr;
- guchar *lines[4]; /* Used to expand rows, via rec_outbuf_height,
- * from the header file:
- * " Usually rec_outbuf_height will be 1 or 2,
- * at most 4."
- */
- guchar **lptr;
- struct jpeg_decompress_struct cinfo;
- struct error_handler_data jerr;
- stdio_src_ptr src;
-
- /* setup error handler */
- cinfo.err = jpeg_std_error (&jerr.pub);
- jerr.pub.error_exit = fatal_error_handler;
- jerr.pub.output_message = output_message_handler;
- jerr.error = error;
-
- if (sigsetjmp (jerr.setjmp_buffer, 1)) {
- /* Whoops there was a jpeg error */
- if (pixbuf)
- g_object_unref (pixbuf);
-
- jpeg_destroy_decompress (&cinfo);
-
- /* error should have been set by fatal_error_handler () */
- return NULL;
- }
-
- /* load header, setup */
- jpeg_create_decompress (&cinfo);
-
- cinfo.src = (struct jpeg_source_mgr *)
- (*cinfo.mem->alloc_small) ((j_common_ptr) &cinfo, JPOOL_PERMANENT,
- sizeof (stdio_source_mgr));
- src = (stdio_src_ptr) cinfo.src;
- src->buffer = (JOCTET *)
- (*cinfo.mem->alloc_small) ((j_common_ptr) &cinfo, JPOOL_PERMANENT,
- JPEG_PROG_BUF_SIZE * sizeof (JOCTET));
-
- src->pub.init_source = stdio_init_source;
- src->pub.fill_input_buffer = stdio_fill_input_buffer;
- src->pub.skip_input_data = stdio_skip_input_data;
- src->pub.resync_to_restart = jpeg_resync_to_restart; /* use default method */
- src->pub.term_source = stdio_term_source;
- src->infile = f;
- src->pub.bytes_in_buffer = 0; /* forces fill_input_buffer on first read */
- src->pub.next_input_byte = NULL; /* until buffer loaded */
-
- jpeg_save_markers (&cinfo, EXIF_JPEG_MARKER, 0xffff);
- jpeg_read_header (&cinfo, TRUE);
-
- /* check for orientation tag */
- is_otag = get_orientation (&cinfo);
-
- jpeg_start_decompress (&cinfo);
- cinfo.do_fancy_upsampling = FALSE;
- cinfo.do_block_smoothing = FALSE;
-
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
- cinfo.out_color_components == 4 ? TRUE : FALSE,
- 8, cinfo.output_width, cinfo.output_height);
-
- if (!pixbuf) {
- jpeg_destroy_decompress (&cinfo);
-
- /* broken check for *error == NULL for robustness against
- * crappy JPEG library
- */
- if (error && *error == NULL) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Insufficient memory to load image, try exiting some applications to free memory"));
- }
-
- return NULL;
- }
-
- /* if orientation tag was found set an option to remember its value */
- if (is_otag) {
- g_snprintf (otag_str, sizeof (otag_str), "%d", is_otag);
- gdk_pixbuf_set_option (pixbuf, "orientation", otag_str);
- }
-
-
- dptr = pixbuf->pixels;
-
- /* decompress all the lines, a few at a time */
- while (cinfo.output_scanline < cinfo.output_height) {
- lptr = lines;
- for (i = 0; i < cinfo.rec_outbuf_height; i++) {
- *lptr++ = dptr;
- dptr += pixbuf->rowstride;
- }
-
- jpeg_read_scanlines (&cinfo, lines, cinfo.rec_outbuf_height);
-
- switch (cinfo.out_color_space) {
- case JCS_GRAYSCALE:
- explode_gray_into_buf (&cinfo, lines);
- break;
- case JCS_RGB:
- /* do nothing */
- break;
- case JCS_CMYK:
- convert_cmyk_to_rgb (&cinfo, lines);
- break;
- default:
- g_object_unref (pixbuf);
- if (error && *error == NULL) {
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
- _("Unsupported JPEG color space (%s)"),
- colorspace_name (cinfo.out_color_space));
- }
-
- jpeg_destroy_decompress (&cinfo);
- return NULL;
- }
- }
-
- jpeg_finish_decompress (&cinfo);
- jpeg_destroy_decompress (&cinfo);
-
- return pixbuf;
-}
-
-
-/**** Progressive image loading handling *****/
-
-/* these routines required because we are acting as a source manager for */
-/* libjpeg. */
-static void
-init_source (j_decompress_ptr cinfo)
-{
- my_src_ptr src = (my_src_ptr) cinfo->src;
-
- src->skip_next = 0;
-}
-
-
-static void
-term_source (j_decompress_ptr cinfo)
-{
- /* XXXX - probably should scream something has happened */
-}
-
-
-/* for progressive loading (called "I/O Suspension" by libjpeg docs) */
-/* we do nothing except return "FALSE" */
-static boolean
-fill_input_buffer (j_decompress_ptr cinfo)
-{
- return FALSE;
-}
-
-
-static void
-skip_input_data (j_decompress_ptr cinfo, long num_bytes)
-{
- my_src_ptr src = (my_src_ptr) cinfo->src;
- long num_can_do;
-
- /* move as far as we can into current buffer */
- /* then set skip_next to catch the rest */
- if (num_bytes > 0) {
- num_can_do = MIN (src->pub.bytes_in_buffer, num_bytes);
- src->pub.next_input_byte += (size_t) num_can_do;
- src->pub.bytes_in_buffer -= (size_t) num_can_do;
-
- src->skip_next = num_bytes - num_can_do;
- }
-}
-
-
-/*
- * func - called when we have pixmap created (but no image data)
- * user_data - passed as arg 1 to func
- * return context (opaque to user)
- */
-
-static gpointer
-gdk_pixbuf__jpeg_image_begin_load (GdkPixbufModuleSizeFunc size_func,
- GdkPixbufModulePreparedFunc prepared_func,
- GdkPixbufModuleUpdatedFunc updated_func,
- gpointer user_data,
- GError **error)
-{
- JpegProgContext *context;
- my_source_mgr *src;
-
- context = g_new0 (JpegProgContext, 1);
- context->size_func = size_func;
- context->prepared_func = prepared_func;
- context->updated_func = updated_func;
- context->user_data = user_data;
- context->pixbuf = NULL;
- context->got_header = FALSE;
- context->did_prescan = FALSE;
- context->src_initialized = FALSE;
- context->in_output = FALSE;
-
- /* From jpeglib.h: "NB: you must set up the error-manager
- * BEFORE calling jpeg_create_xxx". */
- context->cinfo.err = jpeg_std_error (&context->jerr.pub);
- context->jerr.pub.error_exit = fatal_error_handler;
- context->jerr.pub.output_message = output_message_handler;
- context->jerr.error = error;
-
- /* create libjpeg structures */
- jpeg_create_decompress (&context->cinfo);
-
- context->cinfo.src = (struct jpeg_source_mgr *) g_try_malloc (sizeof (my_source_mgr));
- if (!context->cinfo.src) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Couldn't allocate memory for loading JPEG file"));
- return NULL;
- }
- memset (context->cinfo.src, 0, sizeof (my_source_mgr));
-
- src = (my_src_ptr) context->cinfo.src;
- src->pub.init_source = init_source;
- src->pub.fill_input_buffer = fill_input_buffer;
- src->pub.skip_input_data = skip_input_data;
- src->pub.resync_to_restart = jpeg_resync_to_restart;
- src->pub.term_source = term_source;
- src->pub.bytes_in_buffer = 0;
- src->pub.next_input_byte = NULL;
-
- context->jerr.error = NULL;
-
- return (gpointer) context;
-}
-
-/*
- * context - returned from image_begin_load
- *
- * free context, unref gdk_pixbuf
- */
-static gboolean
-gdk_pixbuf__jpeg_image_stop_load (gpointer data, GError **error)
-{
- JpegProgContext *context = (JpegProgContext *) data;
- gboolean retval;
-
- g_return_val_if_fail (context != NULL, TRUE);
-
- /* FIXME this thing needs to report errors if
- * we have unused image data
- */
-
- if (context->pixbuf)
- g_object_unref (context->pixbuf);
-
- /* if we have an error? */
- context->jerr.error = error;
- if (sigsetjmp (context->jerr.setjmp_buffer, 1)) {
- retval = FALSE;
- } else {
- jpeg_finish_decompress (&context->cinfo);
- retval = TRUE;
- }
-
- jpeg_destroy_decompress (&context->cinfo);
-
- if (context->cinfo.src) {
- my_src_ptr src = (my_src_ptr) context->cinfo.src;
-
- g_free (src);
- }
-
- g_free (context);
-
- return retval;
-}
-
-
-static gboolean
-gdk_pixbuf__jpeg_image_load_lines (JpegProgContext *context,
- GError **error)
-{
- struct jpeg_decompress_struct *cinfo = &context->cinfo;
- guchar *lines[4];
- guchar **lptr;
- guchar *rowptr;
- gint nlines, i;
-
- /* keep going until we've done all scanlines */
- while (cinfo->output_scanline < cinfo->output_height) {
- lptr = lines;
- rowptr = context->dptr;
- for (i=0; i < cinfo->rec_outbuf_height; i++) {
- *lptr++ = rowptr;
- rowptr += context->pixbuf->rowstride;
- }
-
- nlines = jpeg_read_scanlines (cinfo, lines,
- cinfo->rec_outbuf_height);
- if (nlines == 0)
- break;
-
- switch (cinfo->out_color_space) {
- case JCS_GRAYSCALE:
- explode_gray_into_buf (cinfo, lines);
- break;
- case JCS_RGB:
- /* do nothing */
- break;
- case JCS_CMYK:
- convert_cmyk_to_rgb (cinfo, lines);
- break;
- default:
- if (error && *error == NULL) {
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
- _("Unsupported JPEG color space (%s)"),
- colorspace_name (cinfo->out_color_space));
- }
-
- return FALSE;
- }
-
- context->dptr += nlines * context->pixbuf->rowstride;
-
- /* send updated signal */
- if (context->updated_func)
- (* context->updated_func) (context->pixbuf,
- 0,
- cinfo->output_scanline - 1,
- cinfo->image_width,
- nlines,
- context->user_data);
- }
-
- return TRUE;
-}
-
-
-/*
- * context - from image_begin_load
- * buf - new image data
- * size - length of new image data
- *
- * append image data onto inrecrementally built output image
- */
-static gboolean
-gdk_pixbuf__jpeg_image_load_increment (gpointer data,
- const guchar *buf, guint size,
- GError **error)
-{
- JpegProgContext *context = (JpegProgContext *)data;
- struct jpeg_decompress_struct *cinfo;
- my_src_ptr src;
- guint num_left, num_copy;
- guint last_num_left, last_bytes_left;
- guint spinguard;
- gboolean first;
- const guchar *bufhd;
- gint width, height;
- int is_otag;
- char otag_str[5];
-
- g_return_val_if_fail (context != NULL, FALSE);
- g_return_val_if_fail (buf != NULL, FALSE);
-
- src = (my_src_ptr) context->cinfo.src;
-
- cinfo = &context->cinfo;
-
- context->jerr.error = error;
-
- /* check for fatal error */
- if (sigsetjmp (context->jerr.setjmp_buffer, 1)) {
- return FALSE;
- }
-
- /* skip over data if requested, handle unsigned int sizes cleanly */
- /* only can happen if we've already called jpeg_get_header once */
- if (context->src_initialized && src->skip_next) {
- if (src->skip_next > size) {
- src->skip_next -= size;
- return TRUE;
- } else {
- num_left = size - src->skip_next;
- bufhd = buf + src->skip_next;
- src->skip_next = 0;
- }
- } else {
- num_left = size;
- bufhd = buf;
- }
-
- if (num_left == 0)
- return TRUE;
-
- last_num_left = num_left;
- last_bytes_left = 0;
- spinguard = 0;
- first = TRUE;
- while (TRUE) {
-
- /* handle any data from caller we haven't processed yet */
- if (num_left > 0) {
- if(src->pub.bytes_in_buffer &&
- src->pub.next_input_byte != src->buffer)
- memmove(src->buffer, src->pub.next_input_byte,
- src->pub.bytes_in_buffer);
-
-
- num_copy = MIN (JPEG_PROG_BUF_SIZE - src->pub.bytes_in_buffer,
- num_left);
-
- memcpy(src->buffer + src->pub.bytes_in_buffer, bufhd,num_copy);
- src->pub.next_input_byte = src->buffer;
- src->pub.bytes_in_buffer += num_copy;
- bufhd += num_copy;
- num_left -= num_copy;
- }
-
- /* did anything change from last pass, if not return */
- if (first) {
- last_bytes_left = src->pub.bytes_in_buffer;
- first = FALSE;
- } else if (src->pub.bytes_in_buffer == last_bytes_left
- && num_left == last_num_left) {
- spinguard++;
- } else {
- last_bytes_left = src->pub.bytes_in_buffer;
- last_num_left = num_left;
- }
-
- /* should not go through twice and not pull bytes out of buf */
- if (spinguard > 2)
- return TRUE;
-
- /* try to load jpeg header */
- if (!context->got_header) {
- int rc;
-
- jpeg_save_markers (cinfo, EXIF_JPEG_MARKER, 0xffff);
- rc = jpeg_read_header (cinfo, TRUE);
- context->src_initialized = TRUE;
-
- if (rc == JPEG_SUSPENDED)
- continue;
-
- context->got_header = TRUE;
-
- /* check for orientation tag */
- is_otag = get_orientation (cinfo);
-
- width = cinfo->image_width;
- height = cinfo->image_height;
- if (context->size_func) {
- (* context->size_func) (&width, &height, context->user_data);
- if (width == 0 || height == 0) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Transformed JPEG has zero width or height."));
- return FALSE;
- }
- }
-
- cinfo->scale_num = 1;
- for (cinfo->scale_denom = 2; cinfo->scale_denom <= 8; cinfo->scale_denom *= 2) {
- jpeg_calc_output_dimensions (cinfo);
- if (cinfo->output_width < width || cinfo->output_height < height) {
- cinfo->scale_denom /= 2;
- break;
- }
- }
- jpeg_calc_output_dimensions (cinfo);
-
- context->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
- cinfo->output_components == 4 ? TRUE : FALSE,
- 8,
- cinfo->output_width,
- cinfo->output_height);
-
- if (context->pixbuf == NULL) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Couldn't allocate memory for loading JPEG file"));
- return FALSE;
- }
-
- /* if orientation tag was found set an option to remember its value */
- if (is_otag) {
- g_snprintf (otag_str, sizeof (otag_str), "%d", is_otag);
- gdk_pixbuf_set_option (context->pixbuf, "orientation", otag_str);
- }
-
- /* Use pixbuf buffer to store decompressed data */
- context->dptr = context->pixbuf->pixels;
-
- /* Notify the client that we are ready to go */
- if (context->prepared_func)
- (* context->prepared_func) (context->pixbuf,
- NULL,
- context->user_data);
-
- } else if (!context->did_prescan) {
- int rc;
-
- /* start decompression */
- cinfo->buffered_image = cinfo->progressive_mode;
- rc = jpeg_start_decompress (cinfo);
- cinfo->do_fancy_upsampling = FALSE;
- cinfo->do_block_smoothing = FALSE;
-
- if (rc == JPEG_SUSPENDED)
- continue;
-
- context->did_prescan = TRUE;
- } else if (!cinfo->buffered_image) {
- /* we're decompressing unbuffered so
- * simply get scanline by scanline from jpeg lib
- */
- if (! gdk_pixbuf__jpeg_image_load_lines (context,
- error))
- return FALSE;
-
- if (cinfo->output_scanline >= cinfo->output_height)
- return TRUE;
- } else {
- /* we're decompressing buffered (progressive)
- * so feed jpeg lib scanlines
- */
-
- /* keep going until we've done all passes */
- while (!jpeg_input_complete (cinfo)) {
- if (!context->in_output) {
- if (jpeg_start_output (cinfo, cinfo->input_scan_number)) {
- context->in_output = TRUE;
- context->dptr = context->pixbuf->pixels;
- }
- else
- break;
- }
-
- /* get scanlines from jpeg lib */
- if (! gdk_pixbuf__jpeg_image_load_lines (context,
- error))
- return FALSE;
-
- if (cinfo->output_scanline >= cinfo->output_height &&
- jpeg_finish_output (cinfo))
- context->in_output = FALSE;
- else
- break;
- }
- if (jpeg_input_complete (cinfo))
- /* did entire image */
- return TRUE;
- else
- continue;
- }
- }
-}
-
-/* Save */
-
-#define TO_FUNCTION_BUF_SIZE 4096
-
-typedef struct {
- struct jpeg_destination_mgr pub;
- JOCTET *buffer;
- GdkPixbufSaveFunc save_func;
- gpointer user_data;
- GError **error;
-} ToFunctionDestinationManager;
-
-void
-to_callback_init (j_compress_ptr cinfo)
-{
- ToFunctionDestinationManager *destmgr;
-
- destmgr = (ToFunctionDestinationManager*) cinfo->dest;
- destmgr->pub.next_output_byte = destmgr->buffer;
- destmgr->pub.free_in_buffer = TO_FUNCTION_BUF_SIZE;
-}
-
-static void
-to_callback_do_write (j_compress_ptr cinfo, gsize length)
-{
- ToFunctionDestinationManager *destmgr;
-
- destmgr = (ToFunctionDestinationManager*) cinfo->dest;
- if (!destmgr->save_func ((gchar *)destmgr->buffer,
- length,
- destmgr->error,
- destmgr->user_data)) {
- struct error_handler_data *errmgr;
-
- errmgr = (struct error_handler_data *) cinfo->err;
- /* Use a default error message if the callback didn't set one,
- * which it should have.
- */
- if (errmgr->error && *errmgr->error == NULL) {
- g_set_error_literal (errmgr->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- "write function failed");
- }
- siglongjmp (errmgr->setjmp_buffer, 1);
- g_assert_not_reached ();
- }
-}
-
-static boolean
-to_callback_empty_output_buffer (j_compress_ptr cinfo)
-{
- ToFunctionDestinationManager *destmgr;
-
- destmgr = (ToFunctionDestinationManager*) cinfo->dest;
- to_callback_do_write (cinfo, TO_FUNCTION_BUF_SIZE);
- destmgr->pub.next_output_byte = destmgr->buffer;
- destmgr->pub.free_in_buffer = TO_FUNCTION_BUF_SIZE;
- return TRUE;
-}
-
-void
-to_callback_terminate (j_compress_ptr cinfo)
-{
- ToFunctionDestinationManager *destmgr;
-
- destmgr = (ToFunctionDestinationManager*) cinfo->dest;
- to_callback_do_write (cinfo, TO_FUNCTION_BUF_SIZE - destmgr->pub.free_in_buffer);
-}
-
-static gboolean
-real_save_jpeg (GdkPixbuf *pixbuf,
- gchar **keys,
- gchar **values,
- GError **error,
- gboolean to_callback,
- FILE *f,
- GdkPixbufSaveFunc save_func,
- gpointer user_data)
-{
- /* FIXME error handling is broken */
-
- struct jpeg_compress_struct cinfo;
- guchar *buf = NULL;
- guchar *ptr;
- guchar *pixels = NULL;
- JSAMPROW *jbuf;
- int y = 0;
- volatile int quality = 75; /* default; must be between 0 and 100 */
- int i, j;
- int w, h = 0;
- int rowstride = 0;
- int n_channels;
- struct error_handler_data jerr;
- ToFunctionDestinationManager to_callback_destmgr;
-
- to_callback_destmgr.buffer = NULL;
-
- if (keys && *keys) {
- gchar **kiter = keys;
- gchar **viter = values;
-
- while (*kiter) {
- if (strcmp (*kiter, "quality") == 0) {
- char *endptr = NULL;
- quality = strtol (*viter, &endptr, 10);
-
- if (endptr == *viter) {
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_BAD_OPTION,
- _("JPEG quality must be a value between 0 and 100; value '%s' could not be parsed."),
- *viter);
-
- return FALSE;
- }
-
- if (quality < 0 ||
- quality > 100) {
- /* This is a user-visible error;
- * lets people skip the range-checking
- * in their app.
- */
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_BAD_OPTION,
- _("JPEG quality must be a value between 0 and 100; value '%d' is not allowed."),
- quality);
-
- return FALSE;
- }
- } else {
- g_warning ("Unrecognized parameter (%s) passed to JPEG saver.", *kiter);
- }
-
- ++kiter;
- ++viter;
- }
- }
-
- rowstride = gdk_pixbuf_get_rowstride (pixbuf);
- n_channels = gdk_pixbuf_get_n_channels (pixbuf);
-
- w = gdk_pixbuf_get_width (pixbuf);
- h = gdk_pixbuf_get_height (pixbuf);
- pixels = gdk_pixbuf_get_pixels (pixbuf);
-
- /* Allocate a small buffer to convert image data,
- * and a larger buffer if doing to_callback save.
- */
- buf = g_try_malloc (w * 3 * sizeof (guchar));
- if (!buf) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Couldn't allocate memory for loading JPEG file"));
- return FALSE;
- }
- if (to_callback) {
- to_callback_destmgr.buffer = g_try_malloc (TO_FUNCTION_BUF_SIZE);
- if (!to_callback_destmgr.buffer) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Couldn't allocate memory for loading JPEG file"));
- g_free (buf);
- return FALSE;
- }
- }
-
- /* set up error handling */
- cinfo.err = jpeg_std_error (&(jerr.pub));
- jerr.pub.error_exit = fatal_error_handler;
- jerr.pub.output_message = output_message_handler;
- jerr.error = error;
-
- if (sigsetjmp (jerr.setjmp_buffer, 1)) {
- jpeg_destroy_compress (&cinfo);
- g_free (buf);
- g_free (to_callback_destmgr.buffer);
- return FALSE;
- }
-
- /* setup compress params */
- jpeg_create_compress (&cinfo);
- if (to_callback) {
- to_callback_destmgr.pub.init_destination = to_callback_init;
- to_callback_destmgr.pub.empty_output_buffer = to_callback_empty_output_buffer;
- to_callback_destmgr.pub.term_destination = to_callback_terminate;
- to_callback_destmgr.error = error;
- to_callback_destmgr.save_func = save_func;
- to_callback_destmgr.user_data = user_data;
- cinfo.dest = (struct jpeg_destination_mgr*) &to_callback_destmgr;
- } else {
- jpeg_stdio_dest (&cinfo, f);
- }
- cinfo.image_width = w;
- cinfo.image_height = h;
- cinfo.input_components = 3;
- cinfo.in_color_space = JCS_RGB;
-
- /* set up jepg compression parameters */
- jpeg_set_defaults (&cinfo);
- jpeg_set_quality (&cinfo, quality, TRUE);
- jpeg_start_compress (&cinfo, TRUE);
- /* get the start pointer */
- ptr = pixels;
- /* go one scanline at a time... and save */
- i = 0;
- while (cinfo.next_scanline < cinfo.image_height) {
- /* convert scanline from ARGB to RGB packed */
- for (j = 0; j < w; j++)
- memcpy (&(buf[j*3]), &(ptr[i*rowstride + j*n_channels]), 3);
-
- /* write scanline */
- jbuf = (JSAMPROW *)(&buf);
- jpeg_write_scanlines (&cinfo, jbuf, 1);
- i++;
- y++;
-
- }
-
- /* finish off */
- jpeg_finish_compress (&cinfo);
- jpeg_destroy_compress(&cinfo);
- g_free (buf);
- g_free (to_callback_destmgr.buffer);
- return TRUE;
-}
-
-static gboolean
-gdk_pixbuf__jpeg_image_save (FILE *f,
- GdkPixbuf *pixbuf,
- gchar **keys,
- gchar **values,
- GError **error)
-{
- return real_save_jpeg (pixbuf, keys, values, error,
- FALSE, f, NULL, NULL);
-}
-
-static gboolean
-gdk_pixbuf__jpeg_image_save_to_callback (GdkPixbufSaveFunc save_func,
- gpointer user_data,
- GdkPixbuf *pixbuf,
- gchar **keys,
- gchar **values,
- GError **error)
-{
- return real_save_jpeg (pixbuf, keys, values, error,
- TRUE, NULL, save_func, user_data);
-}
-
-#ifndef INCLUDE_jpeg
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__jpeg_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
-{
- module->load = gdk_pixbuf__jpeg_image_load;
- module->begin_load = gdk_pixbuf__jpeg_image_begin_load;
- module->stop_load = gdk_pixbuf__jpeg_image_stop_load;
- module->load_increment = gdk_pixbuf__jpeg_image_load_increment;
- module->save = gdk_pixbuf__jpeg_image_save;
- module->save_to_callback = gdk_pixbuf__jpeg_image_save_to_callback;
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
-{
- static GdkPixbufModulePattern signature[] = {
- { "\xff\xd8", NULL, 100 },
- { NULL, NULL, 0 }
- };
- static gchar * mime_types[] = {
- "image/jpeg",
- NULL
- };
- static gchar * extensions[] = {
- "jpeg",
- "jpe",
- "jpg",
- NULL
- };
-
- info->name = "jpeg";
- info->signature = signature;
- info->description = N_("The JPEG image format");
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_WRITABLE | GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "LGPL";
-}
diff --git a/gdk-pixbuf/io-pcx.c b/gdk-pixbuf/io-pcx.c
deleted file mode 100644
index 584240db31..0000000000
--- a/gdk-pixbuf/io-pcx.c
+++ /dev/null
@@ -1,761 +0,0 @@
-/*
- * GdkPixbuf library - PCX image loader
- *
- * Copyright (C) 2003 Josh A. Beam
- *
- * Authors: Josh A. Beam <josh@joshbeam.com>
- *
- * 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 <stdio.h>
-#include <string.h>
-#include "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-io.h"
-
-#undef PCX_DEBUG
-
-#define PCX_TASK_DONE 0
-#define PCX_TASK_LOAD_HEADER 1
-#define PCX_TASK_LOAD_DATA 2
-#define PCX_TASK_LOAD_PALETTE 3
-
-struct pcx_header {
- guint8 manufacturer;
- guint8 version;
- guint8 encoding;
- guint8 bitsperpixel;
- gint16 xmin;
- gint16 ymin;
- gint16 xmax;
- gint16 ymax;
- guint16 horizdpi;
- guint16 vertdpi;
- guint8 palette[48];
- guint8 reserved;
- guint8 colorplanes;
- guint16 bytesperline;
- guint16 palettetype;
- guint16 hscrsize;
- guint16 vscrsize;
- guint8 filler[54];
-};
-
-struct pcx_context {
- GdkPixbuf *pixbuf;
- gint rowstride;
-
- GdkPixbufModuleSizeFunc size_func;
- GdkPixbufModuleUpdatedFunc updated_func;
- GdkPixbufModulePreparedFunc prepared_func;
- gpointer user_data;
-
- guchar current_task;
-
- gboolean header_loaded;
- struct pcx_header *header;
- guint bpp;
- gint width, height;
- guint num_planes;
- guint bytesperline;
-
- guchar *buf;
- guint buf_size;
- guint buf_pos;
- guchar *data;
- guchar *line;
- guint current_line;
- guchar *p_data;
-};
-
-/*
- * set context's image information based on the header
- */
-static void
-fill_pcx_context(struct pcx_context *context)
-{
- struct pcx_header *header = context->header;
-
- context->bpp = header->bitsperpixel;
- context->width = header->xmax - header->xmin + 1;
- context->height = header->ymax - header->ymin + 1;
- context->num_planes = header->colorplanes;
- context->bytesperline = header->bytesperline;
-
- if(header->version == 5 && context->bpp == 8 && context->num_planes == 3)
- context->bpp = 24;
-}
-
-static void
-free_pcx_context(struct pcx_context *context, gboolean unref_pixbuf)
-{
- g_free(context->header);
- g_free(context->buf);
- if(unref_pixbuf && context->pixbuf)
- g_object_unref(context->pixbuf);
- g_free(context->line);
- g_free(context->p_data);
-
- g_free(context);
-}
-
-/*
- * read each plane of a single scanline. store_planes is
- * the number of planes that can be stored in the planes array.
- * data is the pointer to the block of memory to read
- * from, size is the length of that data, and line_bytes
- * is where the number of bytes read will be stored.
- */
-static gboolean
-read_scanline_data(guchar *data, guint size, guchar *planes[],
- guint store_planes, guint num_planes, guint bytesperline,
- guint *line_bytes)
-{
- guint i, j;
- guint p, count;
- guint d = 0;
- guint8 byte;
-
- for(p = 0; p < num_planes; p++) {
- for(i = 0; i < bytesperline;) { /* i incremented when line byte set */
- if(d >= size)
- return FALSE;
- byte = data[d++];
-
- if(byte >> 6 == 0x3) {
- count = byte & ~(0x3 << 6);
- if(count == 0)
- return FALSE;
- if(d >= size)
- return FALSE;
- byte = data[d++];
- } else {
- count = 1;
- }
-
- for(j = 0; j < count; j++) {
- if(p < store_planes)
- planes[p][i++] = byte;
- else
- i++;
-
- if(i >= bytesperline) {
- p++;
- if(p >= num_planes) {
- *line_bytes = d;
- return TRUE;
- }
- i = 0;
- }
- }
- }
- }
-
- *line_bytes = d; /* number of bytes read for scanline */
- return TRUE;
-}
-
-static gpointer
-gdk_pixbuf__pcx_begin_load(GdkPixbufModuleSizeFunc size_func,
- GdkPixbufModulePreparedFunc prepared_func,
- GdkPixbufModuleUpdatedFunc updated_func,
- gpointer user_data, GError **error)
-{
- struct pcx_context *context;
-
- context = g_new0(struct pcx_context, 1);
- if(!context)
- return NULL;
-
- context->header = g_try_malloc(sizeof(struct pcx_header));
- if(!context->header) {
- g_free(context);
- g_set_error_literal(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't allocate memory for header"));
- return NULL;
- }
-
- context->size_func = size_func;
- context->updated_func = updated_func;
- context->prepared_func = prepared_func;
- context->user_data = user_data;
-
- context->current_task = PCX_TASK_LOAD_HEADER;
-
- context->buf = g_try_malloc(sizeof(guchar) * 512);
- if(!context->buf) {
- g_free(context->header);
- g_free(context);
- g_set_error_literal(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't allocate memory for context buffer"));
- return NULL;
- }
- context->buf_size = 512;
-
- context->header_loaded = FALSE;
-
- return context;
-}
-
-static gboolean
-pcx_resize_context_buf(struct pcx_context *context, guint size)
-{
- guchar *new_buf;
-
- new_buf = g_try_realloc(context->buf, size);
- if(!new_buf)
- return FALSE;
-
- context->buf = new_buf;
- context->buf_size = size;
- return TRUE;
-}
-
-/*
- * remove a number of bytes (specified by size) from the
- * beginning of a context's buf
- */
-static gboolean
-pcx_chop_context_buf(struct pcx_context *context, guint size)
-{
- guint i, j;
-
- if (size > context->buf_pos)
- return FALSE;
- else if (size == 0)
- return TRUE;
-
- for (i = 0, j = size; j < context->buf_pos; i++, j++)
- context->buf[i] = context->buf[j];
-
- context->buf_pos -= size;
-
- return TRUE;
-}
-
-static guchar
-read_pixel_1(guchar *data, guint offset)
-{
- guchar retval;
- guint bit_offset;
-
- if(!(offset % 8)) {
- offset /= 8;
- retval = data[offset] >> 7;
- } else {
- bit_offset = offset % 8;
- offset -= bit_offset;
- offset /= 8;
- retval = (data[offset] >> (7 - bit_offset)) & 0x1;
- }
-
- return retval;
-}
-
-static guchar
-read_pixel_4(guchar *data, guint offset)
-{
- guchar retval;
-
- if(!(offset % 2)) {
- offset /= 2;
- retval = data[offset] >> 4;
- } else {
- offset--;
- offset /= 2;
- retval = data[offset] & 0xf;
- }
-
- return retval;
-}
-
-static gboolean
-pcx_increment_load_data_1(struct pcx_context *context)
-{
- guint i;
- guchar *planes[4];
- guint line_bytes;
- guint store_planes;
-
- if(context->num_planes == 4) {
- planes[0] = context->line;
- planes[1] = planes[0] + context->bytesperline;
- planes[2] = planes[1] + context->bytesperline;
- planes[3] = planes[2] + context->bytesperline;
- store_planes = 4;
- } else if(context->num_planes == 3) {
- planes[0] = context->line;
- planes[1] = planes[0] + context->bytesperline;
- planes[2] = planes[1] + context->bytesperline;
- store_planes = 3;
- } else if(context->num_planes == 2) {
- planes[0] = context->line;
- planes[1] = planes[0] + context->bytesperline;
- store_planes = 2;
- } else if(context->num_planes == 1) {
- planes[0] = context->line;
- store_planes = 1;
- } else {
- return FALSE;
- }
-
- while(read_scanline_data(context->buf, context->buf_pos, planes, store_planes, context->num_planes, context->bytesperline, &line_bytes)) {
- pcx_chop_context_buf(context, line_bytes);
-
- for(i = 0; i < context->width; i++) {
- guchar p;
-
- if(context->num_planes == 4) {
- p = read_pixel_1(planes[3], i);
- p <<= 1;
- p |= read_pixel_1(planes[2], i);
- p <<= 1;
- p |= read_pixel_1(planes[1], i);
- p <<= 1;
- p |= read_pixel_1(planes[0], i);
- } else if(context->num_planes == 3) {
- p = read_pixel_1(planes[2], i);
- p <<= 1;
- p |= read_pixel_1(planes[1], i);
- p <<= 1;
- p |= read_pixel_1(planes[0], i);
- } else if(context->num_planes == 2) {
- p = read_pixel_1(planes[1], i);
- p <<= 1;
- p |= read_pixel_1(planes[0], i);
- } else if(context->num_planes == 1) {
- p = read_pixel_1(planes[0], i);
- } else {
- return FALSE;
- }
- p &= 0xf;
- context->data[context->current_line * context->rowstride + i * 3 + 0] = context->header->palette[p * 3 + 0];
- context->data[context->current_line * context->rowstride + i * 3 + 1] = context->header->palette[p * 3 + 1];
- context->data[context->current_line * context->rowstride + i * 3 + 2] = context->header->palette[p * 3 + 2];
- }
-
- if(context->updated_func)
- context->updated_func(context->pixbuf, 0, context->current_line, context->width, 1, context->user_data);
-
- context->current_line++;
-
- if(context->current_line == context->height) {
- context->current_task = PCX_TASK_DONE;
- return TRUE;
- }
- }
-
- return TRUE;
-}
-
-static gboolean
-pcx_increment_load_data_2(struct pcx_context *context)
-{
- guint i;
- guchar *planes[1];
- guint line_bytes;
- guint shift, h;
-
- planes[0] = context->line;
-
- while(read_scanline_data(context->buf, context->buf_pos, planes, 1, context->num_planes, context->bytesperline, &line_bytes)) {
- pcx_chop_context_buf(context, line_bytes);
-
- for(i = 0; i < context->width; i++) {
- shift = 6 - 2 * (i % 4);
- h = (planes[0][i / 4] >> shift) & 0x3;
- context->data[context->current_line * context->rowstride + i * 3 + 0] = context->header->palette[h * 3 + 0];
- context->data[context->current_line * context->rowstride + i * 3 + 1] = context->header->palette[h * 3 + 1];
- context->data[context->current_line * context->rowstride + i * 3 + 2] = context->header->palette[h * 3 + 2];
- }
-
- if(context->updated_func)
- context->updated_func(context->pixbuf, 0, context->current_line, context->width, 1, context->user_data);
-
- context->current_line++;
-
- if(context->current_line == context->height) {
- context->current_task = PCX_TASK_DONE;
- return TRUE;
- }
- }
-
- return TRUE;
-}
-
-static gboolean
-pcx_increment_load_data_4(struct pcx_context *context)
-{
- guint i;
- guchar *planes[1];
- guint line_bytes;
-
- planes[0] = context->line;
-
- while(read_scanline_data(context->buf, context->buf_pos, planes, 1, context->num_planes, context->bytesperline, &line_bytes)) {
- pcx_chop_context_buf(context, line_bytes);
-
- for(i = 0; i < context->width; i++) {
- guchar p;
-
- p = read_pixel_4(planes[0], i) & 0xf;
- context->data[context->current_line * context->rowstride + i * 3 + 0] = context->header->palette[p * 3 + 0];
- context->data[context->current_line * context->rowstride + i * 3 + 1] = context->header->palette[p * 3 + 1];
- context->data[context->current_line * context->rowstride + i * 3 + 2] = context->header->palette[p * 3 + 2];
- }
-
- if(context->updated_func)
- context->updated_func(context->pixbuf, 0, context->current_line, context->width, 1, context->user_data);
-
- context->current_line++;
-
- if(context->current_line == context->height) {
- context->current_task = PCX_TASK_DONE;
- return TRUE;
- }
- }
-
- return TRUE;
-}
-
-/*
- * for loading 8-bit pcx images, we keep a buffer containing
- * each pixel's palette number; once we've loaded each scanline,
- * we wait for loading to stop and call pcx_load_palette_8,
- * which finds the palette at the end of the pcx data and sets the
- * RGB data.
- */
-static gboolean
-pcx_increment_load_data_8(struct pcx_context *context)
-{
- guint i;
- guchar *planes[1];
- guint line_bytes;
-
- planes[0] = context->line;
-
- while(read_scanline_data(context->buf, context->buf_pos, planes, 1, context->num_planes, context->bytesperline, &line_bytes)) {
- pcx_chop_context_buf(context, line_bytes);
-
- for(i = 0; i < context->width; i++)
- context->p_data[context->current_line * context->width + i + 0] = planes[0][i];
-
- context->current_line++;
-
- if(context->current_line == context->height) {
- context->current_task = PCX_TASK_LOAD_PALETTE;
- return TRUE;
- }
- }
-
- return TRUE;
-}
-
-/*
- * read the palette and set the RGB data
- */
-static gboolean
-pcx_load_palette_8(struct pcx_context *context)
-{
- guint i, j;
-
- if(context->current_line < context->height)
- return FALSE;
-
- if(context->buf_pos >= 769) {
- guchar *palette = context->buf + (context->buf_pos - 769);
-
- if(palette[0] == 12) {
- palette++;
- for(i = 0; i < context->height; i++) {
- for(j = 0; j < context->width; j++) {
- context->data[i * context->rowstride + j * 3 + 0] = palette[(context->p_data[i * context->width + j]) * 3 + 0];
- context->data[i * context->rowstride + j * 3 + 1] = palette[(context->p_data[i * context->width + j]) * 3 + 1];
- context->data[i * context->rowstride + j * 3 + 2] = palette[(context->p_data[i * context->width + j]) * 3 + 2];
- }
-
- if(context->updated_func)
- context->updated_func(context->pixbuf, 0, i, context->width, 1, context->user_data);
- }
-
-#ifdef PCX_DEBUG
- g_print("read palette\n");
-#endif
-
- context->current_task = PCX_TASK_DONE;
- return TRUE;
- } else {
-#ifdef PCX_DEBUG
- g_print("this ain't a palette\n");
-#endif
- return FALSE;
- }
- }
-
- return FALSE;
-}
-
-/*
- * in 24-bit images, each scanline has three color planes
- * for red, green, and blue, respectively.
- */
-static gboolean
-pcx_increment_load_data_24(struct pcx_context *context)
-{
- guint i;
- guchar *planes[3];
- guint line_bytes;
-
- planes[0] = context->line;
- planes[1] = planes[0] + context->bytesperline;
- planes[2] = planes[1] + context->bytesperline;
-
- while(read_scanline_data(context->buf, context->buf_pos, planes, 3, context->num_planes, context->bytesperline, &line_bytes)) {
- pcx_chop_context_buf(context, line_bytes);
-
- for(i = 0; i < context->width; i++) {
- context->data[context->current_line * context->rowstride + i * 3 + 0] = planes[0][i];
- context->data[context->current_line * context->rowstride + i * 3 + 1] = planes[1][i];
- context->data[context->current_line * context->rowstride + i * 3 + 2] = planes[2][i];
- }
-
- if(context->updated_func)
- context->updated_func(context->pixbuf, 0, context->current_line, context->width, 1, context->user_data);
-
- context->current_line++;
-
- if(context->current_line == context->height) {
- context->current_task = PCX_TASK_DONE;
- return TRUE;
- }
- }
-
- return TRUE;
-}
-
-static gboolean
-gdk_pixbuf__pcx_load_increment(gpointer data, const guchar *buf, guint size,
- GError **error)
-{
- struct pcx_context *context = (struct pcx_context *)data;
- struct pcx_header *header;
- guint i;
- gboolean retval = TRUE;
-
- /* if context's buf isn't large enough to hold its current data plus the passed buf, increase its size */
- if(context->buf_pos + size > context->buf_size) {
- if(!pcx_resize_context_buf(context, sizeof(guchar) * (context->buf_pos + size))) {
- g_set_error_literal(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't allocate memory for context buffer"));
- return FALSE;
- }
- }
-
- for(i = 0; i < size; i++)
- context->buf[context->buf_pos++] = buf[i];
-
- if(context->current_task == PCX_TASK_LOAD_HEADER) {
- if(!context->header_loaded && context->buf_pos > sizeof(struct pcx_header)) { /* set header */
- gint width, height;
-
- memcpy(context->header, context->buf, sizeof(struct pcx_header));
- pcx_chop_context_buf(context, sizeof(struct pcx_header));
- header = context->header;
-
- /* convert the multi-byte header variables that will be used */
- header->xmin = GINT16_FROM_LE(header->xmin);
- header->ymin = GINT16_FROM_LE(header->ymin);
- header->xmax = GINT16_FROM_LE(header->xmax);
- header->ymax = GINT16_FROM_LE(header->ymax);
- header->bytesperline = GUINT16_FROM_LE(header->bytesperline);
-
-#ifdef PCX_DEBUG
- g_print ("Manufacturer %d\n"
- "Version %d\n"
- "Encoding %d\n"
- "Bits/Pixel %d\n"
- "Planes %d\n"
- "Palette %d\n",
- header->manufacturer, header->version,
- header->encoding, header->bitsperpixel,
- header->colorplanes, header->palettetype);
-#endif
-
- context->header_loaded = TRUE;
- fill_pcx_context(context);
-
- width = context->width;
- height = context->height;
- if(width <= 0 || height <= 0) {
- g_set_error_literal(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_CORRUPT_IMAGE, _("Image has invalid width and/or height"));
- return FALSE;
- }
- if (context->size_func)
- {
- (*context->size_func) (&width, &height, context->user_data);
- if (width == 0 || height == 0)
- return TRUE;
- }
-
- switch(context->bpp) {
- default:
- g_set_error_literal(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_UNKNOWN_TYPE, _("Image has unsupported bpp"));
- return FALSE;
- break;
- case 1:
- if(context->num_planes < 1 || context->num_planes > 4) {
- g_set_error(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_UNKNOWN_TYPE, _("Image has unsupported number of %d-bit planes"), 1);
- return FALSE;
- }
- break;
- case 2:
- case 4:
- case 8:
- if(context->num_planes != 1) {
- g_set_error(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_UNKNOWN_TYPE, _("Image has unsupported number of %d-bit planes"), (gint)context->bpp);
- return FALSE;
- }
- break;
- case 24:
- break; /* context's bpp is set to 24 if there are three 8-bit planes */
- }
-
-#ifdef PCX_DEBUG
- g_print("io-pcx: header loaded\n");
- g_print("bpp: %u\n", context->bpp);
- g_print("dimensions: %ux%u\n", context->width, context->height);
-#endif
-
- context->pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, context->width, context->height);
- if(!context->pixbuf) {
- g_set_error_literal(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't create new pixbuf"));
- return FALSE;
- }
- context->data = gdk_pixbuf_get_pixels(context->pixbuf);
- context->rowstride = gdk_pixbuf_get_rowstride(context->pixbuf);
-
- context->line = g_try_malloc(sizeof(guchar) * context->bytesperline * context->num_planes);
- if(!context->line) {
- g_set_error_literal(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't allocate memory for line data"));
- return FALSE;
- }
-
- if(context->bpp == 8) {
- context->p_data = g_try_malloc(sizeof(guchar) * context->width * context->height);
- if(!context->p_data) {
- g_set_error_literal(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY, _("Couldn't allocate memory for paletted data"));
- return FALSE;
- }
- }
-
- if(context->prepared_func)
- context->prepared_func(context->pixbuf, NULL, context->user_data);
-
- context->current_task = PCX_TASK_LOAD_DATA;
- }
-
- retval = TRUE;
- }
-
- if(context->current_task == PCX_TASK_LOAD_DATA) {
- switch(context->bpp) {
- default:
- g_set_error_literal(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_UNKNOWN_TYPE, _("Image has unsupported bpp"));
- retval = FALSE;
- break;
- case 1:
- retval = pcx_increment_load_data_1(context);
- break;
- case 2:
- retval = pcx_increment_load_data_2(context);
- break;
- case 4:
- retval = pcx_increment_load_data_4(context);
- break;
- case 8:
- retval = pcx_increment_load_data_8(context);
- break;
- case 24:
- retval = pcx_increment_load_data_24(context);
- break;
- }
- }
-
- return retval;
-}
-
-static gboolean
-gdk_pixbuf__pcx_stop_load(gpointer data, GError **error)
-{
- struct pcx_context *context = (struct pcx_context *)data;
-
- if(context->current_line != context->height) {
- g_set_error_literal(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED, _("Didn't get all lines of PCX image"));
- free_pcx_context(context, FALSE);
- return FALSE;
- }
-
- if(context->current_task == PCX_TASK_LOAD_PALETTE) {
- if(!pcx_load_palette_8(context)) {
- g_set_error_literal(error, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED, _("No palette found at end of PCX data"));
- free_pcx_context(context, FALSE);
- return FALSE;
- }
- }
-
- free_pcx_context(context, FALSE);
-
- return TRUE;
-}
-
-#ifndef INCLUDE_pcx
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__pcx_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
-{
- module->begin_load = gdk_pixbuf__pcx_begin_load;
- module->stop_load = gdk_pixbuf__pcx_stop_load;
- module->load_increment = gdk_pixbuf__pcx_load_increment;
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
-{
- static GdkPixbufModulePattern signature[] = {
- { "\x0a \x01", NULL, 100 },
- { "\x0a\x02\x01", NULL, 100 },
- { "\x0a\x03\x01", NULL, 100 },
- { "\x0a\x04\x01", NULL, 100 },
- { "\x0a\x05\x01", NULL, 100 },
- { NULL, NULL, 0 }
- };
- static gchar *mime_types[] = {
- "image/x-pcx",
- NULL,
- };
- static gchar *extensions[] = {
- "pcx",
- NULL,
- };
-
- info->name = "pcx";
- info->signature = signature;
- info->description = N_("The PCX image format");
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "LGPL";
-}
diff --git a/gdk-pixbuf/io-png.c b/gdk-pixbuf/io-png.c
deleted file mode 100644
index 844064a748..0000000000
--- a/gdk-pixbuf/io-png.c
+++ /dev/null
@@ -1,1117 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/* GdkPixbuf library - PNG image loader
- *
- * Copyright (C) 1999 Mark Crichton
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Authors: Mark Crichton <crichton@gimp.org>
- * 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 Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 <stdio.h>
-#include <stdlib.h>
-#include <png.h>
-#include "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-io.h"
-
-
-
-static gboolean
-setup_png_transformations(png_structp png_read_ptr, png_infop png_info_ptr,
- GError **error,
- png_uint_32* width_p, png_uint_32* height_p,
- int* color_type_p)
-{
- png_uint_32 width, height;
- int bit_depth, color_type, interlace_type, compression_type, filter_type;
- int channels;
-
- /* Get the image info */
-
- /* Must check bit depth, since png_get_IHDR generates an
- FPE on bit_depth 0.
- */
- bit_depth = png_get_bit_depth (png_read_ptr, png_info_ptr);
- if (bit_depth < 1 || bit_depth > 16) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Bits per channel of PNG image is invalid."));
- return FALSE;
- }
- png_get_IHDR (png_read_ptr, png_info_ptr,
- &width, &height,
- &bit_depth,
- &color_type,
- &interlace_type,
- &compression_type,
- &filter_type);
-
- /* set_expand() basically needs to be called unless
- we are already in RGB/RGBA mode
- */
- if (color_type == PNG_COLOR_TYPE_PALETTE &&
- bit_depth <= 8) {
-
- /* Convert indexed images to RGB */
- png_set_expand (png_read_ptr);
-
- } else if (color_type == PNG_COLOR_TYPE_GRAY &&
- bit_depth < 8) {
-
- /* Convert grayscale to RGB */
- png_set_expand (png_read_ptr);
-
- } else if (png_get_valid (png_read_ptr,
- png_info_ptr, PNG_INFO_tRNS)) {
-
- /* If we have transparency header, convert it to alpha
- channel */
- png_set_expand(png_read_ptr);
-
- } else if (bit_depth < 8) {
-
- /* If we have < 8 scale it up to 8 */
- png_set_expand(png_read_ptr);
-
-
- /* Conceivably, png_set_packing() is a better idea;
- * God only knows how libpng works
- */
- }
-
- /* If we are 16-bit, convert to 8-bit */
- if (bit_depth == 16) {
- png_set_strip_16(png_read_ptr);
- }
-
- /* If gray scale, convert to RGB */
- if (color_type == PNG_COLOR_TYPE_GRAY ||
- color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
- png_set_gray_to_rgb(png_read_ptr);
- }
-
- /* If interlaced, handle that */
- if (interlace_type != PNG_INTERLACE_NONE) {
- png_set_interlace_handling(png_read_ptr);
- }
-
- /* Update the info the reflect our transformations */
- png_read_update_info(png_read_ptr, png_info_ptr);
-
- png_get_IHDR (png_read_ptr, png_info_ptr,
- &width, &height,
- &bit_depth,
- &color_type,
- &interlace_type,
- &compression_type,
- &filter_type);
-
- *width_p = width;
- *height_p = height;
- *color_type_p = color_type;
-
- /* Check that the new info is what we want */
-
- if (width == 0 || height == 0) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Transformed PNG has zero width or height."));
- return FALSE;
- }
-
- if (bit_depth != 8) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Bits per channel of transformed PNG is not 8."));
- return FALSE;
- }
-
- if ( ! (color_type == PNG_COLOR_TYPE_RGB ||
- color_type == PNG_COLOR_TYPE_RGB_ALPHA) ) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Transformed PNG not RGB or RGBA."));
- return FALSE;
- }
-
- channels = png_get_channels(png_read_ptr, png_info_ptr);
- if ( ! (channels == 3 || channels == 4) ) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Transformed PNG has unsupported number of channels, must be 3 or 4."));
- return FALSE;
- }
- return TRUE;
-}
-
-static void
-png_simple_error_callback(png_structp png_save_ptr,
- png_const_charp error_msg)
-{
- GError **error;
-
- error = png_get_error_ptr(png_save_ptr);
-
- /* I don't trust libpng to call the error callback only once,
- * so check for already-set error
- */
- if (error && *error == NULL) {
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_FAILED,
- _("Fatal error in PNG image file: %s"),
- error_msg);
- }
-
- longjmp (png_save_ptr->jmpbuf, 1);
-}
-
-static void
-png_simple_warning_callback(png_structp png_save_ptr,
- png_const_charp warning_msg)
-{
- /* Don't print anything; we should not be dumping junk to
- * stderr, since that may be bad for some apps. If it's
- * important enough to display, we need to add a GError
- * **warning return location wherever we have an error return
- * location.
- */
-}
-
-static gboolean
-png_text_to_pixbuf_option (png_text text_ptr,
- gchar **key,
- gchar **value)
-{
- gboolean is_ascii = TRUE;
- int i;
-
- /* Avoid loading iconv if the text is plain ASCII */
- for (i = 0; i < text_ptr.text_length; i++)
- if (text_ptr.text[i] & 0x80) {
- is_ascii = FALSE;
- break;
- }
-
- if (is_ascii) {
- *value = g_strdup (text_ptr.text);
- } else {
- *value = g_convert (text_ptr.text, -1,
- "UTF-8", "ISO-8859-1",
- NULL, NULL, NULL);
- }
-
- if (*value) {
- *key = g_strconcat ("tEXt::", text_ptr.key, NULL);
- return TRUE;
- } else {
- g_warning ("Couldn't convert text chunk value to UTF-8.");
- *key = NULL;
- return FALSE;
- }
-}
-
-static png_voidp
-png_malloc_callback (png_structp o, png_size_t size)
-{
- return g_try_malloc (size);
-}
-
-static void
-png_free_callback (png_structp o, png_voidp x)
-{
- g_free (x);
-}
-
-/* Shared library entry point */
-static GdkPixbuf *
-gdk_pixbuf__png_image_load (FILE *f, GError **error)
-{
- GdkPixbuf * volatile pixbuf = NULL;
- png_structp png_ptr;
- png_infop info_ptr;
- png_textp text_ptr;
- gint i, ctype;
- png_uint_32 w, h;
- png_bytepp volatile rows = NULL;
- gint num_texts;
- gchar *key;
- gchar *value;
- gchar *icc_profile_base64;
- const gchar *icc_profile_title;
- const gchar *icc_profile;
- png_uint_32 icc_profile_size;
- guint32 retval;
- gint compression_type;
-
-#ifdef PNG_USER_MEM_SUPPORTED
- png_ptr = png_create_read_struct_2 (PNG_LIBPNG_VER_STRING,
- error,
- png_simple_error_callback,
- png_simple_warning_callback,
- NULL,
- png_malloc_callback,
- png_free_callback);
-#else
- png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING,
- error,
- png_simple_error_callback,
- png_simple_warning_callback);
-#endif
- if (!png_ptr)
- return NULL;
-
- info_ptr = png_create_info_struct (png_ptr);
- if (!info_ptr) {
- png_destroy_read_struct (&png_ptr, NULL, NULL);
- return NULL;
- }
-
- if (setjmp (png_ptr->jmpbuf)) {
- g_free (rows);
-
- if (pixbuf)
- g_object_unref (pixbuf);
-
- png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
- return NULL;
- }
-
- png_init_io (png_ptr, f);
- png_read_info (png_ptr, info_ptr);
-
- if (!setup_png_transformations(png_ptr, info_ptr, error, &w, &h, &ctype)) {
- png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
- return NULL;
- }
-
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, ctype & PNG_COLOR_MASK_ALPHA, 8, w, h);
-
- if (!pixbuf) {
- if (error && *error == NULL) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Insufficient memory to load PNG file"));
- }
-
-
- png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
- return NULL;
- }
-
- rows = g_new (png_bytep, h);
-
- for (i = 0; i < h; i++)
- rows[i] = pixbuf->pixels + i * pixbuf->rowstride;
-
- png_read_image (png_ptr, rows);
- png_read_end (png_ptr, info_ptr);
-
- if (png_get_text (png_ptr, info_ptr, &text_ptr, &num_texts)) {
- for (i = 0; i < num_texts; i++) {
- png_text_to_pixbuf_option (text_ptr[i], &key, &value);
- gdk_pixbuf_set_option (pixbuf, key, value);
- g_free (key);
- g_free (value);
- }
- }
-
-#if defined(PNG_cHRM_SUPPORTED)
- /* Extract embedded ICC profile */
- retval = png_get_iCCP (png_ptr, info_ptr,
- (png_charpp) &icc_profile_title, &compression_type,
- (png_charpp) &icc_profile, (png_uint_32*) &icc_profile_size);
- if (retval != 0) {
- icc_profile_base64 = g_base64_encode ((const guchar *) icc_profile, (gsize)icc_profile_size);
- gdk_pixbuf_set_option (pixbuf, "icc-profile", icc_profile_base64);
- g_free (icc_profile_base64);
- }
-#endif
-
- g_free (rows);
- png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
-
- return pixbuf;
-}
-
-/* I wish these avoided the setjmp()/longjmp() crap in libpng instead
- just allow you to change the error reporting. */
-static void png_error_callback (png_structp png_read_ptr,
- png_const_charp error_msg);
-
-static void png_warning_callback (png_structp png_read_ptr,
- png_const_charp warning_msg);
-
-/* Called at the start of the progressive load */
-static void png_info_callback (png_structp png_read_ptr,
- png_infop png_info_ptr);
-
-/* Called for each row; note that you will get duplicate row numbers
- for interlaced PNGs */
-static void png_row_callback (png_structp png_read_ptr,
- png_bytep new_row,
- png_uint_32 row_num,
- int pass_num);
-
-/* Called after reading the entire image */
-static void png_end_callback (png_structp png_read_ptr,
- png_infop png_info_ptr);
-
-typedef struct _LoadContext LoadContext;
-
-struct _LoadContext {
- png_structp png_read_ptr;
- png_infop png_info_ptr;
-
- GdkPixbufModuleSizeFunc size_func;
- GdkPixbufModulePreparedFunc prepare_func;
- GdkPixbufModuleUpdatedFunc update_func;
- gpointer notify_user_data;
-
- GdkPixbuf* pixbuf;
-
- /* row number of first row seen, or -1 if none yet seen */
-
- gint first_row_seen_in_chunk;
-
- /* pass number for the first row seen */
-
- gint first_pass_seen_in_chunk;
-
- /* row number of last row seen */
- gint last_row_seen_in_chunk;
-
- gint last_pass_seen_in_chunk;
-
- /* highest row number seen */
- gint max_row_seen_in_chunk;
-
- guint fatal_error_occurred : 1;
-
- GError **error;
-};
-
-static gpointer
-gdk_pixbuf__png_image_begin_load (GdkPixbufModuleSizeFunc size_func,
- GdkPixbufModulePreparedFunc prepare_func,
- GdkPixbufModuleUpdatedFunc update_func,
- gpointer user_data,
- GError **error)
-{
- LoadContext* lc;
-
- lc = g_new0(LoadContext, 1);
-
- lc->fatal_error_occurred = FALSE;
-
- lc->size_func = size_func;
- lc->prepare_func = prepare_func;
- lc->update_func = update_func;
- lc->notify_user_data = user_data;
-
- lc->first_row_seen_in_chunk = -1;
- lc->last_row_seen_in_chunk = -1;
- lc->first_pass_seen_in_chunk = -1;
- lc->last_pass_seen_in_chunk = -1;
- lc->max_row_seen_in_chunk = -1;
- lc->error = error;
-
- /* Create the main PNG context struct */
-
-#ifdef PNG_USER_MEM_SUPPORTED
- lc->png_read_ptr = png_create_read_struct_2 (PNG_LIBPNG_VER_STRING,
- lc, /* error/warning callback data */
- png_error_callback,
- png_warning_callback,
- NULL,
- png_malloc_callback,
- png_free_callback);
-#else
- lc->png_read_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
- lc, /* error/warning callback data */
- png_error_callback,
- png_warning_callback);
-#endif
- if (lc->png_read_ptr == NULL) {
- g_free(lc);
- /* error callback should have set the error */
- return NULL;
- }
-
- if (setjmp (lc->png_read_ptr->jmpbuf)) {
- if (lc->png_info_ptr)
- png_destroy_read_struct(&lc->png_read_ptr, NULL, NULL);
- g_free(lc);
- /* error callback should have set the error */
- return NULL;
- }
-
- /* Create the auxiliary context struct */
-
- lc->png_info_ptr = png_create_info_struct(lc->png_read_ptr);
-
- if (lc->png_info_ptr == NULL) {
- png_destroy_read_struct(&lc->png_read_ptr, NULL, NULL);
- g_free(lc);
- /* error callback should have set the error */
- return NULL;
- }
-
- png_set_progressive_read_fn(lc->png_read_ptr,
- lc, /* callback data */
- png_info_callback,
- png_row_callback,
- png_end_callback);
-
-
- /* We don't want to keep modifying error after returning here,
- * it may no longer be valid.
- */
- lc->error = NULL;
-
- return lc;
-}
-
-static gboolean
-gdk_pixbuf__png_image_stop_load (gpointer context, GError **error)
-{
- LoadContext* lc = context;
-
- g_return_val_if_fail(lc != NULL, TRUE);
-
- /* FIXME this thing needs to report errors if
- * we have unused image data
- */
-
- if (lc->pixbuf)
- g_object_unref (lc->pixbuf);
-
- png_destroy_read_struct(&lc->png_read_ptr, &lc->png_info_ptr, NULL);
- g_free(lc);
-
- return TRUE;
-}
-
-static gboolean
-gdk_pixbuf__png_image_load_increment(gpointer context,
- const guchar *buf, guint size,
- GError **error)
-{
- LoadContext* lc = context;
-
- g_return_val_if_fail(lc != NULL, FALSE);
-
- /* reset */
- lc->first_row_seen_in_chunk = -1;
- lc->last_row_seen_in_chunk = -1;
- lc->first_pass_seen_in_chunk = -1;
- lc->last_pass_seen_in_chunk = -1;
- lc->max_row_seen_in_chunk = -1;
- lc->error = error;
-
- /* Invokes our callbacks as needed */
- if (setjmp (lc->png_read_ptr->jmpbuf)) {
- lc->error = NULL;
- return FALSE;
- } else {
- png_process_data(lc->png_read_ptr, lc->png_info_ptr,
- (guchar*) buf, size);
- }
-
- if (lc->fatal_error_occurred) {
- lc->error = NULL;
- return FALSE;
- } else {
- if (lc->first_row_seen_in_chunk >= 0 && lc->update_func) {
- /* We saw at least one row */
- gint pass_diff = lc->last_pass_seen_in_chunk - lc->first_pass_seen_in_chunk;
-
- g_assert(pass_diff >= 0);
-
- if (pass_diff == 0) {
- /* start and end row were in the same pass */
- (lc->update_func)(lc->pixbuf, 0,
- lc->first_row_seen_in_chunk,
- lc->pixbuf->width,
- (lc->last_row_seen_in_chunk -
- lc->first_row_seen_in_chunk) + 1,
- lc->notify_user_data);
- } else if (pass_diff == 1) {
- /* We have from the first row seen to
- the end of the image (max row
- seen), then from the top of the
- image to the last row seen */
- /* first row to end */
- (lc->update_func)(lc->pixbuf, 0,
- lc->first_row_seen_in_chunk,
- lc->pixbuf->width,
- (lc->max_row_seen_in_chunk -
- lc->first_row_seen_in_chunk) + 1,
- lc->notify_user_data);
- /* top to last row */
- (lc->update_func)(lc->pixbuf,
- 0, 0,
- lc->pixbuf->width,
- lc->last_row_seen_in_chunk + 1,
- lc->notify_user_data);
- } else {
- /* We made at least one entire pass, so update the
- whole image */
- (lc->update_func)(lc->pixbuf,
- 0, 0,
- lc->pixbuf->width,
- lc->max_row_seen_in_chunk + 1,
- lc->notify_user_data);
- }
- }
-
- lc->error = NULL;
-
- return TRUE;
- }
-}
-
-/* Called at the start of the progressive load, once we have image info */
-static void
-png_info_callback (png_structp png_read_ptr,
- png_infop png_info_ptr)
-{
- LoadContext* lc;
- png_uint_32 width, height;
- png_textp png_text_ptr;
- int i, num_texts;
- int color_type;
- gboolean have_alpha = FALSE;
- gchar *icc_profile_base64;
- const gchar *icc_profile_title;
- const gchar *icc_profile;
- png_uint_32 icc_profile_size;
- guint32 retval;
- gint compression_type;
-
- lc = png_get_progressive_ptr(png_read_ptr);
-
- if (lc->fatal_error_occurred)
- return;
-
- if (!setup_png_transformations(lc->png_read_ptr,
- lc->png_info_ptr,
- lc->error,
- &width, &height, &color_type)) {
- lc->fatal_error_occurred = TRUE;
- return;
- }
-
- /* If we have alpha, set a flag */
- if (color_type & PNG_COLOR_MASK_ALPHA)
- have_alpha = TRUE;
-
- if (lc->size_func) {
- gint w = width;
- gint h = height;
- (* lc->size_func) (&w, &h, lc->notify_user_data);
-
- if (w == 0 || h == 0) {
- lc->fatal_error_occurred = TRUE;
- if (lc->error && *lc->error == NULL) {
- g_set_error_literal (lc->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_FAILED,
- _("Transformed PNG has zero width or height."));
- }
- return;
- }
- }
-
- lc->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, have_alpha, 8, width, height);
-
- if (lc->pixbuf == NULL) {
- /* Failed to allocate memory */
- lc->fatal_error_occurred = TRUE;
- if (lc->error && *lc->error == NULL) {
- g_set_error (lc->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Insufficient memory to store a %ld by %ld image; try exiting some applications to reduce memory usage"),
- width, height);
- }
- return;
- }
-
- /* Extract text chunks and attach them as pixbuf options */
-
- if (png_get_text (png_read_ptr, png_info_ptr, &png_text_ptr, &num_texts)) {
- for (i = 0; i < num_texts; i++) {
- gchar *key, *value;
-
- if (png_text_to_pixbuf_option (png_text_ptr[i],
- &key, &value)) {
- gdk_pixbuf_set_option (lc->pixbuf, key, value);
- g_free (key);
- g_free (value);
- }
- }
- }
-
-#if defined(PNG_cHRM_SUPPORTED)
- /* Extract embedded ICC profile */
- retval = png_get_iCCP (png_read_ptr, png_info_ptr,
- (png_charpp) &icc_profile_title, &compression_type,
- (png_charpp) &icc_profile, &icc_profile_size);
- if (retval != 0) {
- icc_profile_base64 = g_base64_encode ((const guchar *) icc_profile, (gsize)icc_profile_size);
- gdk_pixbuf_set_option (lc->pixbuf, "icc-profile", icc_profile_base64);
- g_free (icc_profile_base64);
- }
-#endif
-
- /* Notify the client that we are ready to go */
-
- if (lc->prepare_func)
- (* lc->prepare_func) (lc->pixbuf, NULL, lc->notify_user_data);
-
- return;
-}
-
-/* Called for each row; note that you will get duplicate row numbers
- for interlaced PNGs */
-static void
-png_row_callback (png_structp png_read_ptr,
- png_bytep new_row,
- png_uint_32 row_num,
- int pass_num)
-{
- LoadContext* lc;
- guchar* old_row = NULL;
-
- lc = png_get_progressive_ptr(png_read_ptr);
-
- if (lc->fatal_error_occurred)
- return;
-
- if (row_num >= lc->pixbuf->height) {
- lc->fatal_error_occurred = TRUE;
- if (lc->error && *lc->error == NULL) {
- g_set_error_literal (lc->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Fatal error reading PNG image file"));
- }
- return;
- }
-
- if (lc->first_row_seen_in_chunk < 0) {
- lc->first_row_seen_in_chunk = row_num;
- lc->first_pass_seen_in_chunk = pass_num;
- }
-
- lc->max_row_seen_in_chunk = MAX(lc->max_row_seen_in_chunk, ((gint)row_num));
- lc->last_row_seen_in_chunk = row_num;
- lc->last_pass_seen_in_chunk = pass_num;
-
- old_row = lc->pixbuf->pixels + (row_num * lc->pixbuf->rowstride);
-
- png_progressive_combine_row(lc->png_read_ptr, old_row, new_row);
-}
-
-/* Called after reading the entire image */
-static void
-png_end_callback (png_structp png_read_ptr,
- png_infop png_info_ptr)
-{
- LoadContext* lc;
-
- lc = png_get_progressive_ptr(png_read_ptr);
-
- if (lc->fatal_error_occurred)
- return;
-}
-
-static void
-png_error_callback(png_structp png_read_ptr,
- png_const_charp error_msg)
-{
- LoadContext* lc;
-
- lc = png_get_error_ptr(png_read_ptr);
-
- lc->fatal_error_occurred = TRUE;
-
- /* I don't trust libpng to call the error callback only once,
- * so check for already-set error
- */
- if (lc->error && *lc->error == NULL) {
- g_set_error (lc->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Fatal error reading PNG image file: %s"),
- error_msg);
- }
-
- longjmp (png_read_ptr->jmpbuf, 1);
-}
-
-static void
-png_warning_callback (png_structp png_read_ptr,
- png_const_charp warning_msg)
-{
- LoadContext* lc;
-
- lc = png_get_error_ptr(png_read_ptr);
-
- /* Don't print anything; we should not be dumping junk to
- * stderr, since that may be bad for some apps. If it's
- * important enough to display, we need to add a GError
- * **warning return location wherever we have an error return
- * location.
- */
-}
-
-
-/* Save */
-
-typedef struct {
- GdkPixbufSaveFunc save_func;
- gpointer user_data;
- GError **error;
-} SaveToFunctionIoPtr;
-
-static void
-png_save_to_callback_write_func (png_structp png_ptr,
- png_bytep data,
- png_size_t length)
-{
- SaveToFunctionIoPtr *ioptr = png_get_io_ptr (png_ptr);
-
- if (!ioptr->save_func ((gchar *)data, length, ioptr->error, ioptr->user_data)) {
- /* If save_func has already set an error, which it
- should have done, this won't overwrite it. */
- png_error (png_ptr, "write function failed");
- }
-}
-
-static void
-png_save_to_callback_flush_func (png_structp png_ptr)
-{
- ;
-}
-
-static gboolean real_save_png (GdkPixbuf *pixbuf,
- gchar **keys,
- gchar **values,
- GError **error,
- gboolean to_callback,
- FILE *f,
- GdkPixbufSaveFunc save_func,
- gpointer user_data)
-{
- png_structp png_ptr = NULL;
- png_infop info_ptr;
- png_textp text_ptr = NULL;
- guchar *ptr;
- guchar *pixels;
- int y;
- int i;
- png_bytep row_ptr;
- png_color_8 sig_bit;
- int w, h, rowstride;
- int has_alpha;
- int bpc;
- int num_keys;
- int compression = -1;
- gboolean success = TRUE;
- guchar *icc_profile = NULL;
- gsize icc_profile_size = 0;
- SaveToFunctionIoPtr to_callback_ioptr;
-
- num_keys = 0;
-
- if (keys && *keys) {
- gchar **kiter = keys;
- gchar **viter = values;
-
- while (*kiter) {
- if (strncmp (*kiter, "tEXt::", 6) == 0) {
- gchar *key = *kiter + 6;
- int len = strlen (key);
- if (len <= 1 || len > 79) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_BAD_OPTION,
- _("Keys for PNG text chunks must have at least 1 and at most 79 characters."));
- success = FALSE;
- goto cleanup;
- }
- for (i = 0; i < len; i++) {
- if ((guchar) key[i] > 127) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_BAD_OPTION,
- _("Keys for PNG text chunks must be ASCII characters."));
- success = FALSE;
- goto cleanup;
- }
- }
- num_keys++;
- } else if (strcmp (*kiter, "icc-profile") == 0) {
- /* decode from base64 */
- icc_profile = g_base64_decode (*viter, &icc_profile_size);
- if (icc_profile_size < 127) {
- /* This is a user-visible error */
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_BAD_OPTION,
- _("Color profile has invalid length %d."),
- (gint)icc_profile_size);
- success = FALSE;
- goto cleanup;
- }
- } else if (strcmp (*kiter, "compression") == 0) {
- char *endptr = NULL;
- compression = strtol (*viter, &endptr, 10);
-
- if (endptr == *viter) {
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_BAD_OPTION,
- _("PNG compression level must be a value between 0 and 9; value '%s' could not be parsed."),
- *viter);
- success = FALSE;
- goto cleanup;
- }
- if (compression < 0 || compression > 9) {
- /* This is a user-visible error;
- * lets people skip the range-checking
- * in their app.
- */
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_BAD_OPTION,
- _("PNG compression level must be a value between 0 and 9; value '%d' is not allowed."),
- compression);
- success = FALSE;
- goto cleanup;
- }
- } else {
- g_warning ("Unrecognized parameter (%s) passed to PNG saver.", *kiter);
- }
-
- ++kiter;
- ++viter;
- }
- }
-
- if (num_keys > 0) {
- text_ptr = g_new0 (png_text, num_keys);
- for (i = 0; i < num_keys; i++) {
- text_ptr[i].compression = PNG_TEXT_COMPRESSION_NONE;
- text_ptr[i].key = keys[i] + 6;
- text_ptr[i].text = g_convert (values[i], -1,
- "ISO-8859-1", "UTF-8",
- NULL, &text_ptr[i].text_length,
- NULL);
-
-#ifdef PNG_iTXt_SUPPORTED
- if (!text_ptr[i].text) {
- text_ptr[i].compression = PNG_ITXT_COMPRESSION_NONE;
- text_ptr[i].text = g_strdup (values[i]);
- text_ptr[i].text_length = 0;
- text_ptr[i].itxt_length = strlen (text_ptr[i].text);
- text_ptr[i].lang = NULL;
- text_ptr[i].lang_key = NULL;
- }
-#endif
-
- if (!text_ptr[i].text) {
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_BAD_OPTION,
- _("Value for PNG text chunk %s cannot be converted to ISO-8859-1 encoding."), keys[i] + 6);
- num_keys = i;
- for (i = 0; i < num_keys; i++)
- g_free (text_ptr[i].text);
- g_free (text_ptr);
- return FALSE;
- }
- }
- }
-
- bpc = gdk_pixbuf_get_bits_per_sample (pixbuf);
- w = gdk_pixbuf_get_width (pixbuf);
- h = gdk_pixbuf_get_height (pixbuf);
- rowstride = gdk_pixbuf_get_rowstride (pixbuf);
- has_alpha = gdk_pixbuf_get_has_alpha (pixbuf);
- pixels = gdk_pixbuf_get_pixels (pixbuf);
-
- png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING,
- error,
- png_simple_error_callback,
- png_simple_warning_callback);
- if (png_ptr == NULL) {
- success = FALSE;
- goto cleanup;
- }
-
- info_ptr = png_create_info_struct (png_ptr);
- if (info_ptr == NULL) {
- success = FALSE;
- goto cleanup;
- }
- if (setjmp (png_ptr->jmpbuf)) {
- success = FALSE;
- goto cleanup;
- }
-
- if (num_keys > 0) {
- png_set_text (png_ptr, info_ptr, text_ptr, num_keys);
- }
-
- if (to_callback) {
- to_callback_ioptr.save_func = save_func;
- to_callback_ioptr.user_data = user_data;
- to_callback_ioptr.error = error;
- png_set_write_fn (png_ptr, &to_callback_ioptr,
- png_save_to_callback_write_func,
- png_save_to_callback_flush_func);
- } else {
- png_init_io (png_ptr, f);
- }
-
- if (compression >= 0)
- png_set_compression_level (png_ptr, compression);
-
-#if defined(PNG_iCCP_SUPPORTED)
- /* the proper ICC profile title is encoded in the profile */
- if (icc_profile != NULL) {
- png_set_iCCP (png_ptr, info_ptr,
- "ICC profile", PNG_COMPRESSION_TYPE_BASE,
- (gchar*) icc_profile, icc_profile_size);
- }
-#endif
-
- if (has_alpha) {
- png_set_IHDR (png_ptr, info_ptr, w, h, bpc,
- PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE,
- PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
- } else {
- png_set_IHDR (png_ptr, info_ptr, w, h, bpc,
- PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
- PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
- }
- sig_bit.red = bpc;
- sig_bit.green = bpc;
- sig_bit.blue = bpc;
- sig_bit.alpha = bpc;
- png_set_sBIT (png_ptr, info_ptr, &sig_bit);
- png_write_info (png_ptr, info_ptr);
- png_set_shift (png_ptr, &sig_bit);
- png_set_packing (png_ptr);
-
- ptr = pixels;
- for (y = 0; y < h; y++) {
- row_ptr = (png_bytep)ptr;
- png_write_rows (png_ptr, &row_ptr, 1);
- ptr += rowstride;
- }
-
- png_write_end (png_ptr, info_ptr);
-
-cleanup:
- if (png_ptr != NULL)
- png_destroy_write_struct (&png_ptr, &info_ptr);
-
- g_free (icc_profile);
-
- if (text_ptr != NULL) {
- for (i = 0; i < num_keys; i++)
- g_free (text_ptr[i].text);
- g_free (text_ptr);
- }
-
- return success;
-}
-
-static gboolean
-gdk_pixbuf__png_image_save (FILE *f,
- GdkPixbuf *pixbuf,
- gchar **keys,
- gchar **values,
- GError **error)
-{
- return real_save_png (pixbuf, keys, values, error,
- FALSE, f, NULL, NULL);
-}
-
-static gboolean
-gdk_pixbuf__png_image_save_to_callback (GdkPixbufSaveFunc save_func,
- gpointer user_data,
- GdkPixbuf *pixbuf,
- gchar **keys,
- gchar **values,
- GError **error)
-{
- return real_save_png (pixbuf, keys, values, error,
- TRUE, NULL, save_func, user_data);
-}
-
-#ifndef INCLUDE_png
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__png_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
-{
- module->load = gdk_pixbuf__png_image_load;
- module->begin_load = gdk_pixbuf__png_image_begin_load;
- module->stop_load = gdk_pixbuf__png_image_stop_load;
- module->load_increment = gdk_pixbuf__png_image_load_increment;
- module->save = gdk_pixbuf__png_image_save;
- module->save_to_callback = gdk_pixbuf__png_image_save_to_callback;
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
-{
- static GdkPixbufModulePattern signature[] = {
- { "\x89PNG\r\n\x1a\x0a", NULL, 100 },
- { NULL, NULL, 0 }
- };
- static gchar * mime_types[] = {
- "image/png",
- NULL
- };
- static gchar * extensions[] = {
- "png",
- NULL
- };
-
- info->name = "png";
- info->signature = signature;
- info->description = N_("The PNG image format");
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_WRITABLE | GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "LGPL";
-}
diff --git a/gdk-pixbuf/io-pnm.c b/gdk-pixbuf/io-pnm.c
deleted file mode 100644
index f86826e678..0000000000
--- a/gdk-pixbuf/io-pnm.c
+++ /dev/null
@@ -1,1086 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* GdkPixbuf library - PNM image loader
- *
- * Copyright (C) 1999 Red Hat, Inc.
- *
- * Authors: Jeffrey Stedfast <fejj@helixcode.com>
- * Michael Fulbright <drmike@redhat.com>
- *
- * 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <setjmp.h>
-#include "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-io.h"
-
-
-#define PNM_BUF_SIZE 4096
-
-#define PNM_FATAL_ERR -1
-#define PNM_SUSPEND 0
-#define PNM_OK 1
-
-typedef enum {
- PNM_FORMAT_PGM = 1,
- PNM_FORMAT_PGM_RAW,
- PNM_FORMAT_PPM,
- PNM_FORMAT_PPM_RAW,
- PNM_FORMAT_PBM,
- PNM_FORMAT_PBM_RAW
-} PnmFormat;
-
-typedef struct {
- guchar buffer[PNM_BUF_SIZE];
- guchar *byte;
- guint nbytes;
-} PnmIOBuffer;
-
-typedef struct {
- GdkPixbufModuleUpdatedFunc updated_func;
- GdkPixbufModulePreparedFunc prepared_func;
- GdkPixbufModuleSizeFunc size_func;
- gpointer user_data;
-
- GdkPixbuf *pixbuf;
- guchar *pixels; /* incoming pixel data buffer */
- guchar *dptr; /* current position in pixbuf */
-
- PnmIOBuffer inbuf;
-
- guint width;
- guint height;
- guint maxval;
- guint rowstride;
- PnmFormat type;
-
- guint output_row; /* last row to be completed */
- guint output_col;
- gboolean did_prescan; /* are we in image data yet? */
- gboolean got_header; /* have we loaded pnm header? */
-
- guint scan_state;
-
- GError **error;
-
-} PnmLoaderContext;
-
-static GdkPixbuf *gdk_pixbuf__pnm_image_load (FILE *f, GError **error);
-static gpointer gdk_pixbuf__pnm_image_begin_load (GdkPixbufModuleSizeFunc size_func,
- GdkPixbufModulePreparedFunc func,
- GdkPixbufModuleUpdatedFunc func2,
- gpointer user_data,
- GError **error);
-static gboolean gdk_pixbuf__pnm_image_stop_load (gpointer context, GError **error);
-static gboolean gdk_pixbuf__pnm_image_load_increment (gpointer context,
- const guchar *buf, guint size,
- GError **error);
-
-static void explode_bitmap_into_buf (PnmLoaderContext *context);
-static void explode_gray_into_buf (PnmLoaderContext *context);
-
-
-/* explode bitmap data into rgb components */
-/* we need to know what the row so we can */
-/* do sub-byte expansion (since 1 byte = 8 pixels) */
-/* context->dptr MUST point at first byte in incoming data */
-/* which corresponds to first pixel of row y */
-static void
-explode_bitmap_into_buf (PnmLoaderContext *context)
-{
- gint j;
- guchar *from, *to, data;
- gint bit;
- guchar *dptr;
- gint wid, x;
-
- g_return_if_fail (context != NULL);
- g_return_if_fail (context->dptr != NULL);
-
- /* I'm no clever bit-hacker so I'm sure this can be optimized */
- dptr = context->dptr;
- wid = context->width;
-
- from = dptr + ((wid - 1) / 8);
- to = dptr + (wid - 1) * 3;
- bit = 7 - ((wid-1) % 8);
-
- /* get first byte and align properly */
- data = from[0];
- for (j = 0; j < bit; j++, data >>= 1);
-
- for (x = wid-1; x >= 0; x--) {
-/* g_print ("%c", (data & 1) ? '*' : ' '); */
-
- to[0] = to[1] = to[2] = (data & 0x01) ? 0x00 : 0xff;
-
- to -= 3;
- bit++;
-
- if (bit > 7 && x > 0) {
- from--;
- data = from[0];
- bit = 0;
- } else {
- data >>= 1;
- }
- }
-
-/* g_print ("\n"); */
-}
-
-/* explode gray image row into rgb components in pixbuf */
-static void
-explode_gray_into_buf (PnmLoaderContext *context)
-{
- gint j;
- guchar *from, *to;
- guint w;
-
- g_return_if_fail (context != NULL);
- g_return_if_fail (context->dptr != NULL);
-
- /* Expand grey->colour. Expand from the end of the
- * memory down, so we can use the same buffer.
- */
- w = context->width;
- from = context->dptr + w - 1;
- to = context->dptr + (w - 1) * 3;
- for (j = w - 1; j >= 0; j--) {
- to[0] = from[0];
- to[1] = from[0];
- to[2] = from[0];
- to -= 3;
- from--;
- }
-}
-
-/* skip over whitespace and comments in input buffer */
-static gint
-pnm_skip_whitespace (PnmIOBuffer *inbuf, GError **error)
-{
- register guchar *inptr;
- guchar *inend;
-
- g_return_val_if_fail (inbuf != NULL, PNM_FATAL_ERR);
- g_return_val_if_fail (inbuf->byte != NULL, PNM_FATAL_ERR);
-
- inend = inbuf->byte + inbuf->nbytes;
- inptr = inbuf->byte;
-
- for ( ; inptr < inend; inptr++) {
- if (*inptr == '#') {
- /* in comment - skip to the end of this line */
- for ( ; *inptr != '\n' && inptr < inend; inptr++)
- ;
-
- if ( inptr == inend || *inptr != '\n' ) {
- /* couldn't read whole comment */
- return PNM_SUSPEND;
- }
-
- } else if (!g_ascii_isspace (*inptr)) {
- inbuf->byte = inptr;
- inbuf->nbytes = (guint) (inend - inptr);
- return PNM_OK;
- }
- }
-
- inbuf->byte = inptr;
- inbuf->nbytes = (guint) (inend - inptr);
-
- return PNM_SUSPEND;
-}
-
-/* read next number from buffer */
-static gint
-pnm_read_next_value (PnmIOBuffer *inbuf, gint max_length, guint *value, GError **error)
-{
- register guchar *inptr, *word, *p;
- guchar *inend, buf[129];
- gchar *endptr;
- gint retval;
- glong result;
-
- g_return_val_if_fail (inbuf != NULL, PNM_FATAL_ERR);
- g_return_val_if_fail (inbuf->byte != NULL, PNM_FATAL_ERR);
- g_return_val_if_fail (value != NULL, PNM_FATAL_ERR);
-
- if (max_length < 0)
- max_length = 128;
-
- /* skip white space */
- if ((retval = pnm_skip_whitespace (inbuf, error)) != PNM_OK)
- return retval;
-
- inend = inbuf->byte + inbuf->nbytes;
- inptr = inbuf->byte;
-
- /* copy this pnm 'word' into a temp buffer */
- for (p = inptr, word = buf; (p < inend) && !g_ascii_isspace (*p) && (*p != '#') && (p - inptr < max_length); p++, word++)
- *word = *p;
- *word = '\0';
-
- /* hmmm, there must be more data to this 'word' */
- if (p == inend || (!g_ascii_isspace (*p) && (*p != '#') && (p - inptr < max_length)))
- return PNM_SUSPEND;
-
- /* get the value */
- result = strtol ((gchar *)buf, &endptr, 10);
- if (*endptr != '\0' || result < 0 || result > G_MAXUINT) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("PNM loader expected to find an integer, but didn't"));
- return PNM_FATAL_ERR;
- }
- *value = result;
-
- inbuf->byte = p;
- inbuf->nbytes = (guint) (inend - p);
-
- return PNM_OK;
-}
-
-/* returns PNM_OK, PNM_SUSPEND, or PNM_FATAL_ERR */
-static gint
-pnm_read_header (PnmLoaderContext *context)
-{
- PnmIOBuffer *inbuf;
- gint retval;
-
- g_return_val_if_fail (context != NULL, PNM_FATAL_ERR);
-
- inbuf = &context->inbuf;
-
- if (!context->type) {
- /* file must start with a 'P' followed by a numeral */
- /* so loop till we get enough data to determine type */
- if (inbuf->nbytes < 2)
- return PNM_SUSPEND;
-
- if (*inbuf->byte != 'P') {
- g_set_error_literal (context->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("PNM file has an incorrect initial byte"));
- return PNM_FATAL_ERR;
- }
-
- inbuf->byte++;
- inbuf->nbytes--;
-
- switch (*inbuf->byte) {
- case '1':
- context->type = PNM_FORMAT_PBM;
- break;
- case '2':
- context->type = PNM_FORMAT_PGM;
- break;
- case '3':
- context->type = PNM_FORMAT_PPM;
- break;
- case '4':
- context->type = PNM_FORMAT_PBM_RAW;
- break;
- case '5':
- context->type = PNM_FORMAT_PGM_RAW;
- break;
- case '6':
- context->type = PNM_FORMAT_PPM_RAW;
- break;
- default:
- g_set_error_literal (context->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("PNM file is not in a recognized PNM subformat"));
- return PNM_FATAL_ERR;
- }
-
- if (!inbuf->nbytes)
- return PNM_SUSPEND;
-
- inbuf->byte++;
- inbuf->nbytes--;
- }
-
- if (!context->width) {
- /* read the pixmap width */
- guint width = 0;
-
- retval = pnm_read_next_value (inbuf, -1, &width,
- context->error);
-
- if (retval != PNM_OK)
- return retval;
-
- if (!width) {
- g_set_error_literal (context->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("PNM file has an image width of 0"));
- return PNM_FATAL_ERR;
- }
-
- context->width = width;
- }
-
- if (!context->height) {
- /* read the pixmap height */
- guint height = 0;
-
- retval = pnm_read_next_value (inbuf, -1, &height,
- context->error);
-
- if (retval != PNM_OK)
- return retval;
-
- if (!height) {
- g_set_error_literal (context->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("PNM file has an image height of 0"));
- return PNM_FATAL_ERR;
- }
-
- context->height = height;
- }
-
- switch (context->type) {
- case PNM_FORMAT_PPM:
- case PNM_FORMAT_PPM_RAW:
- case PNM_FORMAT_PGM:
- case PNM_FORMAT_PGM_RAW:
- if (!context->maxval) {
- retval = pnm_read_next_value (inbuf, -1, &context->maxval,
- context->error);
-
- if (retval != PNM_OK)
- return retval;
-
- if (context->maxval == 0) {
- g_set_error_literal (context->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Maximum color value in PNM file is 0"));
- return PNM_FATAL_ERR;
- }
-
- if (context->maxval > 65535) {
- g_set_error_literal (context->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Maximum color value in PNM file is too large"));
- return PNM_FATAL_ERR;
- }
-
- }
- break;
- default:
- break;
- }
-
- return PNM_OK;
-}
-
-static gint
-pnm_read_raw_scanline (PnmLoaderContext *context)
-{
- PnmIOBuffer *inbuf;
- guint numbytes, offset;
- guint numpix = 0;
- guchar *dest;
- guint i;
-
- g_return_val_if_fail (context != NULL, PNM_FATAL_ERR);
-
- inbuf = &context->inbuf;
-
- switch (context->type) {
- case PNM_FORMAT_PBM_RAW:
- numpix = inbuf->nbytes * 8;
- break;
- case PNM_FORMAT_PGM_RAW:
- numpix = inbuf->nbytes;
- break;
- case PNM_FORMAT_PPM_RAW:
- numpix = inbuf->nbytes / 3;
- break;
- default:
- g_set_error_literal (context->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Raw PNM image type is invalid"));
- return PNM_FATAL_ERR;
- }
- if(context->maxval>255)
- numpix/=2;
-
- numpix = MIN (numpix, context->width - context->output_col);
-
- if (!numpix)
- return PNM_SUSPEND;
-
- context->dptr = context->pixels + context->output_row * context->rowstride;
-
- switch (context->type) {
- case PNM_FORMAT_PBM_RAW:
- numbytes = (numpix / 8) + ((numpix % 8) ? 1 : 0);
- offset = context->output_col / 8;
- break;
- case PNM_FORMAT_PGM_RAW:
- numbytes = numpix;
- offset = context->output_col;
- break;
- case PNM_FORMAT_PPM_RAW:
- numbytes = numpix * 3;
- offset = context->output_col * 3;
- break;
- default:
- g_set_error_literal (context->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Raw PNM image type is invalid"));
- return PNM_FATAL_ERR;
- }
- if(context->maxval>255)
- numbytes*=2;
-
- switch (context->type) {
- case PNM_FORMAT_PBM_RAW:
- dest = context->dptr + offset;
- memcpy (dest, inbuf->byte, numbytes);
- break;
- case PNM_FORMAT_PGM_RAW:
- case PNM_FORMAT_PPM_RAW:
- dest = context->dptr + offset;
-
- if (context->maxval == 255) {
- /* special-case optimization */
- memcpy (dest, inbuf->byte, numbytes);
- } else if(context->maxval == 65535) {
- /* optimized version of the next case */
- for(i=0; i < numbytes ; i+=2) {
- *dest++=inbuf->byte[i];
- }
- } else if(context->maxval > 255) {
- /* scale down to 256 colors */
- for(i=0; i < numbytes ; i+=2) {
- guint v=inbuf->byte[i]*256+inbuf->byte[i+1];
- *dest++=v*255/context->maxval;
- }
- } else {
- for (i = 0; i < numbytes; i++) {
- guchar *byte = inbuf->byte + i;
-
- /* scale the color to an 8-bit color depth */
- if (*byte > context->maxval)
- *dest++ = 255;
- else
- *dest++ = (guchar) (255 * *byte / context->maxval);
- }
- }
- break;
- default:
- g_set_error_literal (context->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Raw PNM image type is invalid"));
- return PNM_FATAL_ERR;
- }
-
- inbuf->byte += numbytes;
- inbuf->nbytes -= numbytes;
-
- context->output_col += numpix;
- if (context->output_col == context->width) {
- if (context->type == PNM_FORMAT_PBM_RAW)
- explode_bitmap_into_buf (context);
- else if (context->type == PNM_FORMAT_PGM_RAW)
- explode_gray_into_buf (context);
-
- context->output_col = 0;
- context->output_row++;
- } else {
- return PNM_SUSPEND;
- }
-
- return PNM_OK;
-}
-
-static gint
-pnm_read_ascii_mono_scanline (PnmLoaderContext *context)
-{
- PnmIOBuffer *inbuf;
- guint value;
- gint retval;
- guchar *dptr;
- gint max_length;
-
- if (context->type == PNM_FORMAT_PBM)
- max_length = 1;
- else
- max_length = -1;
-
- inbuf = &context->inbuf;
-
- context->dptr = context->pixels + context->output_row * context->rowstride;
-
- dptr = context->dptr + context->output_col * 3;
-
- while (TRUE) {
- retval = pnm_read_next_value (inbuf, max_length, &value, context->error);
- if (retval != PNM_OK)
- return retval;
-
- if (context->type == PNM_FORMAT_PBM) {
- value = value ? 0 : 0xff;
- }
- else {
- /* scale the color up or down to an 8-bit color depth */
- if (value > context->maxval)
- value = 255;
- else
- value = (guchar)(255 * value / context->maxval);
- }
-
- *dptr++ = value;
- *dptr++ = value;
- *dptr++ = value;
-
- context->output_col++;
-
- if (context->output_col == context->width) {
- context->output_col = 0;
- context->output_row++;
- break;
- }
- }
-
- return PNM_OK;
-}
-
-static gint
-pnm_read_ascii_color_scanline (PnmLoaderContext *context)
-{
- PnmIOBuffer *inbuf;
- guint value, i;
- guchar *dptr;
- gint retval;
-
- inbuf = &context->inbuf;
-
- context->dptr = context->pixels + context->output_row * context->rowstride;
-
- dptr = context->dptr + context->output_col * 3 + context->scan_state;
-
- while (TRUE) {
- for (i = context->scan_state; i < 3; i++) {
- retval = pnm_read_next_value (inbuf, -1, &value, context->error);
- if (retval != PNM_OK) {
- /* save state and return */
- context->scan_state = i;
- return retval;
- }
-
- if (value > context->maxval)
- *dptr++ = 255;
- else
- *dptr++ = (guchar)(255 * value / context->maxval);
- }
-
- context->scan_state = 0;
- context->output_col++;
-
- if (context->output_col == context->width) {
- context->output_col = 0;
- context->output_row++;
- break;
- }
- }
-
- return PNM_OK;
-}
-
-/* returns 1 if a scanline was converted, 0 means we ran out of data */
-static gint
-pnm_read_scanline (PnmLoaderContext *context)
-{
- gint retval;
-
- g_return_val_if_fail (context != NULL, PNM_FATAL_ERR);
-
- /* read in image data */
- /* for raw formats this is trivial */
- switch (context->type) {
- case PNM_FORMAT_PBM_RAW:
- case PNM_FORMAT_PGM_RAW:
- case PNM_FORMAT_PPM_RAW:
- retval = pnm_read_raw_scanline (context);
- if (retval != PNM_OK)
- return retval;
- break;
- case PNM_FORMAT_PBM:
- case PNM_FORMAT_PGM:
- retval = pnm_read_ascii_mono_scanline (context);
- if (retval != PNM_OK)
- return retval;
- break;
- case PNM_FORMAT_PPM:
- retval = pnm_read_ascii_color_scanline (context);
- if (retval != PNM_OK)
- return retval;
- break;
- default:
- g_set_error_literal (context->error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
- _("PNM image loader does not support this PNM subformat"));
-
- return PNM_FATAL_ERR;
- }
-
- return PNM_OK;
-}
-
-/* Shared library entry point */
-static GdkPixbuf *
-gdk_pixbuf__pnm_image_load (FILE *f, GError **error)
-{
- PnmLoaderContext context;
- PnmIOBuffer *inbuf;
- gint nbytes;
- gint retval;
-
- /* pretend to be doing progressive loading */
- context.updated_func = NULL;
- context.prepared_func = NULL;
- context.user_data = NULL;
- context.type = 0;
- context.inbuf.nbytes = 0;
- context.inbuf.byte = NULL;
- context.width = 0;
- context.height = 0;
- context.maxval = 0;
- context.pixels = NULL;
- context.pixbuf = NULL;
- context.got_header = FALSE;
- context.did_prescan = FALSE;
- context.scan_state = 0;
- context.error = error;
-
- inbuf = &context.inbuf;
-
- while (TRUE) {
- guint num_to_read;
-
- /* keep buffer as full as possible */
- num_to_read = PNM_BUF_SIZE - inbuf->nbytes;
-
- if (inbuf->byte != NULL && inbuf->nbytes > 0)
- memmove (inbuf->buffer, inbuf->byte, inbuf->nbytes);
-
- nbytes = fread (inbuf->buffer + inbuf->nbytes, 1, num_to_read, f);
-
- /* error checking */
- if (nbytes == 0) {
- /* we ran out of data? */
- if (context.pixbuf)
- g_object_unref (context.pixbuf);
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Premature end-of-file encountered"));
- return NULL;
- }
-
- inbuf->nbytes += nbytes;
- inbuf->byte = inbuf->buffer;
-
- /* get header if needed */
- if (!context.got_header) {
- retval = pnm_read_header (&context);
- if (retval == PNM_FATAL_ERR)
- return NULL;
- else if (retval == PNM_SUSPEND)
- continue;
-
- context.got_header = TRUE;
- }
-
- /* scan until we hit image data */
- if (!context.did_prescan) {
- switch (context.type) {
- case PNM_FORMAT_PBM_RAW:
- case PNM_FORMAT_PGM_RAW:
- case PNM_FORMAT_PPM_RAW:
- if (inbuf->nbytes <= 0)
- continue;
- /* raw formats require exactly one whitespace */
- if (!g_ascii_isspace(*(inbuf->byte)))
- {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Raw PNM formats require exactly one whitespace before sample data"));
- return NULL;
- }
- inbuf->nbytes--;
- inbuf->byte++;
- break;
- default:
- retval = pnm_skip_whitespace (inbuf,
- context.error);
- if (retval == PNM_FATAL_ERR)
- return NULL;
- else if (retval == PNM_SUSPEND)
- continue;
- break;
- }
- context.did_prescan = TRUE;
- context.output_row = 0;
- context.output_col = 0;
-
- context.pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
- context.width, context.height);
-
- if (!context.pixbuf) {
- /* Failed to allocate memory */
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Cannot allocate memory for loading PNM image"));
- return NULL;
- }
-
- context.rowstride = context.pixbuf->rowstride;
- context.pixels = context.pixbuf->pixels;
- }
-
- /* if we got here we're reading image data */
- while (context.output_row < context.height) {
- retval = pnm_read_scanline (&context);
-
- if (retval == PNM_SUSPEND) {
- break;
- } else if (retval == PNM_FATAL_ERR) {
- if (context.pixbuf)
- g_object_unref (context.pixbuf);
-
- return NULL;
- }
- }
-
- if (context.output_row < context.height)
- continue;
- else
- break;
- }
-
- return context.pixbuf;
-}
-
-/*
- * func - called when we have pixmap created (but no image data)
- * user_data - passed as arg 1 to func
- * return context (opaque to user)
- */
-
-static gpointer
-gdk_pixbuf__pnm_image_begin_load (GdkPixbufModuleSizeFunc size_func,
- GdkPixbufModulePreparedFunc prepared_func,
- GdkPixbufModuleUpdatedFunc updated_func,
- gpointer user_data,
- GError **error)
-{
- PnmLoaderContext *context;
-
- context = g_try_malloc (sizeof (PnmLoaderContext));
- if (!context) {
- g_set_error_literal (error, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Insufficient memory to load PNM context struct"));
- return NULL;
- }
- memset (context, 0, sizeof (PnmLoaderContext));
- context->size_func = size_func;
- context->prepared_func = prepared_func;
- context->updated_func = updated_func;
- context->user_data = user_data;
- context->width = 0;
- context->height = 0;
- context->maxval = 0;
- context->pixbuf = NULL;
- context->pixels = NULL;
- context->got_header = FALSE;
- context->did_prescan = FALSE;
- context->scan_state = 0;
-
- context->inbuf.nbytes = 0;
- context->inbuf.byte = NULL;
-
- context->error = error;
-
- return (gpointer) context;
-}
-
-/*
- * context - returned from image_begin_load
- *
- * free context, unref gdk_pixbuf
- */
-static gboolean
-gdk_pixbuf__pnm_image_stop_load (gpointer data,
- GError **error)
-{
- PnmLoaderContext *context = (PnmLoaderContext *) data;
- gboolean retval = TRUE;
-
- g_return_val_if_fail (context != NULL, TRUE);
-
- if (context->pixbuf)
- g_object_unref (context->pixbuf);
-
-#if 0
- /* We should ignore trailing newlines and we can't
- generally complain about trailing stuff at all, since
- pnm allows to put multiple images in a file
- */
- if (context->inbuf.nbytes > 0) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Unexpected end of PNM image data"));
- retval = FALSE;
- }
-#endif
-
- g_free (context);
-
- return retval;
-}
-
-/*
- * context - from image_begin_load
- * buf - new image data
- * size - length of new image data
- *
- * append image data onto inrecrementally built output image
- */
-static gboolean
-gdk_pixbuf__pnm_image_load_increment (gpointer data,
- const guchar *buf, guint size,
- GError **error)
-{
- PnmLoaderContext *context = (PnmLoaderContext *)data;
- PnmIOBuffer *inbuf;
- const guchar *bufhd;
- guint num_left, spinguard;
- gint retval;
-
- g_return_val_if_fail (context != NULL, FALSE);
- g_return_val_if_fail (buf != NULL, FALSE);
-
- context->error = error;
-
- bufhd = buf;
- inbuf = &context->inbuf;
-
- num_left = size;
- spinguard = 0;
- while (TRUE) {
- guint num_to_copy;
-
- /* keep buffer as full as possible */
- num_to_copy = MIN (PNM_BUF_SIZE - inbuf->nbytes, num_left);
-
- if (num_to_copy == 0)
- spinguard++;
-
- if (spinguard > 1)
- return TRUE;
-
- if (inbuf->byte != NULL && inbuf->nbytes > 0)
- memmove (inbuf->buffer, inbuf->byte, inbuf->nbytes);
-
- memcpy (inbuf->buffer + inbuf->nbytes, bufhd, num_to_copy);
- bufhd += num_to_copy;
- inbuf->nbytes += num_to_copy;
- inbuf->byte = inbuf->buffer;
- num_left -= num_to_copy;
-
- /* ran out of data and we haven't exited main loop */
- if (inbuf->nbytes == 0)
- return TRUE;
-
- /* get header if needed */
- if (!context->got_header) {
- retval = pnm_read_header (context);
-
- if (retval == PNM_FATAL_ERR)
- return FALSE;
- else if (retval == PNM_SUSPEND)
- continue;
-
- context->got_header = TRUE;
- }
-
- if (context->size_func) {
- gint w = context->width;
- gint h = context->height;
- (*context->size_func) (&w, &h, context->user_data);
-
- if (w == 0 || h == 0)
- return FALSE;
- }
-
-
- /* scan until we hit image data */
- if (!context->did_prescan) {
- switch (context->type) {
- case PNM_FORMAT_PBM_RAW:
- case PNM_FORMAT_PGM_RAW:
- case PNM_FORMAT_PPM_RAW:
- if (inbuf->nbytes <= 0)
- continue;
- /* raw formats require exactly one whitespace */
- if (!g_ascii_isspace(*(inbuf->byte)))
- {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Raw PNM formats require exactly one whitespace before sample data"));
- return FALSE;
- }
- inbuf->nbytes--;
- inbuf->byte++;
- break;
- default:
- retval = pnm_skip_whitespace (inbuf,
- context->error);
- if (retval == PNM_FATAL_ERR)
- return FALSE;
- else if (retval == PNM_SUSPEND)
- continue;
- break;
- }
- context->did_prescan = TRUE;
- context->output_row = 0;
- context->output_col = 0;
-
- context->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
- FALSE,
- 8,
- context->width,
- context->height);
-
- if (context->pixbuf == NULL) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Insufficient memory to load PNM file"));
- return FALSE;
- }
-
- context->pixels = context->pixbuf->pixels;
- context->rowstride = context->pixbuf->rowstride;
-
- /* Notify the client that we are ready to go */
- if (context->prepared_func)
- (* context->prepared_func) (context->pixbuf,
- NULL,
- context->user_data);
- }
-
- /* if we got here we're reading image data */
- while (context->output_row < context->height) {
- retval = pnm_read_scanline (context);
-
- if (retval == PNM_SUSPEND) {
- break;
- } else if (retval == PNM_FATAL_ERR) {
- return FALSE;
- } else if (retval == PNM_OK && context->updated_func) {
- /* send updated signal */
- (* context->updated_func) (context->pixbuf,
- 0,
- context->output_row-1,
- context->width,
- 1,
- context->user_data);
- }
- }
-
- if (context->output_row < context->height)
- continue;
- else
- break;
- }
-
- return TRUE;
-}
-
-#ifndef INCLUDE_pnm
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__pnm_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
-{
- module->load = gdk_pixbuf__pnm_image_load;
- module->begin_load = gdk_pixbuf__pnm_image_begin_load;
- module->stop_load = gdk_pixbuf__pnm_image_stop_load;
- module->load_increment = gdk_pixbuf__pnm_image_load_increment;
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
-{
- static GdkPixbufModulePattern signature[] = {
- { "P1", NULL, 100 },
- { "P2", NULL, 100 },
- { "P3", NULL, 100 },
- { "P4", NULL, 100 },
- { "P5", NULL, 100 },
- { "P6", NULL, 100 },
- { NULL, NULL, 0 }
- };
- static gchar * mime_types[] = {
- "image/x-portable-anymap",
- "image/x-portable-bitmap",
- "image/x-portable-graymap",
- "image/x-portable-pixmap",
- NULL
- };
- static gchar * extensions[] = {
- "pnm",
- "pbm",
- "pgm",
- "ppm",
- NULL
- };
-
- info->name = "pnm";
- info->signature = signature;
- info->description = N_("The PNM/PBM/PGM/PPM image format family");
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "LGPL";
-}
diff --git a/gdk-pixbuf/io-qtif.c b/gdk-pixbuf/io-qtif.c
deleted file mode 100644
index a1c57ba08e..0000000000
--- a/gdk-pixbuf/io-qtif.c
+++ /dev/null
@@ -1,608 +0,0 @@
-/* -*- mode: C; c-file-style: "linux" -*- */
-/* GdkPixbuf library - QTIF image loader
- *
- * This module extracts image data from QTIF format and uses
- * other GDK pixbuf modules to decode the image data.
- *
- * Copyright (C) 2008 Kevin Peng
- *
- * Authors: Kevin Peng <kevin@zycomtech.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <setjmp.h>
-#include "gdk-pixbuf.h"
-#include "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-io.h"
-
-/***
- * Definitions
- */
-/* Read buffer size */
-#define READ_BUFFER_SIZE 8192
-
-/* Only allow atom of size up to 10MB. */
-#define ATOM_SIZE_MAX 100000000
-
-/* Aborts after going to through this many atoms. */
-#define QTIF_ATOM_COUNT_MAX 10u
-
-/* QTIF static image data tag "idat". */
-#define QTIF_TAG_IDATA 0x69646174u
-
-
-/***
- * Types
- */
-/* QTIF State */
-typedef enum {
- STATE_READY,
- STATE_DATA,
- STATE_OTHER
-} QTIFState;
-
-/* QTIF Atom Header */
-typedef struct {
- guint32 length;
- guint32 tag;
-} QtHeader;
-
-/* QTIF loader context */
-typedef struct {
- GdkPixbufLoader *loader;
- gpointer user_data;
- QTIFState state;
- guint32 run_length;
- gint atom_count;
-
- guchar header_buffer[sizeof(QtHeader)];
-
- GdkPixbufModuleSizeFunc size_func;
- GdkPixbufModulePreparedFunc prepare_func;
- GdkPixbufModuleUpdatedFunc update_func;
- gint cb_prepare_count;
- gint cb_update_count;
-} QTIFContext;
-
-/***
- * Local function prototypes
- */
-static GdkPixbuf *gdk_pixbuf__qtif_image_load (FILE *f, GError **error);
-static gpointer gdk_pixbuf__qtif_image_begin_load (GdkPixbufModuleSizeFunc size_func,
- GdkPixbufModulePreparedFunc prepare_func,
- GdkPixbufModuleUpdatedFunc update_func,
- gpointer user_data,
- GError **error);
-static gboolean gdk_pixbuf__qtif_image_stop_load (gpointer context, GError **error);
-static gboolean gdk_pixbuf__qtif_image_load_increment(gpointer context,
- const guchar *buf, guint size,
- GError **error);
-static gboolean gdk_pixbuf__qtif_image_create_loader (QTIFContext *context, GError **error);
-static gboolean gdk_pixbuf__qtif_image_free_loader (QTIFContext *context, GError **error);
-
-static void gdk_pixbuf__qtif_cb_size_prepared(GdkPixbufLoader *loader,
- gint width,
- gint height,
- gpointer user_data);
-static void gdk_pixbuf__qtif_cb_area_prepared(GdkPixbufLoader *loader, gpointer user_data);
-static void gdk_pixbuf__qtif_cb_area_updated(GdkPixbufLoader *loader,
- gint x,
- gint y,
- gint width,
- gint height,
- gpointer user_data);
-
-/***
- * Function definitions.
- */
-
-/* Load QTIF from a file handler. */
-static GdkPixbuf *gdk_pixbuf__qtif_image_load (FILE *f, GError **error)
-{
- guint count;
-
- if(f == NULL)
- {
- g_set_error_literal (error, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_BAD_OPTION,
- _("Input file descriptor is NULL."));
- return NULL;
- }
-
- for(count = QTIF_ATOM_COUNT_MAX; count != 0u; count--)
- {
- QtHeader hdr;
- size_t rd;
-
- /* Read QtHeader. */
- rd = fread(&hdr, 1, sizeof(QtHeader), f);
- if(rd != sizeof(QtHeader))
- {
- g_set_error_literal(error, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Failed to read QTIF header"));
- return NULL;
- }
-
- hdr.length = GUINT32_FROM_BE(hdr.length) - sizeof(QtHeader);
- if(hdr.length > ATOM_SIZE_MAX)
- {
- g_set_error(error, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("QTIF atom size too large (%d bytes)"), hdr.length);
- return NULL;
- }
-
- switch(GUINT32_FROM_BE(hdr.tag))
- {
- case QTIF_TAG_IDATA: /* "idat" data atom. */
- {
- /* Load image using GdkPixbufLoader. */
- guchar *buf;
- GdkPixbufLoader *loader;
- GdkPixbuf *pixbuf = NULL;
- GError *tmp = NULL;
-
- /* Allocate read buffer. */
- buf = g_try_malloc(READ_BUFFER_SIZE);
- if(buf == NULL)
- {
- g_set_error(error, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Failed to allocate %d bytes for file read buffer"), READ_BUFFER_SIZE);
- return NULL;
- }
-
- /* Create GdkPixbufLoader. */
- loader = gdk_pixbuf_loader_new();
- if(loader == NULL)
- {
- g_set_error(error, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("QTIF atom size too large (%d bytes)"), hdr.length);
- goto clean_up;
- }
-
- /* Read atom data. */
- while(hdr.length != 0u)
- {
- rd = (hdr.length > READ_BUFFER_SIZE) ? READ_BUFFER_SIZE : hdr.length;
-
- rd = fread(buf, 1, rd, f);
- if(rd < 0)
- {
- g_set_error(error, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("File error when reading QTIF atom: %s"), g_strerror(errno));
- break;
- }
-
- if(!gdk_pixbuf_loader_write(loader, buf, rd, &tmp))
- {
- g_propagate_error (error, tmp);
- break;
- }
- hdr.length -= rd;
- }
-
-clean_up:
- /* Release loader */
- if(loader != NULL)
- {
- gdk_pixbuf_loader_close(loader, NULL);
- pixbuf = gdk_pixbuf_loader_get_pixbuf(loader);
- if(pixbuf != NULL)
- {
- g_object_ref(pixbuf);
- }
- g_object_unref(loader);
- }
- if(buf != NULL)
- {
- g_free(buf);
- }
- return pixbuf;
- }
-
- default:
- /* Skip any other types of atom. */
- if(!fseek(f, hdr.length, SEEK_CUR))
- {
- g_set_error(error, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Failed to skip the next %d bytes with seek()."), hdr.length);
- return NULL;
- }
- break;
- }
- }
- return NULL;
-}
-
-/* Incremental load begin. */
-static gpointer gdk_pixbuf__qtif_image_begin_load (GdkPixbufModuleSizeFunc size_func,
- GdkPixbufModulePreparedFunc prepare_func,
- GdkPixbufModuleUpdatedFunc update_func,
- gpointer user_data,
- GError **error)
-{
- QTIFContext *context;
-
- /* Create context struct. */
- context = g_new0(QTIFContext, 1);
- if(context == NULL)
- {
- g_set_error_literal (error, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Failed to allocate QTIF context structure."));
- return NULL;
- }
-
- /* Fill context parameters. */
- context->loader = NULL;
- context->user_data = user_data;
- context->state = STATE_READY;
- context->run_length = 0u;
- context->atom_count = QTIF_ATOM_COUNT_MAX;
- context->size_func = size_func;
- context->prepare_func = prepare_func;
- context->update_func = update_func;
-
- return context;
-}
-
-/* Incremental load clean up. */
-static gboolean gdk_pixbuf__qtif_image_stop_load (gpointer data, GError **error)
-{
- QTIFContext *context = (QTIFContext *)data;
- gboolean ret = TRUE;
-
- if(context->loader != NULL)
- {
- GError *tmp = NULL;
-
- ret = gdk_pixbuf__qtif_image_free_loader(context, &tmp);
- if(!ret)
- {
- g_propagate_error (error, tmp);
- }
- }
- g_free(context);
-
- return ret;
-}
-
-/* Create a new GdkPixbufLoader and connect to its signals. */
-static gboolean gdk_pixbuf__qtif_image_create_loader (QTIFContext *context, GError **error)
-{
- GError *tmp = NULL;
-
- if(context == NULL)
- {
- return FALSE;
- }
-
- /* Free existing loader. */
- if(context->loader != NULL)
- {
- gdk_pixbuf__qtif_image_free_loader(context, &tmp);
- }
-
- /* Create GdkPixbufLoader object. */
- context->loader = gdk_pixbuf_loader_new();
- if(context->loader == NULL)
- {
- g_set_error_literal (error, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_FAILED,
- _("Failed to create GdkPixbufLoader object."));
- return FALSE;
- }
-
- /* Connect signals. */
- context->cb_prepare_count = 0;
- context->cb_update_count = 0;
- if(context->size_func != NULL)
- {
- g_signal_connect(context->loader, "size-prepared",
- G_CALLBACK(gdk_pixbuf__qtif_cb_size_prepared),
- context);
- }
- if(context->prepare_func != NULL)
- {
- g_signal_connect(context->loader, "area-prepared",
- G_CALLBACK(gdk_pixbuf__qtif_cb_area_prepared),
- context);
- }
- if(context->update_func != NULL)
- {
- g_signal_connect(context->loader, "area-updated",
- G_CALLBACK(gdk_pixbuf__qtif_cb_area_updated),
- context);
- }
- return TRUE;
-}
-
-/* Free the GdkPixbufLoader and perform callback if haven't done so. */
-static gboolean gdk_pixbuf__qtif_image_free_loader (QTIFContext *context, GError **error)
-{
- GdkPixbuf *pixbuf;
- GError *tmp = NULL;
- gboolean ret;
-
- if((context == NULL) || (context->loader == NULL))
- {
- return FALSE;
- }
-
- /* Close GdkPixbufLoader. */
- ret = gdk_pixbuf_loader_close(context->loader, &tmp);
- if(!ret)
- {
- g_propagate_error (error, tmp);
- }
-
-
- /* Get GdkPixbuf from GdkPixbufLoader. */
- pixbuf = gdk_pixbuf_loader_get_pixbuf(context->loader);
- if(pixbuf != NULL)
- {
- g_object_ref(pixbuf);
- }
-
- /* Free GdkPixbufLoader. */
- g_object_ref(context->loader);
- context->loader = NULL;
-
- if(pixbuf != NULL)
- {
- /* Callback functions should be called for at least once. */
- if((context->prepare_func != NULL) && (context->cb_prepare_count == 0))
- {
- (context->prepare_func)(pixbuf, NULL, context->user_data);
- }
-
- if((context->update_func != NULL) && (context->cb_update_count == 0))
- {
- gint width;
- gint height;
-
- width = gdk_pixbuf_get_width(pixbuf);
- height = gdk_pixbuf_get_height(pixbuf);
- (context->update_func)(pixbuf, 0, 0, width, height, context->user_data);
- }
-
- /* Free GdkPixbuf (callback function should ref it). */
- g_object_ref(pixbuf);
- }
-
- return ret;
-}
-
-
-/* Incrementally load the next chunk of data. */
-static gboolean gdk_pixbuf__qtif_image_load_increment (gpointer data,
- const guchar *buf, guint size,
- GError **error)
-{
- QTIFContext *context = (QTIFContext *)data;
- GError *tmp = NULL;
- gboolean ret = TRUE; /* Return TRUE for insufficient data. */
-
- while(ret && (size != 0u))
- {
- switch(context->state)
- {
- case STATE_READY:
- /* Abort if we have seen too mant atoms. */
- if(context->atom_count == 0u)
- {
- g_set_error_literal (error, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Failed to find an image data atom."));
- return FALSE;
- }
- context->atom_count--;
-
- /* Copy to header buffer in context, in case supplied data is not enough. */
- while(context->run_length < sizeof(QtHeader))
- {
- context->header_buffer[context->run_length] = *buf;
- context->run_length++;
- buf++;
- size--;
- }
-
- /* Parse buffer as QT header. */
- if(context->run_length == sizeof(QtHeader))
- {
- QtHeader *hdr = (QtHeader *)context->header_buffer;
- context->run_length = GUINT32_FROM_BE(hdr->length) - sizeof(QtHeader);
-
- /* Atom max size check. */
- if(context->run_length > ATOM_SIZE_MAX)
- {
- g_set_error(error, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("QTIF atom size too large (%d bytes)"), hdr->length);
- return FALSE;
- }
-
- /* Set state according to atom type. */
- if(GUINT32_FROM_BE(hdr->tag) == QTIF_TAG_IDATA)
- {
- GError *tmp = NULL;
-
- context->state = STATE_DATA;
-
- /* Create GdkPixbufLoader for this image data. */
- ret = gdk_pixbuf__qtif_image_create_loader(context, &tmp);
- if(!ret)
- {
- g_propagate_error (error, tmp);
- }
- }
- else
- {
- context->state = STATE_OTHER;
- }
- }
- break;
-
- default: /* Both STATE_DATA and STATE_OTHER will come here. */
- /* Check for atom boundary. */
- if(context->run_length > size)
- {
- /* Supply image data to GdkPixbufLoader if in STATE_DATA. */
- if(context->state == STATE_DATA)
- {
- tmp = NULL;
- ret = gdk_pixbuf_loader_write(context->loader, buf, size, &tmp);
- if(!ret && (error != NULL) && (*error == NULL))
- {
- g_propagate_error (error, tmp);
- }
- }
- context->run_length -= size;
- size = 0u;
- }
- else
- {
- /* Supply image data to GdkPixbufLoader if in STATE_DATA. */
- if(context->state == STATE_DATA)
- {
- gboolean r;
-
- /* Here we should have concluded a complete image atom. */
- tmp = NULL;
- ret = gdk_pixbuf_loader_write(context->loader, buf, context->run_length, &tmp);
- if(!ret && (error != NULL) && (*error == NULL))
- {
- g_propagate_error (error, tmp);
- }
-
- /* Free GdkPixbufLoader and handle callback. */
- tmp = NULL;
- r = gdk_pixbuf__qtif_image_free_loader(context, &tmp);
- if(!r)
- {
- if((error != NULL) && (*error == NULL))
- {
- g_propagate_error (error, tmp);
- }
- ret = FALSE;
- }
- }
- buf = &buf[context->run_length];
- size -= context->run_length;
- context->run_length = 0u;
- context->state = STATE_READY;
- }
- break;
- }
- }
-
- return ret;
-}
-
-/* Event handlers */
-static void gdk_pixbuf__qtif_cb_size_prepared(GdkPixbufLoader *loader,
- gint width,
- gint height,
- gpointer user_data)
-{
- QTIFContext *context = (QTIFContext *)user_data;
- if((context != NULL) && (context->size_func != NULL))
- {
- (context->size_func)(&width, &height, context->user_data);
- context->cb_prepare_count++;
- }
-}
-
-static void gdk_pixbuf__qtif_cb_area_prepared(GdkPixbufLoader *loader, gpointer user_data)
-{
- QTIFContext *context = (QTIFContext *)user_data;
- if((loader != NULL) && (context != NULL) && (context->prepare_func != NULL))
- {
- GdkPixbuf *pixbuf = gdk_pixbuf_loader_get_pixbuf(context->loader);
- (context->prepare_func)(pixbuf, NULL, context->user_data);
- context->cb_update_count++;
- }
-}
-
-static void gdk_pixbuf__qtif_cb_area_updated(GdkPixbufLoader *loader,
- gint x,
- gint y,
- gint width,
- gint height,
- gpointer user_data)
-{
- QTIFContext *context = (QTIFContext *)user_data;
- if((loader != NULL) && (context != NULL) && (context->update_func != NULL))
- {
- GdkPixbuf *pixbuf = gdk_pixbuf_loader_get_pixbuf(context->loader);
- (context->update_func)(pixbuf, x, y, width, height, context->user_data);
- }
-}
-
-
-#ifndef INCLUDE_qtif
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__qtif_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
-{
- module->load = gdk_pixbuf__qtif_image_load;
- module->begin_load = gdk_pixbuf__qtif_image_begin_load;
- module->stop_load = gdk_pixbuf__qtif_image_stop_load;
- module->load_increment = gdk_pixbuf__qtif_image_load_increment;
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
-{
- static GdkPixbufModulePattern signature[] = {
- { "abcdidsc", "xxxx ", 100 },
- { "abcdidat", "xxxx ", 100 },
- { NULL, NULL, 0 }
- };
- static gchar * mime_types[] = {
- "image/x-quicktime",
- "image/qtif",
- NULL
- };
- static gchar * extensions[] = {
- "qtif",
- "qif",
- NULL
- };
-
- info->name = "qtif";
- info->signature = signature;
- info->description = N_("The QTIF image format");
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "LGPL";
-}
-
diff --git a/gdk-pixbuf/io-ras.c b/gdk-pixbuf/io-ras.c
deleted file mode 100644
index 2a5dae8964..0000000000
--- a/gdk-pixbuf/io-ras.c
+++ /dev/null
@@ -1,551 +0,0 @@
-/* -*- mode: C; c-file-style: "linux" -*- */
-/* GdkPixbuf library - SUNRAS image loader
- *
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Authors: Arjan van de Ven <arjan@fenrus.demon.nl>
- * Federico Mena-Quintero <federico@gimp.org>
- *
- * Based on io-gif.c, io-tiff.c and io-png.c
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.
- */
-
-/*
-
-Known bugs:
- * Compressed rasterfiles don't work yet
-
-*/
-
-#include "config.h"
-#include <stdio.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <string.h>
-#include "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-io.h"
-
-
-
-/*
- Header structure for sunras files.
- All values are in big-endian order on disk
-
- Note: Every scanline is padded to be a multiple of 16 bits
- */
-
-struct rasterfile {
- guint magic;
- guint width;
- guint height;
- guint depth;
- guint length;
- guint type;
- guint maptype;
- guint maplength;
-};
-
-/*
- This does a byte-order swap. Does glib have something like
- be32_to_cpu() ??
-*/
-
-/* Progressive loading */
-
-struct ras_progressive_state {
- GdkPixbufModuleSizeFunc size_func;
- GdkPixbufModulePreparedFunc prepared_func;
- GdkPixbufModuleUpdatedFunc updated_func;
- gpointer user_data;
-
- gint HeaderSize; /* The size of the header-part (incl colormap) */
- guchar *HeaderBuf; /* The buffer for the header (incl colormap) */
- gint HeaderDone; /* The nr of bytes actually in HeaderBuf */
-
- gint LineWidth; /* The width of a line in bytes */
- guchar *LineBuf; /* Buffer for 1 line */
- gint LineDone; /* # of bytes in LineBuf */
- gint Lines; /* # of finished lines */
-
- gint RasType; /* 32 = BGRA
- 24 = BGR
- 8 = 8 bit colormapped
- 1 = 1 bit bitonal
- */
- gint DecoderState;
-
- struct rasterfile Header; /* Decoded (BE->CPU) header */
-
-
- GdkPixbuf *pixbuf; /* Our "target" */
-};
-
-static gpointer
-gdk_pixbuf__ras_image_begin_load(GdkPixbufModuleSizeFunc size_func,
- GdkPixbufModulePreparedFunc prepared_func,
- GdkPixbufModuleUpdatedFunc updated_func,
- gpointer user_data,
- GError **error);
-static gboolean gdk_pixbuf__ras_image_stop_load(gpointer data, GError **error);
-static gboolean gdk_pixbuf__ras_image_load_increment(gpointer data,
- const guchar * buf, guint size,
- GError **error);
-
-static gboolean RAS2State(struct rasterfile *RAS,
- struct ras_progressive_state *State,
- GError **error)
-{
- State->Header.width = GUINT32_FROM_BE(RAS->width);
- State->Header.height = GUINT32_FROM_BE(RAS->height);
- State->Header.depth = GUINT32_FROM_BE(RAS->depth);
- State->Header.type = GUINT32_FROM_BE(RAS->type);
- State->Header.maptype = GUINT32_FROM_BE(RAS->maptype);
- State->Header.maplength = GUINT32_FROM_BE(RAS->maplength);
-
- if ((gint)State->Header.width <= 0 ||
- (gint)State->Header.height <= 0 ||
- State->Header.maplength > 768) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("RAS image has bogus header data"));
- return FALSE;
- }
-
- State->RasType = State->Header.depth; /* This may be less trivial someday */
- State->HeaderSize = 32 + State->Header.maplength;
-
- if (State->RasType == 32)
- State->LineWidth = State->Header.width * 4;
- else if (State->RasType == 24)
- State->LineWidth = State->Header.width * 3;
- else if (State->RasType == 8)
- State->LineWidth = State->Header.width * 1;
- else if (State->RasType == 1) {
- State->LineWidth = State->Header.width / 8;
- if ((State->Header.width & 7) != 0)
- State->LineWidth++;
- }
- else {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("RAS image has unknown type"));
- return FALSE;
- }
-
- if (State->Header.type > 2 || State->Header.maptype > 1) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("unsupported RAS image variation"));
- return FALSE;
- }
-
- /* Now pad the line to be a multiple of 16 bits */
- if ((State->LineWidth & 1) != 0)
- State->LineWidth++;
-
- if (!State->LineBuf) {
- State->LineBuf = g_try_malloc (State->LineWidth);
-
- if (!State->LineBuf) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Not enough memory to load RAS image"));
- return FALSE;
- }
- }
-
-
- if (!State->pixbuf) {
- if (State->size_func) {
- gint width = State->Header.width;
- gint height = State->Header.height;
-
- (*State->size_func) (&width, &height, State->user_data);
- if (width == 0 || height == 0)
- return FALSE;
- }
-
- if (State->RasType == 32)
- State->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
- (gint) State->Header.width,
- (gint) State->Header.height);
- else
- State->pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
- (gint) State->Header.width,
- (gint) State->Header.height);
-
- if (!State->pixbuf) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Not enough memory to load RAS image"));
- return FALSE;
- }
-
- if (State->prepared_func != NULL)
- /* Notify the client that we are ready to go */
- (*State->prepared_func) (State->pixbuf,
- NULL,
- State->user_data);
-
- }
-
- if ((State->Header.maplength == 0) && (State->RasType == 1)) {
- State->HeaderBuf[32] = 255;
- State->HeaderBuf[33] = 0;
- State->HeaderBuf[34] = 255;
- State->HeaderBuf[35] = 0;
- State->HeaderBuf[36] = 255;
- State->HeaderBuf[37] = 0;
- }
-
- return TRUE;
-}
-
-/*
- * func - called when we have pixmap created (but no image data)
- * user_data - passed as arg 1 to func
- * return context (opaque to user)
- */
-
-static gpointer
-gdk_pixbuf__ras_image_begin_load(GdkPixbufModuleSizeFunc size_func,
- GdkPixbufModulePreparedFunc prepared_func,
- GdkPixbufModuleUpdatedFunc updated_func,
- gpointer user_data,
- GError **error)
-{
- struct ras_progressive_state *context;
-
- context = g_new0(struct ras_progressive_state, 1);
- context->size_func = size_func;
- context->prepared_func = prepared_func;
- context->updated_func = updated_func;
- context->user_data = user_data;
-
- context->HeaderSize = 32;
- context->HeaderBuf = g_malloc(32 + 768); /* 32 for rasheader,
- 768 for the colormap */
- context->HeaderDone = 0;
-
- context->LineWidth = 0;
- context->LineBuf = NULL;
- context->LineDone = 0;
- context->Lines = 0;
-
- context->RasType = 0;
- context->DecoderState = 0;
-
- memset(&context->Header, 0, sizeof(struct rasterfile));
-
-
- context->pixbuf = NULL;
-
-
- return (gpointer) context;
-}
-
-/*
- * context - returned from image_begin_load
- *
- * free context, unref gdk_pixbuf
- */
-static gboolean
-gdk_pixbuf__ras_image_stop_load(gpointer data, GError **error)
-{
- struct ras_progressive_state *context =
- (struct ras_progressive_state *) data;
-
- /* FIXME this thing needs to report errors if
- * we have unused image data
- */
-
- g_return_val_if_fail(context != NULL, TRUE);
-
- g_free(context->LineBuf);
- g_free(context->HeaderBuf);
-
- if (context->pixbuf)
- g_object_unref(context->pixbuf);
-
- g_free(context);
-
- return TRUE;
-}
-
-/*
- OneLine is called when enough data is received to process 1 line
- of pixels
- */
-
-static void OneLine32(struct ras_progressive_state *context)
-{
- gint X;
- guchar *Pixels;
-
- X = 0;
- Pixels = context->pixbuf->pixels + context->pixbuf->rowstride * context->Lines;
- while (X < context->Header.width) {
- /* The joys of having a BGR byteorder */
- Pixels[X * 4 + 0] = context->LineBuf[X * 4 + 2];
- Pixels[X * 4 + 1] = context->LineBuf[X * 4 + 1];
- Pixels[X * 4 + 2] = context->LineBuf[X * 4 + 0];
- Pixels[X * 4 + 3] = context->LineBuf[X * 4 + 3];
- X++;
- }
-}
-
-static void OneLine24(struct ras_progressive_state *context)
-{
- gint X;
- guchar *Pixels;
-
- X = 0;
- Pixels = context->pixbuf->pixels + context->pixbuf->rowstride * context->Lines;
- while (X < context->Header.width) {
- /* The joys of having a BGR byteorder */
- Pixels[X * 3 + 0] = context->LineBuf[X * 3 + 2];
- Pixels[X * 3 + 1] = context->LineBuf[X * 3 + 1];
- Pixels[X * 3 + 2] = context->LineBuf[X * 3 + 0];
- X++;
- }
-
-}
-
-static void OneLine8(struct ras_progressive_state *context)
-{
- gint X;
- guchar *Pixels;
- int offset = context->Header.maplength / 3;
-
- X = 0;
- Pixels = context->pixbuf->pixels + context->pixbuf->rowstride * context->Lines;
- while (X < context->Header.width) {
- /* The joys of having a BGR byteorder */
- Pixels[X * 3 + 0] =
- context->HeaderBuf[context->LineBuf[X] + 32];
- Pixels[X * 3 + 1] =
- context->HeaderBuf[context->LineBuf[X] + offset + 32];
- Pixels[X * 3 + 2] =
- context->HeaderBuf[context->LineBuf[X] + 2*offset + 32];
- X++;
- }
-}
-
-static void OneLine1(struct ras_progressive_state *context)
-{
- gint X;
- guchar *Pixels;
-
- X = 0;
- Pixels = context->pixbuf->pixels + context->pixbuf->rowstride * context->Lines;
- while (X < context->Header.width) {
- int Bit;
-
- Bit = (context->LineBuf[X/8])>>(7-(X&7));
- Bit = Bit & 1;
- /* The joys of having a BGR byteorder */
- Pixels[X * 3 + 0] =
- context->HeaderBuf[Bit + 32];
- Pixels[X * 3 + 1] =
- context->HeaderBuf[Bit + 2 + 32];
- Pixels[X * 3 + 2] =
- context->HeaderBuf[Bit + 4 + 32];
- X++;
- }
-}
-
-
-static void OneLine(struct ras_progressive_state *context)
-{
- context->LineDone = 0;
- if (context->Lines >= context->Header.height)
- return;
- if (context->RasType == 32)
- OneLine32(context);
- if (context->RasType == 24)
- OneLine24(context);
- if (context->RasType == 8)
- OneLine8(context);
- if (context->RasType == 1)
- OneLine1(context);
-
- context->LineDone = 0;
- context->Lines++;
-
- if (context->updated_func != NULL) {
- (*context->updated_func) (context->pixbuf,
- 0,
- context->Lines,
- context->Header.width,
- 1,
- context->user_data);
-
- }
-}
-
-static gboolean
-DoCompressed (struct ras_progressive_state *context,
- const guchar * buf, guint size,
- GError **error)
-{
- int i;
-
- for (i = 0; i < size; i++) {
- switch (context->DecoderState) {
- case 0:
- if (buf[i] == 0x80)
- context->DecoderState = 1;
- else
- context->LineBuf[context->LineDone++] = buf[i];
- break;
- case 1:
- if (buf[i] == 0) {
- context->LineBuf[context->LineDone++] = 0x80;
- context->DecoderState = 0;
- }
- else
- context->DecoderState = buf[i] + 1;
- break;
- default:
- for (; context->DecoderState; context->DecoderState--) {
- context->LineBuf[context->LineDone++] = buf[i];
- if ((context->LineDone >= context->LineWidth) && (context->LineWidth > 0))
- OneLine(context);
- }
- }
- if ((context->LineDone >= context->LineWidth) && (context->LineWidth > 0))
- OneLine(context);
- }
- return TRUE;
-}
-
-/*
- * context - from image_begin_load
- * buf - new image data
- * size - length of new image data
- *
- * append image data onto incrementally built output image
- */
-static gboolean
-gdk_pixbuf__ras_image_load_increment(gpointer data,
- const guchar * buf, guint size,
- GError **error)
-{
- struct ras_progressive_state *context =
- (struct ras_progressive_state *) data;
-
- gint BytesToCopy;
-
- while (size > 0) {
- if (context->HeaderDone < context->HeaderSize) { /* We still
- have headerbytes to do */
- BytesToCopy =
- context->HeaderSize - context->HeaderDone;
- if (BytesToCopy > size)
- BytesToCopy = size;
-
- memmove(context->HeaderBuf + context->HeaderDone,
- buf, BytesToCopy);
-
- size -= BytesToCopy;
- buf += BytesToCopy;
- context->HeaderDone += BytesToCopy;
-
- } else if (context->Header.type == 2) {
- if (!DoCompressed (context, buf, size, error)) {
- return FALSE;
- }
- size = 0;
- }
- else {
- BytesToCopy =
- context->LineWidth - context->LineDone;
- if (BytesToCopy > size)
- BytesToCopy = size;
-
- if (BytesToCopy > 0) {
- memmove(context->LineBuf +
- context->LineDone, buf,
- BytesToCopy);
-
- size -= BytesToCopy;
- buf += BytesToCopy;
- context->LineDone += BytesToCopy;
- }
- if ((context->LineDone >= context->LineWidth) &&
- (context->LineWidth > 0))
- OneLine(context);
-
-
- }
-
- if (context->HeaderDone >= 32)
- if (!RAS2State((struct rasterfile *) context->HeaderBuf,
- context, error)) {
- return FALSE;
- }
-
-
- }
-
- return TRUE;
-}
-
-#ifndef INCLUDE_ras
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__ras_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
-{
- module->begin_load = gdk_pixbuf__ras_image_begin_load;
- module->stop_load = gdk_pixbuf__ras_image_stop_load;
- module->load_increment = gdk_pixbuf__ras_image_load_increment;
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
-{
- static GdkPixbufModulePattern signature[] = {
- { "\x59\xa6\x6a\x95", NULL, 100 },
- { NULL, NULL, 0 }
- };
- static gchar * mime_types[] = {
- "image/x-cmu-raster",
- "image/x-sun-raster",
- NULL
- };
- static gchar * extensions[] = {
- "ras",
- NULL
- };
-
- info->name = "ras";
- info->signature = signature;
- info->description = N_("The Sun raster image format");
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "LGPL";
-}
-
diff --git a/gdk-pixbuf/io-tga.c b/gdk-pixbuf/io-tga.c
deleted file mode 100644
index 0391e1eec9..0000000000
--- a/gdk-pixbuf/io-tga.c
+++ /dev/null
@@ -1,1013 +0,0 @@
-/* -*- mode: C; c-file-style: "linux" -*- */
-/*
- * GdkPixbuf library - TGA image loader
- * Copyright (C) 1999 Nicola Girardi <nikke@swlibero.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.
- *
- */
-
-/*
- * Some NOTES about the TGA loader (2001/06/07, nikke@swlibero.org)
- *
- * - The TGAFooter isn't present in all TGA files. In fact, there's an older
- * format specification, still in use, which doesn't cover the TGAFooter.
- * Actually, most TGA files I have are of the older type. Anyway I put the
- * struct declaration here for completeness.
- *
- * - Error handling was designed to be very paranoid.
- */
-
-#include "config.h"
-#include <stdio.h>
-#include <string.h>
-
-#include "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-io.h"
-
-#undef DEBUG_TGA
-
-#define TGA_INTERLEAVE_MASK 0xc0
-#define TGA_INTERLEAVE_NONE 0x00
-#define TGA_INTERLEAVE_2WAY 0x40
-#define TGA_INTERLEAVE_4WAY 0x80
-
-#define TGA_ORIGIN_MASK 0x30
-#define TGA_ORIGIN_RIGHT 0x10
-#define TGA_ORIGIN_UPPER 0x20
-
-enum {
- TGA_TYPE_NODATA = 0,
- TGA_TYPE_PSEUDOCOLOR = 1,
- TGA_TYPE_TRUECOLOR = 2,
- TGA_TYPE_GRAYSCALE = 3,
- TGA_TYPE_RLE_PSEUDOCOLOR = 9,
- TGA_TYPE_RLE_TRUECOLOR = 10,
- TGA_TYPE_RLE_GRAYSCALE = 11
-};
-
-#define LE16(p) ((p)[0] + ((p)[1] << 8))
-
-typedef struct _IOBuffer IOBuffer;
-
-typedef struct _TGAHeader TGAHeader;
-typedef struct _TGAFooter TGAFooter;
-
-typedef struct _TGAColormap TGAColormap;
-typedef struct _TGAColor TGAColor;
-
-typedef struct _TGAContext TGAContext;
-
-struct _TGAHeader {
- guint8 infolen;
- guint8 has_cmap;
- guint8 type;
-
- guint8 cmap_start[2];
- guint8 cmap_n_colors[2];
- guint8 cmap_bpp;
-
- guint8 x_origin[2];
- guint8 y_origin[2];
-
- guint8 width[2];
- guint8 height[2];
- guint8 bpp;
-
- guint8 flags;
-};
-
-struct _TGAFooter {
- guint32 extension_area_offset;
- guint32 developer_directory_offset;
-
- /* Standard TGA signature, "TRUEVISION-XFILE.\0". */
- union {
- gchar sig_full[18];
- struct {
- gchar sig_chunk[16];
- gchar dot, null;
- } sig_struct;
- } sig;
-};
-
-struct _TGAColormap {
- gint size;
- TGAColor *cols;
-};
-
-struct _TGAColor {
- guchar r, g, b, a;
-};
-
-struct _TGAContext {
- TGAHeader *hdr;
- guint rowstride;
- guint completed_lines;
- gboolean run_length_encoded;
-
- TGAColormap *cmap;
- guint cmap_size;
-
- GdkPixbuf *pbuf;
- guint pbuf_bytes;
- guint pbuf_bytes_done;
- guchar *pptr;
-
- IOBuffer *in;
-
- gboolean skipped_info;
- gboolean prepared;
- gboolean done;
-
- GdkPixbufModuleSizeFunc sfunc;
- GdkPixbufModulePreparedFunc pfunc;
- GdkPixbufModuleUpdatedFunc ufunc;
- gpointer udata;
-};
-
-struct _IOBuffer {
- guchar *data;
- guint size;
-};
-
-static IOBuffer *io_buffer_new(GError **err)
-{
- IOBuffer *buffer;
- buffer = g_try_malloc(sizeof(IOBuffer));
- if (!buffer) {
- g_set_error_literal(err, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Cannot allocate memory for IOBuffer struct"));
- return NULL;
- }
- buffer->data = NULL;
- buffer->size = 0;
- return buffer;
-}
-
-static IOBuffer *io_buffer_append(IOBuffer *buffer,
- const guchar *data, guint len,
- GError **err)
-{
- if (!buffer)
- return NULL;
- if (!buffer->data) {
- buffer->data = g_try_malloc(len);
- if (!buffer->data) {
- g_set_error_literal(err, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Cannot allocate memory for IOBuffer data"));
- g_free(buffer);
- return NULL;
- }
- g_memmove(buffer->data, data, len);
- buffer->size = len;
- } else {
- guchar *tmp = g_try_realloc (buffer->data, buffer->size + len);
- if (!tmp) {
- g_set_error_literal(err, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Cannot realloc IOBuffer data"));
- g_free(buffer);
- return NULL;
- }
- buffer->data = tmp;
- g_memmove(&buffer->data[buffer->size], data, len);
- buffer->size += len;
- }
- return buffer;
-}
-
-static IOBuffer *io_buffer_free_segment(IOBuffer *buffer,
- guint count,
- GError **err)
-{
- g_return_val_if_fail(buffer != NULL, NULL);
- g_return_val_if_fail(buffer->data != NULL, NULL);
- if (count == buffer->size) {
- g_free(buffer->data);
- buffer->data = NULL;
- buffer->size = 0;
- } else {
- guchar *new_buf;
- guint new_size;
-
- new_size = buffer->size - count;
- new_buf = g_try_malloc(new_size);
- if (!new_buf) {
- g_set_error_literal(err, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Cannot allocate temporary IOBuffer data"));
- g_free(buffer->data);
- g_free(buffer);
- return NULL;
- }
-
- g_memmove(new_buf, &buffer->data[count], new_size);
- g_free(buffer->data);
- buffer->data = new_buf;
- buffer->size = new_size;
- }
- return buffer;
-}
-
-static void io_buffer_free(IOBuffer *buffer)
-{
- g_return_if_fail(buffer != NULL);
- g_free(buffer->data);
- g_free(buffer);
-}
-
-static void free_buffer(guchar *pixels, gpointer data)
-{
- g_free(pixels);
-}
-
-static GdkPixbuf *get_contiguous_pixbuf (guint width,
- guint height,
- gboolean has_alpha)
-{
- guchar *pixels;
- guint channels, rowstride, bytes;
-
- if (has_alpha)
- channels = 4;
- else
- channels = 3;
-
- rowstride = width * channels;
-
- if (rowstride / channels != width)
- return NULL;
-
- bytes = height * rowstride;
-
- if (bytes / rowstride != height)
- return NULL;
-
- pixels = g_try_malloc (bytes);
-
- if (!pixels)
- return NULL;
-
- return gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB, has_alpha, 8,
- width, height, rowstride, free_buffer, NULL);
-}
-
-static void pixbuf_flip_row (GdkPixbuf *pixbuf, guchar *ph)
-{
- guchar *p, *s;
- guchar tmp;
- gint count;
-
- p = ph;
- s = p + pixbuf->n_channels * (pixbuf->width - 1);
- while (p < s) {
- for (count = pixbuf->n_channels; count > 0; count--, p++, s++) {
- tmp = *p;
- *p = *s;
- *s = tmp;
- }
- s -= 2 * pixbuf->n_channels;
- }
-}
-
-static void pixbuf_flip_vertically (GdkPixbuf *pixbuf)
-{
- guchar *ph, *sh, *p, *s;
- guchar tmp;
- gint count;
-
- ph = pixbuf->pixels;
- sh = pixbuf->pixels + pixbuf->height*pixbuf->rowstride;
- while (ph < sh - pixbuf->rowstride) {
- p = ph;
- s = sh - pixbuf->rowstride;
- for (count = pixbuf->n_channels * pixbuf->width; count > 0; count--, p++, s++) {
- tmp = *p;
- *p = *s;
- *s = tmp;
- }
- sh -= pixbuf->rowstride;
- ph += pixbuf->rowstride;
- }
-}
-
-static gboolean fill_in_context(TGAContext *ctx, GError **err)
-{
- gboolean alpha;
- guint w, h;
-
- g_return_val_if_fail(ctx != NULL, FALSE);
-
- ctx->run_length_encoded =
- ((ctx->hdr->type == TGA_TYPE_RLE_PSEUDOCOLOR)
- || (ctx->hdr->type == TGA_TYPE_RLE_TRUECOLOR)
- || (ctx->hdr->type == TGA_TYPE_RLE_GRAYSCALE));
-
- if (ctx->hdr->has_cmap)
- ctx->cmap_size = ((ctx->hdr->cmap_bpp + 7) >> 3) *
- LE16(ctx->hdr->cmap_n_colors);
-
- alpha = ((ctx->hdr->bpp == 16) ||
- (ctx->hdr->bpp == 32) ||
- (ctx->hdr->has_cmap && (ctx->hdr->cmap_bpp == 32)));
-
- w = LE16(ctx->hdr->width);
- h = LE16(ctx->hdr->height);
-
- if (ctx->sfunc) {
- gint wi = w;
- gint hi = h;
-
- (*ctx->sfunc) (&wi, &hi, ctx->udata);
-
- if (wi == 0 || hi == 0)
- return FALSE;
- }
-
- ctx->pbuf = get_contiguous_pixbuf (w, h, alpha);
-
- if (!ctx->pbuf) {
- g_set_error_literal(err, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Cannot allocate new pixbuf"));
- return FALSE;
- }
-
- ctx->pbuf_bytes = ctx->pbuf->rowstride * ctx->pbuf->height;
- if ((ctx->hdr->flags & TGA_ORIGIN_UPPER) || ctx->run_length_encoded)
- ctx->pptr = ctx->pbuf->pixels;
- else
- ctx->pptr = ctx->pbuf->pixels + (ctx->pbuf->height - 1)*ctx->pbuf->rowstride;
-
- if (ctx->hdr->type == TGA_TYPE_PSEUDOCOLOR)
- ctx->rowstride = ctx->pbuf->width;
- else if (ctx->hdr->type == TGA_TYPE_GRAYSCALE)
- ctx->rowstride = (alpha ? ctx->pbuf->width * 2 : ctx->pbuf->width);
- else if (ctx->hdr->type == TGA_TYPE_TRUECOLOR)
- ctx->rowstride = ctx->pbuf->rowstride;
-
- ctx->completed_lines = 0;
- return TRUE;
-}
-
-static void parse_data_for_row_pseudocolor(TGAContext *ctx)
-{
- guchar *s = ctx->in->data;
- guint upper_bound = ctx->pbuf->width;
- guchar *p = ctx->pptr;
-
- for (; upper_bound; upper_bound--, s++) {
- *p++ = ctx->cmap->cols[*s].r;
- *p++ = ctx->cmap->cols[*s].g;
- *p++ = ctx->cmap->cols[*s].b;
- if (ctx->hdr->cmap_bpp == 32)
- *p++ = ctx->cmap->cols[*s].a;
- }
-}
-
-static void swap_channels(TGAContext *ctx)
-{
- guchar swap;
- guint count;
- guchar *p = ctx->pptr;
- for (count = ctx->pbuf->width; count; count--) {
- swap = p[0];
- p[0] = p[2];
- p[2] = swap;
- p += ctx->pbuf->n_channels;
- }
-}
-
-static void parse_data_for_row_truecolor(TGAContext *ctx)
-{
- g_memmove(ctx->pptr, ctx->in->data, ctx->pbuf->rowstride);
- swap_channels(ctx);
-}
-
-static void parse_data_for_row_grayscale(TGAContext *ctx)
-{
- guchar *s = ctx->in->data;
- guint upper_bound = ctx->pbuf->width;
-
- guchar *p = ctx->pptr;
- for (; upper_bound; upper_bound--) {
- p[0] = p[1] = p[2] = *s++;
- if (ctx->pbuf->n_channels == 4)
- p[3] = *s++;
- p += ctx->pbuf->n_channels;
- }
-}
-
-static gboolean parse_data_for_row(TGAContext *ctx, GError **err)
-{
- guint row;
-
- if (ctx->hdr->type == TGA_TYPE_PSEUDOCOLOR)
- parse_data_for_row_pseudocolor(ctx);
- else if (ctx->hdr->type == TGA_TYPE_TRUECOLOR)
- parse_data_for_row_truecolor(ctx);
- else if (ctx->hdr->type == TGA_TYPE_GRAYSCALE)
- parse_data_for_row_grayscale(ctx);
-
- if (ctx->hdr->flags & TGA_ORIGIN_RIGHT)
- pixbuf_flip_row (ctx->pbuf, ctx->pptr);
- if (ctx->hdr->flags & TGA_ORIGIN_UPPER)
- ctx->pptr += ctx->pbuf->rowstride;
- else
- ctx->pptr -= ctx->pbuf->rowstride;
- ctx->pbuf_bytes_done += ctx->pbuf->rowstride;
- if (ctx->pbuf_bytes_done == ctx->pbuf_bytes)
- ctx->done = TRUE;
-
- ctx->in = io_buffer_free_segment(ctx->in, ctx->rowstride, err);
- if (!ctx->in)
- return FALSE;
- row = (ctx->pptr - ctx->pbuf->pixels) / ctx->pbuf->rowstride - 1;
- if (ctx->ufunc)
- (*ctx->ufunc) (ctx->pbuf, 0, row, ctx->pbuf->width, 1, ctx->udata);
- return TRUE;
-}
-
-static void write_rle_data(TGAContext *ctx, TGAColor *color, guint *rle_count)
-{
- for (; *rle_count; (*rle_count)--) {
- g_memmove(ctx->pptr, (guchar *) color, ctx->pbuf->n_channels);
- ctx->pptr += ctx->pbuf->n_channels;
- ctx->pbuf_bytes_done += ctx->pbuf->n_channels;
- if (ctx->pbuf_bytes_done == ctx->pbuf_bytes)
- return;
- }
-}
-
-static guint parse_rle_data_pseudocolor(TGAContext *ctx)
-{
- guint rle_num, raw_num;
- guchar *s, tag;
- guint n;
-
- g_return_val_if_fail(ctx->in->size > 0, 0);
- s = ctx->in->data;
-
- for (n = 0; n < ctx->in->size; ) {
- tag = *s;
- s++, n++;
- if (tag & 0x80) {
- if (n == ctx->in->size) {
- return --n;
- } else {
- rle_num = (tag & 0x7f) + 1;
- write_rle_data(ctx, &ctx->cmap->cols[*s], &rle_num);
- s++, n++;
- if (ctx->pbuf_bytes_done == ctx->pbuf_bytes) {
- ctx->done = TRUE;
- return n;
- }
- }
- } else {
- raw_num = tag + 1;
- if (n + raw_num >= ctx->in->size) {
- return --n;
- } else {
- for (; raw_num; raw_num--) {
- *ctx->pptr++ =
- ctx->cmap->cols[*s].r;
- *ctx->pptr++ =
- ctx->cmap->cols[*s].g;
- *ctx->pptr++ =
- ctx->cmap->cols[*s].b;
- if (ctx->pbuf->n_channels == 4)
- *ctx->pptr++ = ctx->cmap->cols[*s].a;
- s++, n++;
- ctx->pbuf_bytes_done += ctx->pbuf->n_channels;
- if (ctx->pbuf_bytes_done == ctx->pbuf_bytes) {
- ctx->done = TRUE;
- return n;
- }
- }
- }
- }
- }
-
- if (ctx->pbuf_bytes_done == ctx->pbuf_bytes)
- ctx->done = TRUE;
-
- return n;
-}
-
-static guint parse_rle_data_truecolor(TGAContext *ctx)
-{
- TGAColor col;
- guint rle_num, raw_num;
- guchar *s, tag;
- guint n = 0;
-
- g_return_val_if_fail(ctx->in->size > 0, 0);
- s = ctx->in->data;
-
- for (n = 0; n < ctx->in->size; ) {
- tag = *s;
- s++, n++;
- if (tag & 0x80) {
- if (n + ctx->pbuf->n_channels >= ctx->in->size) {
- return --n;
- } else {
- rle_num = (tag & 0x7f) + 1;
- col.b = *s++;
- col.g = *s++;
- col.r = *s++;
- if (ctx->hdr->bpp == 32)
- col.a = *s++;
- n += ctx->pbuf->n_channels;
- write_rle_data(ctx, &col, &rle_num);
- if (ctx->pbuf_bytes_done == ctx->pbuf_bytes) {
- ctx->done = TRUE;
- return n;
- }
- }
- } else {
- raw_num = tag + 1;
- if (n + (raw_num * ctx->pbuf->n_channels) >= ctx->in->size) {
- return --n;
- } else {
- for (; raw_num; raw_num--) {
- ctx->pptr[2] = *s++;
- ctx->pptr[1] = *s++;
- ctx->pptr[0] = *s++;
- if (ctx->hdr->bpp == 32)
- ctx->pptr[3] = *s++;
- n += ctx->pbuf->n_channels;
- ctx->pptr += ctx->pbuf->n_channels;
- ctx->pbuf_bytes_done += ctx->pbuf->n_channels;
- if (ctx->pbuf_bytes_done == ctx->pbuf_bytes) {
- ctx->done = TRUE;
- return n;
- }
- }
-
- if (ctx->pbuf_bytes_done == ctx->pbuf_bytes) {
- ctx->done = TRUE;
- return n;
- }
- }
- }
- }
- if (ctx->pbuf_bytes_done == ctx->pbuf_bytes)
- ctx->done = TRUE;
- return n;
-}
-
-static guint parse_rle_data_grayscale(TGAContext *ctx)
-{
- TGAColor tone;
- guint rle_num, raw_num;
- guchar *s, tag;
- guint n;
-
- g_return_val_if_fail(ctx->in->size > 0, 0);
- s = ctx->in->data;
-
- for (n = 0; n < ctx->in->size; ) {
- tag = *s;
- s++, n++;
- if (tag & 0x80) {
- if (n + (ctx->pbuf->n_channels == 4 ? 2 : 1) >= ctx->in->size) {
- return --n;
- } else {
- rle_num = (tag & 0x7f) + 1;
- tone.r = tone.g = tone.b = *s;
- s++, n++;
- if (ctx->pbuf->n_channels == 4) {
- tone.a = *s++;
- n++;
- }
- write_rle_data(ctx, &tone, &rle_num);
- if (ctx->pbuf_bytes_done == ctx->pbuf_bytes) {
- ctx->done = TRUE;
- return n;
- }
- }
- } else {
- raw_num = tag + 1;
- if (n + raw_num * (ctx->pbuf->n_channels == 4 ? 2 : 1) >= ctx->in->size) {
- return --n;
- } else {
- for (; raw_num; raw_num--) {
- ctx->pptr[0] = ctx->pptr[1] = ctx->pptr[2] = *s;
- s++, n++;
- if (ctx->pbuf->n_channels == 4) {
- ctx->pptr[3] = *s++;
- n++;
- }
- ctx->pptr += ctx->pbuf->n_channels;
- ctx->pbuf_bytes_done += ctx->pbuf->n_channels;
- if (ctx->pbuf_bytes_done == ctx->pbuf_bytes) {
- ctx->done = TRUE;
- return n;
- }
- }
- }
- }
- }
- if (ctx->pbuf_bytes_done == ctx->pbuf_bytes)
- ctx->done = TRUE;
- return n;
-}
-
-static gboolean parse_rle_data(TGAContext *ctx, GError **err)
-{
- guint rows = 0;
- guint count = 0;
- guint bytes_done_before = ctx->pbuf_bytes_done;
-
- if (ctx->hdr->type == TGA_TYPE_RLE_PSEUDOCOLOR)
- count = parse_rle_data_pseudocolor(ctx);
- else if (ctx->hdr->type == TGA_TYPE_RLE_TRUECOLOR)
- count = parse_rle_data_truecolor(ctx);
- else if (ctx->hdr->type == TGA_TYPE_RLE_GRAYSCALE)
- count = parse_rle_data_grayscale(ctx);
-
- if (ctx->hdr->flags & TGA_ORIGIN_RIGHT) {
- guchar *row = ctx->pbuf->pixels + (bytes_done_before / ctx->pbuf->rowstride) * ctx->pbuf->rowstride;
- guchar *row_after = ctx->pbuf->pixels + (ctx->pbuf_bytes_done / ctx->pbuf->rowstride) * ctx->pbuf->rowstride;
- for (; row < row_after; row += ctx->pbuf->rowstride)
- pixbuf_flip_row (ctx->pbuf, row);
- }
-
- ctx->in = io_buffer_free_segment(ctx->in, count, err);
- if (!ctx->in)
- return FALSE;
-
- if (ctx->done) {
- /* FIXME doing the vertical flipping afterwards is not
- * perfect, but doing it during the rle decoding in place
- * is considerably more work.
- */
- if (!(ctx->hdr->flags & TGA_ORIGIN_UPPER)) {
- pixbuf_flip_vertically (ctx->pbuf);
- ctx->hdr->flags |= TGA_ORIGIN_UPPER;
- }
-
- }
-
- rows = ctx->pbuf_bytes_done / ctx->pbuf->rowstride - bytes_done_before / ctx->pbuf->rowstride;
- if (ctx->ufunc)
- (*ctx->ufunc) (ctx->pbuf, 0, bytes_done_before / ctx->pbuf->rowstride,
- ctx->pbuf->width, rows,
- ctx->udata);
-
- return TRUE;
-}
-
-static gboolean try_colormap(TGAContext *ctx, GError **err)
-{
- static guchar *p;
- static guint n;
-
- g_return_val_if_fail(ctx != NULL, FALSE);
-
- if (ctx->cmap_size == 0) {
- g_set_error_literal(err, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Image is corrupted or truncated"));
- return FALSE;
- }
-
- ctx->cmap = g_try_malloc(sizeof(TGAColormap));
- if (!ctx->cmap) {
- g_set_error_literal(err, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Cannot allocate colormap structure"));
- return FALSE;
- }
- ctx->cmap->size = LE16(ctx->hdr->cmap_n_colors);
- ctx->cmap->cols = g_try_malloc(sizeof(TGAColor) * ctx->cmap->size);
- if (!ctx->cmap->cols) {
- g_set_error_literal(err, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Cannot allocate colormap entries"));
- return FALSE;
- }
-
- p = ctx->in->data;
- for (n = 0; n < ctx->cmap->size; n++) {
- if ((ctx->hdr->cmap_bpp == 15) || (ctx->hdr->cmap_bpp == 16)) {
- guint16 col = p[0] + (p[1] << 8);
- ctx->cmap->cols[n].b = (col >> 7) & 0xf8;
- ctx->cmap->cols[n].g = (col >> 2) & 0xf8;
- ctx->cmap->cols[n].r = col << 3;
- p += 2;
- }
- else if ((ctx->hdr->cmap_bpp == 24) || (ctx->hdr->cmap_bpp == 32)) {
- ctx->cmap->cols[n].b = *p++;
- ctx->cmap->cols[n].g = *p++;
- ctx->cmap->cols[n].r = *p++;
- if (ctx->hdr->cmap_bpp == 32)
- ctx->cmap->cols[n].a = *p++;
- } else {
- g_set_error_literal(err, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Unexpected bitdepth for colormap entries"));
- return FALSE;
- }
- }
- ctx->in = io_buffer_free_segment(ctx->in, ctx->cmap_size, err);
- if (!ctx->in)
- return FALSE;
- return TRUE;
-}
-
-static gboolean try_preload(TGAContext *ctx, GError **err)
-{
- if (!ctx->hdr) {
- if (ctx->in->size >= sizeof(TGAHeader)) {
- ctx->hdr = g_try_malloc(sizeof(TGAHeader));
- if (!ctx->hdr) {
- g_set_error_literal(err, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Cannot allocate TGA header memory"));
- return FALSE;
- }
- g_memmove(ctx->hdr, ctx->in->data, sizeof(TGAHeader));
- ctx->in = io_buffer_free_segment(ctx->in, sizeof(TGAHeader), err);
-#ifdef DEBUG_TGA
- g_print ("infolen %d "
- "has_cmap %d "
- "type %d "
- "cmap_start %d "
- "cmap_n_colors %d "
- "cmap_bpp %d "
- "x %d y %d width %d height %d bpp %d "
- "flags %#x",
- ctx->hdr->infolen,
- ctx->hdr->has_cmap,
- ctx->hdr->type,
- LE16(ctx->hdr->cmap_start),
- LE16(ctx->hdr->cmap_n_colors),
- ctx->hdr->cmap_bpp,
- LE16(ctx->hdr->x_origin),
- LE16(ctx->hdr->y_origin),
- LE16(ctx->hdr->width),
- LE16(ctx->hdr->height),
- ctx->hdr->bpp,
- ctx->hdr->flags);
-#endif
- if (!ctx->in)
- return FALSE;
- if (LE16(ctx->hdr->width) == 0 ||
- LE16(ctx->hdr->height) == 0) {
- g_set_error_literal(err, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("TGA image has invalid dimensions"));
- return FALSE;
- }
- if ((ctx->hdr->flags & TGA_INTERLEAVE_MASK) != TGA_INTERLEAVE_NONE) {
- g_set_error_literal(err, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
- _("TGA image type not supported"));
- return FALSE;
- }
- switch (ctx->hdr->type) {
- case TGA_TYPE_PSEUDOCOLOR:
- case TGA_TYPE_RLE_PSEUDOCOLOR:
- if (ctx->hdr->bpp != 8) {
- g_set_error_literal(err, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
- _("TGA image type not supported"));
- return FALSE;
- }
- break;
- case TGA_TYPE_TRUECOLOR:
- case TGA_TYPE_RLE_TRUECOLOR:
- if (ctx->hdr->bpp != 24 &&
- ctx->hdr->bpp != 32) {
- g_set_error_literal(err, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
- _("TGA image type not supported"));
- return FALSE;
- }
- break;
- case TGA_TYPE_GRAYSCALE:
- case TGA_TYPE_RLE_GRAYSCALE:
- if (ctx->hdr->bpp != 8 &&
- ctx->hdr->bpp != 16) {
- g_set_error_literal(err, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
- _("TGA image type not supported"));
- return FALSE;
- }
- break;
- default:
- g_set_error_literal(err, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_UNKNOWN_TYPE,
- _("TGA image type not supported"));
- return FALSE;
- }
- if (!fill_in_context(ctx, err))
- return FALSE;
- } else {
- return TRUE;
- }
- }
- if (!ctx->skipped_info) {
- if (ctx->in->size >= ctx->hdr->infolen) {
- ctx->in = io_buffer_free_segment(ctx->in, ctx->hdr->infolen, err);
- if (!ctx->in)
- return FALSE;
- ctx->skipped_info = TRUE;
- } else {
- return TRUE;
- }
- }
- if (ctx->hdr->has_cmap && !ctx->cmap) {
- if (ctx->in->size >= ctx->cmap_size) {
- if (!try_colormap(ctx, err))
- return FALSE;
- } else {
- return TRUE;
- }
- }
- if (!ctx->prepared) {
- if (ctx->pfunc)
- (*ctx->pfunc) (ctx->pbuf, NULL, ctx->udata);
- ctx->prepared = TRUE;
- }
- /* We shouldn't get here anyway. */
- return TRUE;
-}
-
-static gpointer gdk_pixbuf__tga_begin_load(GdkPixbufModuleSizeFunc f0,
- GdkPixbufModulePreparedFunc f1,
- GdkPixbufModuleUpdatedFunc f2,
- gpointer udata, GError **err)
-{
- TGAContext *ctx;
-
- ctx = g_try_malloc(sizeof(TGAContext));
- if (!ctx) {
- g_set_error_literal(err, GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Cannot allocate memory for TGA context struct"));
- return NULL;
- }
-
- ctx->hdr = NULL;
- ctx->rowstride = 0;
- ctx->run_length_encoded = FALSE;
-
- ctx->cmap = NULL;
- ctx->cmap_size = 0;
-
- ctx->pbuf = NULL;
- ctx->pbuf_bytes = 0;
- ctx->pbuf_bytes_done = 0;
- ctx->pptr = NULL;
-
- ctx->in = io_buffer_new(err);
- if (!ctx->in) {
- g_free(ctx);
- return NULL;
- }
-
- ctx->skipped_info = FALSE;
- ctx->prepared = FALSE;
- ctx->done = FALSE;
-
- ctx->sfunc = f0;
- ctx->pfunc = f1;
- ctx->ufunc = f2;
- ctx->udata = udata;
-
- return ctx;
-}
-
-static gboolean gdk_pixbuf__tga_load_increment(gpointer data,
- const guchar *buffer,
- guint size,
- GError **err)
-{
- TGAContext *ctx = (TGAContext*) data;
- g_return_val_if_fail(ctx != NULL, FALSE);
-
- if (ctx->done)
- return TRUE;
-
- g_return_val_if_fail(buffer != NULL, TRUE);
- ctx->in = io_buffer_append(ctx->in, buffer, size, err);
- if (!ctx->in)
- return FALSE;
- if (!ctx->prepared) {
- if (!try_preload(ctx, err))
- return FALSE;
- if (!ctx->prepared)
- return TRUE;
- if (ctx->in->size == 0)
- return TRUE;
- }
-
- if (ctx->run_length_encoded) {
- if (!parse_rle_data(ctx, err))
- return FALSE;
- } else {
- while (ctx->in->size >= ctx->rowstride) {
- if (ctx->completed_lines >= ctx->pbuf->height) {
- g_set_error_literal(err, GDK_PIXBUF_ERROR, GDK_PIXBUF_ERROR_FAILED,
- _("Excess data in file"));
- return FALSE;
- }
- if (!parse_data_for_row(ctx, err))
- return FALSE;
- ctx->completed_lines++;
- }
- }
-
- return TRUE;
-}
-
-static gboolean gdk_pixbuf__tga_stop_load(gpointer data, GError **err)
-{
- TGAContext *ctx = (TGAContext *) data;
- g_return_val_if_fail(ctx != NULL, FALSE);
-
- if (ctx->hdr &&
- (ctx->hdr->flags & TGA_ORIGIN_UPPER) == 0 &&
- ctx->run_length_encoded &&
- ctx->pbuf) {
- pixbuf_flip_vertically (ctx->pbuf);
- if (ctx->ufunc)
- (*ctx->ufunc) (ctx->pbuf, 0, 0,
- ctx->pbuf->width, ctx->pbuf->height,
- ctx->udata);
- }
- g_free (ctx->hdr);
- if (ctx->cmap) {
- g_free (ctx->cmap->cols);
- g_free (ctx->cmap);
- }
- if (ctx->pbuf)
- g_object_unref (ctx->pbuf);
- if (ctx->in && ctx->in->size)
- ctx->in = io_buffer_free_segment (ctx->in, ctx->in->size, err);
- if (!ctx->in) {
- g_free (ctx);
- return FALSE;
- }
- io_buffer_free (ctx->in);
- g_free (ctx);
- return TRUE;
-}
-
-#ifndef INCLUDE_tga
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__tga_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
-{
- module->begin_load = gdk_pixbuf__tga_begin_load;
- module->stop_load = gdk_pixbuf__tga_stop_load;
- module->load_increment = gdk_pixbuf__tga_load_increment;
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
-{
- static GdkPixbufModulePattern signature[] = {
- { " \x1\x1", "x ", 100 },
- { " \x1\x9", "x ", 100 },
- { " \x2", "xz ", 99 }, /* only 99 since .CUR also matches this */
- { " \x3", "xz ", 100 },
- { " \xa", "xz ", 100 },
- { " \xb", "xz ", 100 },
- { NULL, NULL, 0 }
- };
- static gchar * mime_types[] = {
- "image/x-tga",
- NULL
- };
- static gchar * extensions[] = {
- "tga",
- "targa",
- NULL
- };
-
- info->name = "tga";
- info->signature = signature;
- info->description = N_("The Targa image format");
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "LGPL";
-}
diff --git a/gdk-pixbuf/io-tiff.c b/gdk-pixbuf/io-tiff.c
deleted file mode 100644
index 7128a5c080..0000000000
--- a/gdk-pixbuf/io-tiff.c
+++ /dev/null
@@ -1,875 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
-/* GdkPixbuf library - TIFF image loader
- *
- * Copyright (C) 1999 Mark Crichton
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Authors: Mark Crichton <crichton@gimp.org>
- * Federico Mena-Quintero <federico@gimp.org>
- * Jonathan Blandford <jrb@redhat.com>
- * S�ren Sandmann <sandmann@daimi.au.dk>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.
- */
-
-/* Following code (almost) blatantly ripped from Imlib */
-
-#include "config.h"
-#include <stdlib.h>
-#include <string.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <tiffio.h>
-#include <errno.h>
-#include "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-io.h"
-
-#ifdef G_OS_WIN32
-#include <fcntl.h>
-#include <io.h>
-#define lseek(a,b,c) _lseek(a,b,c)
-#define O_RDWR _O_RDWR
-#endif
-
-
-typedef struct _TiffContext TiffContext;
-struct _TiffContext
-{
- GdkPixbufModuleSizeFunc size_func;
- GdkPixbufModulePreparedFunc prepare_func;
- GdkPixbufModuleUpdatedFunc update_func;
- gpointer user_data;
-
- guchar *buffer;
- guint allocated;
- guint used;
- guint pos;
-};
-
-
-
-static char *global_error = NULL;
-static TIFFErrorHandler orig_error_handler = NULL;
-static TIFFErrorHandler orig_warning_handler = NULL;
-
-static void
-tiff_warning_handler (const char *mod, const char *fmt, va_list ap)
-{
- /* Don't print anything; we should not be dumping junk to
- * stderr, since that may be bad for some apps.
- */
-
- /* libTIFF seems to occasionally warn about things that
- * are really errors, so maybe we should just call tiff_error_handler
- * here.
- */
-}
-
-static void
-tiff_error_handler (const char *mod, const char *fmt, va_list ap)
-{
- if (global_error) {
- /* Blah, loader called us twice */
- return;
- }
-
- global_error = g_strdup_vprintf (fmt, ap);
-}
-
-static void
-tiff_push_handlers (void)
-{
- if (global_error)
- g_warning ("TIFF loader left crufty global_error around, FIXME");
-
- orig_error_handler = TIFFSetErrorHandler (tiff_error_handler);
- orig_warning_handler = TIFFSetWarningHandler (tiff_warning_handler);
-}
-
-static void
-tiff_pop_handlers (void)
-{
- if (global_error)
- g_warning ("TIFF loader left crufty global_error around, FIXME");
-
- TIFFSetErrorHandler (orig_error_handler);
- TIFFSetWarningHandler (orig_warning_handler);
-}
-
-static void
-tiff_set_error (GError **error,
- int error_code,
- const char *msg)
-{
- /* Take the error message from libtiff and merge it with
- * some context we provide.
- */
- if (global_error) {
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- error_code,
- "%s%s%s", msg, ": ", global_error);
-
- g_free (global_error);
- global_error = NULL;
- }
- else {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- error_code, msg);
- }
-}
-
-
-
-static void free_buffer (guchar *pixels, gpointer data)
-{
- g_free (pixels);
-}
-
-static GdkPixbuf *
-tiff_image_parse (TIFF *tiff, TiffContext *context, GError **error)
-{
- guchar *pixels = NULL;
- gint width, height, rowstride, bytes;
- GdkPixbuf *pixbuf;
- uint16 orientation = 0;
- uint16 transform = 0;
- uint16 codec;
- gchar *icc_profile_base64;
- const gchar *icc_profile;
- guint icc_profile_size;
- gint retval;
-
- /* We're called with the lock held. */
-
- g_return_val_if_fail (global_error == NULL, NULL);
-
- if (!TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &width) || global_error) {
- tiff_set_error (error,
- GDK_PIXBUF_ERROR_FAILED,
- _("Could not get image width (bad TIFF file)"));
- return NULL;
- }
-
- if (!TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &height) || global_error) {
- tiff_set_error (error,
- GDK_PIXBUF_ERROR_FAILED,
- _("Could not get image height (bad TIFF file)"));
- return NULL;
- }
-
- if (width <= 0 || height <= 0) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Width or height of TIFF image is zero"));
- return NULL;
- }
-
- rowstride = width * 4;
- if (rowstride / 4 != width) { /* overflow */
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Dimensions of TIFF image too large"));
- return NULL;
- }
-
- bytes = height * rowstride;
- if (bytes / rowstride != height) { /* overflow */
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Dimensions of TIFF image too large"));
- return NULL;
- }
-
- if (context && context->size_func) {
- gint w = width;
- gint h = height;
- (* context->size_func) (&w, &h, context->user_data);
-
- /* This is a signal that this function is being called
- to support gdk_pixbuf_get_file_info, so we can stop
- parsing the tiff file at this point. It is not an
- error condition. */
-
- if (w == 0 || h == 0)
- return NULL;
- }
-
- pixels = g_try_malloc (bytes);
-
- if (!pixels) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Insufficient memory to open TIFF file"));
- return NULL;
- }
-
- pixbuf = gdk_pixbuf_new_from_data (pixels, GDK_COLORSPACE_RGB, TRUE, 8,
- width, height, rowstride,
- free_buffer, NULL);
- if (!pixbuf) {
- g_free (pixels);
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Insufficient memory to open TIFF file"));
- return NULL;
- }
-
- /* Set the "orientation" key associated with this image. libtiff
- orientation handling is odd, so further processing is required
- by higher-level functions based on this tag. If the embedded
- orientation tag is 1-4, libtiff flips/mirrors the image as
- required, and no client processing is required - so we report
- no orientation. Orientations 5-8 require rotations which would
- swap the width and height of the image. libtiff does not do this.
- Instead it interprets orientations 5-8 the same as 1-4.
- See http://bugzilla.remotesensing.org/show_bug.cgi?id=1548.
- To correct for this, the client must apply the transform normally
- used for orientation 5 to both orientations 5 and 7, and apply
- the transform normally used for orientation 7 for both
- orientations 6 and 8. Then everythings works out OK! */
-
- TIFFGetField (tiff, TIFFTAG_ORIENTATION, &orientation);
-
- switch (orientation) {
- case 5:
- case 7:
- transform = 5;
- break;
- case 6:
- case 8:
- transform = 7;
- break;
- default:
- transform = 0;
- break;
- }
-
- if (transform > 0 ) {
- gchar str[5];
- g_snprintf (str, sizeof (str), "%d", transform);
- gdk_pixbuf_set_option (pixbuf, "orientation", str);
- }
-
- TIFFGetField (tiff, TIFFTAG_COMPRESSION, &codec);
- if (codec > 0) {
- gchar str[5];
- g_snprintf (str, sizeof (str), "%d", codec);
- gdk_pixbuf_set_option (pixbuf, "compression", str);
- }
-
- /* Extract embedded ICC profile */
- retval = TIFFGetField (tiff, TIFFTAG_ICCPROFILE, &icc_profile_size, &icc_profile);
- if (retval == 1) {
- icc_profile_base64 = g_base64_encode ((const guchar *) icc_profile, icc_profile_size);
- gdk_pixbuf_set_option (pixbuf, "icc-profile", icc_profile_base64);
- g_free (icc_profile_base64);
- }
-
- if (context && context->prepare_func)
- (* context->prepare_func) (pixbuf, NULL, context->user_data);
-
- if (!TIFFReadRGBAImageOriented (tiff, width, height, (uint32 *)pixels, ORIENTATION_TOPLEFT, 1) || global_error) {
- tiff_set_error (error,
- GDK_PIXBUF_ERROR_FAILED,
- _("Failed to load RGB data from TIFF file"));
- g_object_unref (pixbuf);
- return NULL;
- }
-
-#if G_BYTE_ORDER == G_BIG_ENDIAN
- /* Turns out that the packing used by TIFFRGBAImage depends on
- * the host byte order...
- */
- while (pixels < pixbuf->pixels + bytes) {
- uint32 pixel = *(uint32 *)pixels;
- int r = TIFFGetR(pixel);
- int g = TIFFGetG(pixel);
- int b = TIFFGetB(pixel);
- int a = TIFFGetA(pixel);
- *pixels++ = r;
- *pixels++ = g;
- *pixels++ = b;
- *pixels++ = a;
- }
-#endif
-
- if (context && context->update_func)
- (* context->update_func) (pixbuf, 0, 0, width, height, context->user_data);
-
- return pixbuf;
-}
-
-
-
-/* Static loader */
-
-static GdkPixbuf *
-gdk_pixbuf__tiff_image_load (FILE *f, GError **error)
-{
- TIFF *tiff;
- int fd;
- GdkPixbuf *pixbuf;
-
- g_return_val_if_fail (f != NULL, NULL);
-
- tiff_push_handlers ();
-
- fd = fileno (f);
-
- /* On OSF, apparently fseek() works in some on-demand way, so
- * the fseek gdk_pixbuf_new_from_file() doesn't work here
- * since we are using the raw file descriptor. So, we call lseek() on the fd
- * before using it. (#60840)
- */
- lseek (fd, 0, SEEK_SET);
- tiff = TIFFFdOpen (fd, "libpixbuf-tiff", "r");
-
- if (!tiff || global_error) {
- tiff_set_error (error,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Failed to open TIFF image"));
- tiff_pop_handlers ();
-
- return NULL;
- }
-
- pixbuf = tiff_image_parse (tiff, NULL, error);
-
- TIFFClose (tiff);
- if (global_error) {
- tiff_set_error (error,
- GDK_PIXBUF_ERROR_FAILED,
- _("TIFFClose operation failed"));
- }
-
- tiff_pop_handlers ();
-
- return pixbuf;
-}
-
-
-
-/* Progressive loader */
-
-static gpointer
-gdk_pixbuf__tiff_image_begin_load (GdkPixbufModuleSizeFunc size_func,
- GdkPixbufModulePreparedFunc prepare_func,
- GdkPixbufModuleUpdatedFunc update_func,
- gpointer user_data,
- GError **error)
-{
- TiffContext *context;
-
- context = g_new0 (TiffContext, 1);
- context->size_func = size_func;
- context->prepare_func = prepare_func;
- context->update_func = update_func;
- context->user_data = user_data;
- context->buffer = NULL;
- context->allocated = 0;
- context->used = 0;
- context->pos = 0;
-
- return context;
-}
-
-static tsize_t
-tiff_load_read (thandle_t handle, tdata_t buf, tsize_t size)
-{
- TiffContext *context = (TiffContext *)handle;
-
- if (context->pos + size > context->used)
- return 0;
-
- memcpy (buf, context->buffer + context->pos, size);
- context->pos += size;
- return size;
-}
-
-static tsize_t
-tiff_load_write (thandle_t handle, tdata_t buf, tsize_t size)
-{
- return -1;
-}
-
-static toff_t
-tiff_load_seek (thandle_t handle, toff_t offset, int whence)
-{
- TiffContext *context = (TiffContext *)handle;
-
- switch (whence) {
- case SEEK_SET:
- if (offset > context->used)
- return -1;
- context->pos = offset;
- break;
- case SEEK_CUR:
- if (offset + context->pos >= context->used)
- return -1;
- context->pos += offset;
- break;
- case SEEK_END:
- if (offset + context->used > context->used)
- return -1;
- context->pos = context->used + offset;
- break;
- default:
- return -1;
- }
- return context->pos;
-}
-
-static int
-tiff_load_close (thandle_t context)
-{
- return 0;
-}
-
-static toff_t
-tiff_load_size (thandle_t handle)
-{
- TiffContext *context = (TiffContext *)handle;
-
- return context->used;
-}
-
-static int
-tiff_load_map_file (thandle_t handle, tdata_t *buf, toff_t *size)
-{
- TiffContext *context = (TiffContext *)handle;
-
- *buf = context->buffer;
- *size = context->used;
-
- return 0;
-}
-
-static void
-tiff_load_unmap_file (thandle_t handle, tdata_t data, toff_t offset)
-{
-}
-
-static gboolean
-gdk_pixbuf__tiff_image_stop_load (gpointer data,
- GError **error)
-{
- TiffContext *context = data;
- TIFF *tiff;
- gboolean retval;
-
- g_return_val_if_fail (data != NULL, FALSE);
-
- tiff_push_handlers ();
-
- tiff = TIFFClientOpen ("libtiff-pixbuf", "r", data,
- tiff_load_read, tiff_load_write,
- tiff_load_seek, tiff_load_close,
- tiff_load_size,
- tiff_load_map_file, tiff_load_unmap_file);
- if (!tiff || global_error) {
- tiff_set_error (error,
- GDK_PIXBUF_ERROR_FAILED,
- _("Failed to load TIFF image"));
- retval = FALSE;
- } else {
- GdkPixbuf *pixbuf;
-
- pixbuf = tiff_image_parse (tiff, context, error);
- if (pixbuf)
- g_object_unref (pixbuf);
- retval = pixbuf != NULL;
- if (global_error)
- {
- tiff_set_error (error,
- GDK_PIXBUF_ERROR_FAILED,
- _("Failed to load TIFF image"));
- tiff_pop_handlers ();
-
- retval = FALSE;
- }
- }
-
- if (tiff)
- TIFFClose (tiff);
-
- g_assert (!global_error);
-
- g_free (context->buffer);
- g_free (context);
-
- tiff_pop_handlers ();
-
- return retval;
-}
-
-static gboolean
-make_available_at_least (TiffContext *context, guint needed)
-{
- guchar *new_buffer = NULL;
- guint need_alloc;
-
- need_alloc = context->used + needed;
- if (need_alloc > context->allocated) {
- guint new_size = 1;
- while (new_size < need_alloc)
- new_size *= 2;
-
- new_buffer = g_try_realloc (context->buffer, new_size);
- if (new_buffer) {
- context->buffer = new_buffer;
- context->allocated = new_size;
- return TRUE;
- }
- return FALSE;
- }
- return TRUE;
-}
-
-static gboolean
-gdk_pixbuf__tiff_image_load_increment (gpointer data, const guchar *buf,
- guint size, GError **error)
-{
- TiffContext *context = (TiffContext *) data;
-
- g_return_val_if_fail (data != NULL, FALSE);
-
- if (!make_available_at_least (context, size)) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Insufficient memory to open TIFF file"));
- return FALSE;
- }
-
- memcpy (context->buffer + context->used, buf, size);
- context->used += size;
- return TRUE;
-}
-
-typedef struct {
- gchar *buffer;
- guint allocated;
- guint used;
- guint pos;
-} TiffSaveContext;
-
-static tsize_t
-tiff_save_read (thandle_t handle, tdata_t buf, tsize_t size)
-{
- return -1;
-}
-
-static tsize_t
-tiff_save_write (thandle_t handle, tdata_t buf, tsize_t size)
-{
- TiffSaveContext *context = (TiffSaveContext *)handle;
-
- /* Modify buffer length */
- if (context->pos + size > context->used)
- context->used = context->pos + size;
-
- /* Realloc */
- if (context->used > context->allocated) {
- context->buffer = g_realloc (context->buffer, context->pos + size);
- context->allocated = context->used;
- }
-
- /* Now copy the data */
- memcpy (context->buffer + context->pos, buf, size);
-
- /* Update pos */
- context->pos += size;
-
- return size;
-}
-
-static toff_t
-tiff_save_seek (thandle_t handle, toff_t offset, int whence)
-{
- TiffSaveContext *context = (TiffSaveContext *)handle;
-
- switch (whence) {
- case SEEK_SET:
- context->pos = offset;
- break;
- case SEEK_CUR:
- context->pos += offset;
- break;
- case SEEK_END:
- context->pos = context->used + offset;
- break;
- default:
- return -1;
- }
- return context->pos;
-}
-
-static int
-tiff_save_close (thandle_t context)
-{
- return 0;
-}
-
-static toff_t
-tiff_save_size (thandle_t handle)
-{
- return -1;
-}
-
-static TiffSaveContext *
-create_save_context (void)
-{
- TiffSaveContext *context;
-
- context = g_new (TiffSaveContext, 1);
- context->buffer = NULL;
- context->allocated = 0;
- context->used = 0;
- context->pos = 0;
-
- return context;
-}
-
-static void
-free_save_context (TiffSaveContext *context)
-{
- g_free (context->buffer);
- g_free (context);
-}
-
-static gboolean
-gdk_pixbuf__tiff_image_save_to_callback (GdkPixbufSaveFunc save_func,
- gpointer user_data,
- GdkPixbuf *pixbuf,
- gchar **keys,
- gchar **values,
- GError **error)
-{
- TIFF *tiff;
- gint width, height, rowstride;
- guchar *pixels;
- gboolean has_alpha;
- gushort alpha_samples[1] = { EXTRASAMPLE_UNASSALPHA };
- int y;
- TiffSaveContext *context;
- gboolean retval;
- guchar *icc_profile = NULL;
- gsize icc_profile_size = 0;
-
- tiff_push_handlers ();
-
- context = create_save_context ();
- tiff = TIFFClientOpen ("libtiff-pixbuf", "w", context,
- tiff_save_read, tiff_save_write,
- tiff_save_seek, tiff_save_close,
- tiff_save_size,
- NULL, NULL);
-
- if (!tiff || global_error) {
- tiff_set_error (error,
- GDK_PIXBUF_ERROR_FAILED,
- _("Failed to save TIFF image"));
-
- tiff_pop_handlers ();
-
- free_save_context (context);
- return FALSE;
- }
-
- rowstride = gdk_pixbuf_get_rowstride (pixbuf);
- pixels = gdk_pixbuf_get_pixels (pixbuf);
-
- has_alpha = gdk_pixbuf_get_has_alpha (pixbuf);
-
- height = gdk_pixbuf_get_height (pixbuf);
- width = gdk_pixbuf_get_width (pixbuf);
-
- TIFFSetField (tiff, TIFFTAG_IMAGEWIDTH, width);
- TIFFSetField (tiff, TIFFTAG_IMAGELENGTH, height);
- TIFFSetField (tiff, TIFFTAG_BITSPERSAMPLE, 8);
- TIFFSetField (tiff, TIFFTAG_SAMPLESPERPIXEL, has_alpha ? 4 : 3);
- TIFFSetField (tiff, TIFFTAG_ROWSPERSTRIP, height);
-
- /* libtiff supports a number of 'codecs' such as:
- 1 None, 2 Huffman, 5 LZW, 7 JPEG, 8 Deflate, see tiff.h */
- if (keys && *keys && values && *values) {
- guint i = 0;
-
- while (keys[i]) {
- if (g_str_equal (keys[i], "compression")) {
- guint16 codec = strtol (values[i], NULL, 0);
- if (TIFFIsCODECConfigured (codec))
- TIFFSetField (tiff, TIFFTAG_COMPRESSION, codec);
- else {
- tiff_set_error (error,
- GDK_PIXBUF_ERROR_FAILED,
- _("TIFF compression doesn't refer to a valid codec."));
- retval = FALSE;
- goto cleanup;
- }
- } else if (g_str_equal (keys[i], "icc-profile")) {
- /* decode from base64 */
- icc_profile = g_base64_decode (values[i], &icc_profile_size);
- if (icc_profile_size < 127) {
- g_set_error (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_BAD_OPTION,
- _("Color profile has invalid length %d."),
- (gint)icc_profile_size);
- retval = FALSE;
- goto cleanup;
- }
- }
- i++;
- }
- }
-
- if (has_alpha)
- TIFFSetField (tiff, TIFFTAG_EXTRASAMPLES, 1, alpha_samples);
-
- TIFFSetField (tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
- TIFFSetField (tiff, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);
- TIFFSetField (tiff, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
-
- if (icc_profile != NULL)
- TIFFSetField (tiff, TIFFTAG_ICCPROFILE, icc_profile_size, icc_profile);
-
- for (y = 0; y < height; y++) {
- if (TIFFWriteScanline (tiff, pixels + y * rowstride, y, 0) == -1 ||
- global_error)
- break;
- }
-
- if (global_error) {
- tiff_set_error (error,
- GDK_PIXBUF_ERROR_FAILED,
- _("Failed to write TIFF data"));
-
- TIFFClose (tiff);
- retval = FALSE;
- goto cleanup;
- }
-
- TIFFClose (tiff);
- if (global_error) {
- tiff_set_error (error,
- GDK_PIXBUF_ERROR_FAILED,
- _("TIFFClose operation failed"));
- retval = FALSE;
- goto cleanup;
- }
-
-
- /* Now call the callback */
- retval = save_func (context->buffer, context->used, error, user_data);
-
-cleanup:
- g_free (icc_profile);
- tiff_pop_handlers ();
- free_save_context (context);
- return retval;
-}
-
-static gboolean
-save_to_file_cb (const gchar *buf,
- gsize count,
- GError **error,
- gpointer data)
-{
- gint bytes;
-
- while (count > 0) {
- bytes = fwrite (buf, sizeof (gchar), count, (FILE *) data);
- if (bytes <= 0)
- break;
- count -= bytes;
- buf += bytes;
- }
-
- if (count) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_FAILED,
- _("Couldn't write to TIFF file"));
- return FALSE;
- }
-
- return TRUE;
-}
-
-static gboolean
-gdk_pixbuf__tiff_image_save (FILE *f,
- GdkPixbuf *pixbuf,
- gchar **keys,
- gchar **values,
- GError **error)
-{
- return gdk_pixbuf__tiff_image_save_to_callback (save_to_file_cb,
- f, pixbuf, keys,
- values, error);
-}
-
-#ifndef INCLUDE_tiff
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__tiff_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
-{
- module->load = gdk_pixbuf__tiff_image_load;
- module->begin_load = gdk_pixbuf__tiff_image_begin_load;
- module->stop_load = gdk_pixbuf__tiff_image_stop_load;
- module->load_increment = gdk_pixbuf__tiff_image_load_increment;
- module->save = gdk_pixbuf__tiff_image_save;
- module->save_to_callback = gdk_pixbuf__tiff_image_save_to_callback;
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
-{
- static GdkPixbufModulePattern signature[] = {
- { "MM \x2a", " z ", 100 },
- { "II\x2a ", " z", 100 },
- { "II* \020 CR\002 ", " z zzz z", 0 },
- { NULL, NULL, 0 }
- };
- static gchar * mime_types[] = {
- "image/tiff",
- NULL
- };
- static gchar * extensions[] = {
- "tiff",
- "tif",
- NULL
- };
-
- info->name = "tiff";
- info->signature = signature;
- info->description = N_("The TIFF image format");
- info->mime_types = mime_types;
- info->extensions = extensions;
- /* not threadsafe, due to the error handler handling */
- info->flags = GDK_PIXBUF_FORMAT_WRITABLE;
- info->license = "LGPL";
-}
diff --git a/gdk-pixbuf/io-wbmp.c b/gdk-pixbuf/io-wbmp.c
deleted file mode 100644
index a4575b682d..0000000000
--- a/gdk-pixbuf/io-wbmp.c
+++ /dev/null
@@ -1,380 +0,0 @@
-/* -*- mode: C; c-file-style: "linux" -*- */
-/* GdkPixbuf library - Wireless Bitmap image loader
- *
- * Copyright (C) 2000 Red Hat, Inc.
- *
- * Authors: Elliot Lee <sopwith@redhat.com
- *
- * Based on io-bmp.c
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.
- */
-
-/*
-
-Known bugs:
- * Since this is based off the libgd implementation, no extended headers implemented (not required for a WAP client)
-*/
-
-#include "config.h"
-#include <stdio.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <string.h>
-#include "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-io.h"
-
-
-
-/* Progressive loading */
-
-struct wbmp_progressive_state {
- GdkPixbufModulePreparedFunc prepared_func;
- GdkPixbufModuleUpdatedFunc updated_func;
- gpointer user_data;
-
- guint need_type : 1;
- guint need_header : 1;
- guint need_width : 1;
- guint need_height : 1;
- guint needmore : 1;
- guint call_progressive_updates : 1;
-
- guchar last_buf[16]; /* Just needs to be big enough to hold the largest datum requestable via 'getin' */
- guint last_len;
-
- int type;
- int width, height, curx, cury;
-
- GdkPixbuf *pixbuf; /* Our "target" */
-};
-
-static gpointer
-gdk_pixbuf__wbmp_image_begin_load(GdkPixbufModuleSizeFunc size_func,
- GdkPixbufModulePreparedFunc prepared_func,
- GdkPixbufModuleUpdatedFunc updated_func,
- gpointer user_data,
- GError **error);
-
-static gboolean gdk_pixbuf__wbmp_image_stop_load(gpointer data, GError **error);
-static gboolean gdk_pixbuf__wbmp_image_load_increment(gpointer data,
- const guchar * buf,
- guint size,
- GError **error);
-
-/*
- * func - called when we have pixmap created (but no image data)
- * user_data - passed as arg 1 to func
- * return context (opaque to user)
- */
-
-static gpointer
-gdk_pixbuf__wbmp_image_begin_load(GdkPixbufModuleSizeFunc size_func,
- GdkPixbufModulePreparedFunc prepared_func,
- GdkPixbufModuleUpdatedFunc updated_func,
- gpointer user_data,
- GError **error)
-{
- struct wbmp_progressive_state *context;
-
- context = g_new0(struct wbmp_progressive_state, 1);
- context->prepared_func = prepared_func;
- context->updated_func = updated_func;
- context->user_data = user_data;
-
- context->needmore = context->need_type = context->need_header = context->need_width = context->need_height = TRUE;
- context->call_progressive_updates = TRUE;
- context->pixbuf = NULL;
-
- return (gpointer) context;
-}
-
-/*
- * context - returned from image_begin_load
- *
- * free context, unref gdk_pixbuf
- */
-static gboolean gdk_pixbuf__wbmp_image_stop_load(gpointer data,
- GError **error)
-{
- struct wbmp_progressive_state *context =
- (struct wbmp_progressive_state *) data;
-
- /* FIXME this thing needs to report errors if
- * we have unused image data
- */
-
- g_return_val_if_fail(context != NULL, TRUE);
- if (context->pixbuf)
- g_object_unref(context->pixbuf);
-
- g_free(context);
-
- return TRUE;
-}
-
-static gboolean
-getin(struct wbmp_progressive_state *context, const guchar **buf, guint *buf_size, guchar *ptr, int datum_size)
-{
- int last_num, buf_num;
-
- if((context->last_len + *buf_size) < datum_size)
- return FALSE;
-
- /* We know we can pull it out of there */
- last_num = MIN(datum_size, context->last_len);
- buf_num = MIN(datum_size-last_num, *buf_size);
- memcpy(ptr, context->last_buf, last_num);
- memcpy(ptr+last_num, *buf, buf_num);
-
- context->last_len -= last_num;
- if(context->last_len)
- memmove(context->last_buf, context->last_buf+last_num, context->last_len);
- *buf_size -= buf_num;
- *buf += buf_num;
-
- return TRUE;
-}
-
-static gboolean
-save_rest(struct wbmp_progressive_state *context, const guchar *buf, guint buf_size)
-{
- if(buf_size > (sizeof(context->last_buf) - context->last_len))
- return FALSE;
-
- memcpy(context->last_buf+context->last_len, buf, buf_size);
- context->last_len += buf_size;
-
- return TRUE;
-}
-
-static gboolean
-get_mbi(struct wbmp_progressive_state *context, const guchar **buf, guint *buf_size, int *val)
-{
- guchar intbuf[16];
- int n;
- gboolean rv;
-
- *val = 0;
- n = 0;
- do {
- rv = getin(context, buf, buf_size, intbuf+n, 1);
- if(!rv)
- goto out;
- *val <<= 7;
- *val |= intbuf[n] & 0x7F;
- n++;
- } while(n < sizeof(intbuf) && (intbuf[n-1] & 0x80));
-
- out:
- if(!rv || (intbuf[n-1] & 0x80))
- {
- rv = save_rest(context, intbuf, n);
-
- if(!rv)
- g_error("Couldn't save_rest of intbuf");
- return FALSE;
- }
-
- return TRUE;
-}
-
-/*
- * context - from image_begin_load
- * buf - new image data
- * size - length of new image data
- *
- * append image data onto inrecrementally built output image
- */
-static gboolean gdk_pixbuf__wbmp_image_load_increment(gpointer data,
- const guchar * buf,
- guint size, GError **error)
-{
- struct wbmp_progressive_state *context =
- (struct wbmp_progressive_state *) data;
- gboolean bv = FALSE;
-
- do
- {
- if(context->need_type)
- {
- guchar val;
-
- bv = getin(context, &buf, &size, &val, 1);
- if(bv)
- {
- context->type = val;
- context->need_type = FALSE;
- }
- }
- else if(context->need_header)
- {
- guchar val;
-
- bv = getin(context, &buf, &size, &val, 1);
- if(bv)
- {
- /* We skip over the extended header - val is unused */
- if(!(val & 0x80))
- context->need_header = FALSE;
- }
- }
- else if(context->need_width)
- {
- bv = get_mbi(context, &buf, &size, &context->width);
- if(bv) {
- context->need_width = FALSE;
-
- if (context->width <= 0) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Image has zero width"));
-
- return FALSE;
- }
- }
-
- }
- else if(context->need_height)
- {
- bv = get_mbi(context, &buf, &size, &context->height);
- if(bv)
- {
- context->need_height = FALSE;
-
- if (context->height <= 0) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Image has zero height"));
-
- return FALSE;
- }
-
- context->pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, FALSE, 8, context->width, context->height);
-
- if (!context->pixbuf) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Not enough memory to load image"));
- return FALSE;
- }
-
-
- if(context->prepared_func)
- context->prepared_func(context->pixbuf, NULL, context->user_data);
- }
- }
- else if(context->needmore)
- {
- int first_row;
- first_row = context->cury;
- for( ; context->cury < context->height; context->cury++, context->curx = 0)
- {
- for( ; context->curx < context->width; context->curx += 8)
- {
- guchar byte;
- guchar *ptr;
- int xoff;
- bv = getin(context, &buf, &size, &byte, 1);
- if(!bv)
- goto out;
-
- ptr = context->pixbuf->pixels + context->pixbuf->rowstride * context->cury + context->curx * 3;
- for(xoff = 7; xoff >= 0; xoff--, ptr += 3)
- {
- guchar pixval;
-
- if (context->curx + (7 - xoff) == context->width)
- break;
-
- if(byte & (1<<xoff))
- pixval = 0xFF;
- else
- pixval = 0x0;
-
- ptr[0] = ptr[1] = ptr[2] = pixval;
- }
- }
- }
- context->needmore = FALSE;
-
- out:
- if(context->updated_func)
- context->updated_func(context->pixbuf, 0, first_row, context->width, context->cury - first_row + 1,
- context->user_data);
- }
- else
- bv = FALSE; /* Nothing left to do, stop feeding me data! */
-
- } while(bv);
-
- if(size) {
- bv = save_rest(context, buf, size);
- if (!bv) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Couldn't save the rest"));
-
- return FALSE;
- }
- }
- return TRUE;
-}
-
-#ifndef INCLUDE_wbmp
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__wbmp_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
-{
- module->begin_load = gdk_pixbuf__wbmp_image_begin_load;
- module->stop_load = gdk_pixbuf__wbmp_image_stop_load;
- module->load_increment = gdk_pixbuf__wbmp_image_load_increment;
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
-{
- static GdkPixbufModulePattern signature[] = {
- { " ", "zz", 1 },
- { " \140", "z ", 1 },
- { " \100", "z ", 1 },
- { " \040", "z ", 1 },
- { NULL, NULL, 0 }
- };
- static gchar * mime_types[] = {
- "image/vnd.wap.wbmp",
- NULL
- };
- static gchar * extensions[] = {
- "wbmp",
- NULL
- };
-
- info->name = "wbmp";
- info->signature = signature;
- info->description = N_("The WBMP image format");
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "LGPL";
-}
diff --git a/gdk-pixbuf/io-xbm.c b/gdk-pixbuf/io-xbm.c
deleted file mode 100644
index 05c45ac97c..0000000000
--- a/gdk-pixbuf/io-xbm.c
+++ /dev/null
@@ -1,497 +0,0 @@
-/* -*- mode: C; c-file-style: "linux" -*- */
-/* GdkPixbuf library - XBM image loader
- *
- * Copyright (C) 1999 Mark Crichton
- * Copyright (C) 1999 The Free Software Foundation
- * Copyright (C) 2001 Eazel, Inc.
- *
- * Authors: Mark Crichton <crichton@gimp.org>
- * Federico Mena-Quintero <federico@gimp.org>
- * Jonathan Blandford <jrb@redhat.com>
- * John Harper <jsh@eazel.com>
- *
- * 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.
- */
-
-/* Following code adapted from io-tiff.c, which was ``(almost) blatantly
- ripped from Imlib'' */
-
-#include "config.h"
-#include <stdlib.h>
-#include <string.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#include <stdio.h>
-#include <errno.h>
-#include "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-io.h"
-#include <glib/gstdio.h>
-
-
-typedef struct _XBMData XBMData;
-struct _XBMData
-{
- GdkPixbufModulePreparedFunc prepare_func;
- GdkPixbufModuleUpdatedFunc update_func;
- gpointer user_data;
-
- gchar *tempname;
- FILE *file;
- gboolean all_okay;
-};
-
-
-/* xbm parser borrowed from xc/lib/X11/RdBitF.c */
-
-#define MAX_SIZE 255
-
-/* shared data for the image read/parse logic */
-static short hex_table[256]; /* conversion value */
-static gboolean initialized = FALSE; /* easier to fill in at run time */
-
-
-/* Table index for the hex values. Initialized once, first time.
- * Used for translation value or delimiter significance lookup.
- */
-static void
-init_hex_table (void)
-{
- /*
- * We build the table at run time for several reasons:
- *
- * 1. portable to non-ASCII machines.
- * 2. still reentrant since we set the init flag after setting table.
- * 3. easier to extend.
- * 4. less prone to bugs.
- */
- hex_table['0'] = 0;
- hex_table['1'] = 1;
- hex_table['2'] = 2;
- hex_table['3'] = 3;
- hex_table['4'] = 4;
- hex_table['5'] = 5;
- hex_table['6'] = 6;
- hex_table['7'] = 7;
- hex_table['8'] = 8;
- hex_table['9'] = 9;
- hex_table['A'] = 10;
- hex_table['B'] = 11;
- hex_table['C'] = 12;
- hex_table['D'] = 13;
- hex_table['E'] = 14;
- hex_table['F'] = 15;
- hex_table['a'] = 10;
- hex_table['b'] = 11;
- hex_table['c'] = 12;
- hex_table['d'] = 13;
- hex_table['e'] = 14;
- hex_table['f'] = 15;
-
- /* delimiters of significance are flagged w/ negative value */
- hex_table[' '] = -1;
- hex_table[','] = -1;
- hex_table['}'] = -1;
- hex_table['\n'] = -1;
- hex_table['\t'] = -1;
-
- initialized = TRUE;
-}
-
-/* Read next hex value in the input stream, return -1 if EOF */
-static int
-next_int (FILE *fstream)
-{
- int ch;
- int value = 0;
- int gotone = 0;
- int done = 0;
-
- /* loop, accumulate hex value until find delimiter
- skip any initial delimiters found in read stream */
-
- while (!done) {
- ch = getc (fstream);
- if (ch == EOF) {
- value = -1;
- done++;
- } else {
- /* trim high bits, check type and accumulate */
- ch &= 0xff;
- if (g_ascii_isxdigit (ch)) {
- value = (value << 4) + g_ascii_xdigit_value (ch);
- gotone++;
- } else if ((hex_table[ch]) < 0 && gotone) {
- done++;
- }
- }
- }
- return value;
-}
-
-static gboolean
-read_bitmap_file_data (FILE *fstream,
- guint *width,
- guint *height,
- guchar **data,
- int *x_hot,
- int *y_hot)
-{
- guchar *bits = NULL; /* working variable */
- char line[MAX_SIZE]; /* input line from file */
- int size; /* number of bytes of data */
- char name_and_type[MAX_SIZE]; /* an input line */
- char *type; /* for parsing */
- int value; /* from an input line */
- int version10p; /* boolean, old format */
- int padding; /* to handle alignment */
- int bytes_per_line; /* per scanline of data */
- guint ww = 0; /* width */
- guint hh = 0; /* height */
- int hx = -1; /* x hotspot */
- int hy = -1; /* y hotspot */
-
- /* first time initialization */
- if (!initialized) {
- init_hex_table ();
- }
-
- /* error cleanup and return macro */
-#define RETURN(code) { g_free (bits); return code; }
-
- while (fgets (line, MAX_SIZE, fstream)) {
- if (strlen (line) == MAX_SIZE-1)
- RETURN (FALSE);
- if (sscanf (line,"#define %s %d",name_and_type,&value) == 2) {
- if (!(type = strrchr (name_and_type, '_')))
- type = name_and_type;
- else {
- type++;
- }
-
- if (!strcmp ("width", type))
- ww = (unsigned int) value;
- if (!strcmp ("height", type))
- hh = (unsigned int) value;
- if (!strcmp ("hot", type)) {
- if (type-- == name_and_type
- || type-- == name_and_type)
- continue;
- if (!strcmp ("x_hot", type))
- hx = value;
- if (!strcmp ("y_hot", type))
- hy = value;
- }
- continue;
- }
-
- if (sscanf (line, "static short %s = {", name_and_type) == 1)
- version10p = 1;
- else if (sscanf (line,"static const unsigned char %s = {",name_and_type) == 1)
- version10p = 0;
- else if (sscanf (line,"static unsigned char %s = {",name_and_type) == 1)
- version10p = 0;
- else if (sscanf (line, "static const char %s = {", name_and_type) == 1)
- version10p = 0;
- else if (sscanf (line, "static char %s = {", name_and_type) == 1)
- version10p = 0;
- else
- continue;
-
- if (!(type = strrchr (name_and_type, '_')))
- type = name_and_type;
- else
- type++;
-
- if (strcmp ("bits[]", type))
- continue;
-
- if (!ww || !hh)
- RETURN (FALSE);
-
- if ((ww % 16) && ((ww % 16) < 9) && version10p)
- padding = 1;
- else
- padding = 0;
-
- bytes_per_line = (ww+7)/8 + padding;
-
- size = bytes_per_line * hh;
- bits = g_malloc (size);
-
- if (version10p) {
- unsigned char *ptr;
- int bytes;
-
- for (bytes = 0, ptr = bits; bytes < size; (bytes += 2)) {
- if ((value = next_int (fstream)) < 0)
- RETURN (FALSE);
- *(ptr++) = value;
- if (!padding || ((bytes+2) % bytes_per_line))
- *(ptr++) = value >> 8;
- }
- } else {
- unsigned char *ptr;
- int bytes;
-
- for (bytes = 0, ptr = bits; bytes < size; bytes++, ptr++) {
- if ((value = next_int (fstream)) < 0)
- RETURN (FALSE);
- *ptr=value;
- }
- }
- break;
- }
-
- if (!bits)
- RETURN (FALSE);
-
- *data = bits;
- *width = ww;
- *height = hh;
- if (x_hot)
- *x_hot = hx;
- if (y_hot)
- *y_hot = hy;
-
- return TRUE;
-}
-
-
-
-static GdkPixbuf *
-gdk_pixbuf__xbm_image_load_real (FILE *f,
- XBMData *context,
- GError **error)
-{
- guint w, h;
- int x_hot, y_hot;
- guchar *data, *ptr;
- guchar *pixels;
- guint row_stride;
- int x, y;
- int reg = 0; /* Quiet compiler */
- int bits;
-
- GdkPixbuf *pixbuf;
-
- if (!read_bitmap_file_data (f, &w, &h, &data, &x_hot, &y_hot)) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Invalid XBM file"));
- return NULL;
- }
-
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, w, h);
-
- if (pixbuf == NULL) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Insufficient memory to load XBM image file"));
- return NULL;
- }
-
- if (x_hot != -1 && y_hot != -1) {
- gchar hot[10];
- g_snprintf (hot, 10, "%d", x_hot);
- gdk_pixbuf_set_option (pixbuf, "x_hot", hot);
- g_snprintf (hot, 10, "%d", y_hot);
- gdk_pixbuf_set_option (pixbuf, "y_hot", hot);
- }
-
- pixels = gdk_pixbuf_get_pixels (pixbuf);
- row_stride = gdk_pixbuf_get_rowstride (pixbuf);
-
- if (context && context->prepare_func)
- (* context->prepare_func) (pixbuf, NULL, context->user_data);
-
-
- /* Initialize PIXBUF */
-
- ptr = data;
- for (y = 0; y < h; y++) {
- bits = 0;
- for (x = 0; x < w; x++) {
- guchar channel;
- if (bits == 0) {
- reg = *ptr++;
- bits = 8;
- }
-
- channel = (reg & 1) ? 0 : 255;
- reg >>= 1;
- bits--;
-
- pixels[x*3+0] = channel;
- pixels[x*3+1] = channel;
- pixels[x*3+2] = channel;
- }
- pixels += row_stride;
- }
- g_free (data);
-
- if (context) {
- if (context->update_func)
- (* context->update_func) (pixbuf, 0, 0, w, h, context->user_data);
- }
-
- return pixbuf;
-}
-
-
-/* Static loader */
-
-static GdkPixbuf *
-gdk_pixbuf__xbm_image_load (FILE *f,
- GError **error)
-{
- return gdk_pixbuf__xbm_image_load_real (f, NULL, error);
-}
-
-
-/* Progressive loader */
-
-/*
- * Proper XBM progressive loading isn't implemented. Instead we write
- * it to a file, then load the file when it's done. It's not pretty.
- */
-
-static gpointer
-gdk_pixbuf__xbm_image_begin_load (GdkPixbufModuleSizeFunc size_func,
- GdkPixbufModulePreparedFunc prepare_func,
- GdkPixbufModuleUpdatedFunc update_func,
- gpointer user_data,
- GError **error)
-{
- XBMData *context;
- gint fd;
-
- context = g_new (XBMData, 1);
- context->prepare_func = prepare_func;
- context->update_func = update_func;
- context->user_data = user_data;
- context->all_okay = TRUE;
- fd = g_file_open_tmp ("gdkpixbuf-xbm-tmp.XXXXXX",
- &context->tempname,
- NULL);
- if (fd < 0) {
- 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;
-}
-
-static gboolean
-gdk_pixbuf__xbm_image_stop_load (gpointer data,
- GError **error)
-{
- XBMData *context = (XBMData*) data;
- gboolean retval = TRUE;
-
- g_return_val_if_fail (data != NULL, TRUE);
-
- fflush (context->file);
- rewind (context->file);
- if (context->all_okay) {
- GdkPixbuf *pixbuf;
- pixbuf = gdk_pixbuf__xbm_image_load_real (context->file,
- context,
- error);
- if (pixbuf == NULL)
- retval = FALSE;
- else
- g_object_unref (pixbuf);
- }
-
- fclose (context->file);
- g_unlink (context->tempname);
- g_free (context->tempname);
- g_free ((XBMData *) context);
-
- return retval;
-}
-
-static gboolean
-gdk_pixbuf__xbm_image_load_increment (gpointer data,
- const guchar *buf,
- guint size,
- GError **error)
-{
- XBMData *context = (XBMData *) data;
-
- g_return_val_if_fail (data != NULL, FALSE);
-
- if (fwrite (buf, sizeof (guchar), size, context->file) != size) {
- gint save_errno = errno;
- context->all_okay = FALSE;
- g_set_error_literal (error,
- G_FILE_ERROR,
- g_file_error_from_errno (save_errno),
- _("Failed to write to temporary file when loading XBM image"));
- return FALSE;
- }
-
- return TRUE;
-}
-
-#ifndef INCLUDE_xbm
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__xbm_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
-{
- module->load = gdk_pixbuf__xbm_image_load;
- module->begin_load = gdk_pixbuf__xbm_image_begin_load;
- module->stop_load = gdk_pixbuf__xbm_image_stop_load;
- module->load_increment = gdk_pixbuf__xbm_image_load_increment;
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
-{
- static GdkPixbufModulePattern signature[] = {
- { "#define ", NULL, 100 },
- { "/*", NULL, 50 },
- { NULL, NULL, 0 }
- };
- static gchar * mime_types[] = {
- "image/x-xbitmap",
- NULL
- };
- static gchar * extensions[] = {
- "xbm",
- NULL
- };
-
- info->name = "xbm";
- info->signature = signature;
- info->description = N_("The XBM image format");
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "LGPL";
-}
diff --git a/gdk-pixbuf/io-xpm.c b/gdk-pixbuf/io-xpm.c
deleted file mode 100644
index b8a02d84cc..0000000000
--- a/gdk-pixbuf/io-xpm.c
+++ /dev/null
@@ -1,821 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* GdkPixbuf library - XPM image loader
- *
- * Copyright (C) 1999 Mark Crichton
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Authors: Mark Crichton <crichton@gimp.org>
- * 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 Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <glib.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h> /* for unlink */
-#endif
-#include <errno.h>
-#include "gdk-pixbuf-private.h"
-#include "gdk-pixbuf-io.h"
-#include <glib/gstdio.h>
-
-
-/* I have must have done something to deserve this.
- * XPM is such a crappy format to handle.
- * This code is an ugly hybred from gdkpixmap.c
- * modified to respect transparent colors.
- * It's still a mess, though.
- */
-
-enum buf_op {
- op_header,
- op_cmap,
- op_body
-};
-
-typedef struct {
- gchar *color_string;
- guint16 red;
- guint16 green;
- guint16 blue;
- gint transparent;
-} XPMColor;
-
-struct file_handle {
- FILE *infile;
- gchar *buffer;
- guint buffer_size;
-};
-
-struct mem_handle {
- const gchar **data;
- int offset;
-};
-
-/* The following 2 routines (parse_color, find_color) come from Tk, via the Win32
- * port of GDK. The licensing terms on these (longer than the functions) is:
- *
- * This software is copyrighted by the Regents of the University of
- * California, Sun Microsystems, Inc., and other parties. The following
- * terms apply to all files associated with the software unless explicitly
- * disclaimed in individual files.
- *
- * The authors hereby grant permission to use, copy, modify, distribute,
- * and license this software and its documentation for any purpose, provided
- * that existing copyright notices are retained in all copies and that this
- * notice is included verbatim in any distributions. No written agreement,
- * license, or royalty fee is required for any of the authorized uses.
- * Modifications to this software may be copyrighted by their authors
- * and need not follow the licensing terms described here, provided that
- * the new terms are clearly indicated on the first page of each file where
- * they apply.
- *
- * IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
- * FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
- * ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
- * DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- * THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
- * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE
- * IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
- * NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
- * MODIFICATIONS.
- *
- * GOVERNMENT USE: If you are acquiring this software on behalf of the
- * U.S. government, the Government shall have only "Restricted Rights"
- * in the software and related documentation as defined in the Federal
- * Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2). If you
- * are acquiring the software on behalf of the Department of Defense, the
- * software shall be classified as "Commercial Computer Software" and the
- * Government shall have only "Restricted Rights" as defined in Clause
- * 252.227-7013 (c) (1) of DFARs. Notwithstanding the foregoing, the
- * authors grant the U.S. Government and others acting in its behalf
- * permission to use and distribute the software in accordance with the
- * terms specified in this license.
- */
-
-#include "xpm-color-table.h"
-
-/*
- *----------------------------------------------------------------------
- *
- * find_color --
- *
- * This routine finds the color entry that corresponds to the
- * specified color.
- *
- * Results:
- * Returns non-zero on success. The RGB values of the XColor
- * will be initialized to the proper values on success.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static int
-compare_xcolor_entries (const void *a, const void *b)
-{
- return g_ascii_strcasecmp ((const char *) a,
- color_names + ((const XPMColorEntry *)b)->name_offset);
-}
-
-static gboolean
-find_color(const char *name,
- XPMColor *colorPtr)
-{
- XPMColorEntry *found;
-
- found = bsearch (name, xColors, G_N_ELEMENTS (xColors), sizeof (XPMColorEntry),
- compare_xcolor_entries);
- if (found == NULL)
- return FALSE;
-
- colorPtr->red = (found->red * 65535) / 255;
- colorPtr->green = (found->green * 65535) / 255;
- colorPtr->blue = (found->blue * 65535) / 255;
-
- return TRUE;
-}
-
-/*
- *----------------------------------------------------------------------
- *
- * parse_color --
- *
- * Partial implementation of X color name parsing interface.
- *
- * Results:
- * Returns TRUE on success.
- *
- * Side effects:
- * None.
- *
- *----------------------------------------------------------------------
- */
-
-static gboolean
-parse_color (const char *spec,
- XPMColor *colorPtr)
-{
- if (spec[0] == '#') {
- char fmt[16];
- int i, red, green, blue;
-
- if ((i = strlen (spec + 1)) % 3) {
- return FALSE;
- }
- i /= 3;
-
- g_snprintf (fmt, 16, "%%%dx%%%dx%%%dx", i, i, i);
-
- if (sscanf (spec + 1, fmt, &red, &green, &blue) != 3) {
- return FALSE;
- }
- if (i == 4) {
- colorPtr->red = red;
- colorPtr->green = green;
- colorPtr->blue = blue;
- } else if (i == 1) {
- colorPtr->red = (red * 65535) / 15;
- colorPtr->green = (green * 65535) / 15;
- colorPtr->blue = (blue * 65535) / 15;
- } else if (i == 2)
- {
- colorPtr->red = (red * 65535) / 255;
- colorPtr->green = (green * 65535) / 255;
- colorPtr->blue = (blue * 65535) / 255;
- } else /* if (i == 3) */ {
- colorPtr->red = (red * 65535) / 4095;
- colorPtr->green = (green * 65535) / 4095;
- colorPtr->blue = (blue * 65535) / 4095;
- }
- } else {
- if (!find_color(spec, colorPtr))
- return FALSE;
- }
- return TRUE;
-}
-
-static gint
-xpm_seek_string (FILE *infile, const gchar *str)
-{
- char instr[1024];
-
- while (!feof (infile)) {
- if (fscanf (infile, "%1023s", instr) < 0)
- return FALSE;
- if (strcmp (instr, str) == 0)
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gint
-xpm_seek_char (FILE *infile, gchar c)
-{
- gint b, oldb;
-
- while ((b = getc (infile)) != EOF) {
- if (c != b && b == '/') {
- b = getc (infile);
- if (b == EOF)
- return FALSE;
-
- else if (b == '*') { /* we have a comment */
- b = -1;
- do {
- oldb = b;
- b = getc (infile);
- if (b == EOF)
- return FALSE;
- } while (!(oldb == '*' && b == '/'));
- }
- } else if (c == b)
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gint
-xpm_read_string (FILE *infile, gchar **buffer, guint *buffer_size)
-{
- gint c;
- guint cnt = 0, bufsiz, ret = FALSE;
- gchar *buf;
-
- buf = *buffer;
- bufsiz = *buffer_size;
- if (buf == NULL) {
- bufsiz = 10 * sizeof (gchar);
- buf = g_new (gchar, bufsiz);
- }
-
- do {
- c = getc (infile);
- } while (c != EOF && c != '"');
-
- if (c != '"')
- goto out;
-
- while ((c = getc (infile)) != EOF) {
- if (cnt == bufsiz) {
- guint new_size = bufsiz * 2;
-
- if (new_size > bufsiz)
- bufsiz = new_size;
- else
- goto out;
-
- buf = g_realloc (buf, bufsiz);
- buf[bufsiz - 1] = '\0';
- }
-
- if (c != '"')
- buf[cnt++] = c;
- else {
- buf[cnt] = 0;
- ret = TRUE;
- break;
- }
- }
-
- out:
- buf[bufsiz - 1] = '\0'; /* ensure null termination for errors */
- *buffer = buf;
- *buffer_size = bufsiz;
- return ret;
-}
-
-static gchar *
-xpm_extract_color (const gchar *buffer)
-{
- const gchar *p = &buffer[0];
- gint new_key = 0;
- gint key = 0;
- gint current_key = 1;
- gint space = 128;
- gchar word[129], color[129], current_color[129];
- gchar *r;
-
- word[0] = '\0';
- color[0] = '\0';
- current_color[0] = '\0';
- while (1) {
- /* skip whitespace */
- for (; *p != '\0' && g_ascii_isspace (*p); p++) {
- }
- /* copy word */
- for (r = word; *p != '\0' && !g_ascii_isspace (*p) && r - word < sizeof (word) - 1; p++, r++) {
- *r = *p;
- }
- *r = '\0';
- if (*word == '\0') {
- if (color[0] == '\0') /* incomplete colormap entry */
- return NULL;
- else /* end of entry, still store the last color */
- new_key = 1;
- }
- else if (key > 0 && color[0] == '\0') /* next word must be a color name part */
- new_key = 0;
- else {
- if (strcmp (word, "c") == 0)
- new_key = 5;
- else if (strcmp (word, "g") == 0)
- new_key = 4;
- else if (strcmp (word, "g4") == 0)
- new_key = 3;
- else if (strcmp (word, "m") == 0)
- new_key = 2;
- else if (strcmp (word, "s") == 0)
- new_key = 1;
- else
- new_key = 0;
- }
- if (new_key == 0) { /* word is a color name part */
- if (key == 0) /* key expected */
- return NULL;
- /* accumulate color name */
- if (color[0] != '\0') {
- strncat (color, " ", space);
- space -= MIN (space, 1);
- }
- strncat (color, word, space);
- space -= MIN (space, strlen (word));
- }
- else { /* word is a key */
- if (key > current_key) {
- current_key = key;
- strcpy (current_color, color);
- }
- space = 128;
- color[0] = '\0';
- key = new_key;
- if (*p == '\0') break;
- }
-
- }
- if (current_key > 1)
- return g_strdup (current_color);
- else
- return NULL;
-}
-
-/* (almost) direct copy from gdkpixmap.c... loads an XPM from a file */
-
-static const gchar *
-file_buffer (enum buf_op op, gpointer handle)
-{
- struct file_handle *h = handle;
-
- switch (op) {
- case op_header:
- if (xpm_seek_string (h->infile, "XPM") != TRUE)
- break;
-
- if (xpm_seek_char (h->infile, '{') != TRUE)
- break;
- /* Fall through to the next xpm_seek_char. */
-
- case op_cmap:
- xpm_seek_char (h->infile, '"');
- fseek (h->infile, -1, SEEK_CUR);
- /* Fall through to the xpm_read_string. */
-
- case op_body:
- if(!xpm_read_string (h->infile, &h->buffer, &h->buffer_size))
- return NULL;
- return h->buffer;
-
- default:
- g_assert_not_reached ();
- }
-
- return NULL;
-}
-
-/* This reads from memory */
-static const gchar *
-mem_buffer (enum buf_op op, gpointer handle)
-{
- struct mem_handle *h = handle;
- switch (op) {
- case op_header:
- case op_cmap:
- case op_body:
- if (h->data[h->offset]) {
- const gchar* retval;
-
- retval = h->data[h->offset];
- h->offset += 1;
- return retval;
- }
- break;
-
- default:
- g_assert_not_reached ();
- break;
- }
-
- return NULL;
-}
-
-/* This function does all the work. */
-static GdkPixbuf *
-pixbuf_create_from_xpm (const gchar * (*get_buf) (enum buf_op op, gpointer handle), gpointer handle,
- GError **error)
-{
- gint w, h, n_col, cpp, x_hot, y_hot, items;
- gint cnt, xcnt, ycnt, wbytes, n;
- gint is_trans = FALSE;
- const gchar *buffer;
- gchar *name_buf;
- gchar pixel_str[32];
- GHashTable *color_hash;
- XPMColor *colors, *color, *fallbackcolor;
- guchar *pixtmp;
- GdkPixbuf *pixbuf;
-
- fallbackcolor = NULL;
-
- buffer = (*get_buf) (op_header, handle);
- if (!buffer) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("No XPM header found"));
- return NULL;
- }
- items = sscanf (buffer, "%d %d %d %d %d %d", &w, &h, &n_col, &cpp, &x_hot, &y_hot);
-
- if (items != 4 && items != 6) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Invalid XPM header"));
- return NULL;
- }
-
- if (w <= 0) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("XPM file has image width <= 0"));
- return NULL;
-
- }
- if (h <= 0) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("XPM file has image height <= 0"));
- return NULL;
-
- }
- if (cpp <= 0 || cpp >= 32) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("XPM has invalid number of chars per pixel"));
- return NULL;
- }
- if (n_col <= 0 ||
- n_col >= G_MAXINT / (cpp + 1) ||
- n_col >= G_MAXINT / sizeof (XPMColor)) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("XPM file has invalid number of colors"));
- return NULL;
- }
-
- /* The hash is used for fast lookups of color from chars */
- color_hash = g_hash_table_new (g_str_hash, g_str_equal);
-
- name_buf = g_try_malloc (n_col * (cpp + 1));
- if (!name_buf) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Cannot allocate memory for loading XPM image"));
- g_hash_table_destroy (color_hash);
- return NULL;
- }
- colors = (XPMColor *) g_try_malloc (sizeof (XPMColor) * n_col);
- if (!colors) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Cannot allocate memory for loading XPM image"));
- g_hash_table_destroy (color_hash);
- g_free (name_buf);
- return NULL;
- }
-
- for (cnt = 0; cnt < n_col; cnt++) {
- gchar *color_name;
-
- buffer = (*get_buf) (op_cmap, handle);
- if (!buffer) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
- _("Cannot read XPM colormap"));
- g_hash_table_destroy (color_hash);
- g_free (name_buf);
- g_free (colors);
- return NULL;
- }
-
- color = &colors[cnt];
- color->color_string = &name_buf[cnt * (cpp + 1)];
- strncpy (color->color_string, buffer, cpp);
- color->color_string[cpp] = 0;
- buffer += strlen (color->color_string);
- color->transparent = FALSE;
-
- color_name = xpm_extract_color (buffer);
-
- if ((color_name == NULL) || (g_ascii_strcasecmp (color_name, "None") == 0)
- || (parse_color (color_name, color) == FALSE)) {
- color->transparent = TRUE;
- color->red = 0;
- color->green = 0;
- color->blue = 0;
- is_trans = TRUE;
- }
-
- g_free (color_name);
- g_hash_table_insert (color_hash, color->color_string, color);
-
- if (cnt == 0)
- fallbackcolor = color;
- }
-
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, is_trans, 8, w, h);
-
- if (!pixbuf) {
- g_set_error_literal (error,
- GDK_PIXBUF_ERROR,
- GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
- _("Cannot allocate memory for loading XPM image"));
- g_hash_table_destroy (color_hash);
- g_free (colors);
- g_free (name_buf);
- return NULL;
- }
-
- wbytes = w * cpp;
-
- for (ycnt = 0; ycnt < h; ycnt++) {
- pixtmp = pixbuf->pixels + ycnt * pixbuf->rowstride;
-
- buffer = (*get_buf) (op_body, handle);
- if ((!buffer) || (strlen (buffer) < wbytes))
- continue;
-
- for (n = 0, xcnt = 0; n < wbytes; n += cpp, xcnt++) {
- strncpy (pixel_str, &buffer[n], cpp);
- pixel_str[cpp] = 0;
-
- color = g_hash_table_lookup (color_hash, pixel_str);
-
- /* Bad XPM...punt */
- if (!color)
- color = fallbackcolor;
-
- *pixtmp++ = color->red >> 8;
- *pixtmp++ = color->green >> 8;
- *pixtmp++ = color->blue >> 8;
-
- if (is_trans && color->transparent)
- *pixtmp++ = 0;
- else if (is_trans)
- *pixtmp++ = 0xFF;
- }
- }
-
- g_hash_table_destroy (color_hash);
- g_free (colors);
- g_free (name_buf);
-
- if (items == 6) {
- gchar hot[10];
- g_snprintf (hot, 10, "%d", x_hot);
- gdk_pixbuf_set_option (pixbuf, "x_hot", hot);
- g_snprintf (hot, 10, "%d", y_hot);
- gdk_pixbuf_set_option (pixbuf, "y_hot", hot);
-
- }
-
- return pixbuf;
-}
-
-/* Shared library entry point for file loading */
-static GdkPixbuf *
-gdk_pixbuf__xpm_image_load (FILE *f,
- GError **error)
-{
- GdkPixbuf *pixbuf;
- struct file_handle h;
-
- memset (&h, 0, sizeof (h));
- h.infile = f;
- pixbuf = pixbuf_create_from_xpm (file_buffer, &h, error);
- g_free (h.buffer);
-
- return pixbuf;
-}
-
-/* Shared library entry point for memory loading */
-static GdkPixbuf *
-gdk_pixbuf__xpm_image_load_xpm_data (const gchar **data)
-{
- GdkPixbuf *pixbuf;
- struct mem_handle h;
- GError *error = NULL;
-
- h.data = data;
- h.offset = 0;
-
- pixbuf = pixbuf_create_from_xpm (mem_buffer, &h, &error);
-
- if (error) {
- g_warning ("Inline XPM data is broken: %s", error->message);
- g_error_free (error);
- error = NULL;
- }
-
- return pixbuf;
-}
-
-/* Progressive loader */
-typedef struct _XPMContext XPMContext;
-struct _XPMContext
-{
- GdkPixbufModulePreparedFunc prepare_func;
- GdkPixbufModuleUpdatedFunc 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.
- */
-static gpointer
-gdk_pixbuf__xpm_image_begin_load (GdkPixbufModuleSizeFunc size_func,
- GdkPixbufModulePreparedFunc prepare_func,
- GdkPixbufModuleUpdatedFunc update_func,
- gpointer user_data,
- GError **error)
-{
- XPMContext *context;
- gint fd;
-
- context = g_new (XPMContext, 1);
- context->prepare_func = prepare_func;
- context->update_func = update_func;
- context->user_data = user_data;
- context->all_okay = TRUE;
- fd = g_file_open_tmp ("gdkpixbuf-xpm-tmp.XXXXXX", &context->tempname,
- NULL);
- if (fd < 0) {
- 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;
-}
-
-static gboolean
-gdk_pixbuf__xpm_image_stop_load (gpointer data,
- GError **error)
-{
- XPMContext *context = (XPMContext*) data;
- GdkPixbuf *pixbuf;
- gboolean retval = FALSE;
-
- g_return_val_if_fail (data != NULL, FALSE);
-
- fflush (context->file);
- rewind (context->file);
- if (context->all_okay) {
- pixbuf = gdk_pixbuf__xpm_image_load (context->file, error);
-
- if (pixbuf != NULL) {
- if (context->prepare_func)
- (* context->prepare_func) (pixbuf,
- NULL,
- context->user_data);
- if (context->update_func)
- (* context->update_func) (pixbuf, 0, 0, pixbuf->width, pixbuf->height, context->user_data);
- g_object_unref (pixbuf);
-
- retval = TRUE;
- }
- }
-
- fclose (context->file);
- g_unlink (context->tempname);
- g_free (context->tempname);
- g_free ((XPMContext *) context);
-
- return retval;
-}
-
-static gboolean
-gdk_pixbuf__xpm_image_load_increment (gpointer data,
- const guchar *buf,
- guint size,
- GError **error)
-{
- XPMContext *context = (XPMContext *) data;
-
- g_return_val_if_fail (data != NULL, FALSE);
-
- if (fwrite (buf, sizeof (guchar), size, context->file) != size) {
- gint save_errno = errno;
- context->all_okay = FALSE;
- g_set_error_literal (error,
- G_FILE_ERROR,
- g_file_error_from_errno (save_errno),
- _("Failed to write to temporary file when loading XPM image"));
- return FALSE;
- }
-
- return TRUE;
-}
-
-#ifndef INCLUDE_xpm
-#define MODULE_ENTRY(function) G_MODULE_EXPORT void function
-#else
-#define MODULE_ENTRY(function) void _gdk_pixbuf__xpm_ ## function
-#endif
-
-MODULE_ENTRY (fill_vtable) (GdkPixbufModule *module)
-{
- module->load = gdk_pixbuf__xpm_image_load;
- module->load_xpm_data = gdk_pixbuf__xpm_image_load_xpm_data;
- module->begin_load = gdk_pixbuf__xpm_image_begin_load;
- module->stop_load = gdk_pixbuf__xpm_image_stop_load;
- module->load_increment = gdk_pixbuf__xpm_image_load_increment;
-}
-
-MODULE_ENTRY (fill_info) (GdkPixbufFormat *info)
-{
- static GdkPixbufModulePattern signature[] = {
- { "/* XPM */", NULL, 100 },
- { NULL, NULL, 0 }
- };
- static gchar * mime_types[] = {
- "image/x-xpixmap",
- NULL
- };
- static gchar * extensions[] = {
- "xpm",
- NULL
- };
-
- info->name = "xpm";
- info->signature = signature;
- info->description = N_("The XPM image format");
- info->mime_types = mime_types;
- info->extensions = extensions;
- info->flags = GDK_PIXBUF_FORMAT_THREADSAFE;
- info->license = "LGPL";
-}
diff --git a/gdk-pixbuf/make-inline-pixbuf.c b/gdk-pixbuf/make-inline-pixbuf.c
deleted file mode 100644
index e2e1f6100d..0000000000
--- a/gdk-pixbuf/make-inline-pixbuf.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/* Program to convert an image file to inline C data
- *
- * Copyright (C) 2000 Red Hat, Inc.
- *
- * Developed by Havoc Pennington <hp@redhat.com>
- *
- * 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 "gdk-pixbuf-private.h"
-#include <glib/gstdio.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-void
-output_int (FILE *outfile, guint32 num, const char *comment)
-{
- guchar bytes[4];
-
- /* Note, most significant bytes first */
- bytes[0] = num >> 24;
- bytes[1] = num >> 16;
- bytes[2] = num >> 8;
- bytes[3] = num;
-
- g_fprintf (outfile, " /* %s (%u) */\n 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x,\n",
- comment, num,
- bytes[0], bytes[1], bytes[2], bytes[3]);
-}
-
-void
-output_bool (FILE *outfile, gboolean val, const char *comment)
-{
- g_fprintf (outfile, " /* %s (%s) */\n 0x%.2x,\n",
- comment,
- val ? "TRUE" : "FALSE",
- val ? 1 : 0);
-}
-
-void
-output_pixbuf (FILE *outfile, gboolean ext_symbols,
- const char *varname,
- GdkPixbuf *pixbuf)
-{
- const char *modifier;
- const guchar *p;
- const guchar *end;
- gboolean has_alpha;
- int column;
-
- modifier = "static ";
- if (ext_symbols)
- modifier = "";
-
- g_fprintf (outfile, "%sconst guchar ", modifier);
- fputs (varname, outfile);
- fputs ("[] =\n", outfile);
- fputs ("{\n", outfile);
-
- p = gdk_pixbuf_get_pixels (pixbuf);
- end = p + gdk_pixbuf_get_rowstride (pixbuf) * gdk_pixbuf_get_height (pixbuf);
- has_alpha = gdk_pixbuf_get_has_alpha (pixbuf);
-
- /* Sync the order of writing with the order of reading in
- * gdk-pixbuf-data.c
- */
- output_int (outfile, GDK_PIXBUF_INLINE_MAGIC_NUMBER, "File magic");
- output_int (outfile, GDK_PIXBUF_INLINE_RAW, "Format of following stuff");
- output_int (outfile, gdk_pixbuf_get_rowstride (pixbuf), "Rowstride");
- output_int (outfile, gdk_pixbuf_get_width (pixbuf), "Width");
- output_int (outfile, gdk_pixbuf_get_height (pixbuf), "Height");
-
- output_bool (outfile, has_alpha, "Has an alpha channel");
-
- output_int (outfile, gdk_pixbuf_get_colorspace (pixbuf), "Colorspace (0 == RGB, no other options implemented)");
-
- output_int (outfile, gdk_pixbuf_get_n_channels (pixbuf), "Number of channels");
-
- output_int (outfile, gdk_pixbuf_get_bits_per_sample (pixbuf), "Bits per sample");
-
- fputs (" /* Image data */\n", outfile);
-
- /* Copy the data in the pixbuf */
- column = 0;
- while (p != end)
- {
- guchar r, g, b, a;
-
- r = *p;
- ++p;
- g = *p;
- ++p;
- b = *p;
- ++p;
- if (has_alpha)
- {
- a = *p;
- ++p;
- }
- else
- a = 0;
-
-
- if (has_alpha)
- g_fprintf (outfile, " 0x%.2x, 0x%.2x, 0x%.2x, 0x%.2x", r, g, b, a);
- else
- g_fprintf (outfile, " 0x%.2x, 0x%.2x, 0x%.2x", r, g, b);
-
- if (p != end)
- fputs (",", outfile);
- else
- fputs ("\n", outfile);
-
- ++column;
-
- if (column > 2)
- {
- fputs ("\n", outfile);
- column = 0;
- }
- }
-
- fputs ("};\n\n", outfile);
-}
-
-void
-usage (void)
-{
- g_fprintf (stderr, "Usage: make-inline-pixbuf [--extern-symbols] OUTFILE varname1 imagefile1 varname2 imagefile2 ...\n");
- exit (1);
-}
-
-int
-main (int argc, char **argv)
-{
- gboolean ext_symbols = FALSE;
- FILE *outfile;
- gchar *outfilename;
- int i;
-
- g_type_init ();
-
-
- if (argc < 4)
- usage ();
-
- i = 1;
- if (strcmp (argv[i], "--extern-symbols") == 0)
- {
- ext_symbols = TRUE;
- ++i;
- if (argc < 5)
- usage ();
- }
-
-#ifdef G_OS_WIN32
- outfilename = g_locale_to_utf8 (argv[i], -1, NULL, NULL, NULL)
-#else
- outfilename = argv[i];
-#endif
-
- outfile = g_fopen (outfilename, "w");
- if (outfile == NULL)
- {
- g_fprintf (stderr, "Failed to open output file `%s': %s\n",
- argv[i], strerror (errno));
- exit (1);
- }
-
- ++i;
-
- fputs ("/* This file was automatically generated by the make-inline-pixbuf program.\n"
- " * It contains inline RGB image data.\n"
- " */\n\n", outfile);
-
- /* Check for matched pairs of images/names */
- if (((argc - i) % 2) != 0)
- usage ();
-
- while (i < argc)
- {
- GdkPixbuf *pixbuf = NULL;
- GError *error;
- gchar *infilename;
-
- g_assert ((i + 1) < argc);
-
- error = NULL;
-#ifdef G_OS_WIN32
- infilename = g_locale_to_utf8 (argv[i+1], -1, NULL, NULL, &error);
-#else
- infilename = argv[i+1];
-#endif
- if (infilename)
- pixbuf = gdk_pixbuf_new_from_file (infilename, &error);
-
- if (pixbuf == NULL)
- {
- g_fprintf (stderr, "%s\n", error->message);
- fclose (outfile);
- g_remove (outfilename);
- exit (1);
- }
-
- output_pixbuf (outfile, ext_symbols, argv[i], pixbuf);
-
- g_object_unref (pixbuf);
-
- i += 2;
- }
-
- fclose (outfile);
-
- return 0;
-}
diff --git a/gdk-pixbuf/makefile.msc b/gdk-pixbuf/makefile.msc
deleted file mode 100644
index 7f6486afa1..0000000000
--- a/gdk-pixbuf/makefile.msc
+++ /dev/null
@@ -1,197 +0,0 @@
-TOP = ..\..
-PRJ_TOP = ..
-PACKAGE = gdk_pixbuf
-PKG_VER = $(GDK_PIXBUF_VER)
-
-!INCLUDE $(TOP)/glib/build/win32/make.msc
-
-!IFNDEF PERL
-PERL = perl
-!ENDIF
-
-GDK_PIXBUF_VER = 2.0
-
-# -DINCLUDE_gdiplus _replaces_ -DINCLUDE_bmp -DINCLUDE_gif -DINCLUDE_ico -DINCLUDE_jpeg -DINCLUDE_tiff
-# but not yet -DINCLUDE_png
-##USEGDIP=1
-# to get _working_ include modules we need respective defines ...
-#
-BUILT_IN_FORMATS = \
-!IFDEF USEGDIP
- -DINCLUDE_gdiplus \
-!ELSE
- -DINCLUDE_bmp -DINCLUDE_gif -DINCLUDE_ico -DINCLUDE_jpeg -DINCLUDE_tiff \
-!ENDIF
- -DINCLUDE_png \
- -DINCLUDE_xpm -DINCLUDE_wbmp \
- -DINCLUDE_pnm -DINCLUDE_ras
-
-PKG_CFLAGS = -FImsvc_recommended_pragmas.h \
-!IFNDEF USEGDIP
- $(JPEG_CFLAGS) $(TIFF_CFLAGS) \
-!ENDIF
- -I. -I.. $(GLIB_CFLAGS) \
- $(BUILT_IN_FORMATS) \
- $(PNG_CFLAGS) $(INTL_CFLAGS) \
- $(G_DEBUGGING) \
- -DGDK_PIXBUF_ENABLE_BACKEND \
- -DGTK_PREFIX=\"/just/some/non/existing/path/\" \
- -UUSE_GMODULE # use built-in
-# -DUSE_GMODULE -DPIXBUF_LIBDIR=\".\"
-
-PKG_LINK = $(GLIB_LIBS) \
-!IFNDEF USEGDIP
- $(TIFF_LIBS) $(JPEG_LIBS) \
-!ENDIF
- $(PNG_LIBS) $(INTL_LIBS) \
- pixops\pixops.lib \
-
-OBJECTS_NON_NATIVE = \
- io-bmp.obj \
- io-gif.obj \
- io-ico.obj \
- io-tiff.obj \
- io-jpeg.obj \
-
-OBJECTS_NATIVE = \
- io-gdip-animation.obj \
- io-gdip-bmp.obj \
- io-gdip-emf.obj \
- io-gdip-gif.obj \
- io-gdip-ico.obj \
- io-gdip-jpeg.obj \
- io-gdip-tiff.obj \
- io-gdip-utils.obj \
- io-gdip-wmf.obj
-
-OBJECTS = \
- gdk-pixbuf-enum-types.obj \
- gdk-pixbuf-animation.obj \
- gdk-pixbuf-data.obj \
- gdk-pixbuf-io.obj \
- gdk-pixbuf-loader.obj \
- gdk-pixbuf-scale.obj \
- gdk-pixbuf-scaled-anim.obj \
- gdk-pixbuf-util.obj \
- gdk-pixbuf.obj \
- gdk-pixbuf-simple-anim.obj \
- gdk-pixdata.obj \
- io-wbmp.obj \
- io-gif-animation.obj \
- io-png.obj \
- io-pnm.obj \
- io-ras.obj \
- io-xpm.obj \
-!IFDEF USEGDIP
- $(OBJECTS_NATIVE)
-!ELSE
- $(OBJECTS_NON_NATIVE)
-!ENDIF
-
-gdk_pixbuf_headers = \
- gdk-pixbuf.h \
- gdk-pixbuf-core.h \
- gdk-pixbuf-loader.h \
- gdk-pixbuf-transform.h
-
-gdk-pixbuf-marshal.h: gdk-pixbuf-marshal.list
- ..\..\glib\gobject\glib-genmarshal --prefix=_gdk_pixbuf_marshal gdk-pixbuf-marshal.list --header >gdk-pixbuf-marshal.h
-
-gdk-pixbuf-marshal.c: gdk-pixbuf-marshal.h gdk-pixbuf-marshal.list
- ..\..\glib\gobject\glib-genmarshal --prefix=_gdk_pixbuf_marshal gdk-pixbuf-marshal.list --body >gdk-pixbuf-marshal.c
-
-gdk-pixbuf-alias.h: gdk-pixbuf.symbols
- perl makegdkpixbufalias.pl < gdk-pixbuf.symbols > gdk-pixbuf-alias.h
-
-gdk_pixbuf.def: gdk-pixbuf.symbols makefile.msc
- echo EXPORTS > gdk_pixbuf.def
- cl /EP -DINCLUDE_VARIABLES -DG_OS_WIN32 -DALL_FILES \
- -DG_GNUC_MALLOC= -DG_GNUC_CONST= -DG_GNUC_NULL_TERMINATED= -DG_GNUC_NORETURN= -DG_GNUC_PRINTF=;G_GNUC_PRINTF \
- gdk-pixbuf.symbols >> gdk_pixbuf.def
-
-gdk-pixbuf-aliasdef.c: gdk-pixbuf.symbols
- perl makegdkpixbufalias.pl -def < gdk-pixbuf.symbols > gdk-pixbuf-aliasdef.c
-
-## common stuff
-
-INSTALL = copy
-
-CFLAGS = -I. -DHAVE_CONFIG_H
-
-sub-pixops :
- cd pixops
- nmake -f makefile.msc
- cd ..
-
-## targets
-all : \
- $(PRJ_TOP)\config.h \
- gdk-pixbuf-alias.h \
- gdk-pixbuf-aliasdef.c \
- gdk-pixbuf-marshal.h \
- gdk-pixbuf-marshal.c \
- sub-pixops \
- lib$(PACKAGE)-$(PKG_VER)-0.dll \
- $(PACKAGE)-$(PKG_VER)s.lib \
-# make-inline-pixbuf.exe \
- gdk-pixbuf-csource.exe \
- test-gdk-pixbuf.exe
-
-$(PACKAGE).res : $(PACKAGE).rc
- rc -DBUILDNUMBER=0 -r -fo $(PACKAGE).res $(PACKAGE).rc
-
-$(PACKAGE)-$(PKG_VER)s.lib : $(OBJECTS)
- lib /out:$(PACKAGE)-$(PKG_VER)s.lib $(OBJECTS) pixops\pixops.lib
-
-lib$(PACKAGE)-$(PKG_VER)-0.dll : $(OBJECTS) $(PACKAGE).def $(PACKAGE).res
- $(CC) $(CFLAGS) -LD -Fe$@ $(OBJECTS) $(PKG_LINK) user32.lib advapi32.lib ole32.lib wsock32.lib $(PACKAGE).res \
- $(LDFLAGS) /implib:$(PACKAGE)-$(PKG_VER).lib /def:$(PACKAGE).def
-
-make-inline-pixbuf.exe : make-inline-pixbuf.c
- $(CC) $(PKG_CFLAGS) -Femake-inline-pixbuf.exe make-inline-pixbuf.c $(PKG_LINK) $(PACKAGE)-$(PKG_VER).lib
-
-gdk-pixbuf-csource.exe : gdk-pixbuf-csource.c
- $(CC) $(PKG_CFLAGS) -Fegdk-pixbuf-csource.exe gdk-pixbuf-csource.c $(PKG_LINK) $(PACKAGE)-$(PKG_VER).lib
-
-test-gdk-pixbuf.exe : test-gdk-pixbuf.c
- $(CC) $(PKG_CFLAGS) -Fetest-gdk-pixbuf.exe test-gdk-pixbuf.c $(PKG_LINK) $(PACKAGE)-$(PKG_VER).lib
-
-#
-# gdk-pixbuf-enum-types.h
-#
-gdk-pixbuf-enum-types.h : $(gdk_pixbuf_headers) makefile.msc
- $(PERL) $(GLIB)\gobject\glib-mkenums \
- --fhead "#ifndef __GDK_PIXBUF__ENUM_TYPES_H__\n#define __GDK_PIXBUF_ENUM_TYPES_H__\n" \
- --fprod "/* enumerations from \"@filename@\" */\n" \
- --vhead "GType @enum_name@_get_type (void);\n#define GDK_TYPE_@ENUMSHORT@ (@enum_name@_get_type())\n" \
- --ftail "#endif /* __GDK_PIXBUF_ENUM_TYPES_H__ */" \
- $(gdk_pixbuf_headers) ) > gdk-pixbuf-enum-types.h
-
-#
-# gdk-pixbuf-enum-types.c
-#
-gdk-pixbuf-enum-types.c: $(gdk_pixbuf_headers) makefile.msc
- $(PERL) $(GLIB)\gobject\glib-mkenums \
- --fhead "#include <gdk-pixbuf/gdk-pixbuf.h>" \
- --fprod "\n/* enumerations from \"@filename@\" */" \
- --vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {" \
- --vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
- --vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \
- $(gdk_pixbuf_headers) > gdk-pixbuf-enum-types.c
-
-gdk-pixbuf-enum-types.obj : gdk-pixbuf-enum-types.c gdk-pixbuf-enum-types.h
-
-$(PRJ_TOP)\config.h: $(PRJ_TOP)\config.h.win32
- copy $(PRJ_TOP)\config.h.win32 $(PRJ_TOP)\config.h
-
-.c.obj :
- $(CC) $(CFLAGS) -GD -c $(PKG_CFLAGS) $<
-
-clean::
- del config.h
- del gdk-pixbuf-marshal.h
- del gdk-pixbuf-marshal.c
- del gdk-pixbuf-alaias.h
-
-
-
diff --git a/gdk-pixbuf/makegdkpixbufalias.pl b/gdk-pixbuf/makegdkpixbufalias.pl
deleted file mode 100755
index a03da363e9..0000000000
--- a/gdk-pixbuf/makegdkpixbufalias.pl
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/usr/bin/perl -w
-
-my $do_def = 0;
-
-if (($#ARGV >= 0) && ($ARGV[0] eq "-def")) {
- shift;
- $do_def = 1;
-}
-
-print <<EOF;
-/* Generated by makegdkpixbufalias.pl */
-
-#ifndef DISABLE_VISIBILITY
-
-#include <glib.h>
-
-#ifdef G_HAVE_GNUC_VISIBILITY
-
-EOF
-
-if ($do_def) {
- print <<EOF
-#undef IN_FILE
-#define IN_FILE defined
-
-#undef IN_HEADER
-#define IN_HEADER(x) 1
-
-EOF
-}
-else {
- print <<EOF
-#define IN_FILE(x) 1
-#define IN_HEADER defined
-
-EOF
-}
-
-my $in_comment = 0;
-my $in_skipped_section = 0;
-
-while (<>) {
-
- # ignore empty lines
- next if /^\s*$/;
-
- # skip comments
- if ($_ =~ /^\s*\/\*/)
- {
- $in_comment = 1;
- }
-
- if ($in_comment)
- {
- if ($_ =~ /\*\/\s$/)
- {
- $in_comment = 0;
- }
-
- next;
- }
-
- # handle ifdefs
- if ($_ =~ /^\#endif/)
- {
- if (!$in_skipped_section)
- {
- print $_;
- }
-
- $in_skipped_section = 0;
-
- next;
- }
-
- if ($_ =~ /^\#ifdef\s+INCLUDE_VARIABLES|INCLUDE_INTERNAL_SYMBOLS|ALL_FILES/)
- {
- $in_skipped_section = 1;
- }
-
- if ($in_skipped_section)
- {
- next;
- }
-
- if ($_ =~ /^\#ifn?def\s+G/)
- {
- print $_;
-
- next;
- }
-
- if ($_ =~ /^\#if.*(IN_FILE|IN_HEADER|IN_FILE)/)
- {
- print $_;
-
- next;
- }
-
- chop;
- my $str = $_;
- my @words;
- my $attributes = "";
-
- @words = split(/ /, $str);
- $str = shift(@words);
- chomp($str);
- my $alias = "IA__".$str;
-
- # Drop any Win32 specific .def file syntax, but keep attributes
- foreach $word (@words) {
- $attributes = "$attributes $word" unless $word eq "PRIVATE";
- }
-
- if (!$do_def) {
- print <<EOF
-extern __typeof ($str) $alias __attribute((visibility("hidden")))$attributes;
-\#define $str $alias
-
-EOF
- }
- else {
- print <<EOF
-\#undef $str
-extern __typeof ($str) $str __attribute((alias("$alias"), visibility("default")));
-
-EOF
- }
-}
-
-print <<EOF;
-
-#endif /* G_HAVE_GNUC_VISIBILITY */
-#endif /* DISABLE_VISIBILITY */
-EOF
-
-
diff --git a/gdk-pixbuf/pixops/DETAILS b/gdk-pixbuf/pixops/DETAILS
deleted file mode 100644
index acf16f57e7..0000000000
--- a/gdk-pixbuf/pixops/DETAILS
+++ /dev/null
@@ -1,355 +0,0 @@
-General ideas of Pixops
-=======================
-
- - Gain speed by special-casing the common case, and using
- generic code to handle the uncommon case.
-
- - Most of the time in scaling an image is in the center;
- however code that can handle edges properly is slow
- because it needs to deal with the possibility of running
- off the edge. So make the fast case code only handle
- the centers, and use generic, slow, code for the edges,
-
-Structure of Pixops
-===================
-
-The code of pixops can roughly be grouped into four parts:
-
- - Filter computation functions
-
- - Functions for scaling or compositing lines and pixels
- using precomputed filters
-
- - pixops process, the central driver that iterates through
- the image calling pixel or line functions as necessary
-
- - Wrapper functions (pixops_scale/composite/composite_color)
- that compute the filter, chooses the line and pixel functions
- and then call pixops_processs with the filter, line,
- and pixel functions.
-
-
-pixops process is a pretty scary looking function:
-
-static void
-pixops_process (guchar *dest_buf,
- int render_x0,
- int render_y0,
- int render_x1,
- int render_y1,
- int dest_rowstride,
- int dest_channels,
- gboolean dest_has_alpha,
- const guchar *src_buf,
- int src_width,
- int src_height,
- int src_rowstride,
- int src_channels,
- gboolean src_has_alpha,
- double scale_x,
- double scale_y,
- int check_x,
- int check_y,
- int check_size,
- guint32 color1,
- guint32 color2,
- PixopsFilter *filter,
- PixopsLineFunc line_func,
- PixopsPixelFunc pixel_func)
-
-(Some of the arguments should be moved into structures. It's basically
-"all the arguments to pixops_composite_color plus three more") The
-arguments can be divided up into:
-
-
-Information about the destination buffer
-
- guchar *dest_buf, int dest_rowstride, int dest_channels, gboolean dest_has_alpha,
-
-Information about the source buffer
-
- guchar *src_buf, int src_rowstride, int src_channels, gboolean src_has_alpha,
- int src_width, int src_height,
-
-Information on how to scale the source buf and the region of the scaled source
-to render onto the destination buffer
-
- int render_x0, int render_y0, int render_x1, int render_y1
- double scale_x, double scale_y
-
-Information about a constant color or check pattern onto which to to composite
-
- int check_x, int check_y, int check_size, guint32 color1, guint32 color2
-
-Information precomputed to use during the scale operation
-
- PixopsFilter *filter, PixopsLineFunc line_func, OixopsPixelFunc pixel_func
-
-
-Filter computation
-==================
-
-The PixopsFilter structure looks like:
-
-struct _PixopsFilter
-{
- int *weights;
- int n_x;
- int n_y;
- double x_offset;
- double y_offset;
-};
-
-
-'weights' is an array of size:
-
- weights[SUBSAMPLE][SUBSAMPLE][n_x][n_y]
-
-SUBSAMPLE is a constant - currently 16 in pixops.c.
-
-
-In order to compute a scaled destination pixel we convolve
-an array of n_x by n_y source pixels with one of
-the SUBSAMPLE * SUBSAMPLE filter matrices stored
-in weights. The choice of filter matrix is determined
-by the fractional part of the source location.
-
-To compute dest[i,j] we do the following:
-
- x = i * scale_x + x_offset;
- y = i * scale_x + y_offset;
- x_int = floor(x)
- y_int = floor(y)
-
- C = weights[SUBSAMPLE*(x - x_int)][SUBSAMPLE*(y - y_int)]
- total = sum[l=0..n_x-1, j=0..n_y-1] (C[l,m] * src[x_int + l, x_int + m])
-
-The filter weights are integers scaled so that the total of the
-weights in the weights array is equal to 65536.
-
-When the source does not have alpha, we simply compute each channel
-as above, so total is in the range [0,255*65536]
-
- dest = src / 65536
-
-When the source does have alpha, then we need to compute using
-"pre-multiplied alpha":
-
- a_total = sum (C[l,m] * src_a[x_int + l, x_int + m])
- c_total = sum (C[l,m] * src_a[x_int + l, x_int + m] * src_c[x_int + l, x_int + m])
-
-This gives us a result for c_total in the range of [0,255*a_total]
-
- c_dest = c_total / a_total
-
-
-Mathematical aside:
-
-The process of producing a destination filter consists
-of:
-
- - Producing a continuous approximation to the source
- image via interpolation.
-
- - Sampling that continuous approximation with filter.
-
-This is representable as:
-
- S(x,y) = sum[i=-inf,inf; j=-inf,inf] A(frac(x),frac(y))[i,j] * S[floor(x)+i,floor(y)+j]
-
- D[i,j] = Integral(s=-inf,inf; t=-inf,inf) B(i+x,j+y) S((i+x)/scale_x,(i+y)/scale_y)
-
-By reordering the sums and integrals, you get something of the form:
-
- D[i,j] = sum[l=-inf,inf; m=-inf;inf] C[l,m] S[i+l,j+l]
-
-The arrays in weights are the C[l,m] above, and are thus
-determined by the interpolating algorithm in use and the
-sampling filter:
-
- INTERPOLATE SAMPLE
- ART_FILTER_NEAREST nearest neighbour point
- ART_FILTER_TILES nearest neighbour box
- ART_FILTER_BILINEAR (scale < 1) nearest neighbour box (scale < 1)
- ART_FILTER_BILINEAR (scale > 1) bilinear point (scale > 1)
- ART_FILTER_HYPER bilinear box
-
-
-Pixel Functions
-===============
-
-typedef void (*PixopsPixelFunc) (guchar *dest, int dest_x, int dest_channels, int dest_has_alpha,
- int src_has_alpha,
- int check_size, guint32 color1, guint32 color2,
- int r, int g, int b, int a);
-
-The arguments here are:
-
- dest: location to store the output pixel
- dest_x: x coordinate of destination (for handling checks)
- dest_has_alpha, dest_channels: Information about the destination pixbuf
- src_has_alpha: Information about the source pixbuf
-
- check_size, color1, color2: Information for color background for composite_color variant
-
- r,g,b,a - scaled red, green, blue and alpha
-
-r,g,b are premultiplied alpha.
-
- a is in [0,65536*255]
- r is in [0,255*a]
- g is in [0,255*a]
- b is in [0,255*a]
-
-If src_has_alpha is false, then a will be 65536*255, allowing optimization.
-
-
-Line functions
-==============
-
-typedef guchar *(*PixopsLineFunc) (int *weights, int n_x, int n_y,
- guchar *dest, int dest_x, guchar *dest_end, int dest_channels, int dest_has_alpha,
- guchar **src, int src_channels, gboolean src_has_alpha,
- int x_init, int x_step, int src_width,
- int check_size, guint32 color1, guint32 color2);
-
-The argumets are:
-
- weights, n_x, n_y
-
- Filter weights for this row - dimensions weights[SUBSAMPLE][n_x][n_y]
-
- dest, dest_x, dest_end, dest_channels, dest_has_alpha
-
- The destination buffer, function will start writing into *dest and
- increment by dest_channels, until dest == dest_end. Reading from
- src for these pixels is guaranteed not to go outside of the
- bufer bounds
-
- src, src_channels, src_has_alpha
-
- src[n_y] - an array of pointers to the start of the source rows
- for each filter coordinate.
-
- x_init, x_step
-
- Information about x positions in source image.
-
- src_width - unused
-
- check_size, color1, color2: Information for color background for composite_color variant
-
- The total for the destination pixel at dest + i is given by
-
- SUM (l=0..n_x - 1, m=0..n_y - 1)
- src[m][(x_init + i * x_step)>> SCALE_SHIFT + l] * weights[m][l]
-
-
-Algorithms for compositing
-==========================
-
-Compositing alpha on non alpha:
-
- R = As * Rs + (1 - As) * Rd
- G = As * Gs + (1 - As) * Gd
- B = As * Bs + (1 - As) * Bd
-
-This can be regrouped as:
-
- Cd + Cs * (Cs - Rd)
-
-Compositing alpha on alpha:
-
- A = As + (1 - As) * Ad
- R = (As * Rs + (1 - As) * Rd * Ad) / A
- G = (As * Gs + (1 - As) * Gd * Ad) / A
- B = (As * Bs + (1 - As) * Bd * Ad) / A
-
-The way to think of this is in terms of the "area":
-
-The final pixel is composed of area As of the source pixel
-and (1 - As) * Ad of the target pixel. So the final pixel
-is a weighted average with those weights.
-
-Note that the weights do not add up to one - hence the
-non-constant division.
-
-
-Integer tricks for compositing
-==============================
-
-
-
-MMX Code
-========
-
-Line functions are provided in MMX functionsfor a few special
-cases:
-
- n_x = n_y = 2
-
- src_channels = 3 dest_channels = 3 op = scale
- src_channels = 4 with alpha dest_channels = 4 no alpha op = composite
- src_channels = 4 with alpha dest_channels = 4 no alpha op = composite_color
-
-For the case n_x = n_y = 2 - primarily hit when scaling up with bilinear
-scaling, we can take advantage of the fact that multiple destination
-pixels will be composed from the same source pixels.
-
-That is a destination pixel is a linear combination of the source
-pixels around it:
-
-
- S0 S1
-
-
-
-
-
- D D' D'' ...
-
-
-
-
- S2 S3
-
-Each mmx register is 64 bits wide, so we can unpack a source pixel
-into the low 8 bits of 4 16 bit words, and store it into a mmx
-register.
-
-For each destination pixel, we first make sure that we have pixels S0
-... S3 loaded into registers mm0 ...mm3. (This will often involve not
-doing anything or moving mm1 and mm3 into mm0 and mm1 then reloading
-mm1 and mm3 with new values).
-
-Then we load up the appropriate weights for the 4 corner pixels
-based on the offsets of the destination pixel within the source
-pixels.
-
-We have preexpanded the weights to 64 bits wide and truncated the
-range to 8 bits, so an original filter value of
-
- 0x5321 would be expanded to
-
- 0x0053005300530053
-
-For source buffers without alpha, we simply do a multiply-add
-of the weights, giving us a 16 bit quantity for the result
-that we shift left by 8 and store in the destination buffer.
-
-When the source buffer has alpha, then things become more
-complicated - when we load up mm0 and mm3, we premultiply
-the alpha, so they contain:
-
- (a*ff >> 8) (r*a >> 8) (g*a >> 8) (b*a >> a)
-
-Then when we multiply by the weights, and add we end up
-with premultiplied r,g,b,a in the range of 0 .. 0xff * 0ff,
-call them A,R,G,B
-
-We then need to composite with the dest pixels - which
-we do by:
-
- r_dest = (R + ((0xff * 0xff - A) >> 8) * r_dest) >> 8
-
-(0xff * 0xff)
diff --git a/gdk-pixbuf/pixops/Makefile.am b/gdk-pixbuf/pixops/Makefile.am
deleted file mode 100644
index fe7775a293..0000000000
--- a/gdk-pixbuf/pixops/Makefile.am
+++ /dev/null
@@ -1,34 +0,0 @@
-include $(top_srcdir)/Makefile.decl
-
-noinst_LTLIBRARIES = libpixops.la
-
-INCLUDES = \
- -I$(top_srcdir) -I$(top_builddir) \
- $(GTK_DEBUG_FLAGS) \
- $(GDK_PIXBUF_DEP_CFLAGS)
-
-noinst_PROGRAMS = timescale
-
-timescale_SOURCES = timescale.c
-timescale_LDADD = libpixops.la $(GLIB_LIBS) $(GDK_PIXBUF_DEP_LIBS)
-
-if USE_MMX
-mmx_sources = \
- have_mmx.S \
- scale_line_22_33_mmx.S \
- composite_line_22_4a4_mmx.S \
- composite_line_color_22_4a4_mmx.S
-endif
-
-libpixops_la_SOURCES = \
- pixops.c \
- pixops.h \
- pixops-internal.h \
- $(mmx_sources)
-
-EXTRA_DIST += \
- DETAILS \
- pixbuf-transform-math.ltx \
- makefile.msc
-
--include $(top_srcdir)/git.mk
diff --git a/gdk-pixbuf/pixops/README b/gdk-pixbuf/pixops/README
deleted file mode 100644
index 354c3a1977..0000000000
--- a/gdk-pixbuf/pixops/README
+++ /dev/null
@@ -1,163 +0,0 @@
-The code in this directory implements optimized, filtered scaling
-for pixmap data.
-
-This code is copyright Red Hat, Inc, 2000 and licensed under the terms
-of the GNU Lesser General Public License (LGPL).
-
-(If you want to use it in a project where that license is not
-appropriate, please contact me, and most likely something can be
-worked out.)
-
-Owen Taylor <otaylor@redhat.com>
-
-PRINCIPLES
-==========
-
-The general principle of this code is that it first computes a filter
-matrix for the given filtering mode, and then calls a general driver
-routine, passing in functions to composite pixels and lines.
-
-(The pixel functions are used for handling edge cases, and the line
-functions are simply used for the middle parts of the image.)
-
-The system is designed so that the line functions can be simple,
-don't have to worry about special cases, can be selected to
-be specific to the particular formats involved. This allows them
-to be hyper-optimized. Since most of the compution time is
-spent in these functions, this results in an overall fast design.
-
-MMX assembly code for Intel (and compatible) processors is included
-for a number of the most common special cases:
-
- scaling from RGB to RGB
- compositing from RGBA to RGBx
- compositing against a color from RGBA and storing in a RGBx buffer
-
-Alpha compositing 8 bit RGBAa onto RGB is defined in terms of
-rounding the exact result (real values in [0,1]):
-
- cc = ca * aa + (1 - aa) * Cb
-
- Cc = ROUND [255. * (Ca/255. * Aa/255. + (1 - Aa/255.) * Cb/255.)]
-
-ROUND(i / 255.) can be computed exactly for i in [0,255*255] as:
-
- t = i + 0x80; result = (t + (t >> 8)) >> 8; [ call this as To8(i) ]
-
-So,
-
- t = Ca * Aa + (255 - Aa) * Cb + 0x80;
- Cc = (t + (t >> 8)) >> 8;
-
-Alpha compositing 8 bit RaGaBaAa onto RbGbBbAa is a little harder, for
-non-premultiplied alpha. The premultiplied result is simple:
-
- ac = aa + (1 - aa) * ab
- cc = ca + (1 - aa) * cb
-
-Which can be computed in integers terms as:
-
- Cc = Ca + To8 ((255 - Aa) * Cb)
- Ac = Aa + To8 ((255 - Aa) * Ab)
-
-For non-premultiplied alpha, we need divide the color components by
-the alpha:
-
- +- (ca * aa + (1 - aa) * ab * cb)) / ac; aa != 0
- cc = |
- +- cb; aa == 0
-
-To calculate this as in integer, we note the alternate form:
-
- cc = cb + aa * (ca - cb) / ac
-
-[ 'cc = ca + (ac - aa) * (cb - ca) / ac' can also be useful numerically,
- but isn't important here ]
-
-We can express this as integers as:
-
- Ac_tmp = Aa * 255 + (255 - Aa) * Ab;
-
- +- Cb + (255 * Aa * (Ca - Cb) + Ac_tmp / 2) / Ac_tmp ; Ca > Cb
- Cc = |
- +- Cb - (255 * Aa * (Cb - Ca) + Ac_tmp / 2) / Ac_tmp ; ca <= Cb
-
-Or, playing bit tricks to avoid the conditional
-
- Cc = Cb + (255 * Aa * (Ca - Cb) + (((Ca - Cb) >> 8) ^ (Ac_tmp / 2)) ) / Ac_tmp
-
-TODO
-====
-
-* ART_FILTER_HYPER is not correctly implemented. It is currently
- implemented as a filter that is derived by doing linear interpolation
- on the source image and then averaging that with a box filter.
-
- It should be defined as followed (see art_filterlevel.h)
-
- "HYPER is the highest quality reconstruction function. It is derived
- from the hyperbolic filters in Wolberg's "Digital Image Warping,"
- and is formally defined as the hyperbolic-filter sampling the ideal
- hyperbolic-filter interpolated image (the filter is designed to be
- idempotent for 1:1 pixel mapping). It is the slowest and highest
- quality."
-
- The current HYPER is probably as slow, but lower quality. Also, there
- are some subtle errors in the calculation current HYPER that show up as dark
- stripes if you scale a constant-color image.
-
-* There are some roundoff errors in the compositing routines.
- the _nearest() variants do it right, most of the other code
- is wrong to some degree or another.
-
- For instance, in composite_line_22_4a4(), we have:
-
- dest[0] = ((0xff0000 - a) * dest[0] + r) >> 24;
-
- if a is 0 (implies r == 0), then we have:
-
- (0xff0000 * dest[0]) >> 24
-
- which gives results which are 1 to low:
-
- 255 => 254, 1 => 0.
-
- So, this should be something like:
-
- ((0xff0000 - a) * dest[0] + r + 0xffffff) >> 24;
-
- (Not checked, caveat emptor)
-
- An alternatve formulation of this as:
-
- dest[0] + (r - a * dest[0] + 0xffffff) >> 24
-
- may be better numerically, but would need consideration for overflow.
-
-* The generic functions could be sped up considerably by
- switching around conditionals and inner loops in various
- places.
-
-* Right now, in several of the most common cases, there are
- optimized mmx routines, but no optimized C routines.
-
- For instance, there is a
-
- pixops_composite_line_22_4a4_mmx()
-
- But no
-
- pixops_composite_line_22_4a4()
-
- Also, it may be desirable to include a few more special cases - in particular:
-
- pixops_composite_line_22_4a3()
-
- May be desirable.
-
-* Scaling down images by large scale factors is _slow_ since huge filter
- matrixes are computed. (e.g., to scale down by a factor of 100, we compute
- 101x101 filter matrixes. At some point, it would be more efficent to
- switch over to subsampling when scaling down - one should never need a filter
- matrix bigger than 16x16.
-
diff --git a/gdk-pixbuf/pixops/composite_line_22_4a4_mmx.S b/gdk-pixbuf/pixops/composite_line_22_4a4_mmx.S
deleted file mode 100644
index 232bddf407..0000000000
--- a/gdk-pixbuf/pixops/composite_line_22_4a4_mmx.S
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright (C) 2000 Red Hat, Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.
- */
- .file "composite_line_22_4a4_mmx.S"
- .version "01.01"
-gcc2_compiled.:
-.text
- .align 16
-
-#if !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__INTERIX)
-
-/* Magic indicating no need for an executable stack */
-#if !defined __powerpc64__ && !defined __ia64__
-.section .note.GNU-stack; .previous
-#endif
-
-.globl _pixops_composite_line_22_4a4_mmx
- .type _pixops_composite_line_22_4a4_mmx,@function
-_pixops_composite_line_22_4a4_mmx:
-
-#else
-
-.globl __pixops_composite_line_22_4a4_mmx
-__pixops_composite_line_22_4a4_mmx:
-
-#endif
-/*
- * Arguments
- *
- * weights: 8(%ebp)
- * p: 12(%ebp) %esi
- * q1: 16(%ebp)
- * q2: 20(%ebp)
- * xstep: 24(%ebp)
- * p_end: 28(%ebp)
- * xinit: 32(%ebp)
- *
-*/
-/*
- * Function call entry
- */
- pushl %ebp
- movl %esp,%ebp
- subl $28,%esp
- pushl %edi
- pushl %esi
- pushl %ebx
-/* Locals:
- * int x %ebx
- * int x_scaled -24(%ebp)
- */
-
-/*
- * Setup
- */
-/* Initialize variables */
- movl 32(%ebp),%ebx
- movl 32(%ebp),%edx
- sarl $16,%edx
- movl 12(%ebp),%esi
-
- movl %edx,-24(%ebp)
-
- cmpl 28(%ebp),%esi
- jnb .out
-
-/* Load initial values into %mm1, %mm3 */
- shll $2, %edx
-
- pxor %mm4, %mm4
-
- movl 16(%ebp),%edi
- movl (%edi, %edx), %eax
- movd (%edi, %edx), %mm5
- punpcklbw %mm4, %mm5
- shrl $24, %eax
- movl $0x010101, %ecx
- mull %ecx
- orl $0xff000000, %eax
- movd %eax, %mm1
- punpcklbw %mm4, %mm1
- pmullw %mm5,%mm1
-
- movl -24(%ebp),%edx
- shll $2, %edx
-
- movl 20(%ebp),%edi
- movl (%edi, %edx), %eax
- movd (%edi, %edx), %mm5
- punpcklbw %mm4, %mm5
- shrl $24, %eax
- movl $0x010101, %ecx
- mull %ecx
- orl $0xff000000, %eax
- movd %eax, %mm3
- punpcklbw %mm4, %mm3
- pmullw %mm5,%mm3
-
- psrlw $8,%mm1
- psrlw $8,%mm3
-
- addl $65536,%ebx
- movl %ebx,%edx
- sarl $16,%edx
-
- jmp .newx
- .p2align 4,,7
-.loop:
-/* int x_index = (x & 0xf000) >> 12 */
- movl %ebx,%eax
- andl $0xf000,%eax
- shrl $7,%eax
-
- movq (%edi,%eax),%mm4
- pmullw %mm0,%mm4
- movq 8(%edi,%eax),%mm5
- pmullw %mm1,%mm5
- movq 16(%edi,%eax),%mm6
- movq 24(%edi,%eax),%mm7
- pmullw %mm2,%mm6
- pmullw %mm3,%mm7
- paddw %mm4, %mm5
- paddw %mm6, %mm7
- paddw %mm5, %mm7
-
- movl $0xffff,%ecx
- movd %ecx,%mm4
- psllq $48,%mm4
- movq %mm4,%mm6
- psubw %mm7,%mm4
- pand %mm6,%mm4
-
- movq %mm4,%mm5
- psrlq $16,%mm4
- por %mm4,%mm5
- psrlq $32,%mm5
- por %mm4,%mm5
-
- psrlw $8,%mm5
-
- movd (%esi),%mm7
- pxor %mm4,%mm4
- punpcklbw %mm4, %mm7
-
- pmullw %mm7,%mm5
-
-/* x += x_step; */
- addl 24(%ebp),%ebx
-/* x_scale = x >> 16; */
- movl %ebx,%edx
- sarl $16,%edx
-
- paddw %mm5,%mm6
-
- psrlw $8,%mm6
- packuswb %mm6, %mm6
- movd %mm6,(%esi)
-
- addl $4, %esi
-
- cmpl %esi,28(%ebp)
- je .out
-
- cmpl %edx,-24(%ebp)
- je .loop
-
-.newx:
- movl %edx,-24(%ebp)
-/*
- * Load the two new values into %mm1, %mm3, move old values into %mm0, %mm2
- */
- movq %mm1, %mm0
- movq %mm3, %mm2
-
- shll $2, %edx
-
-# %mm4 will always be already clear here
-# pxor %mm4, %mm4
-
- movl 16(%ebp),%edi
- movl (%edi, %edx), %eax
- movd (%edi, %edx), %mm5
- punpcklbw %mm4, %mm5
- shrl $24, %eax
- movl $0x010101, %ecx
- mull %ecx
-/*
- * mull destroyed %edx, need to reconstitute
- */
- movl -24(%ebp),%edx
- shll $2, %edx
-
- orl $0xff000000, %eax
- movd %eax, %mm1
- punpcklbw %mm4, %mm1
- pmullw %mm5,%mm1
-
- movl 20(%ebp),%edi
- movl (%edi, %edx), %eax
- movd (%edi, %edx), %mm5
- punpcklbw %mm4, %mm5
- shrl $24, %eax
- movl $0x010101, %ecx
- mull %ecx
- orl $0xff000000, %eax
- movd %eax, %mm3
- punpcklbw %mm4, %mm3
- pmullw %mm5,%mm3
-
- psrlw $8,%mm1
- psrlw $8,%mm3
-
- movl 8(%ebp),%edi
-
- jmp .loop
-
-.out:
- movl %esi,%eax
- emms
- leal -40(%ebp),%esp
- popl %ebx
- popl %esi
- popl %edi
- movl %ebp,%esp
- popl %ebp
- ret
diff --git a/gdk-pixbuf/pixops/composite_line_color_22_4a4_mmx.S b/gdk-pixbuf/pixops/composite_line_color_22_4a4_mmx.S
deleted file mode 100644
index ab7c8729e2..0000000000
--- a/gdk-pixbuf/pixops/composite_line_color_22_4a4_mmx.S
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright (C) 2000 Red Hat, Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.
- */
- .file "composite_line_color_22_4a4_mmx.S"
- .version "01.01"
-gcc2_compiled.:
-.text
- .align 16
-
-#if !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__INTERIX)
-
-/* Magic indicating no need for an executable stack */
-#if !defined __powerpc64__ && !defined __ia64__
-.section .note.GNU-stack; .previous
-#endif
-
-.globl _pixops_composite_line_color_22_4a4_mmx
- .type _pixops_composite_line_color_22_4a4_mmx,@function
-_pixops_composite_line_color_22_4a4_mmx:
-
-#else
-
-.globl __pixops_composite_line_color_22_4a4_mmx
-__pixops_composite_line_color_22_4a4_mmx:
-
-#endif
-/*
- * Arguments
- *
- * weights: 8(%ebp)
- * p: 12(%ebp) %esi
- * q1: 16(%ebp)
- * q2: 20(%ebp)
- * xstep: 24(%ebp)
- * p_end: 28(%ebp)
- * xinit: 32(%ebp)
- * dest_x: 36(%ebp)
- * check_shift: 40(%ebp)
- * colors: 44(%ebp)
- *
-*/
-
-/*
- * Function call entry
- */
- pushl %ebp
- movl %esp,%ebp
- subl $28,%esp
- pushl %edi
- pushl %esi
- pushl %ebx
-/* Locals:
- * int x %ebx
- * int x_scaled -24(%ebp)
- */
-
-/*
- * Setup
- */
-/* Initialize variables */
- movl 32(%ebp),%ebx
- movl 32(%ebp),%edx
- sarl $16,%edx
- movl 12(%ebp),%esi
-
- movl %edx,-24(%ebp)
-
- cmpl 28(%ebp),%esi
- jnb .out
-
-/* Load initial values into %mm1, %mm3 */
- shll $2, %edx
-
- pxor %mm4, %mm4
-
- movl 16(%ebp),%edi
- movl (%edi, %edx), %eax
- movd (%edi, %edx), %mm5
- punpcklbw %mm4, %mm5
- shrl $24, %eax
- movl $0x010101, %ecx
- mull %ecx
- orl $0xff000000, %eax
- movd %eax, %mm1
- punpcklbw %mm4, %mm1
- pmullw %mm5,%mm1
-
-/*
- * mull destroyed %edx, need to reconstitute
- */
- movl -24(%ebp),%edx
- shll $2, %edx
-
- movl 20(%ebp),%edi
- movl (%edi, %edx), %eax
- movd (%edi, %edx), %mm5
- punpcklbw %mm4, %mm5
- shrl $24, %eax
- movl $0x010101, %ecx
- mull %ecx
- orl $0xff000000, %eax
- movd %eax, %mm3
- punpcklbw %mm4, %mm3
- pmullw %mm5,%mm3
-
- psrlw $8,%mm1
- psrlw $8,%mm3
-
- addl $65536,%ebx
- movl %ebx,%edx
- sarl $16,%edx
-
- jmp .newx
- .p2align 4,,7
-.loop:
-/* int x_index = (x & 0xf000) >> 12 */
- movl %ebx,%eax
- andl $0xf000,%eax
- shrl $7,%eax
-
- movq (%edi,%eax),%mm4
- pmullw %mm0,%mm4
- movq 8(%edi,%eax),%mm5
- pmullw %mm1,%mm5
- movq 16(%edi,%eax),%mm6
- movq 24(%edi,%eax),%mm7
- pmullw %mm2,%mm6
- pmullw %mm3,%mm7
- paddw %mm4, %mm5
- paddw %mm6, %mm7
- paddw %mm5, %mm7
-
- movl $0xffff,%ecx
- movd %ecx,%mm4
- psllq $48,%mm4
- movq %mm4,%mm6
- psubw %mm7,%mm4
- pand %mm6,%mm4
-
- movq %mm4,%mm5
- psrlq $16,%mm4
- por %mm4,%mm5
- psrlq $32,%mm5
- por %mm4,%mm5
-
- psrlw $8,%mm5
-
- movl 36(%ebp),%eax
- incl 36(%ebp)
-
- movl 40(%ebp),%ecx
- shrl %cl,%eax
- andl $1,%eax
-
- movl 44(%ebp),%ecx
- movq (%ecx,%eax,8),%mm6
-
- pmullw %mm6,%mm5
-
-/* x += x_step; */
- addl 24(%ebp),%ebx
-/* x_scale = x >> 16; */
- movl %ebx,%edx
- sarl $16,%edx
-
- paddw %mm5,%mm7
-
- psrlw $8,%mm7
- packuswb %mm7, %mm7
- movd %mm7,(%esi)
-
- addl $4, %esi
-
- cmpl %esi,28(%ebp)
- je .out
-
- cmpl %edx,-24(%ebp)
- je .loop
-
-.newx:
- movl %edx,-24(%ebp)
-/*
- * Load the two new values into %mm1, %mm3, move old values into %mm0, %mm2
- */
- movq %mm1, %mm0
- movq %mm3, %mm2
-
- shll $2, %edx
-
- pxor %mm4, %mm4
-
- movl 16(%ebp),%edi
- movl (%edi, %edx), %eax
- movd (%edi, %edx), %mm5
- punpcklbw %mm4, %mm5
- shrl $24, %eax
- movl $0x010101, %ecx
- mull %ecx
-/*
- * mull destroyed %edx, need to reconstitute
- */
- movl -24(%ebp),%edx
- shll $2, %edx
-
- orl $0xff000000, %eax
- movd %eax, %mm1
- punpcklbw %mm4, %mm1
- pmullw %mm5,%mm1
-
- movl 20(%ebp),%edi
- movl (%edi, %edx), %eax
- movd (%edi, %edx), %mm5
- punpcklbw %mm4, %mm5
- shrl $24, %eax
- movl $0x010101, %ecx
- mull %ecx
- orl $0xff000000, %eax
- movd %eax, %mm3
- punpcklbw %mm4, %mm3
- pmullw %mm5,%mm3
-
- psrlw $8,%mm1
- psrlw $8,%mm3
-
- movl 8(%ebp),%edi
-
- jmp .loop
-
-.out:
- movl %esi,%eax
- emms
- leal -40(%ebp),%esp
- popl %ebx
- popl %esi
- popl %edi
- movl %ebp,%esp
- popl %ebp
- ret
diff --git a/gdk-pixbuf/pixops/have_mmx.S b/gdk-pixbuf/pixops/have_mmx.S
deleted file mode 100644
index eb72678050..0000000000
--- a/gdk-pixbuf/pixops/have_mmx.S
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2000 Red Hat, Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.
- */
- .file "have_mmx.S"
- .version "01.01"
-gcc2_compiled.:
-.text
- .align 16
-
-#if !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__INTERIX)
-
-/* Magic indicating no need for an executable stack */
-#if !defined __powerpc64__ && !defined __ia64__
-.section .note.GNU-stack; .previous
-#endif
-
-.globl _pixops_have_mmx
- .type _pixops_have_mmx,@function
-_pixops_have_mmx:
-
-#else
-
-.globl __pixops_have_mmx
-__pixops_have_mmx:
-
-#endif
-
- push %ebx
-
-# Check if bit 21 in flags word is writeable
-
- pushfl
- popl %eax
- movl %eax,%ebx
- xorl $0x00200000, %eax
- pushl %eax
- popfl
- pushfl
- popl %eax
-
- cmpl %eax, %ebx
-
- je .notfound
-
-# OK, we have CPUID
-
- movl $1, %eax
- cpuid
-
- test $0x00800000, %edx
- jz .notfound
-
- movl $1, %eax
- jmp .out
-
-.notfound:
- movl $0, %eax
-.out:
- popl %ebx
- ret
-
diff --git a/gdk-pixbuf/pixops/makefile.msc b/gdk-pixbuf/pixops/makefile.msc
deleted file mode 100644
index f7132f83e9..0000000000
--- a/gdk-pixbuf/pixops/makefile.msc
+++ /dev/null
@@ -1,65 +0,0 @@
-TOP = ../../..
-PACKAGE = pixops
-PRJ_TOP = ..\..
-
-!INCLUDE $(TOP)/glib/build/win32/make.msc
-
-PKG_CFLAGS = -I.. $(GLIB_CFLAGS)
-
-OBJECTS = \
- pixops.obj \
-
-#? timescale.obj
-
-## common stuff
-## compiler and linker switches
-!IFNDEF DEBUG
-# Full optimization:
-OPTIMIZE = -Ox -MD
-LINKDEBUG =
-!ELSE
-# Debugging:
-OPTIMIZE = -Zi -MDd
-LINKDEBUG = /debug
-!ENDIF
-
-# cl -? describes the options
-CC = cl -G5 -GF $(OPTIMIZE) -W3 -nologo
-
-# No general LDFLAGS needed
-LDFLAGS = /link $(LINKDEBUG)
-INSTALL = copy
-
-CFLAGS = -I. -I$(PRJ_TOP) -DHAVE_CONFIG_H
-
-## targets
-all : \
- $(PRJ_TOP)\config.h \
- $(PACKAGE).lib
-
-$(PACKAGE).lib : $(OBJECTS)
- lib /out:$(PACKAGE).lib $(OBJECTS)
-
-$(PACKAGE).dll : $(OBJECTS) $(PACKAGE).def
- $(CC) $(CFLAGS) -LD -Fe$(PACKAGE).dll $(OBJECTS) $(PKG_LINK) user32.lib advapi32.lib wsock32.lib $(LDFLAGS) /def:$(PACKAGE).def
-
-$(PRJ_TOP)\config.h: $(PRJ_TOP)\config.h.win32
- copy $(PRJ_TOP)\config.h.win32 $(PRJ_TOP)\config.h
-
-.c.obj :
- $(CC) $(CFLAGS) -GD -c $(PKG_CFLAGS) $<
-
-clean::
- del config.h
- del *.exe
- del *.obj
- del *.dll
- del *.lib
- del *.err
- del *.map
- del *.sym
- del *.exp
- del *.lk1
- del *.mk1
- del *.pdb
- del *.ilk
diff --git a/gdk-pixbuf/pixops/pixbuf-transform-math.ltx b/gdk-pixbuf/pixops/pixbuf-transform-math.ltx
deleted file mode 100644
index 19e231308d..0000000000
--- a/gdk-pixbuf/pixops/pixbuf-transform-math.ltx
+++ /dev/null
@@ -1,112 +0,0 @@
-\documentclass{article}
-
-\begin{document}
-
-\title{Some image transform math}
-\author{Owen Taylor}
-\date{18 February 2003}
-\maketitle
-
-\section{Basics}
-
-The transform process is composed of three steps;
-first we reconstruct a continuous image from the
-source data \(A_{i,j}\):
-\[a(u,v) = \sum_{i = -\infty}^{\infty} \sum_{j = -\infty}^{\infty} A_{i,j}F\left( {u - i \atop v - j} \right) \]
-Then we transform from destination coordinates to source coordinates:
-\[b(x,y) = a\left(u(x,y) \atop v(x,y)\right)
- = a\left(t_{00}x + t_{01}y + t_{02} \atop t_{10}x + t_{11}y + t_{12} \right)\]
-Finally, we resample using a sampling function \(G\):
-\[B_{x_0,y_0} = \int_{-\infty}^{\infty}\int_{-\infty}^{\infty} b(x,y)G\left( {x - x_0 \atop y - y_0} \right) dxdy\]
-Putting all of these together:
-\[B_{x_0,y_0} =
-\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}
-\sum_{i = -\infty}^{\infty} \sum_{j = -\infty}^{\infty} A_{i,j}
-F\left( {u(x,y) - i \atop v(x,y) - j} \right)
-G\left( {x - x_0 \atop y - y_0} \right) dxdy\]
-We can reverse the order of the integrals and the sums:
-\[B_{x_0,y_0} =
-\sum_{i = -\infty}^{\infty} \sum_{j = -\infty}^{\infty} A_{i,j}
-\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}
-F\left( {u(x,y) - i \atop v(x,y) - j} \right)
-G\left( {x - x_0 \atop y - y_0} \right) dxdy\]
-Which shows that the destination pixel values are a linear combination of the
-source pixel values. But the coefficents depend on \(x_0\) and \(y_0\).
-To simplify this a bit, define:
-\[i_0 = \lfloor u(x_0,y_0) \rfloor = \lfloor {t_{00}x_0 + t_{01}y_0 + t_{02}} \rfloor \]
-\[j_0 = \lfloor v(x_0,y_0) \rfloor = \lfloor {t_{10}x_0 + t_{11}y_0 + t_{12}} \rfloor \]
-\[\Delta_u = u(x_0,y_0) - i_0 = t_{00}x_0 + t_{01}y_0 + t_{02} - \lfloor {t_{00}x_0 + t_{01}y_0 + t_{02}} \rfloor \]
-\[\Delta_v = v(x_0,y_0) - j_0 = t_{10}x_0 + t_{11}y_0 + t_{12} - \lfloor {t_{10}x_0 + t_{11}y_0 + t_{12}} \rfloor \]
-Then making the transforms \(x' = x - x_0\), \(y' = y - x_0\), \(i' = i - i_0\), \(j' = j - x_0\)
-\begin{eqnarray*}
-F(u,v) & = & F\left( {t_{00}x + t_{01}y + t_{02} - i \atop t_{10}x + t_{11}y + t_{12} - j} \right)\\
- & = & F\left( {t_{00}(x'+x_0) + t_{01}(y'+y_0) + t_{02} - (i'+i_0) \atop
- t_{10}(x'+x_0) + t_{11}(y'+y_0) + t_{12} - (j'+j_0)} \right) \\
- & = & F\left( {\Delta_u + t_{00}x' + t_{01}y' - i' \atop
- \Delta_v + t_{10}x' + t_{11}y' - j'} \right)
-\end{eqnarray*}
-Using that, we can then reparameterize the sums and integrals and
-define coefficients that depend only on \((\Delta_u,\Delta_v)\),
-which we'll call the \emph{phase} at the point \((x_0,y_0)\):
-\[
-B_{x_0,y_0} =
-\sum_{i = -\infty}^{\infty} \sum_{j = -\infty}^{\infty} A_{i_0+i,j_0+j} C_{i,j}(\Delta_u,\Delta_v)
-\]
-\[
-C_{i,j}(\Delta_u,\Delta_v) =
-\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}
-F\left( {\Delta_u + t_{00}x + t_{01}y - i \atop
- \Delta_v + t_{10}x + t_{11}y - j} \right)
-G\left( {x \atop y} \right) dxdy
-\]
-\section{Separability}
-A frequent special case is when the reconstruction and sampling functions
-are of the form:
-\[F(u,v) = f(u)f(v)\]
-\[G(x,y) = g(x)g(y)\]
-If we also have a transform that is purely a scale and translation;
-(\(t_{10} = 0\), \(t_{01} = 0\)), then we can separate
-\(C_{i,j}(\Delta_u,\Delta_v)\) into the product of a \(x\) portion
-and a \(y\) portion:
-\[C_{i,j}(\Delta_u,\Delta_v) = c_{i}(\Delta_u) c_{j}(\Delta_v)\]
-\[c_{i}(\Delta_u) = \int_{-\infty}^{\infty} f(\Delta_u + t_{00}x - i)g(x)dx\]
-\[c_{j}(\Delta_v) = \int_{-\infty}^{\infty} f(\Delta_v + t_{11}y - j)g(y)dy\]
-
-\section{Some filters}
-gdk-pixbuf provides 4 standard filters for scaling, under the names ``NEAREST'',
-``TILES'', ``BILINEAR'', and ``HYPER''. All of turn out to be separable
-as discussed in the previous section.
-For ``NEAREST'' filter, the reconstruction function is simple replication
-and the sampling function is a delta function\footnote{A delta function is an infinitely narrow spike, such that:
-\[\int_{-\infty}^{\infty}\delta(x)f(x) = f(0)\]}:
-\[f(t) = \cases{1, & if \(0 \le t \le 1\); \cr
- 0, & otherwise}\]
-\[g(t) = \delta(t - 0.5)\]
-For ``TILES'', the reconstruction function is again replication, but we
-replace the delta-function for sampling with a box filter:
-\[f(t) = \cases{1, & if \(0 \le t \le 1\); \cr
- 0, & otherwise}\]
-\[g(t) = \cases{1, & if \(0 \le t \le 1\); \cr
- 0, & otherwise}\]
-The ``HYPER'' filter (in practice, it was originally intended to be
-something else) uses bilinear interpolation for reconstruction and
-a box filter for sampling:
-\[f(t) = \cases{1 - |t - 0.5|, & if \(-0.5 \le t \le 1.5\); \cr
- 0, & otherwise}\]
-\[g(t) = \cases{1, & if \(0 \le t \le 1\); \cr
- 0, & otherwise}\]
-The ``BILINEAR'' filter is defined in a somewhat more complicated way;
-the definition depends on the scale factor in the transform (\(t_{00}\)
-or \(t_{01}]\). In the \(x\) direction, for \(t_{00} < 1\), it is
-the same as for ``TILES'':
-\[f_u(t) = \cases{1, & if \(0 \le t \le 1\); \cr
- 0, & otherwise}\]
-\[g_u(t) = \cases{1, & if \(0 \le t \le 1\); \cr
- 0, & otherwise}\]
-but for \(t_{10} > 1\), we use bilinear reconstruction and delta-function
-sampling:
-\[f_u(t) = \cases{1 - |t - 0.5|, & if \(-0.5 \le t \le 1.5\); \cr
- 0, & otherwise}\]
-\[g_u(t) = \delta(t - 0.5)\]
-The behavior in the \(y\) direction depends in the same way on \(t_{11}\).
-\end{document} \ No newline at end of file
diff --git a/gdk-pixbuf/pixops/pixops-internal.h b/gdk-pixbuf/pixops/pixops-internal.h
deleted file mode 100644
index a048b6983b..0000000000
--- a/gdk-pixbuf/pixops/pixops-internal.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright (C) 2000 Red Hat, Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.
- */
-#ifdef USE_MMX
-guchar *_pixops_scale_line_22_33_mmx (guint32 weights[16][8], guchar *p, guchar *q1, guchar *q2, int x_step, guchar *p_stop, int x_init);
-guchar *_pixops_composite_line_22_4a4_mmx (guint32 weights[16][8], guchar *p, guchar *q1, guchar *q2, int x_step, guchar *p_stop, int x_init);
-guchar *_pixops_composite_line_color_22_4a4_mmx (guint32 weights[16][8], guchar *p, guchar *q1, guchar *q2, int x_step, guchar *p_stop, int x_init, int dest_x, int check_shift, int *colors);
-int _pixops_have_mmx (void);
-#endif
-
diff --git a/gdk-pixbuf/pixops/pixops.c b/gdk-pixbuf/pixops/pixops.c
deleted file mode 100644
index 5db165c3ab..0000000000
--- a/gdk-pixbuf/pixops/pixops.c
+++ /dev/null
@@ -1,2560 +0,0 @@
-/*
- * Copyright (C) 2000 Red Hat, Inc
- * mediaLib integration Copyright (c) 2001-2007 Sun Microsystems, Inc.
- * All rights reserved. (Brian Cameron, Dmitriy Demin, James Cheng,
- * Padraig O'Briain)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 <math.h>
-#include <glib.h>
-
-#include "pixops.h"
-#include "pixops-internal.h"
-
-#define SUBSAMPLE_BITS 4
-#define SUBSAMPLE (1 << SUBSAMPLE_BITS)
-#define SUBSAMPLE_MASK ((1 << SUBSAMPLE_BITS)-1)
-#define SCALE_SHIFT 16
-
-static void
-_pixops_scale_real (guchar *dest_buf,
- int render_x0,
- int render_y0,
- int render_x1,
- int render_y1,
- int dest_rowstride,
- int dest_channels,
- gboolean dest_has_alpha,
- const guchar *src_buf,
- int src_width,
- int src_height,
- int src_rowstride,
- int src_channels,
- gboolean src_has_alpha,
- double scale_x,
- double scale_y,
- PixopsInterpType interp_type);
-
-typedef struct _PixopsFilter PixopsFilter;
-typedef struct _PixopsFilterDimension PixopsFilterDimension;
-
-struct _PixopsFilterDimension
-{
- int n;
- double offset;
- double *weights;
-};
-
-struct _PixopsFilter
-{
- PixopsFilterDimension x;
- PixopsFilterDimension y;
- double overall_alpha;
-};
-
-typedef guchar *(*PixopsLineFunc) (int *weights, int n_x, int n_y,
- guchar *dest, int dest_x, guchar *dest_end,
- int dest_channels, int dest_has_alpha,
- guchar **src, int src_channels,
- gboolean src_has_alpha, int x_init,
- int x_step, int src_width, int check_size,
- guint32 color1, guint32 color2);
-typedef void (*PixopsPixelFunc) (guchar *dest, int dest_x, int dest_channels,
- int dest_has_alpha, int src_has_alpha,
- int check_size, guint32 color1,
- guint32 color2,
- guint r, guint g, guint b, guint a);
-
-#ifdef USE_MEDIALIB
-#include <stdlib.h>
-#include <dlfcn.h>
-#include <mlib_image.h>
-
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif
-
-#if defined(HAVE_SYS_SYSTEMINFO_H)
-#include <sys/systeminfo.h>
-#elif defined(HAVE_SYS_SYSINFO_H)
-#include <sys/sysinfo.h>
-#endif
-
-static void pixops_medialib_composite (guchar *dest_buf,
- int dest_width,
- int dest_height,
- int dest_rowstride,
- int dest_channels,
- int dest_has_alpha,
- const guchar *src_buf,
- int src_width,
- int src_height,
- int src_rowstride,
- int src_channels,
- int src_has_alpha,
- int dest_x,
- int dest_y,
- int dest_region_width,
- int dest_region_height,
- double offset_x,
- double offset_y,
- double scale_x,
- double scale_y,
- PixopsInterpType interp_type,
- int overall_alpha);
-
-static void pixops_medialib_scale (guchar *dest_buf,
- int dest_width,
- int dest_height,
- int dest_rowstride,
- int dest_channels,
- int dest_has_alpha,
- const guchar *src_buf,
- int src_width,
- int src_height,
- int src_rowstride,
- int src_channels,
- int src_has_alpha,
- int dest_x,
- int dest_y,
- int dest_region_width,
- int dest_region_height,
- double offset_x,
- double offset_y,
- double scale_x,
- double scale_y,
- PixopsInterpType interp_type);
-
-typedef struct _mlInterp mlInterp;
-
-struct _mlInterp
-{
- double tx;
- double ty;
- PixopsFilter po_filter;
- void *interp_table;
-};
-
-static gboolean medialib_initialized = FALSE;
-static gboolean use_medialib = TRUE;
-
-/*
- * Sun mediaLib(tm) support.
- *
- * http://www.sun.com/processors/vis/mlib.html
- *
- */
-static void
-_pixops_use_medialib ()
-{
- char *mlib_version_string;
- char sys_info[257];
- long count;
-
- medialib_initialized = TRUE;
-
- if (getenv ("GDK_DISABLE_MEDIALIB"))
- {
- use_medialib = FALSE;
- return;
- }
-
- /*
- * The imaging functions we want to use were added in mediaLib version 2.
- * So turn off mediaLib support if the user has an older version.
- * mlib_version returns a string in this format:
- *
- * mediaLib:0210:20011101:v8plusa
- * ^^^^^^^^ ^^^^ ^^^^^^^^ ^^^^^^^
- * libname vers build ISALIST identifier
- * date (in this case sparcv8plus+vis)
- *
- * The first 2 digits of the version are the major version. The 3rd digit
- * is the minor version, and the 4th digit is the micro version. So the
- * above string corresponds to version 2.1.0. In the following test we only
- * care about the major version.
- */
- mlib_version_string = mlib_version ();
-
- count = sysinfo (SI_ARCHITECTURE, &sys_info[0], 257);
-
- if (count != -1)
- {
- if (strcmp (sys_info, "i386") == 0)
- {
- char *mlib_target_isa = &mlib_version_string[23];
-
- /*
- * For x86 processors mediaLib generic C implementation
- * does not give any performance advantage so disable it
- */
- if (strncmp (mlib_target_isa, "sse", 3) != 0)
- {
- use_medialib = FALSE;
- return;
- }
-
- /*
- * For x86 processors use of libumem conflicts with
- * mediaLib, so avoid using it.
- */
- if (dlsym (RTLD_PROBE, "umem_alloc") != NULL)
- {
- use_medialib = FALSE;
- return;
- }
- }
- }
- else
- {
- /* Failed to get system architecture, disable mediaLib anyway */
- use_medialib = FALSE;
- return;
- }
-}
-#endif
-
-static int
-get_check_shift (int check_size)
-{
- int check_shift = 0;
- g_return_val_if_fail (check_size >= 0, 4);
-
- while (!(check_size & 1))
- {
- check_shift++;
- check_size >>= 1;
- }
-
- return check_shift;
-}
-
-static void
-pixops_scale_nearest (guchar *dest_buf,
- int render_x0,
- int render_y0,
- int render_x1,
- int render_y1,
- int dest_rowstride,
- int dest_channels,
- gboolean dest_has_alpha,
- const guchar *src_buf,
- int src_width,
- int src_height,
- int src_rowstride,
- int src_channels,
- gboolean src_has_alpha,
- double scale_x,
- double scale_y)
-{
- int i;
- int x;
- int x_step = (1 << SCALE_SHIFT) / scale_x;
- int y_step = (1 << SCALE_SHIFT) / scale_y;
- int xmax, xstart, xstop, x_pos, y_pos;
- const guchar *p;
-
-#define INNER_LOOP(SRC_CHANNELS,DEST_CHANNELS,ASSIGN_PIXEL) \
- xmax = x + (render_x1 - render_x0) * x_step; \
- xstart = MIN (0, xmax); \
- xstop = MIN (src_width << SCALE_SHIFT, xmax); \
- p = src + (CLAMP (x, xstart, xstop) >> SCALE_SHIFT) * SRC_CHANNELS; \
- while (x < xstart) \
- { \
- ASSIGN_PIXEL; \
- dest += DEST_CHANNELS; \
- x += x_step; \
- } \
- while (x < xstop) \
- { \
- p = src + (x >> SCALE_SHIFT) * SRC_CHANNELS; \
- ASSIGN_PIXEL; \
- dest += DEST_CHANNELS; \
- x += x_step; \
- } \
- x_pos = x >> SCALE_SHIFT; \
- p = src + CLAMP (x_pos, 0, src_width - 1) * SRC_CHANNELS; \
- while (x < xmax) \
- { \
- ASSIGN_PIXEL; \
- dest += DEST_CHANNELS; \
- x += x_step; \
- }
-
- for (i = 0; i < (render_y1 - render_y0); i++)
- {
- const guchar *src;
- guchar *dest;
- y_pos = ((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT;
- y_pos = CLAMP (y_pos, 0, src_height - 1);
- src = src_buf + y_pos * src_rowstride;
- dest = dest_buf + i * dest_rowstride;
-
- x = render_x0 * x_step + x_step / 2;
-
- if (src_channels == 3)
- {
- if (dest_channels == 3)
- {
- INNER_LOOP (3, 3, dest[0]=p[0];dest[1]=p[1];dest[2]=p[2]);
- }
- else
- {
- INNER_LOOP (3, 4, dest[0]=p[0];dest[1]=p[1];dest[2]=p[2];dest[3]=0xff);
- }
- }
- else if (src_channels == 4)
- {
- if (dest_channels == 3)
- {
- INNER_LOOP (4, 3, dest[0]=p[0];dest[1]=p[1];dest[2]=p[2]);
- }
- else
- {
- guint32 *p32;
- INNER_LOOP(4, 4, p32=(guint32*)dest;*p32=*((guint32*)p));
- }
- }
- }
-}
-
-static void
-pixops_composite_nearest (guchar *dest_buf,
- int render_x0,
- int render_y0,
- int render_x1,
- int render_y1,
- int dest_rowstride,
- int dest_channels,
- gboolean dest_has_alpha,
- const guchar *src_buf,
- int src_width,
- int src_height,
- int src_rowstride,
- int src_channels,
- gboolean src_has_alpha,
- double scale_x,
- double scale_y,
- int overall_alpha)
-{
- int i;
- int x;
- int x_step = (1 << SCALE_SHIFT) / scale_x;
- int y_step = (1 << SCALE_SHIFT) / scale_y;
- int xmax, xstart, xstop, x_pos, y_pos;
- const guchar *p;
- unsigned int a0;
-
- for (i = 0; i < (render_y1 - render_y0); i++)
- {
- const guchar *src;
- guchar *dest;
- y_pos = ((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT;
- y_pos = CLAMP (y_pos, 0, src_height - 1);
- src = src_buf + y_pos * src_rowstride;
- dest = dest_buf + i * dest_rowstride;
-
- x = render_x0 * x_step + x_step / 2;
-
- INNER_LOOP(src_channels, dest_channels,
- if (src_has_alpha)
- a0 = (p[3] * overall_alpha) / 0xff;
- else
- a0 = overall_alpha;
-
- switch (a0)
- {
- case 0:
- break;
- case 255:
- dest[0] = p[0];
- dest[1] = p[1];
- dest[2] = p[2];
- if (dest_has_alpha)
- dest[3] = 0xff;
- break;
- default:
- if (dest_has_alpha)
- {
- unsigned int w0 = 0xff * a0;
- unsigned int w1 = (0xff - a0) * dest[3];
- unsigned int w = w0 + w1;
-
- dest[0] = (w0 * p[0] + w1 * dest[0]) / w;
- dest[1] = (w0 * p[1] + w1 * dest[1]) / w;
- dest[2] = (w0 * p[2] + w1 * dest[2]) / w;
- dest[3] = w / 0xff;
- }
- else
- {
- unsigned int a1 = 0xff - a0;
- unsigned int tmp;
-
- tmp = a0 * p[0] + a1 * dest[0] + 0x80;
- dest[0] = (tmp + (tmp >> 8)) >> 8;
- tmp = a0 * p[1] + a1 * dest[1] + 0x80;
- dest[1] = (tmp + (tmp >> 8)) >> 8;
- tmp = a0 * p[2] + a1 * dest[2] + 0x80;
- dest[2] = (tmp + (tmp >> 8)) >> 8;
- }
- break;
- }
- );
- }
-}
-
-static void
-pixops_composite_color_nearest (guchar *dest_buf,
- int render_x0,
- int render_y0,
- int render_x1,
- int render_y1,
- int dest_rowstride,
- int dest_channels,
- gboolean dest_has_alpha,
- const guchar *src_buf,
- int src_width,
- int src_height,
- int src_rowstride,
- int src_channels,
- gboolean src_has_alpha,
- double scale_x,
- double scale_y,
- int overall_alpha,
- int check_x,
- int check_y,
- int check_size,
- guint32 color1,
- guint32 color2)
-{
- int i, j;
- int x;
- int x_step = (1 << SCALE_SHIFT) / scale_x;
- int y_step = (1 << SCALE_SHIFT) / scale_y;
- int r1, g1, b1, r2, g2, b2;
- int check_shift = get_check_shift (check_size);
- int xmax, xstart, xstop, x_pos, y_pos;
- const guchar *p;
- unsigned int a0;
-
- for (i = 0; i < (render_y1 - render_y0); i++)
- {
- const guchar *src;
- guchar *dest;
- y_pos = ((i + render_y0) * y_step + y_step / 2) >> SCALE_SHIFT;
- y_pos = CLAMP (y_pos, 0, src_height - 1);
- src = src_buf + y_pos * src_rowstride;
- dest = dest_buf + i * dest_rowstride;
-
- x = render_x0 * x_step + x_step / 2;
-
-
- if (((i + check_y) >> check_shift) & 1)
- {
- r1 = (color2 & 0xff0000) >> 16;
- g1 = (color2 & 0xff00) >> 8;
- b1 = color2 & 0xff;
-
- r2 = (color1 & 0xff0000) >> 16;
- g2 = (color1 & 0xff00) >> 8;
- b2 = color1 & 0xff;
- }
- else
- {
- r1 = (color1 & 0xff0000) >> 16;
- g1 = (color1 & 0xff00) >> 8;
- b1 = color1 & 0xff;
-
- r2 = (color2 & 0xff0000) >> 16;
- g2 = (color2 & 0xff00) >> 8;
- b2 = color2 & 0xff;
- }
-
- j = 0;
- INNER_LOOP(src_channels, dest_channels,
- if (src_has_alpha)
- a0 = (p[3] * overall_alpha + 0xff) >> 8;
- else
- a0 = overall_alpha;
-
- switch (a0)
- {
- case 0:
- if (((j + check_x) >> check_shift) & 1)
- {
- dest[0] = r2;
- dest[1] = g2;
- dest[2] = b2;
- }
- else
- {
- dest[0] = r1;
- dest[1] = g1;
- dest[2] = b1;
- }
- break;
- case 255:
- dest[0] = p[0];
- dest[1] = p[1];
- dest[2] = p[2];
- break;
- default:
- {
- unsigned int tmp;
- if (((j + check_x) >> check_shift) & 1)
- {
- tmp = ((int) p[0] - r2) * a0;
- dest[0] = r2 + ((tmp + (tmp >> 8) + 0x80) >> 8);
- tmp = ((int) p[1] - g2) * a0;
- dest[1] = g2 + ((tmp + (tmp >> 8) + 0x80) >> 8);
- tmp = ((int) p[2] - b2) * a0;
- dest[2] = b2 + ((tmp + (tmp >> 8) + 0x80) >> 8);
- }
- else
- {
- tmp = ((int) p[0] - r1) * a0;
- dest[0] = r1 + ((tmp + (tmp >> 8) + 0x80) >> 8);
- tmp = ((int) p[1] - g1) * a0;
- dest[1] = g1 + ((tmp + (tmp >> 8) + 0x80) >> 8);
- tmp = ((int) p[2] - b1) * a0;
- dest[2] = b1 + ((tmp + (tmp >> 8) + 0x80) >> 8);
- }
- }
- break;
- }
-
- if (dest_channels == 4)
- dest[3] = 0xff;
-
- j++;
- );
- }
-}
-#undef INNER_LOOP
-
-static void
-composite_pixel (guchar *dest, int dest_x, int dest_channels, int dest_has_alpha,
- int src_has_alpha, int check_size, guint32 color1, guint32 color2,
- guint r, guint g, guint b, guint a)
-{
- if (dest_has_alpha)
- {
- unsigned int w0 = a - (a >> 8);
- unsigned int w1 = ((0xff0000 - a) >> 8) * dest[3];
- unsigned int w = w0 + w1;
-
- if (w != 0)
- {
- dest[0] = (r - (r >> 8) + w1 * dest[0]) / w;
- dest[1] = (g - (g >> 8) + w1 * dest[1]) / w;
- dest[2] = (b - (b >> 8) + w1 * dest[2]) / w;
- dest[3] = w / 0xff00;
- }
- else
- {
- dest[0] = 0;
- dest[1] = 0;
- dest[2] = 0;
- dest[3] = 0;
- }
- }
- else
- {
- dest[0] = (r + (0xff0000 - a) * dest[0]) / 0xff0000;
- dest[1] = (g + (0xff0000 - a) * dest[1]) / 0xff0000;
- dest[2] = (b + (0xff0000 - a) * dest[2]) / 0xff0000;
- }
-}
-
-static guchar *
-composite_line (int *weights, int n_x, int n_y,
- guchar *dest, int dest_x, guchar *dest_end, int dest_channels, int dest_has_alpha,
- guchar **src, int src_channels, gboolean src_has_alpha,
- int x_init, int x_step, int src_width,
- int check_size, guint32 color1, guint32 color2)
-{
- int x = x_init;
- int i, j;
-
- while (dest < dest_end)
- {
- int x_scaled = x >> SCALE_SHIFT;
- unsigned int r = 0, g = 0, b = 0, a = 0;
- int *pixel_weights;
-
- pixel_weights = weights + ((x >> (SCALE_SHIFT - SUBSAMPLE_BITS)) & SUBSAMPLE_MASK) * n_x * n_y;
-
- for (i=0; i<n_y; i++)
- {
- guchar *q = src[i] + x_scaled * src_channels;
- int *line_weights = pixel_weights + n_x * i;
-
- for (j=0; j<n_x; j++)
- {
- unsigned int ta;
-
- if (src_has_alpha)
- ta = q[3] * line_weights[j];
- else
- ta = 0xff * line_weights[j];
-
- r += ta * q[0];
- g += ta * q[1];
- b += ta * q[2];
- a += ta;
-
- q += src_channels;
- }
- }
-
- if (dest_has_alpha)
- {
- unsigned int w0 = a - (a >> 8);
- unsigned int w1 = ((0xff0000 - a) >> 8) * dest[3];
- unsigned int w = w0 + w1;
-
- if (w != 0)
- {
- dest[0] = (r - (r >> 8) + w1 * dest[0]) / w;
- dest[1] = (g - (g >> 8) + w1 * dest[1]) / w;
- dest[2] = (b - (b >> 8) + w1 * dest[2]) / w;
- dest[3] = w / 0xff00;
- }
- else
- {
- dest[0] = 0;
- dest[1] = 0;
- dest[2] = 0;
- dest[3] = 0;
- }
- }
- else
- {
- dest[0] = (r + (0xff0000 - a) * dest[0]) / 0xff0000;
- dest[1] = (g + (0xff0000 - a) * dest[1]) / 0xff0000;
- dest[2] = (b + (0xff0000 - a) * dest[2]) / 0xff0000;
- }
-
- dest += dest_channels;
- x += x_step;
- }
-
- return dest;
-}
-
-static guchar *
-composite_line_22_4a4 (int *weights, int n_x, int n_y,
- guchar *dest, int dest_x, guchar *dest_end, int dest_channels, int dest_has_alpha,
- guchar **src, int src_channels, gboolean src_has_alpha,
- int x_init, int x_step, int src_width,
- int check_size, guint32 color1, guint32 color2)
-{
- int x = x_init;
- guchar *src0 = src[0];
- guchar *src1 = src[1];
-
- g_return_val_if_fail (src_channels != 3, dest);
- g_return_val_if_fail (src_has_alpha, dest);
-
- while (dest < dest_end)
- {
- int x_scaled = x >> SCALE_SHIFT;
- unsigned int r, g, b, a, ta;
- int *pixel_weights;
- guchar *q0, *q1;
- int w1, w2, w3, w4;
-
- q0 = src0 + x_scaled * 4;
- q1 = src1 + x_scaled * 4;
-
- pixel_weights = (int *)((char *)weights +
- ((x >> (SCALE_SHIFT - SUBSAMPLE_BITS - 4)) & (SUBSAMPLE_MASK << 4)));
-
- w1 = pixel_weights[0];
- w2 = pixel_weights[1];
- w3 = pixel_weights[2];
- w4 = pixel_weights[3];
-
- a = w1 * q0[3];
- r = a * q0[0];
- g = a * q0[1];
- b = a * q0[2];
-
- ta = w2 * q0[7];
- r += ta * q0[4];
- g += ta * q0[5];
- b += ta * q0[6];
- a += ta;
-
- ta = w3 * q1[3];
- r += ta * q1[0];
- g += ta * q1[1];
- b += ta * q1[2];
- a += ta;
-
- ta = w4 * q1[7];
- r += ta * q1[4];
- g += ta * q1[5];
- b += ta * q1[6];
- a += ta;
-
- dest[0] = ((0xff0000 - a) * dest[0] + r) >> 24;
- dest[1] = ((0xff0000 - a) * dest[1] + g) >> 24;
- dest[2] = ((0xff0000 - a) * dest[2] + b) >> 24;
- dest[3] = a >> 16;
-
- dest += 4;
- x += x_step;
- }
-
- return dest;
-}
-
-#ifdef USE_MMX
-static guchar *
-composite_line_22_4a4_mmx_stub (int *weights, int n_x, int n_y, guchar *dest,
- int dest_x, guchar *dest_end,
- int dest_channels, int dest_has_alpha,
- guchar **src, int src_channels,
- gboolean src_has_alpha, int x_init,
- int x_step, int src_width, int check_size,
- guint32 color1, guint32 color2)
-{
- guint32 mmx_weights[16][8];
- int j;
-
- for (j=0; j<16; j++)
- {
- mmx_weights[j][0] = 0x00010001 * (weights[4*j] >> 8);
- mmx_weights[j][1] = 0x00010001 * (weights[4*j] >> 8);
- mmx_weights[j][2] = 0x00010001 * (weights[4*j + 1] >> 8);
- mmx_weights[j][3] = 0x00010001 * (weights[4*j + 1] >> 8);
- mmx_weights[j][4] = 0x00010001 * (weights[4*j + 2] >> 8);
- mmx_weights[j][5] = 0x00010001 * (weights[4*j + 2] >> 8);
- mmx_weights[j][6] = 0x00010001 * (weights[4*j + 3] >> 8);
- mmx_weights[j][7] = 0x00010001 * (weights[4*j + 3] >> 8);
- }
-
- return _pixops_composite_line_22_4a4_mmx (mmx_weights, dest, src[0], src[1],
- x_step, dest_end, x_init);
-}
-#endif /* USE_MMX */
-
-static void
-composite_pixel_color (guchar *dest, int dest_x, int dest_channels,
- int dest_has_alpha, int src_has_alpha, int check_size,
- guint32 color1, guint32 color2, guint r, guint g,
- guint b, guint a)
-{
- int dest_r, dest_g, dest_b;
- int check_shift = get_check_shift (check_size);
-
- if ((dest_x >> check_shift) & 1)
- {
- dest_r = (color2 & 0xff0000) >> 16;
- dest_g = (color2 & 0xff00) >> 8;
- dest_b = color2 & 0xff;
- }
- else
- {
- dest_r = (color1 & 0xff0000) >> 16;
- dest_g = (color1 & 0xff00) >> 8;
- dest_b = color1 & 0xff;
- }
-
- dest[0] = ((0xff0000 - a) * dest_r + r) >> 24;
- dest[1] = ((0xff0000 - a) * dest_g + g) >> 24;
- dest[2] = ((0xff0000 - a) * dest_b + b) >> 24;
-
- if (dest_has_alpha)
- dest[3] = 0xff;
- else if (dest_channels == 4)
- dest[3] = a >> 16;
-}
-
-static guchar *
-composite_line_color (int *weights, int n_x, int n_y, guchar *dest,
- int dest_x, guchar *dest_end, int dest_channels,
- int dest_has_alpha, guchar **src, int src_channels,
- gboolean src_has_alpha, int x_init, int x_step,
- int src_width, int check_size, guint32 color1,
- guint32 color2)
-{
- int x = x_init;
- int i, j;
- int check_shift = get_check_shift (check_size);
- int dest_r1, dest_g1, dest_b1;
- int dest_r2, dest_g2, dest_b2;
-
- g_return_val_if_fail (check_size != 0, dest);
-
- dest_r1 = (color1 & 0xff0000) >> 16;
- dest_g1 = (color1 & 0xff00) >> 8;
- dest_b1 = color1 & 0xff;
-
- dest_r2 = (color2 & 0xff0000) >> 16;
- dest_g2 = (color2 & 0xff00) >> 8;
- dest_b2 = color2 & 0xff;
-
- while (dest < dest_end)
- {
- int x_scaled = x >> SCALE_SHIFT;
- unsigned int r = 0, g = 0, b = 0, a = 0;
- int *pixel_weights;
-
- pixel_weights = weights + ((x >> (SCALE_SHIFT - SUBSAMPLE_BITS)) & SUBSAMPLE_MASK) * n_x * n_y;
-
- for (i=0; i<n_y; i++)
- {
- guchar *q = src[i] + x_scaled * src_channels;
- int *line_weights = pixel_weights + n_x * i;
-
- for (j=0; j<n_x; j++)
- {
- unsigned int ta;
-
- if (src_has_alpha)
- ta = q[3] * line_weights[j];
- else
- ta = 0xff * line_weights[j];
-
- r += ta * q[0];
- g += ta * q[1];
- b += ta * q[2];
- a += ta;
-
- q += src_channels;
- }
- }
-
- if ((dest_x >> check_shift) & 1)
- {
- dest[0] = ((0xff0000 - a) * dest_r2 + r) >> 24;
- dest[1] = ((0xff0000 - a) * dest_g2 + g) >> 24;
- dest[2] = ((0xff0000 - a) * dest_b2 + b) >> 24;
- }
- else
- {
- dest[0] = ((0xff0000 - a) * dest_r1 + r) >> 24;
- dest[1] = ((0xff0000 - a) * dest_g1 + g) >> 24;
- dest[2] = ((0xff0000 - a) * dest_b1 + b) >> 24;
- }
-
- if (dest_has_alpha)
- dest[3] = 0xff;
- else if (dest_channels == 4)
- dest[3] = a >> 16;
-
- dest += dest_channels;
- x += x_step;
- dest_x++;
- }
-
- return dest;
-}
-
-#ifdef USE_MMX
-static guchar *
-composite_line_color_22_4a4_mmx_stub (int *weights, int n_x, int n_y,
- guchar *dest, int dest_x,
- guchar *dest_end, int dest_channels,
- int dest_has_alpha, guchar **src,
- int src_channels, gboolean src_has_alpha,
- int x_init, int x_step, int src_width,
- int check_size, guint32 color1,
- guint32 color2)
-{
- guint32 mmx_weights[16][8];
- int check_shift = get_check_shift (check_size);
- int colors[4];
- int j;
-
- for (j=0; j<16; j++)
- {
- mmx_weights[j][0] = 0x00010001 * (weights[4*j] >> 8);
- mmx_weights[j][1] = 0x00010001 * (weights[4*j] >> 8);
- mmx_weights[j][2] = 0x00010001 * (weights[4*j + 1] >> 8);
- mmx_weights[j][3] = 0x00010001 * (weights[4*j + 1] >> 8);
- mmx_weights[j][4] = 0x00010001 * (weights[4*j + 2] >> 8);
- mmx_weights[j][5] = 0x00010001 * (weights[4*j + 2] >> 8);
- mmx_weights[j][6] = 0x00010001 * (weights[4*j + 3] >> 8);
- mmx_weights[j][7] = 0x00010001 * (weights[4*j + 3] >> 8);
- }
-
- colors[0] = (color1 & 0xff00) << 8 | (color1 & 0xff);
- colors[1] = (color1 & 0xff0000) >> 16;
- colors[2] = (color2 & 0xff00) << 8 | (color2 & 0xff);
- colors[3] = (color2 & 0xff0000) >> 16;
-
- return _pixops_composite_line_color_22_4a4_mmx (mmx_weights, dest, src[0],
- src[1], x_step, dest_end, x_init, dest_x, check_shift, colors);
-}
-#endif /* USE_MMX */
-
-static void
-scale_pixel (guchar *dest, int dest_x, int dest_channels, int dest_has_alpha,
- int src_has_alpha, int check_size, guint32 color1, guint32 color2,
- guint r, guint g, guint b, guint a)
-{
- if (src_has_alpha)
- {
- if (a)
- {
- dest[0] = r / a;
- dest[1] = g / a;
- dest[2] = b / a;
- dest[3] = a >> 16;
- }
- else
- {
- dest[0] = 0;
- dest[1] = 0;
- dest[2] = 0;
- dest[3] = 0;
- }
- }
- else
- {
- dest[0] = (r + 0xffffff) >> 24;
- dest[1] = (g + 0xffffff) >> 24;
- dest[2] = (b + 0xffffff) >> 24;
-
- if (dest_has_alpha)
- dest[3] = 0xff;
- }
-}
-
-static guchar *
-scale_line (int *weights, int n_x, int n_y, guchar *dest, int dest_x,
- guchar *dest_end, int dest_channels, int dest_has_alpha,
- guchar **src, int src_channels, gboolean src_has_alpha, int x_init,
- int x_step, int src_width, int check_size, guint32 color1,
- guint32 color2)
-{
- int x = x_init;
- int i, j;
-
- while (dest < dest_end)
- {
- int x_scaled = x >> SCALE_SHIFT;
- int *pixel_weights;
-
- pixel_weights = weights +
- ((x >> (SCALE_SHIFT - SUBSAMPLE_BITS)) & SUBSAMPLE_MASK) * n_x * n_y;
-
- if (src_has_alpha)
- {
- unsigned int r = 0, g = 0, b = 0, a = 0;
- for (i=0; i<n_y; i++)
- {
- guchar *q = src[i] + x_scaled * src_channels;
- int *line_weights = pixel_weights + n_x * i;
-
- for (j=0; j<n_x; j++)
- {
- unsigned int ta;
-
- ta = q[3] * line_weights[j];
- r += ta * q[0];
- g += ta * q[1];
- b += ta * q[2];
- a += ta;
-
- q += src_channels;
- }
- }
-
- if (a)
- {
- dest[0] = r / a;
- dest[1] = g / a;
- dest[2] = b / a;
- dest[3] = a >> 16;
- }
- else
- {
- dest[0] = 0;
- dest[1] = 0;
- dest[2] = 0;
- dest[3] = 0;
- }
- }
- else
- {
- unsigned int r = 0, g = 0, b = 0;
- for (i=0; i<n_y; i++)
- {
- guchar *q = src[i] + x_scaled * src_channels;
- int *line_weights = pixel_weights + n_x * i;
-
- for (j=0; j<n_x; j++)
- {
- unsigned int ta = line_weights[j];
-
- r += ta * q[0];
- g += ta * q[1];
- b += ta * q[2];
-
- q += src_channels;
- }
- }
-
- dest[0] = (r + 0xffff) >> 16;
- dest[1] = (g + 0xffff) >> 16;
- dest[2] = (b + 0xffff) >> 16;
-
- if (dest_has_alpha)
- dest[3] = 0xff;
- }
-
- dest += dest_channels;
-
- x += x_step;
- }
-
- return dest;
-}
-
-#ifdef USE_MMX
-static guchar *
-scale_line_22_33_mmx_stub (int *weights, int n_x, int n_y, guchar *dest,
- int dest_x, guchar *dest_end, int dest_channels,
- int dest_has_alpha, guchar **src, int src_channels,
- gboolean src_has_alpha, int x_init, int x_step,
- int src_width, int check_size, guint32 color1,
- guint32 color2)
-{
- guint32 mmx_weights[16][8];
- int j;
-
- for (j=0; j<16; j++)
- {
- mmx_weights[j][0] = 0x00010001 * (weights[4*j] >> 8);
- mmx_weights[j][1] = 0x00010001 * (weights[4*j] >> 8);
- mmx_weights[j][2] = 0x00010001 * (weights[4*j + 1] >> 8);
- mmx_weights[j][3] = 0x00010001 * (weights[4*j + 1] >> 8);
- mmx_weights[j][4] = 0x00010001 * (weights[4*j + 2] >> 8);
- mmx_weights[j][5] = 0x00010001 * (weights[4*j + 2] >> 8);
- mmx_weights[j][6] = 0x00010001 * (weights[4*j + 3] >> 8);
- mmx_weights[j][7] = 0x00010001 * (weights[4*j + 3] >> 8);
- }
-
- return _pixops_scale_line_22_33_mmx (mmx_weights, dest, src[0], src[1],
- x_step, dest_end, x_init);
-}
-#endif /* USE_MMX */
-
-static guchar *
-scale_line_22_33 (int *weights, int n_x, int n_y, guchar *dest, int dest_x,
- guchar *dest_end, int dest_channels, int dest_has_alpha,
- guchar **src, int src_channels, gboolean src_has_alpha,
- int x_init, int x_step, int src_width,
- int check_size, guint32 color1, guint32 color2)
-{
- int x = x_init;
- guchar *src0 = src[0];
- guchar *src1 = src[1];
-
- while (dest < dest_end)
- {
- unsigned int r, g, b;
- int x_scaled = x >> SCALE_SHIFT;
- int *pixel_weights;
- guchar *q0, *q1;
- int w1, w2, w3, w4;
-
- q0 = src0 + x_scaled * 3;
- q1 = src1 + x_scaled * 3;
-
- pixel_weights = weights +
- ((x >> (SCALE_SHIFT - SUBSAMPLE_BITS)) & SUBSAMPLE_MASK) * 4;
-
- w1 = pixel_weights[0];
- w2 = pixel_weights[1];
- w3 = pixel_weights[2];
- w4 = pixel_weights[3];
-
- r = w1 * q0[0];
- g = w1 * q0[1];
- b = w1 * q0[2];
-
- r += w2 * q0[3];
- g += w2 * q0[4];
- b += w2 * q0[5];
-
- r += w3 * q1[0];
- g += w3 * q1[1];
- b += w3 * q1[2];
-
- r += w4 * q1[3];
- g += w4 * q1[4];
- b += w4 * q1[5];
-
- dest[0] = (r + 0x8000) >> 16;
- dest[1] = (g + 0x8000) >> 16;
- dest[2] = (b + 0x8000) >> 16;
-
- dest += 3;
- x += x_step;
- }
-
- return dest;
-}
-
-static void
-process_pixel (int *weights, int n_x, int n_y, guchar *dest, int dest_x,
- int dest_channels, int dest_has_alpha, guchar **src,
- int src_channels, gboolean src_has_alpha, int x_start,
- int src_width, int check_size, guint32 color1, guint32 color2,
- PixopsPixelFunc pixel_func)
-{
- unsigned int r = 0, g = 0, b = 0, a = 0;
- int i, j;
-
- for (i=0; i<n_y; i++)
- {
- int *line_weights = weights + n_x * i;
-
- for (j=0; j<n_x; j++)
- {
- unsigned int ta;
- guchar *q;
-
- if (x_start + j < 0)
- q = src[i];
- else if (x_start + j < src_width)
- q = src[i] + (x_start + j) * src_channels;
- else
- q = src[i] + (src_width - 1) * src_channels;
-
- if (src_has_alpha)
- ta = q[3] * line_weights[j];
- else
- ta = 0xff * line_weights[j];
-
- r += ta * q[0];
- g += ta * q[1];
- b += ta * q[2];
- a += ta;
- }
- }
-
- (*pixel_func) (dest, dest_x, dest_channels, dest_has_alpha, src_has_alpha,
- check_size, color1, color2, r, g, b, a);
-}
-
-static void
-correct_total (int *weights,
- int n_x,
- int n_y,
- int total,
- double overall_alpha)
-{
- int correction = (int)(0.5 + 65536 * overall_alpha) - total;
- int remaining, c, d, i;
-
- if (correction != 0)
- {
- remaining = correction;
- for (d = 1, c = correction; c != 0 && remaining != 0; d++, c = correction / d)
- for (i = n_x * n_y - 1; i >= 0 && c != 0 && remaining != 0; i--)
- if (*(weights + i) + c >= 0)
- {
- *(weights + i) += c;
- remaining -= c;
- if ((0 < remaining && remaining < c) ||
- (0 > remaining && remaining > c))
- c = remaining;
- }
- }
-}
-
-static int *
-make_filter_table (PixopsFilter *filter)
-{
- int i_offset, j_offset;
- int n_x = filter->x.n;
- int n_y = filter->y.n;
- int *weights = g_new (int, SUBSAMPLE * SUBSAMPLE * n_x * n_y);
-
- for (i_offset=0; i_offset < SUBSAMPLE; i_offset++)
- for (j_offset=0; j_offset < SUBSAMPLE; j_offset++)
- {
- double weight;
- int *pixel_weights = weights + ((i_offset*SUBSAMPLE) + j_offset) * n_x * n_y;
- int total = 0;
- int i, j;
-
- for (i=0; i < n_y; i++)
- for (j=0; j < n_x; j++)
- {
- weight = filter->x.weights[(j_offset * n_x) + j] *
- filter->y.weights[(i_offset * n_y) + i] *
- filter->overall_alpha * 65536 + 0.5;
-
- total += (int)weight;
-
- *(pixel_weights + n_x * i + j) = weight;
- }
-
- correct_total (pixel_weights, n_x, n_y, total, filter->overall_alpha);
- }
-
- return weights;
-}
-
-static void
-pixops_process (guchar *dest_buf,
- int render_x0,
- int render_y0,
- int render_x1,
- int render_y1,
- int dest_rowstride,
- int dest_channels,
- gboolean dest_has_alpha,
- const guchar *src_buf,
- int src_width,
- int src_height,
- int src_rowstride,
- int src_channels,
- gboolean src_has_alpha,
- double scale_x,
- double scale_y,
- int check_x,
- int check_y,
- int check_size,
- guint32 color1,
- guint32 color2,
- PixopsFilter *filter,
- PixopsLineFunc line_func,
- PixopsPixelFunc pixel_func)
-{
- int i, j;
- int x, y; /* X and Y position in source (fixed_point) */
-
- guchar **line_bufs;
- int *filter_weights;
-
- int x_step;
- int y_step;
-
- int check_shift;
- int scaled_x_offset;
-
- int run_end_x;
- int run_end_index;
-
- x_step = (1 << SCALE_SHIFT) / scale_x; /* X step in source (fixed point) */
- y_step = (1 << SCALE_SHIFT) / scale_y; /* Y step in source (fixed point) */
-
- if (x_step == 0 || y_step == 0)
- return; /* overflow, bail out */
-
- line_bufs = g_new (guchar *, filter->y.n);
- filter_weights = make_filter_table (filter);
-
- check_shift = check_size ? get_check_shift (check_size) : 0;
-
- scaled_x_offset = floor (filter->x.offset * (1 << SCALE_SHIFT));
-
- /* Compute the index where we run off the end of the source buffer. The
- * furthest source pixel we access at index i is:
- *
- * ((render_x0 + i) * x_step + scaled_x_offset) >> SCALE_SHIFT + filter->x.n - 1
- *
- * So, run_end_index is the smallest i for which this pixel is src_width,
- * i.e, for which:
- *
- * (i + render_x0) * x_step >= ((src_width - filter->x.n + 1) << SCALE_SHIFT) - scaled_x_offset
- *
- */
-#define MYDIV(a,b) ((a) > 0 ? (a) / (b) : ((a) - (b) + 1) / (b)) /* Division so that -1/5 = -1 */
-
- run_end_x = (((src_width - filter->x.n + 1) << SCALE_SHIFT) - scaled_x_offset);
- run_end_index = MYDIV (run_end_x + x_step - 1, x_step) - render_x0;
- run_end_index = MIN (run_end_index, render_x1 - render_x0);
-
- y = render_y0 * y_step + floor (filter->y.offset * (1 << SCALE_SHIFT));
- for (i = 0; i < (render_y1 - render_y0); i++)
- {
- int dest_x;
- int y_start = y >> SCALE_SHIFT;
- int x_start;
- int *run_weights = filter_weights +
- ((y >> (SCALE_SHIFT - SUBSAMPLE_BITS)) & SUBSAMPLE_MASK) *
- filter->x.n * filter->y.n * SUBSAMPLE;
- guchar *new_outbuf;
- guint32 tcolor1, tcolor2;
-
- guchar *outbuf = dest_buf + dest_rowstride * i;
- guchar *outbuf_end = outbuf + dest_channels * (render_x1 - render_x0);
-
- if (((i + check_y) >> check_shift) & 1)
- {
- tcolor1 = color2;
- tcolor2 = color1;
- }
- else
- {
- tcolor1 = color1;
- tcolor2 = color2;
- }
-
- for (j=0; j<filter->y.n; j++)
- {
- if (y_start < 0)
- line_bufs[j] = (guchar *)src_buf;
- else if (y_start < src_height)
- line_bufs[j] = (guchar *)src_buf + src_rowstride * y_start;
- else
- line_bufs[j] = (guchar *)src_buf + src_rowstride * (src_height - 1);
-
- y_start++;
- }
-
- dest_x = check_x;
- x = render_x0 * x_step + scaled_x_offset;
- x_start = x >> SCALE_SHIFT;
-
- while (x_start < 0 && outbuf < outbuf_end)
- {
- process_pixel (run_weights + ((x >> (SCALE_SHIFT - SUBSAMPLE_BITS)) & SUBSAMPLE_MASK) * (filter->x.n * filter->y.n), filter->x.n, filter->y.n,
- outbuf, dest_x, dest_channels, dest_has_alpha,
- line_bufs, src_channels, src_has_alpha,
- x >> SCALE_SHIFT, src_width,
- check_size, tcolor1, tcolor2, pixel_func);
-
- x += x_step;
- x_start = x >> SCALE_SHIFT;
- dest_x++;
- outbuf += dest_channels;
- }
-
- new_outbuf = (*line_func) (run_weights, filter->x.n, filter->y.n,
- outbuf, dest_x, dest_buf + dest_rowstride *
- i + run_end_index * dest_channels,
- dest_channels, dest_has_alpha,
- line_bufs, src_channels, src_has_alpha,
- x, x_step, src_width, check_size, tcolor1,
- tcolor2);
-
- dest_x += (new_outbuf - outbuf) / dest_channels;
-
- x = (dest_x - check_x + render_x0) * x_step + scaled_x_offset;
- outbuf = new_outbuf;
-
- while (outbuf < outbuf_end)
- {
- process_pixel (run_weights + ((x >> (SCALE_SHIFT - SUBSAMPLE_BITS)) & SUBSAMPLE_MASK) * (filter->x.n * filter->y.n), filter->x.n, filter->y.n,
- outbuf, dest_x, dest_channels, dest_has_alpha,
- line_bufs, src_channels, src_has_alpha,
- x >> SCALE_SHIFT, src_width,
- check_size, tcolor1, tcolor2, pixel_func);
-
- x += x_step;
- dest_x++;
- outbuf += dest_channels;
- }
-
- y += y_step;
- }
-
- g_free (line_bufs);
- g_free (filter_weights);
-}
-
-/* Compute weights for reconstruction by replication followed by
- * sampling with a box filter
- */
-static void
-tile_make_weights (PixopsFilterDimension *dim,
- double scale)
-{
- int n = ceil (1 / scale + 1);
- double *pixel_weights = g_new (double, SUBSAMPLE * n);
- int offset;
- int i;
-
- dim->n = n;
- dim->offset = 0;
- dim->weights = pixel_weights;
-
- for (offset = 0; offset < SUBSAMPLE; offset++)
- {
- double x = (double)offset / SUBSAMPLE;
- double a = x + 1 / scale;
-
- for (i = 0; i < n; i++)
- {
- if (i < x)
- {
- if (i + 1 > x)
- *(pixel_weights++) = (MIN (i + 1, a) - x) * scale;
- else
- *(pixel_weights++) = 0;
- }
- else
- {
- if (a > i)
- *(pixel_weights++) = (MIN (i + 1, a) - i) * scale;
- else
- *(pixel_weights++) = 0;
- }
- }
- }
-}
-
-/* Compute weights for a filter that, for minification
- * is the same as 'tiles', and for magnification, is bilinear
- * reconstruction followed by a sampling with a delta function.
- */
-static void
-bilinear_magnify_make_weights (PixopsFilterDimension *dim,
- double scale)
-{
- double *pixel_weights;
- int n;
- int offset;
- int i;
-
- if (scale > 1.0) /* Linear */
- {
- n = 2;
- dim->offset = 0.5 * (1 / scale - 1);
- }
- else /* Tile */
- {
- n = ceil (1.0 + 1.0 / scale);
- dim->offset = 0.0;
- }
-
- dim->n = n;
- dim->weights = g_new (double, SUBSAMPLE * n);
-
- pixel_weights = dim->weights;
-
- for (offset=0; offset < SUBSAMPLE; offset++)
- {
- double x = (double)offset / SUBSAMPLE;
-
- if (scale > 1.0) /* Linear */
- {
- for (i = 0; i < n; i++)
- *(pixel_weights++) = (((i == 0) ? (1 - x) : x) / scale) * scale;
- }
- else /* Tile */
- {
- double a = x + 1 / scale;
-
- /* x
- * ---------|--.-|----|--.-|------- SRC
- * ------------|---------|--------- DEST
- */
- for (i = 0; i < n; i++)
- {
- if (i < x)
- {
- if (i + 1 > x)
- *(pixel_weights++) = (MIN (i + 1, a) - x) * scale;
- else
- *(pixel_weights++) = 0;
- }
- else
- {
- if (a > i)
- *(pixel_weights++) = (MIN (i + 1, a) - i) * scale;
- else
- *(pixel_weights++) = 0;
- }
- }
- }
- }
-}
-
-/* Computes the integral from b0 to b1 of
- *
- * f(x) = x; 0 <= x < 1
- * f(x) = 0; otherwise
- *
- * We combine two of these to compute the convolution of
- * a box filter with a triangular spike.
- */
-static double
-linear_box_half (double b0, double b1)
-{
- double a0, a1;
- double x0, x1;
-
- a0 = 0.;
- a1 = 1.;
-
- if (a0 < b0)
- {
- if (a1 > b0)
- {
- x0 = b0;
- x1 = MIN (a1, b1);
- }
- else
- return 0;
- }
- else
- {
- if (b1 > a0)
- {
- x0 = a0;
- x1 = MIN (a1, b1);
- }
- else
- return 0;
- }
-
- return 0.5 * (x1*x1 - x0*x0);
-}
-
-/* Compute weights for reconstructing with bilinear
- * interpolation, then sampling with a box filter
- */
-static void
-bilinear_box_make_weights (PixopsFilterDimension *dim,
- double scale)
-{
- int n = ceil (1/scale + 3.0);
- double *pixel_weights = g_new (double, SUBSAMPLE * n);
- double w;
- int offset, i;
-
- dim->offset = -1.0;
- dim->n = n;
- dim->weights = pixel_weights;
-
- for (offset = 0; offset < SUBSAMPLE; offset++)
- {
- double x = (double)offset / SUBSAMPLE;
- double a = x + 1 / scale;
-
- for (i = 0; i < n; i++)
- {
- w = linear_box_half (0.5 + i - a, 0.5 + i - x);
- w += linear_box_half (1.5 + x - i, 1.5 + a - i);
-
- *(pixel_weights++) = w * scale;
- }
- }
-}
-
-static void
-make_weights (PixopsFilter *filter,
- PixopsInterpType interp_type,
- double scale_x,
- double scale_y)
-{
- switch (interp_type)
- {
- case PIXOPS_INTERP_NEAREST:
- g_assert_not_reached ();
- break;
-
- case PIXOPS_INTERP_TILES:
- tile_make_weights (&filter->x, scale_x);
- tile_make_weights (&filter->y, scale_y);
- break;
-
- case PIXOPS_INTERP_BILINEAR:
- bilinear_magnify_make_weights (&filter->x, scale_x);
- bilinear_magnify_make_weights (&filter->y, scale_y);
- break;
-
- case PIXOPS_INTERP_HYPER:
- bilinear_box_make_weights (&filter->x, scale_x);
- bilinear_box_make_weights (&filter->y, scale_y);
- break;
- }
-}
-
-static void
-_pixops_composite_color_real (guchar *dest_buf,
- int render_x0,
- int render_y0,
- int render_x1,
- int render_y1,
- int dest_rowstride,
- int dest_channels,
- gboolean dest_has_alpha,
- const guchar *src_buf,
- int src_width,
- int src_height,
- int src_rowstride,
- int src_channels,
- gboolean src_has_alpha,
- double scale_x,
- double scale_y,
- PixopsInterpType interp_type,
- int overall_alpha,
- int check_x,
- int check_y,
- int check_size,
- guint32 color1,
- guint32 color2)
-{
- PixopsFilter filter;
- PixopsLineFunc line_func;
-
-#ifdef USE_MMX
- gboolean found_mmx = _pixops_have_mmx ();
-#endif
-
- g_return_if_fail (!(dest_channels == 3 && dest_has_alpha));
- g_return_if_fail (!(src_channels == 3 && src_has_alpha));
-
- if (scale_x == 0 || scale_y == 0)
- return;
-
- if (interp_type == PIXOPS_INTERP_NEAREST)
- {
- pixops_composite_color_nearest (dest_buf, render_x0, render_y0,
- render_x1, render_y1, dest_rowstride,
- dest_channels, dest_has_alpha, src_buf,
- src_width, src_height, src_rowstride,
- src_channels, src_has_alpha, scale_x,
- scale_y, overall_alpha, check_x, check_y,
- check_size, color1, color2);
- return;
- }
-
- filter.overall_alpha = overall_alpha / 255.;
- make_weights (&filter, interp_type, scale_x, scale_y);
-
-#ifdef USE_MMX
- if (filter.x.n == 2 && filter.y.n == 2 &&
- dest_channels == 4 && src_channels == 4 &&
- src_has_alpha && !dest_has_alpha && found_mmx)
- line_func = composite_line_color_22_4a4_mmx_stub;
- else
-#endif
- line_func = composite_line_color;
-
- pixops_process (dest_buf, render_x0, render_y0, render_x1, render_y1,
- dest_rowstride, dest_channels, dest_has_alpha,
- src_buf, src_width, src_height, src_rowstride, src_channels,
- src_has_alpha, scale_x, scale_y, check_x, check_y, check_size, color1, color2,
- &filter, line_func, composite_pixel_color);
-
- g_free (filter.x.weights);
- g_free (filter.y.weights);
-}
-
-void
-_pixops_composite_color (guchar *dest_buf,
- int dest_width,
- int dest_height,
- int dest_rowstride,
- int dest_channels,
- gboolean dest_has_alpha,
- const guchar *src_buf,
- int src_width,
- int src_height,
- int src_rowstride,
- int src_channels,
- gboolean src_has_alpha,
- int dest_x,
- int dest_y,
- int dest_region_width,
- int dest_region_height,
- double offset_x,
- double offset_y,
- double scale_x,
- double scale_y,
- PixopsInterpType interp_type,
- int overall_alpha,
- int check_x,
- int check_y,
- int check_size,
- guint32 color1,
- guint32 color2)
-{
- guchar *new_dest_buf;
- int render_x0;
- int render_y0;
- int render_x1;
- int render_y1;
-
- if (!src_has_alpha && overall_alpha == 255)
- {
- _pixops_scale (dest_buf, dest_width, dest_height, dest_rowstride,
- dest_channels, dest_has_alpha, src_buf, src_width,
- src_height, src_rowstride, src_channels, src_has_alpha,
- dest_x, dest_y, dest_region_width, dest_region_height,
- offset_x, offset_y, scale_x, scale_y, interp_type);
- return;
- }
-
- new_dest_buf = dest_buf + dest_y * dest_rowstride + dest_x *
- dest_channels;
- render_x0 = dest_x - offset_x;
- render_y0 = dest_y - offset_y;
- render_x1 = dest_x + dest_region_width - offset_x;
- render_y1 = dest_y + dest_region_height - offset_y;
-
- _pixops_composite_color_real (new_dest_buf, render_x0, render_y0, render_x1,
- render_y1, dest_rowstride, dest_channels,
- dest_has_alpha, src_buf, src_width,
- src_height, src_rowstride, src_channels,
- src_has_alpha, scale_x, scale_y,
- (PixopsInterpType)interp_type, overall_alpha,
- check_x, check_y, check_size, color1, color2);
-}
-
-/**
- * _pixops_composite_real:
- * @dest_buf: pointer to location to store result
- * @render_x0: x0 of region of scaled source to store into @dest_buf
- * @render_y0: y0 of region of scaled source to store into @dest_buf
- * @render_x1: x1 of region of scaled source to store into @dest_buf
- * @render_y1: y1 of region of scaled source to store into @dest_buf
- * @dest_rowstride: rowstride of @dest_buf
- * @dest_channels: number of channels in @dest_buf
- * @dest_has_alpha: whether @dest_buf has alpha
- * @src_buf: pointer to source pixels
- * @src_width: width of source (used for clipping)
- * @src_height: height of source (used for clipping)
- * @src_rowstride: rowstride of source
- * @src_channels: number of channels in @src_buf
- * @src_has_alpha: whether @src_buf has alpha
- * @scale_x: amount to scale source by in X direction
- * @scale_y: amount to scale source by in Y direction
- * @interp_type: type of enumeration
- * @overall_alpha: overall alpha factor to multiply source by
- *
- * Scale source buffer by scale_x / scale_y, then composite a given rectangle
- * of the result into the destination buffer.
- **/
-static void
-_pixops_composite_real (guchar *dest_buf,
- int render_x0,
- int render_y0,
- int render_x1,
- int render_y1,
- int dest_rowstride,
- int dest_channels,
- gboolean dest_has_alpha,
- const guchar *src_buf,
- int src_width,
- int src_height,
- int src_rowstride,
- int src_channels,
- gboolean src_has_alpha,
- double scale_x,
- double scale_y,
- PixopsInterpType interp_type,
- int overall_alpha)
-{
- PixopsFilter filter;
- PixopsLineFunc line_func;
-
-#ifdef USE_MMX
- gboolean found_mmx = _pixops_have_mmx ();
-#endif
-
- g_return_if_fail (!(dest_channels == 3 && dest_has_alpha));
- g_return_if_fail (!(src_channels == 3 && src_has_alpha));
-
- if (scale_x == 0 || scale_y == 0)
- return;
-
- if (interp_type == PIXOPS_INTERP_NEAREST)
- {
- pixops_composite_nearest (dest_buf, render_x0, render_y0, render_x1,
- render_y1, dest_rowstride, dest_channels,
- dest_has_alpha, src_buf, src_width, src_height,
- src_rowstride, src_channels, src_has_alpha,
- scale_x, scale_y, overall_alpha);
- return;
- }
-
- filter.overall_alpha = overall_alpha / 255.;
- make_weights (&filter, interp_type, scale_x, scale_y);
-
- if (filter.x.n == 2 && filter.y.n == 2 && dest_channels == 4 &&
- src_channels == 4 && src_has_alpha && !dest_has_alpha)
- {
-#ifdef USE_MMX
- if (found_mmx)
- line_func = composite_line_22_4a4_mmx_stub;
- else
-#endif
- line_func = composite_line_22_4a4;
- }
- else
- line_func = composite_line;
-
- pixops_process (dest_buf, render_x0, render_y0, render_x1, render_y1,
- dest_rowstride, dest_channels, dest_has_alpha,
- src_buf, src_width, src_height, src_rowstride, src_channels,
- src_has_alpha, scale_x, scale_y, 0, 0, 0, 0, 0,
- &filter, line_func, composite_pixel);
-
- g_free (filter.x.weights);
- g_free (filter.y.weights);
-}
-
-void
-_pixops_composite (guchar *dest_buf,
- int dest_width,
- int dest_height,
- int dest_rowstride,
- int dest_channels,
- int dest_has_alpha,
- const guchar *src_buf,
- int src_width,
- int src_height,
- int src_rowstride,
- int src_channels,
- int src_has_alpha,
- int dest_x,
- int dest_y,
- int dest_region_width,
- int dest_region_height,
- double offset_x,
- double offset_y,
- double scale_x,
- double scale_y,
- PixopsInterpType interp_type,
- int overall_alpha)
-{
- guchar *new_dest_buf;
- int render_x0;
- int render_y0;
- int render_x1;
- int render_y1;
-
- if (!src_has_alpha && overall_alpha == 255)
- {
- _pixops_scale (dest_buf, dest_width, dest_height, dest_rowstride,
- dest_channels, dest_has_alpha, src_buf, src_width,
- src_height, src_rowstride, src_channels, src_has_alpha,
- dest_x, dest_y, dest_region_width, dest_region_height,
- offset_x, offset_y, scale_x, scale_y, interp_type);
- return;
- }
-
-#ifdef USE_MEDIALIB
- pixops_medialib_composite (dest_buf, dest_width, dest_height, dest_rowstride,
- dest_channels, dest_has_alpha, src_buf,
- src_width, src_height, src_rowstride,
- src_channels, src_has_alpha, dest_x, dest_y,
- dest_region_width, dest_region_height, offset_x,
- offset_y, scale_x, scale_y,
- (PixopsInterpType)interp_type, overall_alpha);
- return;
-#endif
-
- new_dest_buf = dest_buf + dest_y * dest_rowstride + dest_x * dest_channels;
- render_x0 = dest_x - offset_x;
- render_y0 = dest_y - offset_y;
- render_x1 = dest_x + dest_region_width - offset_x;
- render_y1 = dest_y + dest_region_height - offset_y;
-
- _pixops_composite_real (new_dest_buf, render_x0, render_y0, render_x1,
- render_y1, dest_rowstride, dest_channels,
- dest_has_alpha, src_buf, src_width, src_height,
- src_rowstride, src_channels, src_has_alpha, scale_x,
- scale_y, (PixopsInterpType)interp_type,
- overall_alpha);
-}
-
-#ifdef USE_MEDIALIB
-static void
-medialib_get_interpolation (mlInterp * ml_interp,
- PixopsInterpType interp_type,
- double scale_x,
- double scale_y,
- double overall_alpha)
-{
- mlib_s32 leftPadding, topPadding;
- ml_interp->interp_table = NULL;
-
- /*
- * medialib 2.1 and later supports scaling with user-defined interpolation
- * tables, so this logic is used.
- *
- * bilinear_magnify_make_weights builds an interpolation table of size 2x2 if
- * the scale factor >= 1.0 and "ceil (1.0 + 1.0/scale)" otherwise. These map
- * most closely to MLIB_BILINEAR, which uses an interpolation table of size
- * 2x2.
- *
- * tile_make_weights builds an interpolation table of size 2x2 if the scale
- * factor >= 1.0 and "ceil (1.0 + 1.0/scale)" otherwise. These map most
- * closely to MLIB_BILINEAR, which uses an interpolation table of size 2x2.
- *
- * bilinear_box_make_weights builds an interpolation table of size 4x4 if the
- * scale factor >= 1.0 and "ceil (1.0 + 1.0/scale)" otherwise. These map most
- * closely to MLIB_BICUBIC, which uses an interpolation table of size 4x4.
- *
- * PIXOPS_INTERP_NEAREST calls pixops_scale_nearest which does not use an
- * interpolation table. This maps to MLIB_NEAREST.
- */
- switch (interp_type)
- {
- case PIXOPS_INTERP_BILINEAR:
- bilinear_magnify_make_weights (&(ml_interp->po_filter.x), scale_x);
- bilinear_magnify_make_weights (&(ml_interp->po_filter.y), scale_y);
- leftPadding = 0;
- topPadding = 0;
-
- if (scale_x <= 1.0)
- ml_interp->tx = 0.5 * (1 - scale_x);
- else
- ml_interp->tx = 0.0;
-
- if (scale_y <= 1.0)
- ml_interp->ty = 0.5 * (1 - scale_y);
- else
- ml_interp->ty = 0.0;
-
- break;
-
- case PIXOPS_INTERP_TILES:
- tile_make_weights (&(ml_interp->po_filter.x), scale_x);
- tile_make_weights (&(ml_interp->po_filter.y), scale_y);
- leftPadding = 0;
- topPadding = 0;
- ml_interp->tx = 0.5 * (1 - scale_x);
- ml_interp->ty = 0.5 * (1 - scale_y);
- break;
-
- case PIXOPS_INTERP_HYPER:
- bilinear_box_make_weights (&(ml_interp->po_filter.x), scale_x);
- bilinear_box_make_weights (&(ml_interp->po_filter.y), scale_y);
- leftPadding = 1;
- topPadding = 1;
- ml_interp->tx = 0.5 * (1 - scale_x);
- ml_interp->ty = 0.5 * (1 - scale_y);
- break;
-
- case PIXOPS_INTERP_NEAREST:
- default:
- /*
- * Note that this function should not be called in the
- * PIXOPS_INTERP_NEAREST case since it does not use an interpolation
- * table.
- */
- g_assert_not_reached ();
- break;
- }
-
- /*
- * If overall_alpha is not 1.0, then multiply the vectors built by the
- * sqrt (overall_alpha). This will cause overall_alpha to get evenly
- * blended across both axis.
- *
- * Note there is no need to multiply the vectors built by the various
- * make-weight functions by sqrt (overall_alpha) since the make-weight
- * functions are called with overall_alpha hardcoded to 1.0.
- */
- if (overall_alpha != 1.0)
- {
- double sqrt_alpha = sqrt (overall_alpha);
- int i;
-
- for (i=0; i < SUBSAMPLE * ml_interp->po_filter.x.n; i++)
- ml_interp->po_filter.x.weights[i] *= sqrt_alpha;
- for (i=0; i < SUBSAMPLE * ml_interp->po_filter.y.n; i++)
- ml_interp->po_filter.y.weights[i] *= sqrt_alpha;
- }
-
- ml_interp->interp_table = (void *) mlib_ImageInterpTableCreate (MLIB_DOUBLE,
- ml_interp->po_filter.x.n, ml_interp->po_filter.y.n, leftPadding,
- topPadding, SUBSAMPLE_BITS, SUBSAMPLE_BITS, 8,
- ml_interp->po_filter.x.weights, ml_interp->po_filter.y.weights);
-
- g_free (ml_interp->po_filter.x.weights);
- g_free (ml_interp->po_filter.y.weights);
-}
-
-static void
-pixops_medialib_composite (guchar *dest_buf,
- int dest_width,
- int dest_height,
- int dest_rowstride,
- int dest_channels,
- int dest_has_alpha,
- const guchar *src_buf,
- int src_width,
- int src_height,
- int src_rowstride,
- int src_channels,
- int src_has_alpha,
- int dest_x,
- int dest_y,
- int dest_region_width,
- int dest_region_height,
- double offset_x,
- double offset_y,
- double scale_x,
- double scale_y,
- PixopsInterpType interp_type,
- int overall_alpha)
-{
- mlib_blend blend;
- g_return_if_fail (!(dest_channels == 3 && dest_has_alpha));
- g_return_if_fail (!(src_channels == 3 && src_has_alpha));
-
- if (scale_x == 0 || scale_y == 0)
- return;
-
- if (!medialib_initialized)
- _pixops_use_medialib ();
-
- if (!use_medialib)
- {
- /* Use non-mediaLib version */
- _pixops_composite_real (dest_buf + dest_y * dest_rowstride + dest_x *
- dest_channels, dest_x - offset_x, dest_y -
- offset_y, dest_x + dest_region_width - offset_x,
- dest_y + dest_region_height - offset_y,
- dest_rowstride, dest_channels, dest_has_alpha,
- src_buf, src_width, src_height, src_rowstride,
- src_channels, src_has_alpha, scale_x, scale_y,
- interp_type, overall_alpha);
- }
- else
- {
- mlInterp ml_interp;
- mlib_image img_src, img_dest;
- double ml_offset_x, ml_offset_y;
-
- if (!src_has_alpha && overall_alpha == 255 &&
- dest_channels <= src_channels)
- {
- pixops_medialib_scale (dest_buf, dest_region_width,
- dest_region_height, dest_rowstride,
- dest_channels, dest_has_alpha, src_buf,
- src_width, src_height, src_rowstride,
- src_channels, src_has_alpha, dest_x, dest_y,
- dest_region_width, dest_region_height,
- offset_x, offset_y, scale_x, scale_y,
- interp_type);
- return;
- }
-
- mlib_ImageSetStruct (&img_src, MLIB_BYTE, src_channels,
- src_width, src_height, src_rowstride, src_buf);
-
- if (dest_x == 0 && dest_y == 0 &&
- dest_width == dest_region_width &&
- dest_height == dest_region_height)
- {
- mlib_ImageSetStruct (&img_dest, MLIB_BYTE, dest_channels,
- dest_width, dest_height, dest_rowstride,
- dest_buf);
- }
- else
- {
- mlib_u8 *data = dest_buf + (dest_y * dest_rowstride) +
- (dest_x * dest_channels);
-
- mlib_ImageSetStruct (&img_dest, MLIB_BYTE, dest_channels,
- dest_region_width, dest_region_height,
- dest_rowstride, data);
- }
-
- ml_offset_x = floor (offset_x) - dest_x;
- ml_offset_y = floor (offset_y) - dest_y;
-
- if (interp_type == PIXOPS_INTERP_NEAREST)
- {
- blend = src_has_alpha ? MLIB_BLEND_GTK_SRC_OVER2 : MLIB_BLEND_GTK_SRC;
-
- mlib_ImageZoomTranslateBlend (&img_dest,
- &img_src,
- scale_x,
- scale_y,
- ml_offset_x,
- ml_offset_y,
- MLIB_NEAREST,
- MLIB_EDGE_SRC_EXTEND_INDEF,
- blend,
- overall_alpha,
- 1);
- }
- else
- {
- blend = src_has_alpha ? MLIB_BLEND_GTK_SRC_OVER : MLIB_BLEND_GTK_SRC;
-
- if (interp_type == PIXOPS_INTERP_BILINEAR &&
- scale_x > 1.0 && scale_y > 1.0)
- {
- mlib_ImageZoomTranslateBlend (&img_dest,
- &img_src,
- scale_x,
- scale_y,
- ml_offset_x,
- ml_offset_y,
- MLIB_BILINEAR,
- MLIB_EDGE_SRC_EXTEND_INDEF,
- blend,
- overall_alpha,
- 1);
- }
- else
- {
- medialib_get_interpolation (&ml_interp, interp_type, scale_x,
- scale_y, overall_alpha/255.0);
-
- if (ml_interp.interp_table != NULL)
- {
- mlib_ImageZoomTranslateTableBlend (&img_dest,
- &img_src,
- scale_x,
- scale_y,
- ml_offset_x + ml_interp.tx,
- ml_offset_y + ml_interp.ty,
- ml_interp.interp_table,
- MLIB_EDGE_SRC_EXTEND_INDEF,
- blend,
- 1);
- mlib_ImageInterpTableDelete (ml_interp.interp_table);
- }
- else
- {
- /* Should not happen - Use non-mediaLib version */
- _pixops_composite_real (dest_buf + dest_y * dest_rowstride +
- dest_x * dest_channels,
- dest_x - offset_x, dest_y - offset_y,
- dest_x + dest_region_width - offset_x,
- dest_y + dest_region_height - offset_y,
- dest_rowstride, dest_channels,
- dest_has_alpha, src_buf, src_width,
- src_height, src_rowstride,
- src_channels, src_has_alpha, scale_x,
- scale_y, interp_type, overall_alpha);
- }
- }
- }
- }
-}
-#endif
-
-static void
-_pixops_scale_real (guchar *dest_buf,
- int render_x0,
- int render_y0,
- int render_x1,
- int render_y1,
- int dest_rowstride,
- int dest_channels,
- gboolean dest_has_alpha,
- const guchar *src_buf,
- int src_width,
- int src_height,
- int src_rowstride,
- int src_channels,
- gboolean src_has_alpha,
- double scale_x,
- double scale_y,
- PixopsInterpType interp_type)
-{
- PixopsFilter filter;
- PixopsLineFunc line_func;
-
-#ifdef USE_MMX
- gboolean found_mmx = _pixops_have_mmx ();
-#endif
-
- g_return_if_fail (!(dest_channels == 3 && dest_has_alpha));
- g_return_if_fail (!(src_channels == 3 && src_has_alpha));
- g_return_if_fail (!(src_has_alpha && !dest_has_alpha));
-
- if (scale_x == 0 || scale_y == 0)
- return;
-
- if (interp_type == PIXOPS_INTERP_NEAREST)
- {
- pixops_scale_nearest (dest_buf, render_x0, render_y0, render_x1,
- render_y1, dest_rowstride, dest_channels,
- dest_has_alpha, src_buf, src_width, src_height,
- src_rowstride, src_channels, src_has_alpha,
- scale_x, scale_y);
- return;
- }
-
- filter.overall_alpha = 1.0;
- make_weights (&filter, interp_type, scale_x, scale_y);
-
- if (filter.x.n == 2 && filter.y.n == 2 && dest_channels == 3 && src_channels == 3)
- {
-#ifdef USE_MMX
- if (found_mmx)
- line_func = scale_line_22_33_mmx_stub;
- else
-#endif
- line_func = scale_line_22_33;
- }
- else
- line_func = scale_line;
-
- pixops_process (dest_buf, render_x0, render_y0, render_x1, render_y1,
- dest_rowstride, dest_channels, dest_has_alpha,
- src_buf, src_width, src_height, src_rowstride, src_channels,
- src_has_alpha, scale_x, scale_y, 0, 0, 0, 0, 0,
- &filter, line_func, scale_pixel);
-
- g_free (filter.x.weights);
- g_free (filter.y.weights);
-}
-
-void
-_pixops_scale (guchar *dest_buf,
- int dest_width,
- int dest_height,
- int dest_rowstride,
- int dest_channels,
- int dest_has_alpha,
- const guchar *src_buf,
- int src_width,
- int src_height,
- int src_rowstride,
- int src_channels,
- int src_has_alpha,
- int dest_x,
- int dest_y,
- int dest_region_width,
- int dest_region_height,
- double offset_x,
- double offset_y,
- double scale_x,
- double scale_y,
- PixopsInterpType interp_type)
-{
- guchar *new_dest_buf;
- int render_x0;
- int render_y0;
- int render_x1;
- int render_y1;
-
-#ifdef USE_MEDIALIB
- pixops_medialib_scale (dest_buf, dest_width, dest_height, dest_rowstride,
- dest_channels, dest_has_alpha, src_buf, src_width,
- src_height, src_rowstride, src_channels,
- src_has_alpha, dest_x, dest_y, dest_region_width,
- dest_region_height, offset_x, offset_y, scale_x,
- scale_y, (PixopsInterpType)interp_type);
- return;
-#endif
-
- new_dest_buf = dest_buf + dest_y * dest_rowstride + dest_x * dest_channels;
- render_x0 = dest_x - offset_x;
- render_y0 = dest_y - offset_y;
- render_x1 = dest_x + dest_region_width - offset_x;
- render_y1 = dest_y + dest_region_height - offset_y;
-
- _pixops_scale_real (new_dest_buf, render_x0, render_y0, render_x1,
- render_y1, dest_rowstride, dest_channels,
- dest_has_alpha, src_buf, src_width, src_height,
- src_rowstride, src_channels, src_has_alpha,
- scale_x, scale_y, (PixopsInterpType)interp_type);
-}
-
-#ifdef USE_MEDIALIB
-static void
-pixops_medialib_scale (guchar *dest_buf,
- int dest_width,
- int dest_height,
- int dest_rowstride,
- int dest_channels,
- int dest_has_alpha,
- const guchar *src_buf,
- int src_width,
- int src_height,
- int src_rowstride,
- int src_channels,
- int src_has_alpha,
- int dest_x,
- int dest_y,
- int dest_region_width,
- int dest_region_height,
- double offset_x,
- double offset_y,
- double scale_x,
- double scale_y,
- PixopsInterpType interp_type)
-{
- if (scale_x == 0 || scale_y == 0)
- return;
-
- if (!medialib_initialized)
- _pixops_use_medialib ();
-
- /*
- * We no longer support mediaLib 2.1 because it has a core dumping problem
- * in the mlib_ImageZoomTranslateTable function that has been corrected in
- * 2.2. Although the mediaLib_zoom function could be used, it does not
- * work properly if the source and destination images have different
- * values for "has_alpha" or "num_channels". The complicated if-logic
- * required to support both versions is not worth supporting
- * mediaLib 2.1 moving forward.
- */
- if (!use_medialib)
- {
- _pixops_scale_real (dest_buf + dest_y * dest_rowstride + dest_x *
- dest_channels, dest_x - offset_x, dest_y - offset_y,
- dest_x + dest_region_width - offset_x,
- dest_y + dest_region_height - offset_y,
- dest_rowstride, dest_channels, dest_has_alpha,
- src_buf, src_width, src_height, src_rowstride,
- src_channels, src_has_alpha, scale_x, scale_y,
- interp_type);
- }
- else
- {
- mlInterp ml_interp;
- mlib_image img_orig_src, img_src, img_dest;
- double ml_offset_x, ml_offset_y;
- guchar *tmp_buf = NULL;
-
- mlib_ImageSetStruct (&img_orig_src, MLIB_BYTE, src_channels, src_width,
- src_height, src_rowstride, src_buf);
-
- if (dest_x == 0 && dest_y == 0 &&
- dest_width == dest_region_width &&
- dest_height == dest_region_height)
- {
- mlib_ImageSetStruct (&img_dest, MLIB_BYTE, dest_channels,
- dest_width, dest_height, dest_rowstride,
- dest_buf);
- }
- else
- {
- mlib_u8 *data = dest_buf + (dest_y * dest_rowstride) +
- (dest_x * dest_channels);
-
- mlib_ImageSetStruct (&img_dest, MLIB_BYTE, dest_channels,
- dest_region_width, dest_region_height,
- dest_rowstride, data);
- }
-
- ml_offset_x = floor (offset_x) - dest_x;
- ml_offset_y = floor (offset_y) - dest_y;
-
- /*
- * Note that zoomTranslate and zoomTranslateTable are faster
- * than zoomTranslateBlend and zoomTranslateTableBlend. However
- * the faster functions only work in the following case:
- *
- * if (src_channels == dest_channels &&
- * (!src_alpha && interp_table != PIXOPS_INTERP_NEAREST))
- *
- * We use the faster versions if we can.
- *
- * Note when the interp_type is BILINEAR and the interpolation
- * table will be size 2x2 (when both x/y scale factors > 1.0),
- * then we do not bother building the interpolation table. In
- * this case we can just use MLIB_BILINEAR, which is faster than
- * using a specified interpolation table.
- */
- img_src = img_orig_src;
-
- if (!src_has_alpha)
- {
- if (src_channels > dest_channels)
- {
- int channels = 3;
- int rowstride = (channels * src_width + 3) & ~3;
-
- tmp_buf = g_malloc (src_rowstride * src_height);
-
- if (src_buf != NULL)
- {
- src_channels = channels;
- src_rowstride = rowstride;
-
- mlib_ImageSetStruct (&img_src, MLIB_BYTE, src_channels,
- src_width, src_height, src_rowstride,
- tmp_buf);
- mlib_ImageChannelExtract (&img_src, &img_orig_src, 0xE);
- }
- }
- }
-
- if (interp_type == PIXOPS_INTERP_NEAREST)
- {
- if (src_channels == dest_channels)
- {
- mlib_ImageZoomTranslate (&img_dest,
- &img_src,
- scale_x,
- scale_y,
- ml_offset_x,
- ml_offset_y,
- MLIB_NEAREST,
- MLIB_EDGE_SRC_EXTEND_INDEF);
- }
- else
- {
- mlib_ImageZoomTranslateBlend (&img_dest,
- &img_src,
- scale_x,
- scale_y,
- ml_offset_x,
- ml_offset_y,
- MLIB_NEAREST,
- MLIB_EDGE_SRC_EXTEND_INDEF,
- MLIB_BLEND_GTK_SRC,
- 1.0,
- 1);
- }
- }
- else if (src_channels == dest_channels && !src_has_alpha)
- {
- if (interp_type == PIXOPS_INTERP_BILINEAR &&
- scale_x > 1.0 && scale_y > 1.0)
- {
- mlib_ImageZoomTranslate (&img_dest,
- &img_src,
- scale_x,
- scale_y,
- ml_offset_x,
- ml_offset_y,
- MLIB_BILINEAR,
- MLIB_EDGE_SRC_EXTEND_INDEF);
- }
- else
- {
- medialib_get_interpolation (&ml_interp, interp_type,
- scale_x, scale_y, 1.0);
-
- if (ml_interp.interp_table != NULL)
- {
- mlib_ImageZoomTranslateTable (&img_dest,
- &img_src,
- scale_x,
- scale_y,
- ml_offset_x + ml_interp.tx,
- ml_offset_y + ml_interp.ty,
- ml_interp.interp_table,
- MLIB_EDGE_SRC_EXTEND_INDEF);
-
- mlib_ImageInterpTableDelete (ml_interp.interp_table);
- }
- else
- {
- /* Should not happen. */
- mlib_filter ml_filter;
-
- switch (interp_type)
- {
- case PIXOPS_INTERP_BILINEAR:
- ml_filter = MLIB_BILINEAR;
- break;
-
- case PIXOPS_INTERP_TILES:
- ml_filter = MLIB_BILINEAR;
- break;
-
- case PIXOPS_INTERP_HYPER:
- ml_filter = MLIB_BICUBIC;
- break;
- }
-
- mlib_ImageZoomTranslate (&img_dest,
- &img_src,
- scale_x,
- scale_y,
- ml_offset_x,
- ml_offset_y,
- ml_filter,
- MLIB_EDGE_SRC_EXTEND_INDEF);
- }
- }
- }
-
- /* Deal with case where src_channels != dest_channels || src_has_alpha */
- else if (interp_type == PIXOPS_INTERP_BILINEAR &&
- scale_x > 1.0 && scale_y > 1.0)
- {
- mlib_ImageZoomTranslateBlend (&img_dest,
- &img_src,
- scale_x,
- scale_y,
- ml_offset_x,
- ml_offset_y,
- MLIB_BILINEAR,
- MLIB_EDGE_SRC_EXTEND_INDEF,
- MLIB_BLEND_GTK_SRC,
- 1.0,
- 1);
- }
- else
- {
- medialib_get_interpolation (&ml_interp, interp_type,
- scale_x, scale_y, 1.0);
-
- if (ml_interp.interp_table != NULL)
- {
- mlib_ImageZoomTranslateTableBlend (&img_dest,
- &img_src,
- scale_x,
- scale_y,
- ml_offset_x + ml_interp.tx,
- ml_offset_y + ml_interp.ty,
- ml_interp.interp_table,
- MLIB_EDGE_SRC_EXTEND_INDEF,
- MLIB_BLEND_GTK_SRC,
- 1);
- mlib_ImageInterpTableDelete (ml_interp.interp_table);
- }
- else
- {
- mlib_filter ml_filter;
-
- switch (interp_type)
- {
- case PIXOPS_INTERP_BILINEAR:
- ml_filter = MLIB_BILINEAR;
- break;
-
- case PIXOPS_INTERP_TILES:
- ml_filter = MLIB_BILINEAR;
- break;
-
- case PIXOPS_INTERP_HYPER:
- ml_filter = MLIB_BICUBIC;
- break;
- }
-
- mlib_ImageZoomTranslate (&img_dest,
- &img_src,
- scale_x,
- scale_y,
- ml_offset_x,
- ml_offset_y,
- ml_filter,
- MLIB_EDGE_SRC_EXTEND_INDEF);
- }
- }
-
- if (tmp_buf != NULL)
- g_free (tmp_buf);
- }
-}
-#endif
diff --git a/gdk-pixbuf/pixops/pixops.h b/gdk-pixbuf/pixops/pixops.h
deleted file mode 100644
index 56d3ff0b8b..0000000000
--- a/gdk-pixbuf/pixops/pixops.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2000 Red Hat, Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 PIXOPS_H
-#define PIXOPS_H
-
-#include <glib.h>
-
-/* Interpolation modes; must match GdkInterpType */
-typedef enum {
- PIXOPS_INTERP_NEAREST,
- PIXOPS_INTERP_TILES,
- PIXOPS_INTERP_BILINEAR,
- PIXOPS_INTERP_HYPER
-} PixopsInterpType;
-
-/* Scale src_buf from src_width / src_height by factors scale_x, scale_y
- * and composite the portion corresponding to
- * render_x, render_y, render_width, render_height in the new
- * coordinate system into dest_buf starting at 0, 0
- */
-void _pixops_composite (guchar *dest_buf,
- int dest_width,
- int dest_height,
- int dest_rowstride,
- int dest_channels,
- int dest_has_alpha,
- const guchar *src_buf,
- int src_width,
- int src_height,
- int src_rowstride,
- int src_channels,
- int src_has_alpha,
- int dest_x,
- int dest_y,
- int dest_region_width,
- int dest_region_height,
- double offset_x,
- double offset_y,
- double scale_x,
- double scale_y,
- PixopsInterpType interp_type,
- int overall_alpha);
-
-/* Scale src_buf from src_width / src_height by factors scale_x, scale_y
- * and composite the portion corresponding to
- * render_x, render_y, render_width, render_height in the new
- * coordinate system against a checkboard with checks of size check_size
- * of the colors color1 and color2 into dest_buf starting at 0, 0
- */
-void _pixops_composite_color (guchar *dest_buf,
- int dest_width,
- int dest_height,
- int dest_rowstride,
- int dest_channels,
- int dest_has_alpha,
- const guchar *src_buf,
- int src_width,
- int src_height,
- int src_rowstride,
- int src_channels,
- int src_has_alpha,
- int dest_x,
- int dest_y,
- int dest_region_width,
- int dest_region_height,
- double offset_x,
- double offset_y,
- double scale_x,
- double scale_y,
- PixopsInterpType interp_type,
- int overall_alpha,
- int check_x,
- int check_y,
- int check_size,
- guint32 color1,
- guint32 color2);
-
-/* Scale src_buf from src_width / src_height by factors scale_x, scale_y
- * and composite the portion corresponding to
- * render_x, render_y, render_width, render_height in the new
- * coordinate system into dest_buf starting at 0, 0
- */
-void _pixops_scale (guchar *dest_buf,
- int dest_width,
- int dest_height,
- int dest_rowstride,
- int dest_channels,
- int dest_has_alpha,
- const guchar *src_buf,
- int src_width,
- int src_height,
- int src_rowstride,
- int src_channels,
- int src_has_alpha,
- int dest_x,
- int dest_y,
- int dest_region_width,
- int dest_region_height,
- double offset_x,
- double offset_y,
- double scale_x,
- double scale_y,
- PixopsInterpType interp_type);
-#endif
diff --git a/gdk-pixbuf/pixops/scale_line_22_33_mmx.S b/gdk-pixbuf/pixops/scale_line_22_33_mmx.S
deleted file mode 100644
index 53144aef9d..0000000000
--- a/gdk-pixbuf/pixops/scale_line_22_33_mmx.S
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright (C) 2000 Red Hat, Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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.
- */
- .file "scale_line_22_33_mmx.S"
- .version "01.01"
-gcc2_compiled.:
-.text
- .align 16
-
-#if !defined(__MINGW32__) && !defined(__CYGWIN__) && !defined(__INTERIX)
-
-/* Magic indicating no need for an executable stack */
-#if !defined __powerpc64__ && !defined __ia64__
-.section .note.GNU-stack; .previous
-#endif
-
-.globl _pixops_scale_line_22_33_mmx
- .type _pixops_scale_line_22_33_mmx,@function
-_pixops_scale_line_22_33_mmx:
-
-#else
-
-.globl __pixops_scale_line_22_33_mmx
-__pixops_scale_line_22_33_mmx:
-
-#endif
-/*
- * Arguments
- *
- * weights: 8(%ebp)
- * p: 12(%ebp) %esi
- * q1: 16(%ebp)
- * q2: 20(%ebp)
- * xstep: 24(%ebp)
- * p_end: 28(%ebp)
- * xinit: 32(%ebp)
- *
-*/
-
-/*
- * Function call entry
- */
- pushl %ebp
- movl %esp,%ebp
- subl $28,%esp
- pushl %edi
- pushl %esi
- pushl %ebx
-/* Locals:
- * int x %ebx
- * int x_scaled -24(%ebp)
- */
-
-/*
- * Setup
- */
-/* Initialize variables */
- movl 32(%ebp),%ebx
- movl 32(%ebp),%edx
- sarl $16,%edx
- movl 12(%ebp),%esi
-
- cmpl 28(%ebp),%esi
- jnb .out
-
-/* For the body of this loop, %mm01, %mm1, %mm2, %mm3 hold the 4 adjoining
- * points we are interpolating between, as:
- *
- * 000000BB00GG00RR
- */
-
-/* Load initial values into %mm1, %mm3 */
- leal (%edx,%edx,2),%edx # Multiply by 3
-
- movl 16(%ebp),%edi
- pxor %mm4, %mm4
- movzbl 2(%edi,%edx),%ecx
- shll $16,%ecx
- movzwl (%edi,%edx),%eax
- orl %eax,%ecx
- movd %ecx, %mm1
- punpcklbw %mm4, %mm1
-
- movl 20(%ebp),%edi
- movzbl 2(%edi,%edx),%ecx
- shll $16,%ecx
- movzwl (%edi,%edx),%eax
- orl %eax,%ecx
- movd %ecx, %mm3
- punpcklbw %mm4, %mm3
-
- addl $65536,%ebx
- movl %ebx,%edx
- sarl $16,%edx
-
- jmp .newx
- .p2align 4,,7
-.loop:
-/* short *pixel_weights = weights + ((x >> (SCALE_SHIFT - SUBSAMPLE_BITS)) & SUBSAMPLE_MASK) * n_x * n_y
- * 16 4 0xf 2 2
- */
- movl %ebx,%eax
- andl $0xf000,%eax
- shrl $7,%eax
-
-/* At this point, %edi holds weights. Load the 4 weights into %mm4,%mm5,%mm6,%mm7, multiply and
- * accumulate.
- */
- movq (%edi,%eax),%mm4
- pmullw %mm0,%mm4
- movq 8(%edi,%eax),%mm5
- pmullw %mm1,%mm5
- movq 16(%edi,%eax),%mm6
- movq 24(%edi,%eax),%mm7
- pmullw %mm2,%mm6
- pmullw %mm3,%mm7
- paddw %mm4, %mm5
- paddw %mm6, %mm7
- paddw %mm5, %mm7
-
-/* %mm7 holds the accumulated sum. Compute (C + 0x80) / 256
- */
- pxor %mm4, %mm4
- movl $8421504, %eax # 0x00808080
- movd %eax, %mm6
- punpcklbw %mm4, %mm6
- paddw %mm6, %mm7
- psrlw $8, %mm7
-
-/* Pack into %eax and store result
- */
- packuswb %mm7, %mm7
- movd %mm7, %eax
-
- movb %al, (%esi)
- shrl $8, %eax
- movw %ax, 1(%esi)
- addl $3, %esi
-
- cmpl %esi,28(%ebp)
- je .out
-
-/* x += x_step; */
- addl 24(%ebp),%ebx
-/* x_scaled = x >> 16; */
- movl %ebx,%edx
- sarl $16,%edx
-
- cmpl %edx,-24(%ebp)
- je .loop
-
-.newx:
- movl %edx,-24(%ebp)
-/*
- * Load the two new values into %mm1, %mm3, move old values into %mm0, %mm2
- */
- movq %mm1, %mm0
- movq %mm3, %mm2
-
- leal (%edx,%edx,2),%edx # Multiply by 3
-
- movl 16(%ebp),%edi
- movzbl 2(%edi,%edx),%ecx
- shll $16,%ecx
- movzwl (%edi,%edx),%eax
- orl %eax,%ecx
- movd %ecx, %mm1
- punpcklbw %mm4, %mm1
-
- movl 20(%ebp),%edi
- movzbl 2(%edi,%edx),%ecx
- shll $16,%ecx
- movzwl (%edi,%edx),%eax
- orl %eax,%ecx
- movd %ecx, %mm3
- punpcklbw %mm4, %mm3
-
- movl 8(%ebp),%edi
-
- jmp .loop
-
-.out:
- movl %esi,%eax
- emms
- leal -40(%ebp),%esp
- popl %ebx
- popl %esi
- popl %edi
- movl %ebp,%esp
- popl %ebp
- ret
diff --git a/gdk-pixbuf/pixops/timescale.c b/gdk-pixbuf/pixops/timescale.c
deleted file mode 100644
index cac11d9c1c..0000000000
--- a/gdk-pixbuf/pixops/timescale.c
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Copyright (C) 2000 Red Hat, Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser 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 <glib.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "pixops.h"
-
-static GTimeVal start_time;
-
-static void
-start_timing (void)
-{
- g_get_current_time (&start_time);
-}
-
-static double
-stop_timing (const char *test, int iterations, int bytes)
-{
- GTimeVal stop_time;
- double msecs;
-
- g_get_current_time (&stop_time);
- if (stop_time.tv_usec < start_time.tv_usec)
- {
- stop_time.tv_usec += 1000000;
- stop_time.tv_sec -= 1;
- }
-
- msecs = (stop_time.tv_sec - start_time.tv_sec) * 1000. +
- (stop_time.tv_usec - start_time.tv_usec) / 1000.;
-
- printf("%s%d\t%.1f\t\t%.2f\t\t%.2f\n",
- test, iterations, msecs, msecs / iterations, ((double)bytes * iterations) / (1000*msecs));
-
- return ((double)bytes * iterations) / (1000*msecs);
-}
-
-static void
-init_array (double times[3][3][4])
-{
- int i, j, k;
-
- for (i=0; i<3; i++)
- for (j=0; j<3; j++)
- for (k=0; k<4; k++)
- times[i][j][k] = -1;
-}
-
-static void
-dump_array (double times[3][3][4])
-{
- int i, j;
-
- printf(" 3\t4\t4a\n");
- for (i=0; i<3; i++)
- {
- for (j=0; j<4; j++)
- {
- if (j == 0)
- switch (i)
- {
- case 0:
- printf("3 ");
- break;
- case 1:
- printf("4 ");
- break;
- case 2:
- printf("4a ");
- break;
- }
- else
- printf(" ");
-
- printf("%6.2f %6.2f %6.2f",
- times[i][0][j], times[i][1][j], times[i][2][j]);
-
- switch (j)
- {
- case PIXOPS_INTERP_NEAREST:
- printf (" NEAREST\n");
- break;
- case PIXOPS_INTERP_TILES:
- printf (" TILES\n");
- break;
- case PIXOPS_INTERP_BILINEAR:
- printf (" BILINEAR\n");
- break;
- case PIXOPS_INTERP_HYPER:
- printf (" HYPER\n");
- break;
- }
- }
- }
- printf("\n");
-}
-
-#define ITERS 10
-
-int main (int argc, char **argv)
-{
- int src_width, src_height, dest_width, dest_height;
- unsigned char *src_buf, *dest_buf;
- int src_index, dest_index;
- int i;
- double scale_times[3][3][4];
- double composite_times[3][3][4];
- double composite_color_times[3][3][4];
-
- if (argc == 5)
- {
- src_width = atoi(argv[1]);
- src_height = atoi(argv[2]);
- dest_width = atoi(argv[3]);
- dest_height = atoi(argv[4]);
- }
- else if (argc == 1)
- {
- src_width = 343;
- src_height = 343;
- dest_width = 711;
- dest_height = 711;
- }
- else
- {
- fprintf (stderr, "Usage: scale [src_width src_height dest_width dest_height]\n");
- exit(1);
- }
-
-
- printf ("Scaling from (%d, %d) to (%d, %d)\n\n", src_width, src_height, dest_width, dest_height);
-
- init_array (scale_times);
- init_array (composite_times);
- init_array (composite_color_times);
-
- for (src_index = 0; src_index < 3; src_index++)
- for (dest_index = 0; dest_index < 3; dest_index++)
- {
- int src_channels = (src_index == 0) ? 3 : 4;
- int src_has_alpha = (src_index == 2);
- int dest_channels = (dest_index == 0) ? 3 : 4;
- int dest_has_alpha = (dest_index == 2);
-
- int src_rowstride = (src_channels*src_width + 3) & ~3;
- int dest_rowstride = (dest_channels *dest_width + 3) & ~3;
-
- int filter_level;
-
- src_buf = g_malloc(src_rowstride * src_height);
- memset (src_buf, 0x80, src_rowstride * src_height);
-
- dest_buf = g_malloc(dest_rowstride * dest_height);
- memset (dest_buf, 0x80, dest_rowstride * dest_height);
-
- for (filter_level = PIXOPS_INTERP_NEAREST ; filter_level <= PIXOPS_INTERP_HYPER; filter_level++)
- {
- printf ("src_channels = %d (%s); dest_channels = %d (%s); filter_level=",
- src_channels, src_has_alpha ? "alpha" : "no alpha",
- dest_channels, dest_has_alpha ? "alpha" : "no alpha");
- switch (filter_level)
- {
- case PIXOPS_INTERP_NEAREST:
- printf ("PIXOPS_INTERP_NEAREST\n");
- break;
- case PIXOPS_INTERP_TILES:
- printf ("PIXOPS_INTERP_TILES\n");
- break;
- case PIXOPS_INTERP_BILINEAR:
- printf ("PIXOPS_INTERP_BILINEAR\n");
- break;
- case PIXOPS_INTERP_HYPER:
- printf ("PIXOPS_INTERP_HYPER\n");
- break;
- }
-
- printf("\t\t\titers\ttotal\t\tmsecs/iter\tMpixels/sec\t\n");
-
-
- if (!(src_has_alpha && !dest_has_alpha))
- {
- start_timing ();
- for (i = 0; i < ITERS; i++)
- {
- _pixops_scale (dest_buf, dest_width, dest_height,
- dest_rowstride, dest_channels,
- dest_has_alpha, src_buf, src_width,
- src_height, src_rowstride, src_channels,
- src_has_alpha, 0, 0, 0, 0, 0, 0,
- (double)dest_width / src_width,
- (double)dest_height / src_height,
- filter_level);
- }
- scale_times[src_index][dest_index][filter_level] =
- stop_timing (" scale\t\t", ITERS, dest_height * dest_width);
- }
-
- start_timing ();
- for (i = 0; i < ITERS; i++)
- {
- _pixops_composite (dest_buf, dest_width, dest_height,
- dest_rowstride, dest_channels,
- dest_has_alpha, src_buf, src_width,
- src_height, src_rowstride, src_channels,
- src_has_alpha, 0, 0, 0, 0, 0, 0,
- (double)dest_width / src_width,
- (double)dest_height / src_height,
- filter_level, 255);
- }
- composite_times[src_index][dest_index][filter_level] =
- stop_timing (" composite\t\t", ITERS,
- dest_height * dest_width);
-
- start_timing ();
- for (i = 0; i < ITERS; i++)
- {
- _pixops_composite_color (dest_buf, dest_width, dest_height,
- dest_rowstride, dest_channels,
- dest_has_alpha, src_buf, src_width,
- src_height, src_rowstride,
- src_channels, src_has_alpha, 0, 0,
- 0, 0, 0, 0,
- (double)dest_width / src_width,
- (double)dest_height / src_height,
- filter_level, 255, 0, 0, 16,
- 0xaaaaaa, 0x555555);
- }
- composite_color_times[src_index][dest_index][filter_level] =
- stop_timing (" composite color\t", ITERS, dest_height * dest_width);
-
- printf ("\n");
- }
- printf ("\n");
-
- g_free (src_buf);
- g_free (dest_buf);
- }
-
- printf ("SCALE\n=====\n\n");
- dump_array (scale_times);
-
- printf ("COMPOSITE\n=========\n\n");
- dump_array (composite_times);
-
- printf ("COMPOSITE_COLOR\n===============\n\n");
- dump_array (composite_color_times);
- return 0;
-}
diff --git a/gdk-pixbuf/pltcheck.sh b/gdk-pixbuf/pltcheck.sh
deleted file mode 100755
index 7c0dd52303..0000000000
--- a/gdk-pixbuf/pltcheck.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-LANG=C
-
-status=0
-
-if ! which readelf 2>/dev/null >/dev/null; then
- echo "'readelf' not found; skipping test"
- exit 0
-fi
-
-for so in .libs/libgdk_pixbuf*.so; do
- echo Checking $so for local PLT entries
- readelf -r $so | grep 'JU\?MP_SLOT' | grep 'gdk_pixbuf' && status=1
-done
-
-exit $status
diff --git a/gdk-pixbuf/queryloaders.c b/gdk-pixbuf/queryloaders.c
deleted file mode 100644
index b8f993517f..0000000000
--- a/gdk-pixbuf/queryloaders.c
+++ /dev/null
@@ -1,361 +0,0 @@
-/* -*- mode: C; c-file-style: "linux" -*- */
-/* GdkPixbuf library
- * queryloaders.c:
- *
- * Copyright (C) 2002 The Free Software Foundation
- *
- * Author: Matthias Clasen <maclas@gmx.de>
- *
- * 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 <glib.h>
-#include <glib/gprintf.h>
-#include <gmodule.h>
-
-#include <errno.h>
-#include <string.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include "gdk-pixbuf/gdk-pixbuf.h"
-#include "gdk-pixbuf/gdk-pixbuf-private.h"
-#include "gdk-pixbuf/gdk-pixbuf-io.h"
-
-#ifdef USE_LA_MODULES
-#define SOEXT ".la"
-#else
-#define SOEXT ("." G_MODULE_SUFFIX)
-#endif
-#define SOEXT_LEN (strlen (SOEXT))
-
-#ifdef G_OS_WIN32
-#include <windows.h>
-#endif
-
-static void
-print_escaped (GString *contents, const char *str)
-{
- gchar *tmp = g_strescape (str, "");
- g_string_append_printf (contents, "\"%s\" ", tmp);
- g_free (tmp);
-}
-
-static int
-loader_sanity_check (const char *path, GdkPixbufFormat *info, GdkPixbufModule *vtable)
-{
- const GdkPixbufModulePattern *pattern;
- const char *error = "";
-
- for (pattern = info->signature; pattern->prefix; pattern++)
- {
- int prefix_len = strlen (pattern->prefix);
- if (prefix_len == 0)
- {
- error = "empty pattern";
-
- goto error;
- }
- if (pattern->mask)
- {
- int mask_len = strlen (pattern->mask);
- if (mask_len != prefix_len)
- {
- error = "mask length mismatch";
-
- goto error;
- }
- if (strspn (pattern->mask, " !xzn*") < mask_len)
- {
- error = "bad char in mask";
-
- goto error;
- }
- }
- }
-
- if (!vtable->load && !vtable->begin_load && !vtable->load_animation)
- {
- error = "no load method implemented";
-
- goto error;
- }
-
- if (vtable->begin_load && (!vtable->stop_load || !vtable->load_increment))
- {
- error = "incremental loading support incomplete";
-
- goto error;
- }
-
- if ((info->flags & GDK_PIXBUF_FORMAT_WRITABLE) && !(vtable->save || vtable->save_to_callback))
- {
- error = "loader claims to support saving but doesn't implement save";
- goto error;
- }
-
- return 1;
-
- error:
- g_fprintf (stderr, "Loader sanity check failed for %s: %s\n",
- path, error);
-
- return 0;
-}
-
-static void
-write_loader_info (GString *contents, const char *path, GdkPixbufFormat *info)
-{
- const GdkPixbufModulePattern *pattern;
- char **mime;
- char **ext;
-
- g_string_append_printf (contents, "\"%s\"\n", path);
- g_string_append_printf (contents, "\"%s\" %u \"%s\" \"%s\" \"%s\"\n",
- info->name,
- info->flags,
- info->domain ? info->domain : GETTEXT_PACKAGE,
- info->description,
- info->license ? info->license : "");
- for (mime = info->mime_types; *mime; mime++) {
- g_string_append_printf (contents, "\"%s\" ", *mime);
- }
- g_string_append (contents, "\"\"\n");
- for (ext = info->extensions; *ext; ext++) {
- g_string_append_printf (contents, "\"%s\" ", *ext);
- }
- g_string_append (contents, "\"\"\n");
- for (pattern = info->signature; pattern->prefix; pattern++) {
- print_escaped (contents, pattern->prefix);
- print_escaped (contents, pattern->mask ? (const char *)pattern->mask : "");
- g_string_append_printf (contents, "%d\n", pattern->relevance);
- }
- g_string_append_c (contents, '\n');
-}
-
-static void
-query_module (GString *contents, const char *dir, const char *file)
-{
- char *path;
- GModule *module;
- void (*fill_info) (GdkPixbufFormat *info);
- void (*fill_vtable) (GdkPixbufModule *module);
- gpointer fill_info_ptr;
- gpointer fill_vtable_ptr;
-
- if (g_path_is_absolute (file))
- path = g_strdup (file);
- else
- path = g_build_filename (dir, file, NULL);
-
- module = g_module_open (path, 0);
- if (module &&
- g_module_symbol (module, "fill_info", &fill_info_ptr) &&
- g_module_symbol (module, "fill_vtable", &fill_vtable_ptr)) {
- GdkPixbufFormat *info;
- GdkPixbufModule *vtable;
-
-#ifdef G_OS_WIN32
- /* Replace backslashes in path with forward slashes, so that
- * it reads in without problems.
- */
- {
- char *p = path;
- while (*p) {
- if (*p == '\\')
- *p = '/';
- p++;
- }
- }
-#endif
- info = g_new0 (GdkPixbufFormat, 1);
- vtable = g_new0 (GdkPixbufModule, 1);
-
- vtable->module = module;
-
- fill_info = fill_info_ptr;
- fill_vtable = fill_vtable_ptr;
-
- (*fill_info) (info);
- (*fill_vtable) (vtable);
-
- if (loader_sanity_check (path, info, vtable))
- write_loader_info (contents, path, info);
-
- g_free (info);
- g_free (vtable);
- }
- else {
- if (module == NULL)
- g_fprintf (stderr, "g_module_open() failed for %s: %s\n", path,
- g_module_error());
- else
- g_fprintf (stderr, "Cannot load loader %s\n", path);
- }
- if (module)
- g_module_close (module);
- g_free (path);
-}
-
-static gchar *
-gdk_pixbuf_get_module_file (void)
-{
- gchar *result = g_strdup (g_getenv ("GDK_PIXBUF_MODULE_FILE"));
-
- if (!result)
- result = g_build_filename (GTK_LIBDIR, "gtk-3.0", GTK_BINARY_VERSION, "loaders.cache", NULL);
-
- return result;
-}
-
-int main (int argc, char **argv)
-{
- gint i;
- gchar *prgname;
- GString *contents;
- gchar *cache_file = NULL;
- gint first_file = 1;
-
-#ifdef G_OS_WIN32
- gchar *libdir;
- gchar *runtime_prefix;
- gchar *slash;
-
- if (g_ascii_strncasecmp (PIXBUF_LIBDIR, GTK_PREFIX, strlen (GTK_PREFIX)) == 0 &&
- G_IS_DIR_SEPARATOR (PIXBUF_LIBDIR[strlen (GTK_PREFIX)])) {
- /* GTK_PREFIX is a prefix of PIXBUF_LIBDIR, as it
- * normally is. Replace that prefix in PIXBUF_LIBDIR
- * with the installation directory on this machine.
- * We assume this invokation of
- * gdk-pixbuf-query-loaders is run from either a "bin"
- * subdirectory of the installation directory, or in
- * the installation directory itself.
- */
- wchar_t fn[1000];
- GetModuleFileNameW (NULL, fn, G_N_ELEMENTS (fn));
- runtime_prefix = g_utf16_to_utf8 (fn, -1, NULL, NULL, NULL);
- slash = strrchr (runtime_prefix, '\\');
- *slash = '\0';
- slash = strrchr (runtime_prefix, '\\');
- /* If running from some weird location, or from the
- * build directory (either in the .libs folder where
- * libtool places the real executable when using a
- * wrapper, or directly from the gdk-pixbuf folder),
- * use the compile-time libdir.
- */
- if (slash == NULL ||
- g_ascii_strcasecmp (slash + 1, ".libs") == 0 ||
- g_ascii_strcasecmp (slash + 1, "gdk-pixbuf") == 0) {
- libdir = PIXBUF_LIBDIR;
- }
- else {
- if (slash != NULL && g_ascii_strcasecmp (slash + 1, "bin") == 0) {
- *slash = '\0';
- }
-
- libdir = g_strconcat (runtime_prefix,
- "/",
- PIXBUF_LIBDIR + strlen (GTK_PREFIX) + 1,
- NULL);
- }
- }
- else {
- libdir = PIXBUF_LIBDIR;
- }
-
-#undef PIXBUF_LIBDIR
-#define PIXBUF_LIBDIR libdir
-
-#endif
-
- if (argc > 1 && strcmp (argv[1], "--update-cache") == 0) {
- cache_file = gdk_pixbuf_get_module_file ();
- first_file = 2;
- }
-
- contents = g_string_new ("");
-
- prgname = g_get_prgname ();
- g_string_append_printf (contents,
- "# GdkPixbuf Image Loader Modules file\n"
- "# Automatically generated file, do not edit\n"
- "# Created by %s from gtk+-%s\n"
- "#\n",
- (prgname ? prgname : "gdk-pixbuf-query-loaders-3.0"),
- GDK_PIXBUF_VERSION);
-
- if (argc == first_file) {
-#ifdef USE_GMODULE
- const char *path;
- GDir *dir;
-
- path = g_getenv ("GDK_PIXBUF_MODULEDIR");
-#ifdef G_OS_WIN32
- if (path != NULL && *path != '\0')
- path = g_locale_to_utf8 (path, -1, NULL, NULL, NULL);
-#endif
- if (path == NULL || *path == '\0')
- path = PIXBUF_LIBDIR;
-
- g_string_append_printf (contents, "# LoaderDir = %s\n#\n", path);
-
- dir = g_dir_open (path, 0, NULL);
- if (dir) {
- const char *dent;
-
- while ((dent = g_dir_read_name (dir))) {
- gint len = strlen (dent);
- if (len > SOEXT_LEN &&
- strcmp (dent + len - SOEXT_LEN, SOEXT) == 0) {
- query_module (contents, path, dent);
- }
- }
- g_dir_close (dir);
- }
-#else
- g_string_append_printf (contents, "# dynamic loading of modules not supported\n");
-#endif
- }
- else {
- char *cwd = g_get_current_dir ();
-
- for (i = 1; i < argc; i++) {
- char *infilename = argv[i];
-#ifdef G_OS_WIN32
- infilename = g_locale_to_utf8 (infilename,
- -1, NULL, NULL, NULL);
-#endif
- query_module (contents, cwd, infilename);
- }
- g_free (cwd);
- }
-
- if (cache_file) {
- GError *err;
-
- err = NULL;
- if (!g_file_set_contents (cache_file, contents->str, -1, &err)) {
- g_fprintf (stderr, "%s\n", err->message);
- }
- }
- else
- g_print ("%s\n", contents->str);
-
- return 0;
-}
diff --git a/gdk-pixbuf/test-gdk-pixbuf.c b/gdk-pixbuf/test-gdk-pixbuf.c
deleted file mode 100644
index b2d565a902..0000000000
--- a/gdk-pixbuf/test-gdk-pixbuf.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-
-/* GdkPixbuf library - test program
- *
- * Copyright (C) 1999 The Free Software Foundation
- *
- * Author: Federico Mena-Quintero <federico@gimp.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program 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 General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include "gdk-pixbuf.h"
-#include <glib-object.h>
-
-
-
-static void
-store_pixel (guchar *pixels,
- int pixel,
- gboolean alpha)
-{
- if (alpha) {
- pixels[0] = pixel >> 24;
- pixels[1] = pixel >> 16;
- pixels[2] = pixel >> 8;
- pixels[3] = pixel;
- } else {
- pixels[0] = pixel >> 16;
- pixels[1] = pixel >> 8;
- pixels[2] = pixel;
- }
-}
-
-static void
-fill_with_pixel (GdkPixbuf *pixbuf,
- int pixel)
-{
- int x, y;
-
- for (x = 0; x < gdk_pixbuf_get_width (pixbuf); x++) {
- for (y = 0; y < gdk_pixbuf_get_height (pixbuf); y++) {
- store_pixel (gdk_pixbuf_get_pixels (pixbuf)
- + y * gdk_pixbuf_get_rowstride (pixbuf)
- + x * gdk_pixbuf_get_n_channels (pixbuf),
- pixel,
- gdk_pixbuf_get_has_alpha (pixbuf));
- }
- }
-}
-
-static int
-load_pixel (const guchar *pixels,
- gboolean alpha)
-{
- if (alpha)
- return (((((pixels[0] << 8) | pixels[1]) << 8) | pixels[2]) << 8) | pixels[3];
- else
- return (((pixels[0] << 8) | pixels[1]) << 8) | pixels[2];
-}
-
-static gboolean
-simple_composite_test_one (GdkInterpType type,
- int source_pixel,
- gboolean source_alpha,
- int destination_pixel,
- gboolean destination_alpha,
- int expected_result)
-{
- GdkPixbuf *source_pixbuf;
- GdkPixbuf *destination_pixbuf;
- int result_pixel;
-
- source_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, source_alpha, 8, 32, 32);
- destination_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, destination_alpha, 8, 32, 32);
-
- fill_with_pixel (source_pixbuf, source_pixel);
- fill_with_pixel (destination_pixbuf, destination_pixel);
-
- gdk_pixbuf_composite (source_pixbuf, destination_pixbuf,
- 0, 0, 32, 32, 0, 0, 1, 1, type, 0xFF);
-
- result_pixel = load_pixel (gdk_pixbuf_get_pixels (destination_pixbuf)
- + 16 * gdk_pixbuf_get_rowstride (destination_pixbuf)
- + 16 * gdk_pixbuf_get_n_channels (destination_pixbuf),
- destination_alpha);
-
- g_object_unref (source_pixbuf);
- g_object_unref (destination_pixbuf);
-
- if (result_pixel != expected_result) {
- char *interpolation_type, *source_string, *destination_string, *result_string, *expected_string;
-
- switch (type) {
- case GDK_INTERP_NEAREST: interpolation_type = "GDK_INTERP_NEAREST"; break;
- case GDK_INTERP_TILES: interpolation_type = "GDK_INTERP_TILES"; break;
- case GDK_INTERP_BILINEAR: interpolation_type = "GDK_INTERP_BILINEAR"; break;
- case GDK_INTERP_HYPER: interpolation_type = "GDK_INTERP_HYPER"; break;
- default: interpolation_type = "???";
- }
-
- if (source_alpha) {
- source_string = g_strdup_printf ("0x%08X", source_pixel);
- } else {
- source_string = g_strdup_printf ("0x%06X", source_pixel);
- }
-
- if (destination_alpha) {
- destination_string = g_strdup_printf ("0x%08X", destination_pixel);
- result_string = g_strdup_printf ("0x%08X", result_pixel);
- expected_string = g_strdup_printf ("0x%08X", expected_result);
- } else {
- destination_string = g_strdup_printf ("0x%06X", destination_pixel);
- result_string = g_strdup_printf ("0x%06X", result_pixel);
- expected_string = g_strdup_printf ("0x%06X", expected_result);
- }
-
- g_message ("simple_composite_test (%s): composite %s on top of %s, expected %s, got %s",
- interpolation_type,
- source_string, destination_string, expected_string, result_string);
- return FALSE;
- }
-
- return TRUE;
-}
-
-static gboolean
-simple_composite_test_one_type (GdkInterpType type)
-{
- gboolean success;
-
- success = TRUE;
-
- /* There are only a few trivial cases in here.
- * But these were enough to expose the problems in the old composite code.
- */
-
- /* Non-alpha into non-alpha. */
- success &= simple_composite_test_one (type, 0x000000, FALSE, 0x000000, FALSE, 0x000000);
- success &= simple_composite_test_one (type, 0x000000, FALSE, 0xFFFFFF, FALSE, 0x000000);
- success &= simple_composite_test_one (type, 0xFF0000, FALSE, 0x000000, FALSE, 0xFF0000);
- success &= simple_composite_test_one (type, 0x00FF00, FALSE, 0x000000, FALSE, 0x00FF00);
- success &= simple_composite_test_one (type, 0x0000FF, FALSE, 0x000000, FALSE, 0x0000FF);
- success &= simple_composite_test_one (type, 0x000000, FALSE, 0xFF0000, FALSE, 0x000000);
- success &= simple_composite_test_one (type, 0x000000, FALSE, 0x00FF00, FALSE, 0x000000);
- success &= simple_composite_test_one (type, 0x000000, FALSE, 0x0000FF, FALSE, 0x000000);
- success &= simple_composite_test_one (type, 0x00FF00, FALSE, 0xFFFFFF, FALSE, 0x00FF00);
- success &= simple_composite_test_one (type, 0xFFFFFF, FALSE, 0xFFFFFF, FALSE, 0xFFFFFF);
-
- /* Alpha into non-alpha. */
- success &= simple_composite_test_one (type, 0x00000000, TRUE, 0x000000, FALSE, 0x000000);
- success &= simple_composite_test_one (type, 0x00000000, TRUE, 0xFFFFFF, FALSE, 0xFFFFFF);
- success &= simple_composite_test_one (type, 0x0000007F, TRUE, 0xFFFFFF, FALSE, 0x808080);
- success &= simple_composite_test_one (type, 0x00000080, TRUE, 0xFFFFFF, FALSE, 0x7F7F7F);
- success &= simple_composite_test_one (type, 0x000000FF, TRUE, 0xFFFFFF, FALSE, 0x000000);
- success &= simple_composite_test_one (type, 0x000000FF, TRUE, 0xFFFFFF, FALSE, 0x000000);
- success &= simple_composite_test_one (type, 0xFF0000FF, TRUE, 0x000000, FALSE, 0xFF0000);
- success &= simple_composite_test_one (type, 0x00FF00FF, TRUE, 0x000000, FALSE, 0x00FF00);
- success &= simple_composite_test_one (type, 0x0000FFFF, TRUE, 0x000000, FALSE, 0x0000FF);
- success &= simple_composite_test_one (type, 0x00000000, TRUE, 0xFF0000, FALSE, 0xFF0000);
- success &= simple_composite_test_one (type, 0x00000000, TRUE, 0x00FF00, FALSE, 0x00FF00);
- success &= simple_composite_test_one (type, 0x00000000, TRUE, 0x0000FF, FALSE, 0x0000FF);
- success &= simple_composite_test_one (type, 0x00FF0080, TRUE, 0xFFFFFF, FALSE, 0x7FFF7F);
- success &= simple_composite_test_one (type, 0xFFFFFFFF, TRUE, 0xFFFFFF, FALSE, 0xFFFFFF);
-
- /* Non-alpha into alpha. */
- success &= simple_composite_test_one (type, 0x000000, FALSE, 0x00000000, TRUE, 0x000000FF);
- success &= simple_composite_test_one (type, 0x000000, FALSE, 0xFFFFFFFF, TRUE, 0x000000FF);
- success &= simple_composite_test_one (type, 0xFF0000, FALSE, 0x00000000, TRUE, 0xFF0000FF);
- success &= simple_composite_test_one (type, 0x00FF00, FALSE, 0x00000000, TRUE, 0x00FF00FF);
- success &= simple_composite_test_one (type, 0x0000FF, FALSE, 0x00000000, TRUE, 0x0000FFFF);
- success &= simple_composite_test_one (type, 0x000000, FALSE, 0xFF0000FF, TRUE, 0x000000FF);
- success &= simple_composite_test_one (type, 0x000000, FALSE, 0x00FF00FF, TRUE, 0x000000FF);
- success &= simple_composite_test_one (type, 0x000000, FALSE, 0x0000FFFF, TRUE, 0x000000FF);
- success &= simple_composite_test_one (type, 0x00FF00, FALSE, 0xFFFFFF00, TRUE, 0x00FF00FF);
- success &= simple_composite_test_one (type, 0xFFFFFF, FALSE, 0xFFFFFFFF, TRUE, 0xFFFFFFFF);
-
- /* Alpha into alpha. */
- success &= simple_composite_test_one (type, 0x00000000, TRUE, 0x00000000, TRUE, 0x00000000);
- success &= simple_composite_test_one (type, 0x00000000, TRUE, 0xFFFFFFFF, TRUE, 0xFFFFFFFF);
- success &= simple_composite_test_one (type, 0x0000007F, TRUE, 0xFFFFFFFF, TRUE, 0x808080FF);
- success &= simple_composite_test_one (type, 0x00000080, TRUE, 0xFFFFFFFF, TRUE, 0x7F7F7FFF);
- success &= simple_composite_test_one (type, 0x000000FF, TRUE, 0xFFFFFFFF, TRUE, 0x000000FF);
- success &= simple_composite_test_one (type, 0xFF0000FF, TRUE, 0x00000000, TRUE, 0xFF0000FF);
- success &= simple_composite_test_one (type, 0x00FF00FF, TRUE, 0x00000000, TRUE, 0x00FF00FF);
- success &= simple_composite_test_one (type, 0x0000FFFF, TRUE, 0x00000000, TRUE, 0x0000FFFF);
- success &= simple_composite_test_one (type, 0x00000000, TRUE, 0xFF0000FF, TRUE, 0xFF0000FF);
- success &= simple_composite_test_one (type, 0x00000000, TRUE, 0x00FF00FF, TRUE, 0x00FF00FF);
- success &= simple_composite_test_one (type, 0x00000000, TRUE, 0x0000FFFF, TRUE, 0x0000FFFF);
- success &= simple_composite_test_one (type, 0x00FF0080, TRUE, 0xFFFFFF00, TRUE, 0x00FF0080);
- success &= simple_composite_test_one (type, 0xFF000080, TRUE, 0x00FF0040, TRUE, 0xCC32009F);
- success &= simple_composite_test_one (type, 0xFFFFFFFF, TRUE, 0xFFFFFFFF, TRUE, 0xFFFFFFFF);
-
- return success;
-}
-
-static gboolean
-simple_composite_test (void)
-{
- gboolean success;
-
- success = TRUE;
-
- success &= simple_composite_test_one_type (GDK_INTERP_NEAREST);
- success &= simple_composite_test_one_type (GDK_INTERP_TILES);
- success &= simple_composite_test_one_type (GDK_INTERP_BILINEAR);
- success &= simple_composite_test_one_type (GDK_INTERP_HYPER);
-
- return success;
-}
-
-int
-main (int argc, char **argv)
-{
- int result;
-
- result = EXIT_SUCCESS;
-
- g_type_init ();
-
- /* Run some tests. */
- if (!simple_composite_test ()) {
- result = EXIT_FAILURE;
- }
-
- return result;
-}
diff --git a/gdk-pixbuf/xpm-color-table.h b/gdk-pixbuf/xpm-color-table.h
deleted file mode 100644
index 637a27c469..0000000000
--- a/gdk-pixbuf/xpm-color-table.h
+++ /dev/null
@@ -1,1521 +0,0 @@
-/* xpm-color-table.h: Generated by gen-color-table.pl from rgb.txt
- *
- * Date: Tue Mar 8 03:54:56 2005
- *
- * Do not edit.
- */
-static const char color_names[] =
- "alice blue\0"
- "AliceBlue\0"
- "antique white\0"
- "AntiqueWhite\0"
- "AntiqueWhite1\0"
- "AntiqueWhite2\0"
- "AntiqueWhite3\0"
- "AntiqueWhite4\0"
- "aquamarine\0"
- "aquamarine1\0"
- "aquamarine2\0"
- "aquamarine3\0"
- "aquamarine4\0"
- "azure\0"
- "azure1\0"
- "azure2\0"
- "azure3\0"
- "azure4\0"
- "beige\0"
- "bisque\0"
- "bisque1\0"
- "bisque2\0"
- "bisque3\0"
- "bisque4\0"
- "black\0"
- "blanched almond\0"
- "BlanchedAlmond\0"
- "blue\0"
- "blue violet\0"
- "blue1\0"
- "blue2\0"
- "blue3\0"
- "blue4\0"
- "BlueViolet\0"
- "brown\0"
- "brown1\0"
- "brown2\0"
- "brown3\0"
- "brown4\0"
- "burlywood\0"
- "burlywood1\0"
- "burlywood2\0"
- "burlywood3\0"
- "burlywood4\0"
- "cadet blue\0"
- "CadetBlue\0"
- "CadetBlue1\0"
- "CadetBlue2\0"
- "CadetBlue3\0"
- "CadetBlue4\0"
- "chartreuse\0"
- "chartreuse1\0"
- "chartreuse2\0"
- "chartreuse3\0"
- "chartreuse4\0"
- "chocolate\0"
- "chocolate1\0"
- "chocolate2\0"
- "chocolate3\0"
- "chocolate4\0"
- "coral\0"
- "coral1\0"
- "coral2\0"
- "coral3\0"
- "coral4\0"
- "cornflower blue\0"
- "CornflowerBlue\0"
- "cornsilk\0"
- "cornsilk1\0"
- "cornsilk2\0"
- "cornsilk3\0"
- "cornsilk4\0"
- "cyan\0"
- "cyan1\0"
- "cyan2\0"
- "cyan3\0"
- "cyan4\0"
- "dark blue\0"
- "dark cyan\0"
- "dark goldenrod\0"
- "dark gray\0"
- "dark green\0"
- "dark grey\0"
- "dark khaki\0"
- "dark magenta\0"
- "dark olive green\0"
- "dark orange\0"
- "dark orchid\0"
- "dark red\0"
- "dark salmon\0"
- "dark sea green\0"
- "dark slate blue\0"
- "dark slate gray\0"
- "dark slate grey\0"
- "dark turquoise\0"
- "dark violet\0"
- "DarkBlue\0"
- "DarkCyan\0"
- "DarkGoldenrod\0"
- "DarkGoldenrod1\0"
- "DarkGoldenrod2\0"
- "DarkGoldenrod3\0"
- "DarkGoldenrod4\0"
- "DarkGray\0"
- "DarkGreen\0"
- "DarkGrey\0"
- "DarkKhaki\0"
- "DarkMagenta\0"
- "DarkOliveGreen\0"
- "DarkOliveGreen1\0"
- "DarkOliveGreen2\0"
- "DarkOliveGreen3\0"
- "DarkOliveGreen4\0"
- "DarkOrange\0"
- "DarkOrange1\0"
- "DarkOrange2\0"
- "DarkOrange3\0"
- "DarkOrange4\0"
- "DarkOrchid\0"
- "DarkOrchid1\0"
- "DarkOrchid2\0"
- "DarkOrchid3\0"
- "DarkOrchid4\0"
- "DarkRed\0"
- "DarkSalmon\0"
- "DarkSeaGreen\0"
- "DarkSeaGreen1\0"
- "DarkSeaGreen2\0"
- "DarkSeaGreen3\0"
- "DarkSeaGreen4\0"
- "DarkSlateBlue\0"
- "DarkSlateGray\0"
- "DarkSlateGray1\0"
- "DarkSlateGray2\0"
- "DarkSlateGray3\0"
- "DarkSlateGray4\0"
- "DarkSlateGrey\0"
- "DarkTurquoise\0"
- "DarkViolet\0"
- "deep pink\0"
- "deep sky blue\0"
- "DeepPink\0"
- "DeepPink1\0"
- "DeepPink2\0"
- "DeepPink3\0"
- "DeepPink4\0"
- "DeepSkyBlue\0"
- "DeepSkyBlue1\0"
- "DeepSkyBlue2\0"
- "DeepSkyBlue3\0"
- "DeepSkyBlue4\0"
- "dim gray\0"
- "dim grey\0"
- "DimGray\0"
- "DimGrey\0"
- "dodger blue\0"
- "DodgerBlue\0"
- "DodgerBlue1\0"
- "DodgerBlue2\0"
- "DodgerBlue3\0"
- "DodgerBlue4\0"
- "firebrick\0"
- "firebrick1\0"
- "firebrick2\0"
- "firebrick3\0"
- "firebrick4\0"
- "floral white\0"
- "FloralWhite\0"
- "forest green\0"
- "ForestGreen\0"
- "gainsboro\0"
- "ghost white\0"
- "GhostWhite\0"
- "gold\0"
- "gold1\0"
- "gold2\0"
- "gold3\0"
- "gold4\0"
- "goldenrod\0"
- "goldenrod1\0"
- "goldenrod2\0"
- "goldenrod3\0"
- "goldenrod4\0"
- "gray\0"
- "gray0\0"
- "gray1\0"
- "gray10\0"
- "gray100\0"
- "gray11\0"
- "gray12\0"
- "gray13\0"
- "gray14\0"
- "gray15\0"
- "gray16\0"
- "gray17\0"
- "gray18\0"
- "gray19\0"
- "gray2\0"
- "gray20\0"
- "gray21\0"
- "gray22\0"
- "gray23\0"
- "gray24\0"
- "gray25\0"
- "gray26\0"
- "gray27\0"
- "gray28\0"
- "gray29\0"
- "gray3\0"
- "gray30\0"
- "gray31\0"
- "gray32\0"
- "gray33\0"
- "gray34\0"
- "gray35\0"
- "gray36\0"
- "gray37\0"
- "gray38\0"
- "gray39\0"
- "gray4\0"
- "gray40\0"
- "gray41\0"
- "gray42\0"
- "gray43\0"
- "gray44\0"
- "gray45\0"
- "gray46\0"
- "gray47\0"
- "gray48\0"
- "gray49\0"
- "gray5\0"
- "gray50\0"
- "gray51\0"
- "gray52\0"
- "gray53\0"
- "gray54\0"
- "gray55\0"
- "gray56\0"
- "gray57\0"
- "gray58\0"
- "gray59\0"
- "gray6\0"
- "gray60\0"
- "gray61\0"
- "gray62\0"
- "gray63\0"
- "gray64\0"
- "gray65\0"
- "gray66\0"
- "gray67\0"
- "gray68\0"
- "gray69\0"
- "gray7\0"
- "gray70\0"
- "gray71\0"
- "gray72\0"
- "gray73\0"
- "gray74\0"
- "gray75\0"
- "gray76\0"
- "gray77\0"
- "gray78\0"
- "gray79\0"
- "gray8\0"
- "gray80\0"
- "gray81\0"
- "gray82\0"
- "gray83\0"
- "gray84\0"
- "gray85\0"
- "gray86\0"
- "gray87\0"
- "gray88\0"
- "gray89\0"
- "gray9\0"
- "gray90\0"
- "gray91\0"
- "gray92\0"
- "gray93\0"
- "gray94\0"
- "gray95\0"
- "gray96\0"
- "gray97\0"
- "gray98\0"
- "gray99\0"
- "green\0"
- "green yellow\0"
- "green1\0"
- "green2\0"
- "green3\0"
- "green4\0"
- "GreenYellow\0"
- "grey\0"
- "grey0\0"
- "grey1\0"
- "grey10\0"
- "grey100\0"
- "grey11\0"
- "grey12\0"
- "grey13\0"
- "grey14\0"
- "grey15\0"
- "grey16\0"
- "grey17\0"
- "grey18\0"
- "grey19\0"
- "grey2\0"
- "grey20\0"
- "grey21\0"
- "grey22\0"
- "grey23\0"
- "grey24\0"
- "grey25\0"
- "grey26\0"
- "grey27\0"
- "grey28\0"
- "grey29\0"
- "grey3\0"
- "grey30\0"
- "grey31\0"
- "grey32\0"
- "grey33\0"
- "grey34\0"
- "grey35\0"
- "grey36\0"
- "grey37\0"
- "grey38\0"
- "grey39\0"
- "grey4\0"
- "grey40\0"
- "grey41\0"
- "grey42\0"
- "grey43\0"
- "grey44\0"
- "grey45\0"
- "grey46\0"
- "grey47\0"
- "grey48\0"
- "grey49\0"
- "grey5\0"
- "grey50\0"
- "grey51\0"
- "grey52\0"
- "grey53\0"
- "grey54\0"
- "grey55\0"
- "grey56\0"
- "grey57\0"
- "grey58\0"
- "grey59\0"
- "grey6\0"
- "grey60\0"
- "grey61\0"
- "grey62\0"
- "grey63\0"
- "grey64\0"
- "grey65\0"
- "grey66\0"
- "grey67\0"
- "grey68\0"
- "grey69\0"
- "grey7\0"
- "grey70\0"
- "grey71\0"
- "grey72\0"
- "grey73\0"
- "grey74\0"
- "grey75\0"
- "grey76\0"
- "grey77\0"
- "grey78\0"
- "grey79\0"
- "grey8\0"
- "grey80\0"
- "grey81\0"
- "grey82\0"
- "grey83\0"
- "grey84\0"
- "grey85\0"
- "grey86\0"
- "grey87\0"
- "grey88\0"
- "grey89\0"
- "grey9\0"
- "grey90\0"
- "grey91\0"
- "grey92\0"
- "grey93\0"
- "grey94\0"
- "grey95\0"
- "grey96\0"
- "grey97\0"
- "grey98\0"
- "grey99\0"
- "honeydew\0"
- "honeydew1\0"
- "honeydew2\0"
- "honeydew3\0"
- "honeydew4\0"
- "hot pink\0"
- "HotPink\0"
- "HotPink1\0"
- "HotPink2\0"
- "HotPink3\0"
- "HotPink4\0"
- "indian red\0"
- "IndianRed\0"
- "IndianRed1\0"
- "IndianRed2\0"
- "IndianRed3\0"
- "IndianRed4\0"
- "ivory\0"
- "ivory1\0"
- "ivory2\0"
- "ivory3\0"
- "ivory4\0"
- "khaki\0"
- "khaki1\0"
- "khaki2\0"
- "khaki3\0"
- "khaki4\0"
- "lavender\0"
- "lavender blush\0"
- "LavenderBlush\0"
- "LavenderBlush1\0"
- "LavenderBlush2\0"
- "LavenderBlush3\0"
- "LavenderBlush4\0"
- "lawn green\0"
- "LawnGreen\0"
- "lemon chiffon\0"
- "LemonChiffon\0"
- "LemonChiffon1\0"
- "LemonChiffon2\0"
- "LemonChiffon3\0"
- "LemonChiffon4\0"
- "light blue\0"
- "light coral\0"
- "light cyan\0"
- "light goldenrod\0"
- "light goldenrod yellow\0"
- "light gray\0"
- "light green\0"
- "light grey\0"
- "light pink\0"
- "light salmon\0"
- "light sea green\0"
- "light sky blue\0"
- "light slate blue\0"
- "light slate gray\0"
- "light slate grey\0"
- "light steel blue\0"
- "light yellow\0"
- "LightBlue\0"
- "LightBlue1\0"
- "LightBlue2\0"
- "LightBlue3\0"
- "LightBlue4\0"
- "LightCoral\0"
- "LightCyan\0"
- "LightCyan1\0"
- "LightCyan2\0"
- "LightCyan3\0"
- "LightCyan4\0"
- "LightGoldenrod\0"
- "LightGoldenrod1\0"
- "LightGoldenrod2\0"
- "LightGoldenrod3\0"
- "LightGoldenrod4\0"
- "LightGoldenrodYellow\0"
- "LightGray\0"
- "LightGreen\0"
- "LightGrey\0"
- "LightPink\0"
- "LightPink1\0"
- "LightPink2\0"
- "LightPink3\0"
- "LightPink4\0"
- "LightSalmon\0"
- "LightSalmon1\0"
- "LightSalmon2\0"
- "LightSalmon3\0"
- "LightSalmon4\0"
- "LightSeaGreen\0"
- "LightSkyBlue\0"
- "LightSkyBlue1\0"
- "LightSkyBlue2\0"
- "LightSkyBlue3\0"
- "LightSkyBlue4\0"
- "LightSlateBlue\0"
- "LightSlateGray\0"
- "LightSlateGrey\0"
- "LightSteelBlue\0"
- "LightSteelBlue1\0"
- "LightSteelBlue2\0"
- "LightSteelBlue3\0"
- "LightSteelBlue4\0"
- "LightYellow\0"
- "LightYellow1\0"
- "LightYellow2\0"
- "LightYellow3\0"
- "LightYellow4\0"
- "lime green\0"
- "LimeGreen\0"
- "linen\0"
- "magenta\0"
- "magenta1\0"
- "magenta2\0"
- "magenta3\0"
- "magenta4\0"
- "maroon\0"
- "maroon1\0"
- "maroon2\0"
- "maroon3\0"
- "maroon4\0"
- "medium aquamarine\0"
- "medium blue\0"
- "medium orchid\0"
- "medium purple\0"
- "medium sea green\0"
- "medium slate blue\0"
- "medium spring green\0"
- "medium turquoise\0"
- "medium violet red\0"
- "MediumAquamarine\0"
- "MediumBlue\0"
- "MediumOrchid\0"
- "MediumOrchid1\0"
- "MediumOrchid2\0"
- "MediumOrchid3\0"
- "MediumOrchid4\0"
- "MediumPurple\0"
- "MediumPurple1\0"
- "MediumPurple2\0"
- "MediumPurple3\0"
- "MediumPurple4\0"
- "MediumSeaGreen\0"
- "MediumSlateBlue\0"
- "MediumSpringGreen\0"
- "MediumTurquoise\0"
- "MediumVioletRed\0"
- "midnight blue\0"
- "MidnightBlue\0"
- "mint cream\0"
- "MintCream\0"
- "misty rose\0"
- "MistyRose\0"
- "MistyRose1\0"
- "MistyRose2\0"
- "MistyRose3\0"
- "MistyRose4\0"
- "moccasin\0"
- "navajo white\0"
- "NavajoWhite\0"
- "NavajoWhite1\0"
- "NavajoWhite2\0"
- "NavajoWhite3\0"
- "NavajoWhite4\0"
- "navy\0"
- "navy blue\0"
- "NavyBlue\0"
- "old lace\0"
- "OldLace\0"
- "olive drab\0"
- "OliveDrab\0"
- "OliveDrab1\0"
- "OliveDrab2\0"
- "OliveDrab3\0"
- "OliveDrab4\0"
- "orange\0"
- "orange red\0"
- "orange1\0"
- "orange2\0"
- "orange3\0"
- "orange4\0"
- "OrangeRed\0"
- "OrangeRed1\0"
- "OrangeRed2\0"
- "OrangeRed3\0"
- "OrangeRed4\0"
- "orchid\0"
- "orchid1\0"
- "orchid2\0"
- "orchid3\0"
- "orchid4\0"
- "pale goldenrod\0"
- "pale green\0"
- "pale turquoise\0"
- "pale violet red\0"
- "PaleGoldenrod\0"
- "PaleGreen\0"
- "PaleGreen1\0"
- "PaleGreen2\0"
- "PaleGreen3\0"
- "PaleGreen4\0"
- "PaleTurquoise\0"
- "PaleTurquoise1\0"
- "PaleTurquoise2\0"
- "PaleTurquoise3\0"
- "PaleTurquoise4\0"
- "PaleVioletRed\0"
- "PaleVioletRed1\0"
- "PaleVioletRed2\0"
- "PaleVioletRed3\0"
- "PaleVioletRed4\0"
- "papaya whip\0"
- "PapayaWhip\0"
- "peach puff\0"
- "PeachPuff\0"
- "PeachPuff1\0"
- "PeachPuff2\0"
- "PeachPuff3\0"
- "PeachPuff4\0"
- "peru\0"
- "pink\0"
- "pink1\0"
- "pink2\0"
- "pink3\0"
- "pink4\0"
- "plum\0"
- "plum1\0"
- "plum2\0"
- "plum3\0"
- "plum4\0"
- "powder blue\0"
- "PowderBlue\0"
- "purple\0"
- "purple1\0"
- "purple2\0"
- "purple3\0"
- "purple4\0"
- "red\0"
- "red1\0"
- "red2\0"
- "red3\0"
- "red4\0"
- "rosy brown\0"
- "RosyBrown\0"
- "RosyBrown1\0"
- "RosyBrown2\0"
- "RosyBrown3\0"
- "RosyBrown4\0"
- "royal blue\0"
- "RoyalBlue\0"
- "RoyalBlue1\0"
- "RoyalBlue2\0"
- "RoyalBlue3\0"
- "RoyalBlue4\0"
- "saddle brown\0"
- "SaddleBrown\0"
- "salmon\0"
- "salmon1\0"
- "salmon2\0"
- "salmon3\0"
- "salmon4\0"
- "sandy brown\0"
- "SandyBrown\0"
- "sea green\0"
- "SeaGreen\0"
- "SeaGreen1\0"
- "SeaGreen2\0"
- "SeaGreen3\0"
- "SeaGreen4\0"
- "seashell\0"
- "seashell1\0"
- "seashell2\0"
- "seashell3\0"
- "seashell4\0"
- "sienna\0"
- "sienna1\0"
- "sienna2\0"
- "sienna3\0"
- "sienna4\0"
- "sky blue\0"
- "SkyBlue\0"
- "SkyBlue1\0"
- "SkyBlue2\0"
- "SkyBlue3\0"
- "SkyBlue4\0"
- "slate blue\0"
- "slate gray\0"
- "slate grey\0"
- "SlateBlue\0"
- "SlateBlue1\0"
- "SlateBlue2\0"
- "SlateBlue3\0"
- "SlateBlue4\0"
- "SlateGray\0"
- "SlateGray1\0"
- "SlateGray2\0"
- "SlateGray3\0"
- "SlateGray4\0"
- "SlateGrey\0"
- "snow\0"
- "snow1\0"
- "snow2\0"
- "snow3\0"
- "snow4\0"
- "spring green\0"
- "SpringGreen\0"
- "SpringGreen1\0"
- "SpringGreen2\0"
- "SpringGreen3\0"
- "SpringGreen4\0"
- "steel blue\0"
- "SteelBlue\0"
- "SteelBlue1\0"
- "SteelBlue2\0"
- "SteelBlue3\0"
- "SteelBlue4\0"
- "tan\0"
- "tan1\0"
- "tan2\0"
- "tan3\0"
- "tan4\0"
- "thistle\0"
- "thistle1\0"
- "thistle2\0"
- "thistle3\0"
- "thistle4\0"
- "tomato\0"
- "tomato1\0"
- "tomato2\0"
- "tomato3\0"
- "tomato4\0"
- "turquoise\0"
- "turquoise1\0"
- "turquoise2\0"
- "turquoise3\0"
- "turquoise4\0"
- "violet\0"
- "violet red\0"
- "VioletRed\0"
- "VioletRed1\0"
- "VioletRed2\0"
- "VioletRed3\0"
- "VioletRed4\0"
- "wheat\0"
- "wheat1\0"
- "wheat2\0"
- "wheat3\0"
- "wheat4\0"
- "white\0"
- "white smoke\0"
- "WhiteSmoke\0"
- "yellow\0"
- "yellow green\0"
- "yellow1\0"
- "yellow2\0"
- "yellow3\0"
- "yellow4\0"
- "YellowGreen\0";
-
-typedef struct {
- guint16 name_offset;
- guchar red;
- guchar green;
- guchar blue;
-} XPMColorEntry;
-
-static const XPMColorEntry xColors[] = {
- { 0, 240, 248, 255 },
- { 11, 240, 248, 255 },
- { 21, 250, 235, 215 },
- { 35, 250, 235, 215 },
- { 48, 255, 239, 219 },
- { 62, 238, 223, 204 },
- { 76, 205, 192, 176 },
- { 90, 139, 131, 120 },
- { 104, 127, 255, 212 },
- { 115, 127, 255, 212 },
- { 127, 118, 238, 198 },
- { 139, 102, 205, 170 },
- { 151, 69, 139, 116 },
- { 163, 240, 255, 255 },
- { 169, 240, 255, 255 },
- { 176, 224, 238, 238 },
- { 183, 193, 205, 205 },
- { 190, 131, 139, 139 },
- { 197, 245, 245, 220 },
- { 203, 255, 228, 196 },
- { 210, 255, 228, 196 },
- { 218, 238, 213, 183 },
- { 226, 205, 183, 158 },
- { 234, 139, 125, 107 },
- { 242, 0, 0, 0 },
- { 248, 255, 235, 205 },
- { 264, 255, 235, 205 },
- { 279, 0, 0, 255 },
- { 284, 138, 43, 226 },
- { 296, 0, 0, 255 },
- { 302, 0, 0, 238 },
- { 308, 0, 0, 205 },
- { 314, 0, 0, 139 },
- { 320, 138, 43, 226 },
- { 331, 165, 42, 42 },
- { 337, 255, 64, 64 },
- { 344, 238, 59, 59 },
- { 351, 205, 51, 51 },
- { 358, 139, 35, 35 },
- { 365, 222, 184, 135 },
- { 375, 255, 211, 155 },
- { 386, 238, 197, 145 },
- { 397, 205, 170, 125 },
- { 408, 139, 115, 85 },
- { 419, 95, 158, 160 },
- { 430, 95, 158, 160 },
- { 440, 152, 245, 255 },
- { 451, 142, 229, 238 },
- { 462, 122, 197, 205 },
- { 473, 83, 134, 139 },
- { 484, 127, 255, 0 },
- { 495, 127, 255, 0 },
- { 507, 118, 238, 0 },
- { 519, 102, 205, 0 },
- { 531, 69, 139, 0 },
- { 543, 210, 105, 30 },
- { 553, 255, 127, 36 },
- { 564, 238, 118, 33 },
- { 575, 205, 102, 29 },
- { 586, 139, 69, 19 },
- { 597, 255, 127, 80 },
- { 603, 255, 114, 86 },
- { 610, 238, 106, 80 },
- { 617, 205, 91, 69 },
- { 624, 139, 62, 47 },
- { 631, 100, 149, 237 },
- { 647, 100, 149, 237 },
- { 662, 255, 248, 220 },
- { 671, 255, 248, 220 },
- { 681, 238, 232, 205 },
- { 691, 205, 200, 177 },
- { 701, 139, 136, 120 },
- { 711, 0, 255, 255 },
- { 716, 0, 255, 255 },
- { 722, 0, 238, 238 },
- { 728, 0, 205, 205 },
- { 734, 0, 139, 139 },
- { 740, 0, 0, 139 },
- { 750, 0, 139, 139 },
- { 760, 184, 134, 11 },
- { 775, 169, 169, 169 },
- { 785, 0, 100, 0 },
- { 796, 169, 169, 169 },
- { 806, 189, 183, 107 },
- { 817, 139, 0, 139 },
- { 830, 85, 107, 47 },
- { 847, 255, 140, 0 },
- { 859, 153, 50, 204 },
- { 871, 139, 0, 0 },
- { 880, 233, 150, 122 },
- { 892, 143, 188, 143 },
- { 907, 72, 61, 139 },
- { 923, 47, 79, 79 },
- { 939, 47, 79, 79 },
- { 955, 0, 206, 209 },
- { 970, 148, 0, 211 },
- { 982, 0, 0, 139 },
- { 991, 0, 139, 139 },
- { 1000, 184, 134, 11 },
- { 1014, 255, 185, 15 },
- { 1029, 238, 173, 14 },
- { 1044, 205, 149, 12 },
- { 1059, 139, 101, 8 },
- { 1074, 169, 169, 169 },
- { 1083, 0, 100, 0 },
- { 1093, 169, 169, 169 },
- { 1102, 189, 183, 107 },
- { 1112, 139, 0, 139 },
- { 1124, 85, 107, 47 },
- { 1139, 202, 255, 112 },
- { 1155, 188, 238, 104 },
- { 1171, 162, 205, 90 },
- { 1187, 110, 139, 61 },
- { 1203, 255, 140, 0 },
- { 1214, 255, 127, 0 },
- { 1226, 238, 118, 0 },
- { 1238, 205, 102, 0 },
- { 1250, 139, 69, 0 },
- { 1262, 153, 50, 204 },
- { 1273, 191, 62, 255 },
- { 1285, 178, 58, 238 },
- { 1297, 154, 50, 205 },
- { 1309, 104, 34, 139 },
- { 1321, 139, 0, 0 },
- { 1329, 233, 150, 122 },
- { 1340, 143, 188, 143 },
- { 1353, 193, 255, 193 },
- { 1367, 180, 238, 180 },
- { 1381, 155, 205, 155 },
- { 1395, 105, 139, 105 },
- { 1409, 72, 61, 139 },
- { 1423, 47, 79, 79 },
- { 1437, 151, 255, 255 },
- { 1452, 141, 238, 238 },
- { 1467, 121, 205, 205 },
- { 1482, 82, 139, 139 },
- { 1497, 47, 79, 79 },
- { 1511, 0, 206, 209 },
- { 1525, 148, 0, 211 },
- { 1536, 255, 20, 147 },
- { 1546, 0, 191, 255 },
- { 1560, 255, 20, 147 },
- { 1569, 255, 20, 147 },
- { 1579, 238, 18, 137 },
- { 1589, 205, 16, 118 },
- { 1599, 139, 10, 80 },
- { 1609, 0, 191, 255 },
- { 1621, 0, 191, 255 },
- { 1634, 0, 178, 238 },
- { 1647, 0, 154, 205 },
- { 1660, 0, 104, 139 },
- { 1673, 105, 105, 105 },
- { 1682, 105, 105, 105 },
- { 1691, 105, 105, 105 },
- { 1699, 105, 105, 105 },
- { 1707, 30, 144, 255 },
- { 1719, 30, 144, 255 },
- { 1730, 30, 144, 255 },
- { 1742, 28, 134, 238 },
- { 1754, 24, 116, 205 },
- { 1766, 16, 78, 139 },
- { 1778, 178, 34, 34 },
- { 1788, 255, 48, 48 },
- { 1799, 238, 44, 44 },
- { 1810, 205, 38, 38 },
- { 1821, 139, 26, 26 },
- { 1832, 255, 250, 240 },
- { 1845, 255, 250, 240 },
- { 1857, 34, 139, 34 },
- { 1870, 34, 139, 34 },
- { 1882, 220, 220, 220 },
- { 1892, 248, 248, 255 },
- { 1904, 248, 248, 255 },
- { 1915, 255, 215, 0 },
- { 1920, 255, 215, 0 },
- { 1926, 238, 201, 0 },
- { 1932, 205, 173, 0 },
- { 1938, 139, 117, 0 },
- { 1944, 218, 165, 32 },
- { 1954, 255, 193, 37 },
- { 1965, 238, 180, 34 },
- { 1976, 205, 155, 29 },
- { 1987, 139, 105, 20 },
- { 1998, 190, 190, 190 },
- { 2003, 0, 0, 0 },
- { 2009, 3, 3, 3 },
- { 2015, 26, 26, 26 },
- { 2022, 255, 255, 255 },
- { 2030, 28, 28, 28 },
- { 2037, 31, 31, 31 },
- { 2044, 33, 33, 33 },
- { 2051, 36, 36, 36 },
- { 2058, 38, 38, 38 },
- { 2065, 41, 41, 41 },
- { 2072, 43, 43, 43 },
- { 2079, 46, 46, 46 },
- { 2086, 48, 48, 48 },
- { 2093, 5, 5, 5 },
- { 2099, 51, 51, 51 },
- { 2106, 54, 54, 54 },
- { 2113, 56, 56, 56 },
- { 2120, 59, 59, 59 },
- { 2127, 61, 61, 61 },
- { 2134, 64, 64, 64 },
- { 2141, 66, 66, 66 },
- { 2148, 69, 69, 69 },
- { 2155, 71, 71, 71 },
- { 2162, 74, 74, 74 },
- { 2169, 8, 8, 8 },
- { 2175, 77, 77, 77 },
- { 2182, 79, 79, 79 },
- { 2189, 82, 82, 82 },
- { 2196, 84, 84, 84 },
- { 2203, 87, 87, 87 },
- { 2210, 89, 89, 89 },
- { 2217, 92, 92, 92 },
- { 2224, 94, 94, 94 },
- { 2231, 97, 97, 97 },
- { 2238, 99, 99, 99 },
- { 2245, 10, 10, 10 },
- { 2251, 102, 102, 102 },
- { 2258, 105, 105, 105 },
- { 2265, 107, 107, 107 },
- { 2272, 110, 110, 110 },
- { 2279, 112, 112, 112 },
- { 2286, 115, 115, 115 },
- { 2293, 117, 117, 117 },
- { 2300, 120, 120, 120 },
- { 2307, 122, 122, 122 },
- { 2314, 125, 125, 125 },
- { 2321, 13, 13, 13 },
- { 2327, 127, 127, 127 },
- { 2334, 130, 130, 130 },
- { 2341, 133, 133, 133 },
- { 2348, 135, 135, 135 },
- { 2355, 138, 138, 138 },
- { 2362, 140, 140, 140 },
- { 2369, 143, 143, 143 },
- { 2376, 145, 145, 145 },
- { 2383, 148, 148, 148 },
- { 2390, 150, 150, 150 },
- { 2397, 15, 15, 15 },
- { 2403, 153, 153, 153 },
- { 2410, 156, 156, 156 },
- { 2417, 158, 158, 158 },
- { 2424, 161, 161, 161 },
- { 2431, 163, 163, 163 },
- { 2438, 166, 166, 166 },
- { 2445, 168, 168, 168 },
- { 2452, 171, 171, 171 },
- { 2459, 173, 173, 173 },
- { 2466, 176, 176, 176 },
- { 2473, 18, 18, 18 },
- { 2479, 179, 179, 179 },
- { 2486, 181, 181, 181 },
- { 2493, 184, 184, 184 },
- { 2500, 186, 186, 186 },
- { 2507, 189, 189, 189 },
- { 2514, 191, 191, 191 },
- { 2521, 194, 194, 194 },
- { 2528, 196, 196, 196 },
- { 2535, 199, 199, 199 },
- { 2542, 201, 201, 201 },
- { 2549, 20, 20, 20 },
- { 2555, 204, 204, 204 },
- { 2562, 207, 207, 207 },
- { 2569, 209, 209, 209 },
- { 2576, 212, 212, 212 },
- { 2583, 214, 214, 214 },
- { 2590, 217, 217, 217 },
- { 2597, 219, 219, 219 },
- { 2604, 222, 222, 222 },
- { 2611, 224, 224, 224 },
- { 2618, 227, 227, 227 },
- { 2625, 23, 23, 23 },
- { 2631, 229, 229, 229 },
- { 2638, 232, 232, 232 },
- { 2645, 235, 235, 235 },
- { 2652, 237, 237, 237 },
- { 2659, 240, 240, 240 },
- { 2666, 242, 242, 242 },
- { 2673, 245, 245, 245 },
- { 2680, 247, 247, 247 },
- { 2687, 250, 250, 250 },
- { 2694, 252, 252, 252 },
- { 2701, 0, 255, 0 },
- { 2707, 173, 255, 47 },
- { 2720, 0, 255, 0 },
- { 2727, 0, 238, 0 },
- { 2734, 0, 205, 0 },
- { 2741, 0, 139, 0 },
- { 2748, 173, 255, 47 },
- { 2760, 190, 190, 190 },
- { 2765, 0, 0, 0 },
- { 2771, 3, 3, 3 },
- { 2777, 26, 26, 26 },
- { 2784, 255, 255, 255 },
- { 2792, 28, 28, 28 },
- { 2799, 31, 31, 31 },
- { 2806, 33, 33, 33 },
- { 2813, 36, 36, 36 },
- { 2820, 38, 38, 38 },
- { 2827, 41, 41, 41 },
- { 2834, 43, 43, 43 },
- { 2841, 46, 46, 46 },
- { 2848, 48, 48, 48 },
- { 2855, 5, 5, 5 },
- { 2861, 51, 51, 51 },
- { 2868, 54, 54, 54 },
- { 2875, 56, 56, 56 },
- { 2882, 59, 59, 59 },
- { 2889, 61, 61, 61 },
- { 2896, 64, 64, 64 },
- { 2903, 66, 66, 66 },
- { 2910, 69, 69, 69 },
- { 2917, 71, 71, 71 },
- { 2924, 74, 74, 74 },
- { 2931, 8, 8, 8 },
- { 2937, 77, 77, 77 },
- { 2944, 79, 79, 79 },
- { 2951, 82, 82, 82 },
- { 2958, 84, 84, 84 },
- { 2965, 87, 87, 87 },
- { 2972, 89, 89, 89 },
- { 2979, 92, 92, 92 },
- { 2986, 94, 94, 94 },
- { 2993, 97, 97, 97 },
- { 3000, 99, 99, 99 },
- { 3007, 10, 10, 10 },
- { 3013, 102, 102, 102 },
- { 3020, 105, 105, 105 },
- { 3027, 107, 107, 107 },
- { 3034, 110, 110, 110 },
- { 3041, 112, 112, 112 },
- { 3048, 115, 115, 115 },
- { 3055, 117, 117, 117 },
- { 3062, 120, 120, 120 },
- { 3069, 122, 122, 122 },
- { 3076, 125, 125, 125 },
- { 3083, 13, 13, 13 },
- { 3089, 127, 127, 127 },
- { 3096, 130, 130, 130 },
- { 3103, 133, 133, 133 },
- { 3110, 135, 135, 135 },
- { 3117, 138, 138, 138 },
- { 3124, 140, 140, 140 },
- { 3131, 143, 143, 143 },
- { 3138, 145, 145, 145 },
- { 3145, 148, 148, 148 },
- { 3152, 150, 150, 150 },
- { 3159, 15, 15, 15 },
- { 3165, 153, 153, 153 },
- { 3172, 156, 156, 156 },
- { 3179, 158, 158, 158 },
- { 3186, 161, 161, 161 },
- { 3193, 163, 163, 163 },
- { 3200, 166, 166, 166 },
- { 3207, 168, 168, 168 },
- { 3214, 171, 171, 171 },
- { 3221, 173, 173, 173 },
- { 3228, 176, 176, 176 },
- { 3235, 18, 18, 18 },
- { 3241, 179, 179, 179 },
- { 3248, 181, 181, 181 },
- { 3255, 184, 184, 184 },
- { 3262, 186, 186, 186 },
- { 3269, 189, 189, 189 },
- { 3276, 191, 191, 191 },
- { 3283, 194, 194, 194 },
- { 3290, 196, 196, 196 },
- { 3297, 199, 199, 199 },
- { 3304, 201, 201, 201 },
- { 3311, 20, 20, 20 },
- { 3317, 204, 204, 204 },
- { 3324, 207, 207, 207 },
- { 3331, 209, 209, 209 },
- { 3338, 212, 212, 212 },
- { 3345, 214, 214, 214 },
- { 3352, 217, 217, 217 },
- { 3359, 219, 219, 219 },
- { 3366, 222, 222, 222 },
- { 3373, 224, 224, 224 },
- { 3380, 227, 227, 227 },
- { 3387, 23, 23, 23 },
- { 3393, 229, 229, 229 },
- { 3400, 232, 232, 232 },
- { 3407, 235, 235, 235 },
- { 3414, 237, 237, 237 },
- { 3421, 240, 240, 240 },
- { 3428, 242, 242, 242 },
- { 3435, 245, 245, 245 },
- { 3442, 247, 247, 247 },
- { 3449, 250, 250, 250 },
- { 3456, 252, 252, 252 },
- { 3463, 240, 255, 240 },
- { 3472, 240, 255, 240 },
- { 3482, 224, 238, 224 },
- { 3492, 193, 205, 193 },
- { 3502, 131, 139, 131 },
- { 3512, 255, 105, 180 },
- { 3521, 255, 105, 180 },
- { 3529, 255, 110, 180 },
- { 3538, 238, 106, 167 },
- { 3547, 205, 96, 144 },
- { 3556, 139, 58, 98 },
- { 3565, 205, 92, 92 },
- { 3576, 205, 92, 92 },
- { 3586, 255, 106, 106 },
- { 3597, 238, 99, 99 },
- { 3608, 205, 85, 85 },
- { 3619, 139, 58, 58 },
- { 3630, 255, 255, 240 },
- { 3636, 255, 255, 240 },
- { 3643, 238, 238, 224 },
- { 3650, 205, 205, 193 },
- { 3657, 139, 139, 131 },
- { 3664, 240, 230, 140 },
- { 3670, 255, 246, 143 },
- { 3677, 238, 230, 133 },
- { 3684, 205, 198, 115 },
- { 3691, 139, 134, 78 },
- { 3698, 230, 230, 250 },
- { 3707, 255, 240, 245 },
- { 3722, 255, 240, 245 },
- { 3736, 255, 240, 245 },
- { 3751, 238, 224, 229 },
- { 3766, 205, 193, 197 },
- { 3781, 139, 131, 134 },
- { 3796, 124, 252, 0 },
- { 3807, 124, 252, 0 },
- { 3817, 255, 250, 205 },
- { 3831, 255, 250, 205 },
- { 3844, 255, 250, 205 },
- { 3858, 238, 233, 191 },
- { 3872, 205, 201, 165 },
- { 3886, 139, 137, 112 },
- { 3900, 173, 216, 230 },
- { 3911, 240, 128, 128 },
- { 3923, 224, 255, 255 },
- { 3934, 238, 221, 130 },
- { 3950, 250, 250, 210 },
- { 3973, 211, 211, 211 },
- { 3984, 144, 238, 144 },
- { 3996, 211, 211, 211 },
- { 4007, 255, 182, 193 },
- { 4018, 255, 160, 122 },
- { 4031, 32, 178, 170 },
- { 4047, 135, 206, 250 },
- { 4062, 132, 112, 255 },
- { 4079, 119, 136, 153 },
- { 4096, 119, 136, 153 },
- { 4113, 176, 196, 222 },
- { 4130, 255, 255, 224 },
- { 4143, 173, 216, 230 },
- { 4153, 191, 239, 255 },
- { 4164, 178, 223, 238 },
- { 4175, 154, 192, 205 },
- { 4186, 104, 131, 139 },
- { 4197, 240, 128, 128 },
- { 4208, 224, 255, 255 },
- { 4218, 224, 255, 255 },
- { 4229, 209, 238, 238 },
- { 4240, 180, 205, 205 },
- { 4251, 122, 139, 139 },
- { 4262, 238, 221, 130 },
- { 4277, 255, 236, 139 },
- { 4293, 238, 220, 130 },
- { 4309, 205, 190, 112 },
- { 4325, 139, 129, 76 },
- { 4341, 250, 250, 210 },
- { 4362, 211, 211, 211 },
- { 4372, 144, 238, 144 },
- { 4383, 211, 211, 211 },
- { 4393, 255, 182, 193 },
- { 4403, 255, 174, 185 },
- { 4414, 238, 162, 173 },
- { 4425, 205, 140, 149 },
- { 4436, 139, 95, 101 },
- { 4447, 255, 160, 122 },
- { 4459, 255, 160, 122 },
- { 4472, 238, 149, 114 },
- { 4485, 205, 129, 98 },
- { 4498, 139, 87, 66 },
- { 4511, 32, 178, 170 },
- { 4525, 135, 206, 250 },
- { 4538, 176, 226, 255 },
- { 4552, 164, 211, 238 },
- { 4566, 141, 182, 205 },
- { 4580, 96, 123, 139 },
- { 4594, 132, 112, 255 },
- { 4609, 119, 136, 153 },
- { 4624, 119, 136, 153 },
- { 4639, 176, 196, 222 },
- { 4654, 202, 225, 255 },
- { 4670, 188, 210, 238 },
- { 4686, 162, 181, 205 },
- { 4702, 110, 123, 139 },
- { 4718, 255, 255, 224 },
- { 4730, 255, 255, 224 },
- { 4743, 238, 238, 209 },
- { 4756, 205, 205, 180 },
- { 4769, 139, 139, 122 },
- { 4782, 50, 205, 50 },
- { 4793, 50, 205, 50 },
- { 4803, 250, 240, 230 },
- { 4809, 255, 0, 255 },
- { 4817, 255, 0, 255 },
- { 4826, 238, 0, 238 },
- { 4835, 205, 0, 205 },
- { 4844, 139, 0, 139 },
- { 4853, 176, 48, 96 },
- { 4860, 255, 52, 179 },
- { 4868, 238, 48, 167 },
- { 4876, 205, 41, 144 },
- { 4884, 139, 28, 98 },
- { 4892, 102, 205, 170 },
- { 4910, 0, 0, 205 },
- { 4922, 186, 85, 211 },
- { 4936, 147, 112, 219 },
- { 4950, 60, 179, 113 },
- { 4967, 123, 104, 238 },
- { 4985, 0, 250, 154 },
- { 5005, 72, 209, 204 },
- { 5022, 199, 21, 133 },
- { 5040, 102, 205, 170 },
- { 5057, 0, 0, 205 },
- { 5068, 186, 85, 211 },
- { 5081, 224, 102, 255 },
- { 5095, 209, 95, 238 },
- { 5109, 180, 82, 205 },
- { 5123, 122, 55, 139 },
- { 5137, 147, 112, 219 },
- { 5150, 171, 130, 255 },
- { 5164, 159, 121, 238 },
- { 5178, 137, 104, 205 },
- { 5192, 93, 71, 139 },
- { 5206, 60, 179, 113 },
- { 5221, 123, 104, 238 },
- { 5237, 0, 250, 154 },
- { 5255, 72, 209, 204 },
- { 5271, 199, 21, 133 },
- { 5287, 25, 25, 112 },
- { 5301, 25, 25, 112 },
- { 5314, 245, 255, 250 },
- { 5325, 245, 255, 250 },
- { 5335, 255, 228, 225 },
- { 5346, 255, 228, 225 },
- { 5356, 255, 228, 225 },
- { 5367, 238, 213, 210 },
- { 5378, 205, 183, 181 },
- { 5389, 139, 125, 123 },
- { 5400, 255, 228, 181 },
- { 5409, 255, 222, 173 },
- { 5422, 255, 222, 173 },
- { 5434, 255, 222, 173 },
- { 5447, 238, 207, 161 },
- { 5460, 205, 179, 139 },
- { 5473, 139, 121, 94 },
- { 5486, 0, 0, 128 },
- { 5491, 0, 0, 128 },
- { 5501, 0, 0, 128 },
- { 5510, 253, 245, 230 },
- { 5519, 253, 245, 230 },
- { 5527, 107, 142, 35 },
- { 5538, 107, 142, 35 },
- { 5548, 192, 255, 62 },
- { 5559, 179, 238, 58 },
- { 5570, 154, 205, 50 },
- { 5581, 105, 139, 34 },
- { 5592, 255, 165, 0 },
- { 5599, 255, 69, 0 },
- { 5610, 255, 165, 0 },
- { 5618, 238, 154, 0 },
- { 5626, 205, 133, 0 },
- { 5634, 139, 90, 0 },
- { 5642, 255, 69, 0 },
- { 5652, 255, 69, 0 },
- { 5663, 238, 64, 0 },
- { 5674, 205, 55, 0 },
- { 5685, 139, 37, 0 },
- { 5696, 218, 112, 214 },
- { 5703, 255, 131, 250 },
- { 5711, 238, 122, 233 },
- { 5719, 205, 105, 201 },
- { 5727, 139, 71, 137 },
- { 5735, 238, 232, 170 },
- { 5750, 152, 251, 152 },
- { 5761, 175, 238, 238 },
- { 5776, 219, 112, 147 },
- { 5792, 238, 232, 170 },
- { 5806, 152, 251, 152 },
- { 5816, 154, 255, 154 },
- { 5827, 144, 238, 144 },
- { 5838, 124, 205, 124 },
- { 5849, 84, 139, 84 },
- { 5860, 175, 238, 238 },
- { 5874, 187, 255, 255 },
- { 5889, 174, 238, 238 },
- { 5904, 150, 205, 205 },
- { 5919, 102, 139, 139 },
- { 5934, 219, 112, 147 },
- { 5948, 255, 130, 171 },
- { 5963, 238, 121, 159 },
- { 5978, 205, 104, 137 },
- { 5993, 139, 71, 93 },
- { 6008, 255, 239, 213 },
- { 6020, 255, 239, 213 },
- { 6031, 255, 218, 185 },
- { 6042, 255, 218, 185 },
- { 6052, 255, 218, 185 },
- { 6063, 238, 203, 173 },
- { 6074, 205, 175, 149 },
- { 6085, 139, 119, 101 },
- { 6096, 205, 133, 63 },
- { 6101, 255, 192, 203 },
- { 6106, 255, 181, 197 },
- { 6112, 238, 169, 184 },
- { 6118, 205, 145, 158 },
- { 6124, 139, 99, 108 },
- { 6130, 221, 160, 221 },
- { 6135, 255, 187, 255 },
- { 6141, 238, 174, 238 },
- { 6147, 205, 150, 205 },
- { 6153, 139, 102, 139 },
- { 6159, 176, 224, 230 },
- { 6171, 176, 224, 230 },
- { 6182, 160, 32, 240 },
- { 6189, 155, 48, 255 },
- { 6197, 145, 44, 238 },
- { 6205, 125, 38, 205 },
- { 6213, 85, 26, 139 },
- { 6221, 255, 0, 0 },
- { 6225, 255, 0, 0 },
- { 6230, 238, 0, 0 },
- { 6235, 205, 0, 0 },
- { 6240, 139, 0, 0 },
- { 6245, 188, 143, 143 },
- { 6256, 188, 143, 143 },
- { 6266, 255, 193, 193 },
- { 6277, 238, 180, 180 },
- { 6288, 205, 155, 155 },
- { 6299, 139, 105, 105 },
- { 6310, 65, 105, 225 },
- { 6321, 65, 105, 225 },
- { 6331, 72, 118, 255 },
- { 6342, 67, 110, 238 },
- { 6353, 58, 95, 205 },
- { 6364, 39, 64, 139 },
- { 6375, 139, 69, 19 },
- { 6388, 139, 69, 19 },
- { 6400, 250, 128, 114 },
- { 6407, 255, 140, 105 },
- { 6415, 238, 130, 98 },
- { 6423, 205, 112, 84 },
- { 6431, 139, 76, 57 },
- { 6439, 244, 164, 96 },
- { 6451, 244, 164, 96 },
- { 6462, 46, 139, 87 },
- { 6472, 46, 139, 87 },
- { 6481, 84, 255, 159 },
- { 6491, 78, 238, 148 },
- { 6501, 67, 205, 128 },
- { 6511, 46, 139, 87 },
- { 6521, 255, 245, 238 },
- { 6530, 255, 245, 238 },
- { 6540, 238, 229, 222 },
- { 6550, 205, 197, 191 },
- { 6560, 139, 134, 130 },
- { 6570, 160, 82, 45 },
- { 6577, 255, 130, 71 },
- { 6585, 238, 121, 66 },
- { 6593, 205, 104, 57 },
- { 6601, 139, 71, 38 },
- { 6609, 135, 206, 235 },
- { 6618, 135, 206, 235 },
- { 6626, 135, 206, 255 },
- { 6635, 126, 192, 238 },
- { 6644, 108, 166, 205 },
- { 6653, 74, 112, 139 },
- { 6662, 106, 90, 205 },
- { 6673, 112, 128, 144 },
- { 6684, 112, 128, 144 },
- { 6695, 106, 90, 205 },
- { 6705, 131, 111, 255 },
- { 6716, 122, 103, 238 },
- { 6727, 105, 89, 205 },
- { 6738, 71, 60, 139 },
- { 6749, 112, 128, 144 },
- { 6759, 198, 226, 255 },
- { 6770, 185, 211, 238 },
- { 6781, 159, 182, 205 },
- { 6792, 108, 123, 139 },
- { 6803, 112, 128, 144 },
- { 6813, 255, 250, 250 },
- { 6818, 255, 250, 250 },
- { 6824, 238, 233, 233 },
- { 6830, 205, 201, 201 },
- { 6836, 139, 137, 137 },
- { 6842, 0, 255, 127 },
- { 6855, 0, 255, 127 },
- { 6867, 0, 255, 127 },
- { 6880, 0, 238, 118 },
- { 6893, 0, 205, 102 },
- { 6906, 0, 139, 69 },
- { 6919, 70, 130, 180 },
- { 6930, 70, 130, 180 },
- { 6940, 99, 184, 255 },
- { 6951, 92, 172, 238 },
- { 6962, 79, 148, 205 },
- { 6973, 54, 100, 139 },
- { 6984, 210, 180, 140 },
- { 6988, 255, 165, 79 },
- { 6993, 238, 154, 73 },
- { 6998, 205, 133, 63 },
- { 7003, 139, 90, 43 },
- { 7008, 216, 191, 216 },
- { 7016, 255, 225, 255 },
- { 7025, 238, 210, 238 },
- { 7034, 205, 181, 205 },
- { 7043, 139, 123, 139 },
- { 7052, 255, 99, 71 },
- { 7059, 255, 99, 71 },
- { 7067, 238, 92, 66 },
- { 7075, 205, 79, 57 },
- { 7083, 139, 54, 38 },
- { 7091, 64, 224, 208 },
- { 7101, 0, 245, 255 },
- { 7112, 0, 229, 238 },
- { 7123, 0, 197, 205 },
- { 7134, 0, 134, 139 },
- { 7145, 238, 130, 238 },
- { 7152, 208, 32, 144 },
- { 7163, 208, 32, 144 },
- { 7173, 255, 62, 150 },
- { 7184, 238, 58, 140 },
- { 7195, 205, 50, 120 },
- { 7206, 139, 34, 82 },
- { 7217, 245, 222, 179 },
- { 7223, 255, 231, 186 },
- { 7230, 238, 216, 174 },
- { 7237, 205, 186, 150 },
- { 7244, 139, 126, 102 },
- { 7251, 255, 255, 255 },
- { 7257, 245, 245, 245 },
- { 7269, 245, 245, 245 },
- { 7280, 255, 255, 0 },
- { 7287, 154, 205, 50 },
- { 7300, 255, 255, 0 },
- { 7308, 238, 238, 0 },
- { 7316, 205, 205, 0 },
- { 7324, 139, 139, 0 },
- { 7332, 154, 205, 50 }
-};
diff --git a/gdk/Makefile.am b/gdk/Makefile.am
index b8ac4a363b..0716a17d98 100644
--- a/gdk/Makefile.am
+++ b/gdk/Makefile.am
@@ -3,12 +3,10 @@ include $(top_srcdir)/Makefile.decl
-include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS =
INTROSPECTION_SCANNER_ARGS = \
- --add-include-path=../gdk \
- --add-include-path=../gdk-pixbuf
+ --add-include-path=../gdk
INTROSPECTION_COMPILER_ARGS = \
--includedir=$(srcdir) \
- --includedir=. \
- --includedir=../gdk-pixbuf
+ --includedir=.
SUBDIRS = $(gdktarget) . tests
DIST_SUBDIRS = win32 x11 quartz directfb tests
@@ -39,7 +37,6 @@ INCLUDES = \
-DGDK_COMPILATION \
-I$(top_srcdir) \
-I$(top_builddir)/gdk \
- -I$(top_srcdir)/gdk-pixbuf \
$(GTK_DEBUG_FLAGS) \
$(GDK_DEP_CFLAGS)
@@ -176,24 +173,20 @@ common_sources = \
gdkmarshalers.c \
gdkmarshalers.h
-libgdk_directfb_3_0_la_SOURCES = $(common_sources)
-libgdk_directfb_3_0_la_LIBADD = directfb/libgdk-directfb.la $(GDK_DEP_LIBS) \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la
+libgdk_directfb_3_0_la_SOURCES = $(common_sources)
+libgdk_directfb_3_0_la_LIBADD = directfb/libgdk-directfb.la $(GDK_DEP_LIBS)
libgdk_directfb_3_0_la_LDFLAGS = $(LDADD)
libgdk_x11_3_0_la_SOURCES = $(common_sources)
-libgdk_x11_3_0_la_LIBADD = x11/libgdk-x11.la $(GDK_DEP_LIBS) \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la
+libgdk_x11_3_0_la_LIBADD = x11/libgdk-x11.la $(GDK_DEP_LIBS)
libgdk_x11_3_0_la_LDFLAGS = $(LDADD)
libgdk_quartz_3_0_la_SOURCES = $(common_sources) gdkkeynames.c
-libgdk_quartz_3_0_la_LIBADD = quartz/libgdk-quartz.la $(GDK_DEP_LIBS) \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la
+libgdk_quartz_3_0_la_LIBADD = quartz/libgdk-quartz.la $(GDK_DEP_LIBS)
libgdk_quartz_3_0_la_LDFLAGS = $(LDADD)
libgdk_win32_3_0_la_SOURCES = $(common_sources) gdkkeynames.c
-libgdk_win32_3_0_la_LIBADD = win32/libgdk-win32.la $(GDK_DEP_LIBS) \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la
+libgdk_win32_3_0_la_LIBADD = win32/libgdk-win32.la $(GDK_DEP_LIBS)
libgdk_win32_3_0_la_DEPENDENCIES = win32/libgdk-win32.la win32/rc/gdk-win32-res.o gdk.def
libgdk_win32_3_0_la_LDFLAGS = -Wl,win32/rc/gdk-win32-res.o -export-symbols $(srcdir)/gdk.def $(LDADD)
@@ -206,8 +199,8 @@ introspection_files = \
gdkenumtypes.h
Gdk-3.0.gir: $(gdktargetlib) Makefile
-Gdk_3_0_gir_SCANNERFLAGS = --strip-prefix=Gdk --add-include-path=../gdk-pixbuf
-Gdk_3_0_gir_INCLUDES = Gio-2.0 GdkPixbuf-3.0 Pango-1.0
+Gdk_3_0_gir_SCANNERFLAGS = --strip-prefix=Gdk
+Gdk_3_0_gir_INCLUDES = Gio-2.0 GdkPixbuf-2.0 Pango-1.0
Gdk_3_0_gir_LIBS = $(gdktargetlib)
Gdk_3_0_gir_FILES = $(addprefix $(srcdir)/,$(introspection_files))
Gdk_3_0_gir_CFLAGS = $(INCLUDES)
@@ -219,8 +212,8 @@ x11_introspection_files = \
x11/gdkx.h
GdkX11-3.0.gir: $(gdktargetlib) Makefile
-GdkX11_3_0_gir_SCANNERFLAGS = --strip-prefix=gdk_x11 --add-include-path=../gdk-pixbuf --add-include-path=.
-GdkX11_3_0_gir_INCLUDES = Gio-2.0 Gdk-3.0 GdkPixbuf-3.0 Pango-1.0 xlib-2.0
+GdkX11_3_0_gir_SCANNERFLAGS = --strip-prefix=gdk_x11
+GdkX11_3_0_gir_INCLUDES = Gio-2.0 Gdk-3.0 GdkPixbuf-2.0 Pango-1.0 xlib-2.0
GdkX11_3_0_gir_LIBS = $(gdktargetlib)
GdkX11_3_0_gir_FILES = $(addprefix $(srcdir)/,$(x11_introspection_files))
GdkX11_3_0_gir_CFLAGS = $(INCLUDES) -L$(top_builddir)/gdk
diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c
index d2a3317a93..47a2a7d99a 100644
--- a/gdk/gdkdraw.c
+++ b/gdk/gdkdraw.c
@@ -27,12 +27,12 @@
#include "config.h"
#include <math.h>
#include <pango/pangocairo.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
#include "gdkcairo.h"
#include "gdkdrawable.h"
#include "gdkinternals.h"
#include "gdkwindow.h"
#include "gdkscreen.h"
-#include "gdk-pixbuf-private.h"
#include "gdkpixbuf.h"
#include "gdkalias.h"
@@ -1377,20 +1377,21 @@ gdk_drawable_real_draw_pixbuf (GdkDrawable *drawable,
GdkDrawable *real_drawable;
g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
- g_return_if_fail (pixbuf->colorspace == GDK_COLORSPACE_RGB);
- g_return_if_fail (pixbuf->n_channels == 3 || pixbuf->n_channels == 4);
- g_return_if_fail (pixbuf->bits_per_sample == 8);
+ g_return_if_fail (gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB);
+ g_return_if_fail (gdk_pixbuf_get_n_channels (pixbuf) == 3 ||
+ gdk_pixbuf_get_n_channels (pixbuf) == 4);
+ g_return_if_fail (gdk_pixbuf_get_bits_per_sample (pixbuf) == 8);
g_return_if_fail (drawable != NULL);
if (width == -1)
- width = pixbuf->width;
+ width = gdk_pixbuf_get_width (pixbuf);
if (height == -1)
- height = pixbuf->height;
+ height = gdk_pixbuf_get_height (pixbuf);
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 (src_x >= 0 && src_x + width <= gdk_pixbuf_get_width (pixbuf));
+ g_return_if_fail (src_y >= 0 && src_y + height <= gdk_pixbuf_get_height (pixbuf));
/* Clip to the drawable; this is required for get_from_drawable() so
* can't be done implicitly
@@ -1460,7 +1461,7 @@ gdk_drawable_real_draw_pixbuf (GdkDrawable *drawable,
else
real_drawable = GDK_PIXMAP_OBJECT (drawable)->impl;
- if (pixbuf->has_alpha)
+ if (gdk_pixbuf_get_has_alpha (pixbuf))
{
GdkVisual *visual = gdk_drawable_get_visual (drawable);
void (*composite_func) (guchar *src_buf,
@@ -1523,8 +1524,8 @@ gdk_drawable_real_draw_pixbuf (GdkDrawable *drawable,
dest_x + x0, dest_y + y0,
xs0, ys0,
width1, height1);
- (*composite_func) (pixbuf->pixels + (src_y + y0) * pixbuf->rowstride + (src_x + x0) * 4,
- pixbuf->rowstride,
+ (*composite_func) (gdk_pixbuf_get_pixels (pixbuf) + (src_y + y0) * gdk_pixbuf_get_rowstride (pixbuf) + (src_x + x0) * 4,
+ gdk_pixbuf_get_rowstride (pixbuf),
(guchar*)image->mem + ys0 * image->bpl + xs0 * image->bpp,
image->bpl,
visual->byte_order,
@@ -1551,10 +1552,10 @@ gdk_drawable_real_draw_pixbuf (GdkDrawable *drawable,
width, height);
if (composited)
- composite (pixbuf->pixels + src_y * pixbuf->rowstride + src_x * 4,
- pixbuf->rowstride,
- composited->pixels,
- composited->rowstride,
+ composite (gdk_pixbuf_get_pixels (pixbuf) + src_y * gdk_pixbuf_get_rowstride (pixbuf) + src_x * 4,
+ gdk_pixbuf_get_rowstride (pixbuf),
+ gdk_pixbuf_get_pixels (composited),
+ gdk_pixbuf_get_rowstride (composited),
width, height);
}
}
@@ -1566,26 +1567,26 @@ gdk_drawable_real_draw_pixbuf (GdkDrawable *drawable,
pixbuf = composited;
}
- if (pixbuf->n_channels == 4)
+ if (gdk_pixbuf_get_n_channels (pixbuf) == 4)
{
- guchar *buf = pixbuf->pixels + src_y * pixbuf->rowstride + src_x * 4;
+ guchar *buf = gdk_pixbuf_get_pixels (pixbuf) + src_y * gdk_pixbuf_get_rowstride (pixbuf) + src_x * 4;
gdk_draw_rgb_32_image_dithalign (real_drawable, gc,
dest_x, dest_y,
width, height,
dither,
- buf, pixbuf->rowstride,
+ buf, gdk_pixbuf_get_rowstride (pixbuf),
x_dither, y_dither);
}
else /* n_channels == 3 */
{
- guchar *buf = pixbuf->pixels + src_y * pixbuf->rowstride + src_x * 3;
+ guchar *buf = gdk_pixbuf_get_pixels (pixbuf) + src_y * gdk_pixbuf_get_rowstride (pixbuf) + src_x * 3;
gdk_draw_rgb_image_dithalign (real_drawable, gc,
dest_x, dest_y,
width, height,
dither,
- buf, pixbuf->rowstride,
+ buf, gdk_pixbuf_get_rowstride (pixbuf),
x_dither, y_dither);
}
diff --git a/gdk/gdkpixbuf-drawable.c b/gdk/gdkpixbuf-drawable.c
index 036ff521d3..ff85cb7e7a 100644
--- a/gdk/gdkpixbuf-drawable.c
+++ b/gdk/gdkpixbuf-drawable.c
@@ -25,13 +25,14 @@
#include "config.h"
#include <stdio.h>
#include <string.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
#include "gdkcolor.h"
#include "gdkimage.h"
#include "gdkvisual.h"
#include "gdkwindow.h"
#include "gdkpixbuf.h"
#include "gdkpixmap.h"
-#include "gdk-pixbuf-private.h"
#include "gdkinternals.h"
#include "gdkalias.h"
@@ -1230,9 +1231,10 @@ gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
g_return_val_if_fail (dest_x == 0 && dest_y == 0, NULL);
else
{
- g_return_val_if_fail (dest->colorspace == GDK_COLORSPACE_RGB, NULL);
- g_return_val_if_fail (dest->n_channels == 3 || dest->n_channels == 4, NULL);
- g_return_val_if_fail (dest->bits_per_sample == 8, NULL);
+ g_return_val_if_fail (gdk_pixbuf_get_colorspace (dest) == GDK_COLORSPACE_RGB, NULL);
+ g_return_val_if_fail (gdk_pixbuf_get_n_channels (dest) == 3 ||
+ gdk_pixbuf_get_n_channels (dest) == 4, NULL);
+ g_return_val_if_fail (gdk_pixbuf_get_bits_per_sample (dest) == 8, NULL);
}
if (cmap == NULL)
@@ -1281,8 +1283,8 @@ gdk_pixbuf_get_from_drawable (GdkPixbuf *dest,
if (dest)
{
g_return_val_if_fail (dest_x >= 0 && dest_y >= 0, NULL);
- g_return_val_if_fail (dest_x + width <= dest->width, NULL);
- g_return_val_if_fail (dest_y + height <= dest->height, NULL);
+ g_return_val_if_fail (dest_x + width <= gdk_pixbuf_get_width (dest), NULL);
+ g_return_val_if_fail (dest_y + height <= gdk_pixbuf_get_height (dest), NULL);
}
for (y0 = 0; y0 < height; y0 += GDK_SCRATCH_IMAGE_HEIGHT)
@@ -1348,9 +1350,10 @@ gdk_pixbuf_get_from_image (GdkPixbuf *dest,
g_return_val_if_fail (dest_x == 0 && dest_y == 0, NULL);
else
{
- g_return_val_if_fail (dest->colorspace == GDK_COLORSPACE_RGB, NULL);
- g_return_val_if_fail (dest->n_channels == 3 || dest->n_channels == 4, NULL);
- g_return_val_if_fail (dest->bits_per_sample == 8, NULL);
+ g_return_val_if_fail (gdk_pixbuf_get_colorspace (dest) == GDK_COLORSPACE_RGB, NULL);
+ g_return_val_if_fail (gdk_pixbuf_get_n_channels (dest) == 3 ||
+ gdk_pixbuf_get_n_channels (dest) == 4, NULL);
+ g_return_val_if_fail (gdk_pixbuf_get_bits_per_sample (dest) == 8, NULL);
}
if (cmap == NULL)
@@ -1380,8 +1383,8 @@ gdk_pixbuf_get_from_image (GdkPixbuf *dest,
if (dest)
{
g_return_val_if_fail (dest_x >= 0 && dest_y >= 0, NULL);
- g_return_val_if_fail (dest_x + width <= dest->width, NULL);
- g_return_val_if_fail (dest_y + height <= dest->height, NULL);
+ g_return_val_if_fail (dest_x + width <= gdk_pixbuf_get_width (dest), NULL);
+ g_return_val_if_fail (dest_y + height <= gdk_pixbuf_get_height (dest), NULL);
}
/* Create the pixbuf if needed */
@@ -1392,14 +1395,14 @@ gdk_pixbuf_get_from_image (GdkPixbuf *dest,
return NULL;
}
- alpha = dest->has_alpha;
- rowstride = dest->rowstride;
+ alpha = gdk_pixbuf_get_has_alpha (dest);
+ rowstride = gdk_pixbuf_get_rowstride (dest);
bpp = alpha ? 4 : 3;
/* we offset into the image data based on the position we are
* retrieving from
*/
- rgbconvert (src, dest->pixels +
+ rgbconvert (src, gdk_pixbuf_get_pixels (dest) +
(dest_y * rowstride) + (dest_x * bpp),
rowstride,
alpha,
diff --git a/gdk/gdkpixbuf-render.c b/gdk/gdkpixbuf-render.c
index a0ba77d8b2..614719a82f 100644
--- a/gdk/gdkpixbuf-render.c
+++ b/gdk/gdkpixbuf-render.c
@@ -22,7 +22,7 @@
#include "config.h"
#include <gdk/gdk.h>
-#include "gdk-pixbuf-private.h"
+#include <gdk-pixbuf/gdk-pixbuf.h>
#include "gdkpixbuf.h"
#include "gdkscreen.h"
#include "gdkinternals.h"
@@ -63,20 +63,20 @@ gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf,
int start, start_status;
int status;
- g_return_if_fail (GDK_IS_PIXBUF (pixbuf));
- g_return_if_fail (pixbuf->colorspace == GDK_COLORSPACE_RGB);
- g_return_if_fail (pixbuf->n_channels == 3 || pixbuf->n_channels == 4);
- g_return_if_fail (pixbuf->bits_per_sample == 8);
+ g_return_val_if_fail (gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB, NULL);
+ g_return_val_if_fail (gdk_pixbuf_get_n_channels (pixbuf) == 3 ||
+ gdk_pixbuf_get_n_channels (pixbuf) == 4, NULL);
+ g_return_val_if_fail (gdk_pixbuf_get_bits_per_sample (pixbuf) == 8, NULL);
if (width == -1)
- width = pixbuf->width;
+ width = gdk_pixbuf_get_width (pixbuf);
if (height == -1)
- height = pixbuf->height;
+ height = gdk_pixbuf_get_height (pixbuf);
g_return_if_fail (bitmap != NULL);
g_return_if_fail (width >= 0 && height >= 0);
- g_return_if_fail (src_x >= 0 && src_x + width <= pixbuf->width);
- g_return_if_fail (src_y >= 0 && src_y + height <= pixbuf->height);
+ g_return_if_fail (src_x >= 0 && src_x + width <= gdk_pixbuf_get_width (pixbuf));
+ g_return_if_fail (src_y >= 0 && src_y + height <= gdk_pixbuf_get_height (pixbuf));
g_return_if_fail (alpha_threshold >= 0 && alpha_threshold <= 255);
@@ -85,7 +85,7 @@ gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf,
gc = _gdk_drawable_get_scratch_gc (bitmap, FALSE);
- if (!pixbuf->has_alpha)
+ if (!gdk_pixbuf_get_has_alpha (pixbuf))
{
color.pixel = (alpha_threshold == 255) ? 0 : 1;
gdk_gc_set_foreground (gc, &color);
@@ -102,8 +102,8 @@ gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf,
for (y = 0; y < height; y++)
{
- p = (pixbuf->pixels + (y + src_y) * pixbuf->rowstride + src_x * pixbuf->n_channels
- + pixbuf->n_channels - 1);
+ p = (gdk_pixbuf_get_pixels (pixbuf) + (y + src_y) * gdk_pixbuf_get_rowstride (pixbuf) + src_x * gdk_pixbuf_get_n_channels (pixbuf)
+ + gdk_pixbuf_get_n_channels (pixbuf) - 1);
start = 0;
start_status = *p < alpha_threshold;
@@ -123,7 +123,7 @@ gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf,
start_status = status;
}
- p += pixbuf->n_channels;
+ p += gdk_pixbuf_get_n_channels (pixbuf);
}
if (!start_status)
diff --git a/gdk/x11/Makefile.am b/gdk/x11/Makefile.am
index 2502ac180f..394da9575a 100644
--- a/gdk/x11/Makefile.am
+++ b/gdk/x11/Makefile.am
@@ -87,7 +87,7 @@ libgdkinclude_HEADERS = \
noinst_PROGRAMS = checksettings
-checksettings_LDADD = libgdk-x11.la $(GLIB_LIBS) $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la
+checksettings_LDADD = libgdk-x11.la $(GLIB_LIBS)
TESTS = checksettings
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index cadc72d6f8..502720952d 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -3,12 +3,10 @@ include $(top_srcdir)/Makefile.decl
-include $(INTROSPECTION_MAKEFILE)
INTROSPECTION_GIRS =
INTROSPECTION_SCANNER_ARGS = \
- --add-include-path=../gdk-pixbuf \
--add-include-path=../gdk
INTROSPECTION_COMPILER_ARGS = \
--includedir=$(srcdir) \
--includedir=. \
- --includedir=../gdk-pixbuf \
--includedir=../gdk
if USE_QUARTZ
@@ -50,7 +48,6 @@ INCLUDES = \
-I$(top_builddir)/gtk \
-I$(top_srcdir) -I../gdk \
-I$(top_srcdir)/gdk \
- -I$(top_srcdir)/gdk-pixbuf -I../gdk-pixbuf \
-DGDK_DISABLE_DEPRECATED \
-DGTK_DISABLE_DEPRECATED \
-DGTK_FILE_SYSTEM_ENABLE_UNSUPPORTED \
@@ -124,7 +121,6 @@ endif
libgtkincludedir = $(includedir)/gtk-3.0/gtk
libadd = \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
$(top_builddir)/gdk/$(gdktargetlib) \
$(GTK_DEP_LIBS)
deps =
@@ -908,13 +904,12 @@ distclean-local:
rm -f $(MAINTAINERCLEANFILES); \
fi
-DEPS = $(gtktargetlib) $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la $(top_builddir)/gdk/$(gdktargetlib)
+DEPS = $(gtktargetlib) $(top_builddir)/gdk/$(gdktargetlib)
TEST_DEPS = $(DEPS) immodules.cache
LDADDS = \
$(gtktargetlib) \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
$(top_builddir)/gdk/$(gdktargetlib) \
$(GTK_DEP_LIBS)
@@ -993,16 +988,10 @@ endif
gtk_query_immodules_3_0_DEPENDENCIES = $(DEPS)
gtk_query_immodules_3_0_LDADD = $(LDADDS)
-
gtk_query_immodules_3_0_SOURCES = queryimmodules.c
-gtk_update_icon_cache_3_0_LDADD = \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
- $(GDK_PIXBUF_DEP_LIBS)
-
-
-gtk_update_icon_cache_3_0_SOURCES = \
- updateiconcache.c
+gtk_update_icon_cache_3_0_LDADD = $(GDK_PIXBUF_LIBS)
+gtk_update_icon_cache_3_0_SOURCES = updateiconcache.c
.PHONY: files test test-debug
@@ -1307,7 +1296,6 @@ if CROSS_COMPILING
gtk_update_icon_cache_program = $(GTK_UPDATE_ICON_CACHE)
else
gtk_update_icon_cache_program = \
- GDK_PIXBUF_MODULE_FILE=$(top_builddir)/gdk-pixbuf/loaders.cache \
./gtk-update-icon-cache-3.0
endif
diff --git a/gtk/tests/Makefile.am b/gtk/tests/Makefile.am
index 803314f026..0ba7225210 100644
--- a/gtk/tests/Makefile.am
+++ b/gtk/tests/Makefile.am
@@ -10,12 +10,10 @@ INCLUDES = \
$(GTK_DEP_CFLAGS)
DEPS = \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
$(top_builddir)/gdk/$(gdktargetlib) \
$(top_builddir)/gtk/$(gtktargetlib)
progs_ldadd = \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
$(top_builddir)/gdk/$(gdktargetlib) \
$(top_builddir)/gtk/$(gtktargetlib) \
$(GTK_DEP_LIBS)
diff --git a/gtk/theme-bits/Makefile.am b/gtk/theme-bits/Makefile.am
index dee422ef6e..0c6d3b2d74 100644
--- a/gtk/theme-bits/Makefile.am
+++ b/gtk/theme-bits/Makefile.am
@@ -3,12 +3,12 @@ include $(top_srcdir)/Makefile.decl
INCLUDES = \
-I$(top_srcdir) \
-I$(top_builddir) \
- $(GDK_PIXBUF_DEP_CFLAGS)
+ $(BASE_DEPENDENCIES_CFLAGS)
noinst_PROGRAMS = decompose-bits
decompose_bits_SOURCES = decompose-bits.c
-decompose_bits_LDADD = $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la $(GLIB_LIBS)
+decompose_bits_LDADD = $(BASE_DEPENDENCIES_LIBS)
EXTRA_DIST += check-13.png check-13-inconsistent.png radio-13.png radio-13-inconsistent.png
diff --git a/modules/engines/pixbuf/Makefile.am b/modules/engines/pixbuf/Makefile.am
index 05f6ebb6ef..a3e8eef4cd 100644
--- a/modules/engines/pixbuf/Makefile.am
+++ b/modules/engines/pixbuf/Makefile.am
@@ -13,7 +13,6 @@ INCLUDES = \
LDADDS = \
$(GTK_DEP_LIBS) \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
$(top_builddir)/gdk/$(gdktargetlib) \
$(top_builddir)/gtk/$(gtktargetlib)
diff --git a/modules/input/Makefile.am b/modules/input/Makefile.am
index 01248fed04..63da6b9484 100644
--- a/modules/input/Makefile.am
+++ b/modules/input/Makefile.am
@@ -17,13 +17,11 @@ INCLUDES = \
$(INCLUDED_IMMODULE_DEFINE)
DEPS = \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
$(top_builddir)/gdk/$(gdktargetlib) \
$(top_builddir)/gtk/$(gtktargetlib)
LDADDS = \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
- $(top_builddir)/gdk/$(gdktargetlib) \
+ $(top_builddir)/gdk/$(gdktargetlib) \
$(top_builddir)/gtk/$(gtktargetlib) \
$(GTK_DEP_LIBS)
diff --git a/modules/other/gail/Makefile.am b/modules/other/gail/Makefile.am
index 533207f131..4745347ef7 100644
--- a/modules/other/gail/Makefile.am
+++ b/modules/other/gail/Makefile.am
@@ -145,7 +145,6 @@ libgail_la_CFLAGS = \
$(AM_CFLAGS)
libgail_la_LIBADD = \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
$(top_builddir)/gdk/$(gdktargetlib) \
$(top_builddir)/gtk/$(gtktargetlib) \
$(top_builddir)/modules/other/gail/libgail-util/libgailutil-3.0.la \
diff --git a/perf/Makefile.am b/perf/Makefile.am
index 68d18185d6..6b95b16b48 100644
--- a/perf/Makefile.am
+++ b/perf/Makefile.am
@@ -11,12 +11,10 @@ INCLUDES = \
$(GTK_DEP_CFLAGS)
DEPS = \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
$(top_builddir)/gdk/$(gdktargetlib) \
$(top_builddir)/gtk/$(gtktargetlib)
LDADDS = \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
$(top_builddir)/gdk/$(gdktargetlib) \
$(top_builddir)/gtk/$(gtktargetlib) \
$(GTK_DEP_LIBS)
diff --git a/po-properties/POTFILES.in b/po-properties/POTFILES.in
index 1db31f4694..c2f36b7edb 100644
--- a/po-properties/POTFILES.in
+++ b/po-properties/POTFILES.in
@@ -1,29 +1,5 @@
# Files from the Gtk distribution which have already been
# marked to allow runtime translation of messages
-gdk-pixbuf/gdk-pixbuf-animation.c
-gdk-pixbuf/gdk-pixbuf-data.c
-gdk-pixbuf/gdk-pixbuf-io.c
-gdk-pixbuf/gdk-pixbuf-loader.c
-gdk-pixbuf/gdk-pixbuf-simple-anim.c
-gdk-pixbuf/gdk-pixbuf.c
-gdk-pixbuf/gdk-pixdata.c
-gdk-pixbuf/io-ani.c
-gdk-pixbuf/io-bmp.c
-gdk-pixbuf/io-gif.c
-gdk-pixbuf/io-icns.c
-gdk-pixbuf/io-ico.c
-gdk-pixbuf/io-jasper.c
-gdk-pixbuf/io-jpeg.c
-gdk-pixbuf/io-pcx.c
-gdk-pixbuf/io-png.c
-gdk-pixbuf/io-pnm.c
-gdk-pixbuf/io-qtif.c
-gdk-pixbuf/io-ras.c
-gdk-pixbuf/io-tga.c
-gdk-pixbuf/io-tiff.c
-gdk-pixbuf/io-wbmp.c
-gdk-pixbuf/io-xbm.c
-gdk-pixbuf/io-xpm.c
gdk/directfb/gdkdisplay-directfb.c
gdk/gdk.c
gdk/gdkdisplaymanager.c
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 98e1a559a2..9d6f9dea28 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -7,38 +7,6 @@ gdk/gdkpango.c
gdk/gdkscreen.c
gdk/gdkwindow.c
gdk/keyname-table.h
-gdk-pixbuf/gdk-pixbuf-animation.c
-gdk-pixbuf/gdk-pixbuf.c
-gdk-pixbuf/gdk-pixbuf-data.c
-gdk-pixbuf/gdk-pixbuf-io.c
-gdk-pixbuf/gdk-pixbuf-loader.c
-gdk-pixbuf/gdk-pixbuf-simple-anim.c
-gdk-pixbuf/gdk-pixdata.c
-gdk-pixbuf/io-ani.c
-gdk-pixbuf/io-bmp.c
-gdk-pixbuf/io-gif.c
-gdk-pixbuf/io-ico.c
-gdk-pixbuf/io-icns.c
-gdk-pixbuf/io-jasper.c
-gdk-pixbuf/io-jpeg.c
-gdk-pixbuf/io-pcx.c
-gdk-pixbuf/io-png.c
-gdk-pixbuf/io-pnm.c
-gdk-pixbuf/io-qtif.c
-gdk-pixbuf/io-ras.c
-gdk-pixbuf/io-tga.c
-gdk-pixbuf/io-tiff.c
-gdk-pixbuf/io-wbmp.c
-gdk-pixbuf/io-xbm.c
-gdk-pixbuf/io-xpm.c
-gdk-pixbuf/io-gdip-bmp.c
-gdk-pixbuf/io-gdip-emf.c
-gdk-pixbuf/io-gdip-gif.c
-gdk-pixbuf/io-gdip-ico.c
-gdk-pixbuf/io-gdip-jpeg.c
-gdk-pixbuf/io-gdip-png.c
-gdk-pixbuf/io-gdip-utils.c
-gdk-pixbuf/io-gdip-wmf.c
gdk/win32/gdkmain-win32.c
gdk/x11/gdkmain-x11.c
gdk/x11/gdkapplaunchcontext-x11.c
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 71659c19dd..0f16669f86 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -12,15 +12,14 @@ INCLUDES = \
$(GDK_DEP_CFLAGS)
DEPS = \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
$(top_builddir)/gdk/$(gdktargetlib) \
$(top_builddir)/gtk/$(gtktargetlib)
LDADDS = \
- $(top_builddir)/gdk-pixbuf/libgdk_pixbuf-$(GTK_API_VERSION).la \
$(top_builddir)/gdk/$(gdktargetlib) \
$(top_builddir)/gtk/$(gtktargetlib) \
- $(GTK_DEP_LIBS)
+ $(GTK_DEP_LIBS) \
+ -lm
if USE_X11
testsocket_programs = testsocket testsocket_child