more work on docs

started adding .xml intro to vips sections
This commit is contained in:
John Cupitt 2014-07-25 09:22:49 +01:00
parent 79a144c3f0
commit f4671f46e8
10 changed files with 1446 additions and 23 deletions

3
TODO
View File

@ -1,3 +1,6 @@
- vips_object_unref_outputs() needs docs ... bindings will need it
- maxpos_avg seems to give variable results

View File

@ -13,7 +13,16 @@ rm -f swig/vipsCC/*.cxx
rm -f swig/vipsCC/VImage.h
rm -f swig/vipsCC/VImage.py python/vipsCC/VError.py python/vipsCC/VMask.py python/vipsCC/Display.py
rm -f benchmark/temp*
( cd doc ; mkdir poop ; mv reference/libvips-docs.sgml.in poop ; mv reference/Makefile.am poop ; mv reference/images poop ; rm -rf reference/* ; mv poop/* reference ; rmdir poop )
( cd doc ; \
mkdir poop ; \
mv reference/libvips-docs.sgml.in poop ; \
mv reference/Makefile.am poop ; \
mv reference/images poop ; \
mv reference/*.xml poop ; \
rm -rf reference/* ; \
mv poop/* reference ; \
rmdir poop \
)
# glib-gettextize asks us to copy these files to m4 if they aren't there
# I don't have $ACDIR/isc-posix.m4, how mysterious

View File

@ -134,12 +134,20 @@ HTML_IMAGES = \
# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
content_files=
content_files = \
using-command-line.xml \
using-C.xml \
extending.xml \
binding.xml
# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
# These files must be listed here *and* in content_files
# e.g. expand_content_files=running.sgml
expand_content_files=
expand_content_files = \
using-command-line.xml \
using-C.xml \
extending.xml \
binding.xml
# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
# Only needed if you are using gtkdoc-scangobj to dynamically query widget

550
doc/reference/binding.xml Normal file
View File

@ -0,0 +1,550 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
]>
<refentry id="glib-building">
<refmeta>
<refentrytitle>Compiling the GLib package</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GLib Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Compiling the GLib Package</refname>
<refpurpose>How to compile GLib itself</refpurpose>
</refnamediv>
<refsect1 id="building">
<title>Building the Library on UNIX</title>
<para>
On UNIX, GLib uses the standard GNU build system,
using <application>autoconf</application> for package
configuration and resolving portability issues,
<application>automake</application> for building makefiles
that comply with the GNU Coding Standards, and
<application>libtool</application> for building shared
libraries on multiple platforms. The normal sequence for
compiling and installing the GLib library is thus:
<literallayout>
<userinput>./configure</userinput>
<userinput>make</userinput>
<userinput>make install</userinput>
</literallayout>
</para>
<para>
The standard options provided by <application>GNU
autoconf</application> may be passed to the
<command>configure</command> script. Please see the
<application>autoconf</application> documentation or run
<command>./configure --help</command> for information about
the standard options.
</para>
<para>
The GTK+ documentation contains
<ulink url="../gtk/gtk-building.html">further details</ulink>
about the build process and ways to influence it.
</para>
</refsect1>
<refsect1 id="dependencies">
<title>Dependencies</title>
<para>
Before you can compile the GLib library, you need to have
various other tools and libraries installed on your system.
Beyond a C compiler (which must implement C90, but does not need
to implement C99), the two tools needed during the build process
(as differentiated from the tools used in when creating GLib
mentioned above such as <application>autoconf</application>) are
<command>pkg-config</command> and GNU make.
</para>
<itemizedlist>
<listitem>
<para>
<ulink url="http://www.freedesktop.org/software/pkgconfig/">pkg-config</ulink>
is a tool for tracking the compilation flags needed for
libraries that are used by the GLib library. (For each
library, a small <literal>.pc</literal> text file is
installed in a standard location that contains the compilation
flags needed for that library along with version number
information.) The version of <command>pkg-config</command>
needed to build GLib is mirrored in the
<filename>dependencies</filename> directory
on the <ulink url="ftp://ftp.gtk.org/pub/gtk/v2.2/">GTK+ FTP
site.</ulink>
</para>
</listitem>
<listitem>
<para>
The GLib Makefiles make use of several features specific to
<ulink url="http://www.gnu.org/software/make">GNU
make</ulink>, and will not build correctly with other
versions of <command>make</command>. You will need to
install it if you don't already have it on your system. (It
may be called <command>gmake</command> rather than
<command>make</command>.)
</para>
</listitem>
</itemizedlist>
<para>
A UNIX build of GLib requires that the system implements at
least the original 1990 version of POSIX. Beyond this, it
depends on a number of other libraries.
</para>
<itemizedlist>
<listitem>
<para>
The <ulink url="http://www.gnu.org/software/libiconv/">GNU
libiconv library</ulink> is needed to build GLib if your
system doesn't have the <function>iconv()</function>
function for doing conversion between character
encodings. Most modern systems should have
<function>iconv()</function>, however many older systems lack
an <function>iconv()</function> implementation. On such systems,
you must install the libiconv library. This can be found at:
<ulink url="http://www.gnu.org/software/libiconv">http://www.gnu.org/software/libiconv</ulink>.
</para>
<para>
If your system has an <function>iconv()</function> implementation but
you want to use libiconv instead, you can pass the
--with-libiconv option to configure. This forces
libiconv to be used.
</para>
<para>
Note that if you have libiconv installed in your default include
search path (for instance, in <filename>/usr/local/</filename>), but
don't enable it, you will get an error while compiling GLib because
the <filename>iconv.h</filename> that libiconv installs hides the
system iconv.
</para>
<para>
If you are using the native iconv implementation on Solaris
instead of libiconv, you'll need to make sure that you have
the converters between locale encodings and UTF-8 installed.
At a minimum you'll need the SUNWuiu8 package. You probably
should also install the SUNWciu8, SUNWhiu8, SUNWjiu8, and
SUNWkiu8 packages.
</para>
<para>
The native iconv on Compaq Tru64 doesn't contain support for
UTF-8, so you'll need to use GNU libiconv instead. (When
using GNU libiconv for GLib, you'll need to use GNU libiconv
for GNU gettext as well.) This probably applies to related
operating systems as well.
</para>
</listitem>
<listitem>
<para>
The libintl library from the <ulink
url="http://www.gnu.org/software/gettext">GNU gettext
package</ulink> is needed if your system doesn't have the
<function>gettext()</function> functionality for handling
message translation databases.
</para>
</listitem>
<listitem>
<para>
A thread implementation is needed. The thread support in GLib
can be based upon POSIX threads or win32 threads.
</para>
</listitem>
<listitem>
<para>
GRegex uses the <ulink url="http://www.pcre.org/">PCRE library</ulink>
for regular expression matching. The default is to use the internal
version of PCRE that is patched to use GLib for memory management
and Unicode handling. If you prefer to use the system-supplied PCRE
library you can pass the <option>--with-pcre=system</option> option
to, but it is not recommended.
</para>
</listitem>
<listitem>
<para>
The optional extended attribute support in GIO requires the
getxattr() family of functions that may be provided by glibc or
by the standalone libattr library. To build GLib without extended
attribute support, use the <option>--disable-xattr</option>
option.
</para>
</listitem>
<listitem>
<para>
The optional SELinux support in GIO requires libselinux.
To build GLib without SELinux support, use the
<option>--disable-selinux</option> option.
</para>
</listitem>
<listitem>
<para>
The optional support for DTrace requires the
<filename>sys/sdt.h</filename> header, which is provided
by SystemTap on Linux. To build GLib without DTrace, use
the <option>--disable-dtrace</option> configure option.
</para>
</listitem>
<listitem>
<para>
The optional support for
<ulink url="http://sourceware.org/systemtap/">SystemTap</ulink>
can be disabled with the <option>--disable-systemtap</option>
configure option.
</para>
</listitem>
</itemizedlist>
</refsect1>
<refsect1 id="extra-configuration-options">
<title>Extra Configuration Options</title>
<para>
In addition to the normal options, the
<command>configure</command> script in the GLib
library supports these additional arguments:
</para>
<formalpara>
<title><systemitem>--enable-debug</systemitem></title>
<para>
Turns on various amounts of debugging support. Setting this to 'no'
disables g_assert(), g_return_if_fail(), g_return_val_if_fail() and
all cast checks between different object types. Setting it to 'minimum' disables only cast checks. Setting it to 'yes' enables
<link linkend="G-DEBUG:CAPS">runtime debugging</link>.
The default is 'minimum'.
Note that 'no' is fast, but dangerous as it tends to destabilize
even mostly bug-free software by changing the effect of many bugs
from simple warnings into fatal crashes. Thus
<option>--enable-debug=no</option> should <emphasis>not</emphasis>
be used for stable releases of GLib.
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-gc-friendly</systemitem> and
<systemitem>--enable-gc-friendly</systemitem></title>
<para>
By default, and with <systemitem>--disable-gc-friendly</systemitem>
as well, Glib does not clear the memory for certain objects before
they are freed. For example, Glib may decide to recycle GList nodes
by putting them in a free list. However, memory profiling and debugging
tools like <ulink url="http://www.valgrind.org">Valgrind</ulink> work
better if an application does not keep dangling pointers to freed
memory (even though these pointers are no longer dereferenced), or
invalid pointers inside uninitialized memory.
The <systemitem>--enable-gc-friendly</systemitem> option makes Glib
clear memory in these situations:
</para>
<itemizedlist>
<listitem>
<para>
When shrinking a GArray, Glib will clear the memory no longer
available in the array: shrink an array from 10 bytes to 7, and
the last 3 bytes will be cleared. This includes removals of single
and multiple elements.
</para>
</listitem>
<listitem>
<para>
When growing a GArray, Glib will clear the new chunk of memory.
Grow an array from 7 bytes to 10 bytes, and the last 3 bytes will
be cleared.
</para>
</listitem>
<listitem>
<para>
The above applies to GPtrArray as well.
</para>
</listitem>
<listitem>
<para>
When freeing a node from a GHashTable, Glib will first clear
the node, which used to have pointers to the key and the value
stored at that node.
</para>
</listitem>
<listitem>
<para>
When destroying or removing a GTree node, Glib will clear the node,
which used to have pointers to the node's value, and the left and
right subnodes.
</para>
</listitem>
</itemizedlist>
<para>
Since clearing the memory has a cost,
<systemitem>--disable-gc-friendly</systemitem> is the default.
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-mem-pools</systemitem> and
<systemitem>--enable-mem-pools</systemitem></title>
<para>
Many small chunks of memory are often allocated via collective pools
in GLib and are cached after release to speed up reallocations.
For sparse memory systems this behaviour is often inferior, so
memory pools can be disabled to avoid excessive caching and force
atomic maintenance of chunks through the <function>g_malloc()</function>
and <function>g_free()</function> functions. Code currently affected by
this:
<itemizedlist>
<listitem>
<para>
<structname>GMemChunk</structname>s become basically non-effective
</para>
</listitem>
<listitem>
<para>
<structname>GSignal</structname> disables all caching
(potentially very slow)
</para>
</listitem>
<listitem>
<para>
<structname>GType</structname> doesn't honour the
<structname>GTypeInfo</structname>
<structfield>n_preallocs</structfield> field anymore
</para>
</listitem>
<listitem>
<para>
the <structname>GBSearchArray</structname> flag
<literal>G_BSEARCH_ALIGN_POWER2</literal> becomes non-functional
</para>
</listitem>
</itemizedlist>
</para>
</formalpara>
<formalpara>
<title><systemitem>--with-threads</systemitem></title>
<para>
Specify a thread implementation to use. Available options are
'posix' or 'win32'. Normally, <command>configure</command>
should be able to work out the system threads API on its own.
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-regex</systemitem> and
<systemitem>--enable-regex</systemitem></title>
<para>
Do not compile GLib with regular expression support.
GLib will be smaller because it will not need the
PCRE library. This is however not recommended, as
programs may need GRegex.
</para>
</formalpara>
<formalpara>
<title><systemitem>--with-pcre</systemitem></title>
<para>
Specify whether to use the internal or the system-supplied
PCRE library.
<itemizedlist>
<listitem>
<para>
'internal' means that GRegex will be compiled to use
the internal PCRE library.
</para>
</listitem>
<listitem>
<para>
'system' means that GRegex will be compiled to use
the system-supplied PCRE library.
</para>
</listitem>
</itemizedlist>
Using the internal PCRE is the preferred solution:
<itemizedlist>
<listitem>
<para>
System-supplied PCRE has a separated copy of the big tables
used for Unicode handling.
</para>
</listitem>
<listitem>
<para>
Some systems have PCRE libraries compiled without some needed
features, such as UTF-8 and Unicode support.
</para>
</listitem>
<listitem>
<para>
PCRE uses some global variables for memory management and
other features. In the rare case of a program using both
GRegex and PCRE (maybe indirectly through a library),
this variables could lead to problems when they are modified.
</para>
</listitem>
</itemizedlist>
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-included-printf</systemitem> and
<systemitem>--enable-included-printf</systemitem></title>
<para>
By default the <command>configure</command> script will try
to auto-detect whether the C library provides a suitable set
of printf() functions. In detail, <command>configure</command>
checks that the semantics of snprintf() are as specified by C99
and that positional parameters as specified in the Single Unix
Specification are supported. If this not the case, GLib will
include an implementation of the printf() family.
</para>
<para>
These options can be used to explicitly control whether
an implementation of the printf() family should be included or not.
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-Bsymbolic</systemitem> and
<systemitem>--enable-Bsymbolic</systemitem></title>
<para>
By default, GLib uses the -Bsymbolic-functions linker
flag to avoid intra-library PLT jumps. A side-effect
of this is that it is no longer possible to override
internal uses of GLib functions with
<envar>LD_PRELOAD</envar>. Therefore, it may make
sense to turn this feature off in some situations.
The <option>--disable-Bsymbolic</option> option allows
to do that.
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-gtk-doc</systemitem> and
<systemitem>--enable-gtk-doc</systemitem></title>
<para>
By default the <command>configure</command> script will try
to auto-detect whether the
<application>gtk-doc</application> package is installed.
If it is, then it will use it to extract and build the
documentation for the GLib library. These options
can be used to explicitly control whether
<application>gtk-doc</application> should be
used or not. If it is not used, the distributed,
pre-generated HTML files will be installed instead of
building them on your machine.
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-man</systemitem> and
<systemitem>--enable-man</systemitem></title>
<para>
By default the <command>configure</command> script will try
to auto-detect whether <application>xsltproc</application>
and the necessary Docbook stylesheets are installed.
If they are, then it will use them to rebuild the included
man pages from the XML sources. These options can be used
to explicitly control whether man pages should be rebuilt
used or not. The distribution includes pre-generated man
pages.
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-xattr</systemitem> and
<systemitem>--enable-xattr</systemitem></title>
<para>
By default the <command>configure</command> script will try
to auto-detect whether the getxattr() family of functions
is available. If it is, then extended attribute support
will be included in GIO. These options can be used to
explicitly control whether extended attribute support
should be included or not. getxattr() and friends can
be provided by glibc or by the standalone libattr library.
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-selinux</systemitem> and
<systemitem>--enable-selinux</systemitem></title>
<para>
By default the <command>configure</command> script will
auto-detect if libselinux is available and include
SELinux support in GIO if it is. These options can be
used to explicitly control whether SELinux support should
be included.
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-dtrace</systemitem> and
<systemitem>--enable-dtrace</systemitem></title>
<para>
By default the <command>configure</command> script will
detect if DTrace support is available, and use it.
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-systemtap</systemitem> and
<systemitem>--enable-systemtap</systemitem></title>
<para>
This option requires DTrace support. If it is available, then
the <command>configure</command> script will also check for
the presence of SystemTap.
</para>
</formalpara>
<formalpara>
<title><systemitem>--enable-gcov</systemitem> and
<systemitem>--disable-gcov</systemitem></title>
<para>
Enable the generation of coverage reports for the GLib tests.
This requires the lcov frontend to gcov from the
<ulink url="http://ltp.sourceforge.net">Linux Test Project</ulink>.
To generate a coverage report, use the lcov make target. The
report is placed in the <filename>glib-lcov</filename> directory.
</para>
</formalpara>
<formalpara>
<title><systemitem>--with-runtime-libdir=RELPATH</systemitem></title>
<para>
Allows specifying a relative path to where to install the runtime
libraries (meaning library files used for running, not developing,
GLib applications). This can be used in operating system setups where
programs using GLib needs to run before e.g. <filename>/usr</filename>
is mounted.
For example, if LIBDIR is <filename>/usr/lib</filename> and
<filename>../../lib</filename> is passed to
<systemitem>--with-runtime-libdir</systemitem> then the
runtime libraries are installed into <filename>/lib</filename> rather
than <filename>/usr/lib</filename>.
</para>
</formalpara>
<formalpara>
<title><systemitem>--with-python</systemitem></title>
<para>
Allows specifying the Python interpreter to use, either as an absolute path,
or as a program name. GLib can be built with Python 2 (at least version 2.5)
or Python 3.
</para>
</formalpara>
</refsect1>
</refentry>

550
doc/reference/extending.xml Normal file
View File

@ -0,0 +1,550 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
]>
<refentry id="glib-building">
<refmeta>
<refentrytitle>Compiling the GLib package</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GLib Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Compiling the GLib Package</refname>
<refpurpose>How to compile GLib itself</refpurpose>
</refnamediv>
<refsect1 id="building">
<title>Building the Library on UNIX</title>
<para>
On UNIX, GLib uses the standard GNU build system,
using <application>autoconf</application> for package
configuration and resolving portability issues,
<application>automake</application> for building makefiles
that comply with the GNU Coding Standards, and
<application>libtool</application> for building shared
libraries on multiple platforms. The normal sequence for
compiling and installing the GLib library is thus:
<literallayout>
<userinput>./configure</userinput>
<userinput>make</userinput>
<userinput>make install</userinput>
</literallayout>
</para>
<para>
The standard options provided by <application>GNU
autoconf</application> may be passed to the
<command>configure</command> script. Please see the
<application>autoconf</application> documentation or run
<command>./configure --help</command> for information about
the standard options.
</para>
<para>
The GTK+ documentation contains
<ulink url="../gtk/gtk-building.html">further details</ulink>
about the build process and ways to influence it.
</para>
</refsect1>
<refsect1 id="dependencies">
<title>Dependencies</title>
<para>
Before you can compile the GLib library, you need to have
various other tools and libraries installed on your system.
Beyond a C compiler (which must implement C90, but does not need
to implement C99), the two tools needed during the build process
(as differentiated from the tools used in when creating GLib
mentioned above such as <application>autoconf</application>) are
<command>pkg-config</command> and GNU make.
</para>
<itemizedlist>
<listitem>
<para>
<ulink url="http://www.freedesktop.org/software/pkgconfig/">pkg-config</ulink>
is a tool for tracking the compilation flags needed for
libraries that are used by the GLib library. (For each
library, a small <literal>.pc</literal> text file is
installed in a standard location that contains the compilation
flags needed for that library along with version number
information.) The version of <command>pkg-config</command>
needed to build GLib is mirrored in the
<filename>dependencies</filename> directory
on the <ulink url="ftp://ftp.gtk.org/pub/gtk/v2.2/">GTK+ FTP
site.</ulink>
</para>
</listitem>
<listitem>
<para>
The GLib Makefiles make use of several features specific to
<ulink url="http://www.gnu.org/software/make">GNU
make</ulink>, and will not build correctly with other
versions of <command>make</command>. You will need to
install it if you don't already have it on your system. (It
may be called <command>gmake</command> rather than
<command>make</command>.)
</para>
</listitem>
</itemizedlist>
<para>
A UNIX build of GLib requires that the system implements at
least the original 1990 version of POSIX. Beyond this, it
depends on a number of other libraries.
</para>
<itemizedlist>
<listitem>
<para>
The <ulink url="http://www.gnu.org/software/libiconv/">GNU
libiconv library</ulink> is needed to build GLib if your
system doesn't have the <function>iconv()</function>
function for doing conversion between character
encodings. Most modern systems should have
<function>iconv()</function>, however many older systems lack
an <function>iconv()</function> implementation. On such systems,
you must install the libiconv library. This can be found at:
<ulink url="http://www.gnu.org/software/libiconv">http://www.gnu.org/software/libiconv</ulink>.
</para>
<para>
If your system has an <function>iconv()</function> implementation but
you want to use libiconv instead, you can pass the
--with-libiconv option to configure. This forces
libiconv to be used.
</para>
<para>
Note that if you have libiconv installed in your default include
search path (for instance, in <filename>/usr/local/</filename>), but
don't enable it, you will get an error while compiling GLib because
the <filename>iconv.h</filename> that libiconv installs hides the
system iconv.
</para>
<para>
If you are using the native iconv implementation on Solaris
instead of libiconv, you'll need to make sure that you have
the converters between locale encodings and UTF-8 installed.
At a minimum you'll need the SUNWuiu8 package. You probably
should also install the SUNWciu8, SUNWhiu8, SUNWjiu8, and
SUNWkiu8 packages.
</para>
<para>
The native iconv on Compaq Tru64 doesn't contain support for
UTF-8, so you'll need to use GNU libiconv instead. (When
using GNU libiconv for GLib, you'll need to use GNU libiconv
for GNU gettext as well.) This probably applies to related
operating systems as well.
</para>
</listitem>
<listitem>
<para>
The libintl library from the <ulink
url="http://www.gnu.org/software/gettext">GNU gettext
package</ulink> is needed if your system doesn't have the
<function>gettext()</function> functionality for handling
message translation databases.
</para>
</listitem>
<listitem>
<para>
A thread implementation is needed. The thread support in GLib
can be based upon POSIX threads or win32 threads.
</para>
</listitem>
<listitem>
<para>
GRegex uses the <ulink url="http://www.pcre.org/">PCRE library</ulink>
for regular expression matching. The default is to use the internal
version of PCRE that is patched to use GLib for memory management
and Unicode handling. If you prefer to use the system-supplied PCRE
library you can pass the <option>--with-pcre=system</option> option
to, but it is not recommended.
</para>
</listitem>
<listitem>
<para>
The optional extended attribute support in GIO requires the
getxattr() family of functions that may be provided by glibc or
by the standalone libattr library. To build GLib without extended
attribute support, use the <option>--disable-xattr</option>
option.
</para>
</listitem>
<listitem>
<para>
The optional SELinux support in GIO requires libselinux.
To build GLib without SELinux support, use the
<option>--disable-selinux</option> option.
</para>
</listitem>
<listitem>
<para>
The optional support for DTrace requires the
<filename>sys/sdt.h</filename> header, which is provided
by SystemTap on Linux. To build GLib without DTrace, use
the <option>--disable-dtrace</option> configure option.
</para>
</listitem>
<listitem>
<para>
The optional support for
<ulink url="http://sourceware.org/systemtap/">SystemTap</ulink>
can be disabled with the <option>--disable-systemtap</option>
configure option.
</para>
</listitem>
</itemizedlist>
</refsect1>
<refsect1 id="extra-configuration-options">
<title>Extra Configuration Options</title>
<para>
In addition to the normal options, the
<command>configure</command> script in the GLib
library supports these additional arguments:
</para>
<formalpara>
<title><systemitem>--enable-debug</systemitem></title>
<para>
Turns on various amounts of debugging support. Setting this to 'no'
disables g_assert(), g_return_if_fail(), g_return_val_if_fail() and
all cast checks between different object types. Setting it to 'minimum' disables only cast checks. Setting it to 'yes' enables
<link linkend="G-DEBUG:CAPS">runtime debugging</link>.
The default is 'minimum'.
Note that 'no' is fast, but dangerous as it tends to destabilize
even mostly bug-free software by changing the effect of many bugs
from simple warnings into fatal crashes. Thus
<option>--enable-debug=no</option> should <emphasis>not</emphasis>
be used for stable releases of GLib.
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-gc-friendly</systemitem> and
<systemitem>--enable-gc-friendly</systemitem></title>
<para>
By default, and with <systemitem>--disable-gc-friendly</systemitem>
as well, Glib does not clear the memory for certain objects before
they are freed. For example, Glib may decide to recycle GList nodes
by putting them in a free list. However, memory profiling and debugging
tools like <ulink url="http://www.valgrind.org">Valgrind</ulink> work
better if an application does not keep dangling pointers to freed
memory (even though these pointers are no longer dereferenced), or
invalid pointers inside uninitialized memory.
The <systemitem>--enable-gc-friendly</systemitem> option makes Glib
clear memory in these situations:
</para>
<itemizedlist>
<listitem>
<para>
When shrinking a GArray, Glib will clear the memory no longer
available in the array: shrink an array from 10 bytes to 7, and
the last 3 bytes will be cleared. This includes removals of single
and multiple elements.
</para>
</listitem>
<listitem>
<para>
When growing a GArray, Glib will clear the new chunk of memory.
Grow an array from 7 bytes to 10 bytes, and the last 3 bytes will
be cleared.
</para>
</listitem>
<listitem>
<para>
The above applies to GPtrArray as well.
</para>
</listitem>
<listitem>
<para>
When freeing a node from a GHashTable, Glib will first clear
the node, which used to have pointers to the key and the value
stored at that node.
</para>
</listitem>
<listitem>
<para>
When destroying or removing a GTree node, Glib will clear the node,
which used to have pointers to the node's value, and the left and
right subnodes.
</para>
</listitem>
</itemizedlist>
<para>
Since clearing the memory has a cost,
<systemitem>--disable-gc-friendly</systemitem> is the default.
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-mem-pools</systemitem> and
<systemitem>--enable-mem-pools</systemitem></title>
<para>
Many small chunks of memory are often allocated via collective pools
in GLib and are cached after release to speed up reallocations.
For sparse memory systems this behaviour is often inferior, so
memory pools can be disabled to avoid excessive caching and force
atomic maintenance of chunks through the <function>g_malloc()</function>
and <function>g_free()</function> functions. Code currently affected by
this:
<itemizedlist>
<listitem>
<para>
<structname>GMemChunk</structname>s become basically non-effective
</para>
</listitem>
<listitem>
<para>
<structname>GSignal</structname> disables all caching
(potentially very slow)
</para>
</listitem>
<listitem>
<para>
<structname>GType</structname> doesn't honour the
<structname>GTypeInfo</structname>
<structfield>n_preallocs</structfield> field anymore
</para>
</listitem>
<listitem>
<para>
the <structname>GBSearchArray</structname> flag
<literal>G_BSEARCH_ALIGN_POWER2</literal> becomes non-functional
</para>
</listitem>
</itemizedlist>
</para>
</formalpara>
<formalpara>
<title><systemitem>--with-threads</systemitem></title>
<para>
Specify a thread implementation to use. Available options are
'posix' or 'win32'. Normally, <command>configure</command>
should be able to work out the system threads API on its own.
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-regex</systemitem> and
<systemitem>--enable-regex</systemitem></title>
<para>
Do not compile GLib with regular expression support.
GLib will be smaller because it will not need the
PCRE library. This is however not recommended, as
programs may need GRegex.
</para>
</formalpara>
<formalpara>
<title><systemitem>--with-pcre</systemitem></title>
<para>
Specify whether to use the internal or the system-supplied
PCRE library.
<itemizedlist>
<listitem>
<para>
'internal' means that GRegex will be compiled to use
the internal PCRE library.
</para>
</listitem>
<listitem>
<para>
'system' means that GRegex will be compiled to use
the system-supplied PCRE library.
</para>
</listitem>
</itemizedlist>
Using the internal PCRE is the preferred solution:
<itemizedlist>
<listitem>
<para>
System-supplied PCRE has a separated copy of the big tables
used for Unicode handling.
</para>
</listitem>
<listitem>
<para>
Some systems have PCRE libraries compiled without some needed
features, such as UTF-8 and Unicode support.
</para>
</listitem>
<listitem>
<para>
PCRE uses some global variables for memory management and
other features. In the rare case of a program using both
GRegex and PCRE (maybe indirectly through a library),
this variables could lead to problems when they are modified.
</para>
</listitem>
</itemizedlist>
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-included-printf</systemitem> and
<systemitem>--enable-included-printf</systemitem></title>
<para>
By default the <command>configure</command> script will try
to auto-detect whether the C library provides a suitable set
of printf() functions. In detail, <command>configure</command>
checks that the semantics of snprintf() are as specified by C99
and that positional parameters as specified in the Single Unix
Specification are supported. If this not the case, GLib will
include an implementation of the printf() family.
</para>
<para>
These options can be used to explicitly control whether
an implementation of the printf() family should be included or not.
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-Bsymbolic</systemitem> and
<systemitem>--enable-Bsymbolic</systemitem></title>
<para>
By default, GLib uses the -Bsymbolic-functions linker
flag to avoid intra-library PLT jumps. A side-effect
of this is that it is no longer possible to override
internal uses of GLib functions with
<envar>LD_PRELOAD</envar>. Therefore, it may make
sense to turn this feature off in some situations.
The <option>--disable-Bsymbolic</option> option allows
to do that.
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-gtk-doc</systemitem> and
<systemitem>--enable-gtk-doc</systemitem></title>
<para>
By default the <command>configure</command> script will try
to auto-detect whether the
<application>gtk-doc</application> package is installed.
If it is, then it will use it to extract and build the
documentation for the GLib library. These options
can be used to explicitly control whether
<application>gtk-doc</application> should be
used or not. If it is not used, the distributed,
pre-generated HTML files will be installed instead of
building them on your machine.
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-man</systemitem> and
<systemitem>--enable-man</systemitem></title>
<para>
By default the <command>configure</command> script will try
to auto-detect whether <application>xsltproc</application>
and the necessary Docbook stylesheets are installed.
If they are, then it will use them to rebuild the included
man pages from the XML sources. These options can be used
to explicitly control whether man pages should be rebuilt
used or not. The distribution includes pre-generated man
pages.
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-xattr</systemitem> and
<systemitem>--enable-xattr</systemitem></title>
<para>
By default the <command>configure</command> script will try
to auto-detect whether the getxattr() family of functions
is available. If it is, then extended attribute support
will be included in GIO. These options can be used to
explicitly control whether extended attribute support
should be included or not. getxattr() and friends can
be provided by glibc or by the standalone libattr library.
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-selinux</systemitem> and
<systemitem>--enable-selinux</systemitem></title>
<para>
By default the <command>configure</command> script will
auto-detect if libselinux is available and include
SELinux support in GIO if it is. These options can be
used to explicitly control whether SELinux support should
be included.
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-dtrace</systemitem> and
<systemitem>--enable-dtrace</systemitem></title>
<para>
By default the <command>configure</command> script will
detect if DTrace support is available, and use it.
</para>
</formalpara>
<formalpara>
<title><systemitem>--disable-systemtap</systemitem> and
<systemitem>--enable-systemtap</systemitem></title>
<para>
This option requires DTrace support. If it is available, then
the <command>configure</command> script will also check for
the presence of SystemTap.
</para>
</formalpara>
<formalpara>
<title><systemitem>--enable-gcov</systemitem> and
<systemitem>--disable-gcov</systemitem></title>
<para>
Enable the generation of coverage reports for the GLib tests.
This requires the lcov frontend to gcov from the
<ulink url="http://ltp.sourceforge.net">Linux Test Project</ulink>.
To generate a coverage report, use the lcov make target. The
report is placed in the <filename>glib-lcov</filename> directory.
</para>
</formalpara>
<formalpara>
<title><systemitem>--with-runtime-libdir=RELPATH</systemitem></title>
<para>
Allows specifying a relative path to where to install the runtime
libraries (meaning library files used for running, not developing,
GLib applications). This can be used in operating system setups where
programs using GLib needs to run before e.g. <filename>/usr</filename>
is mounted.
For example, if LIBDIR is <filename>/usr/lib</filename> and
<filename>../../lib</filename> is passed to
<systemitem>--with-runtime-libdir</systemitem> then the
runtime libraries are installed into <filename>/lib</filename> rather
than <filename>/usr/lib</filename>.
</para>
</formalpara>
<formalpara>
<title><systemitem>--with-python</systemitem></title>
<para>
Allows specifying the Python interpreter to use, either as an absolute path,
or as a program name. GLib can be built with Python 2 (at least version 2.5)
or Python 3.
</para>
</formalpara>
</refsect1>
</refentry>

View File

@ -11,22 +11,44 @@
For VIPS @VIPS_VERSION@.
The latest version of this documentation can be found on the
<ulink role="online-location"
url="http://http://www.vips.ecs.soton.ac.uk/index.php?title=Documentation">VIPS website</ulink>.
url="http://http://www.vips.ecs.soton.ac.uk/index.php?title=Documentation">VIPS website</ulink>.
</releaseinfo>
</bookinfo>
<chapter>
<title>VIPS Overview</title>
<para>
VIPS is a free image processing system. It is good with large
images (images larger than the amount of RAM you have available), with
many CPUs (speed scales linearly to at least 32 threads), for working
with colour, for scientific analysis and for general research
and development. As well as JPEG, TIFF and PNG images, it also
supports scientific formats like FITS, Matlab, Analyze, PFM,
Radiance and OpenSlide. It works on many UNIX-like platforms,
as well as Windows and OS X. VIPS is released under the GNU Library
General Public License (GNU LGPL).
</para>
<xi:include href="using-command-line.xml"/>
<xi:include href="using-C.xml"/>
<xi:include href="binding.xml"/>
<xi:include href="extending.xml"/>
</chapter>
<chapter>
<title>Core VIPS API</title>
<xi:include href="xml/vips.xml"/>
<xi:include href="xml/image.xml"/>
<xi:include href="xml/region.xml"/>
<xi:include href="xml/generate.xml"/>
<xi:include href="xml/header.xml"/>
<xi:include href="xml/generate.xml"/>
<xi:include href="xml/operation.xml"/>
<xi:include href="xml/rect.xml"/>
<xi:include href="xml/threadpool.xml"/>
<xi:include href="xml/object.xml"/>
<xi:include href="xml/memory.xml"/>
<xi:include href="xml/error.xml"/>
<xi:include href="xml/memory.xml"/>
<xi:include href="xml/region.xml"/>
<xi:include href="xml/type.xml"/>
<xi:include href="xml/rect.xml"/>
<xi:include href="xml/object.xml"/>
<xi:include href="xml/threadpool.xml"/>
<xi:include href="xml/buf.xml"/>
</chapter>
@ -63,6 +85,7 @@
<index id="api-index-full">
<title>API Index</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
<xi:include href="xml/api-index-deprecated.xml"><xi:fallback /></xi:include>
</index>
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>

73
doc/reference/using-C.xml Normal file
View File

@ -0,0 +1,73 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
]>
<refentry id="using-from-c">
<refmeta>
<refentrytitle>Using VIPS from C</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>VIPS Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Using VIPS</refname>
<refpurpose>How to use the VIPS library</refpurpose>
</refnamediv>
<refsect1 id="using-C">
<title>Using VIPS from C</title>
<para>
VIPS comes with a convenient, high-level C API. You should read the API
docs for full details, but this section will try to give a brief
overview. The <command>vips</command> program is handy for getting a
summary of an operation's parameters.
When your program starts, use <function>vips_init()</function> to set up
the VIPS library. You should pass it the name of your program, usually
<literal>argv[0]</literal>. Use <function>vips_shutdown()</function>
when you exit.
You can add the VIPS flags to your GObject command-line processing
with vips_get_option_group(), see below.
The basic data object is #VipsImage. You can create an image from a
file on disc or from an area of memory, either as a C-style array,
or as a formatted object, like JPEG. See vips_image_new_from_file() and
friends.
Loading an image is fast. VIPS read just enough of the image to be able
to get the various properties, such as width in pixels. It delays
reading any pixels until they are really needed.
Once you have an image, you can get properties from it in the usual way.
You can use projection functions like vips_image_get_width(), or
g_object_get() to get GObject properties.
VIPS is based on the GObject library and is therefore refcounted.
vips_image_new_from_file() returns an object with a count of 1.
When you are done with an image, use g_object_unref() to dispose of it.
If you pass an image to an operation and that operation needs to keep a
copy of the image, it will ref it. So you can unref an image as soon as
you no longer need it, you don't need to hang on to it in case anyone
else is still using it.
VIPS images are three-dimensional arrays, the dimensions being width,
height and bands. Each dimension can be up to 2 ** 31 pixels (or band
elements). An image has a format, meaning the machine number type used
to represent each value. VIPS supports 10 formats, from 8-bit unsigned
integer up to 128-bit double complex, see #VipsBandFormat.
In VIPS, images are uninterpreted arrays, meaning that from the point of
view of most operations, they are just large collections of numbers.
There's no difference between an RGBA (RGB with alpha) image and a CMYK
image, for example, they are both just four-band images. It's up to the
user of the library to pass the right sort of image to each operation.
To take an example, VIPS has vips_Lab2XYZ(), an operation to transform
an image from CIE LAB colour space to CIE XYZ space. It assumes the
first three bands represent pixels in LAB colour space and returns an
image where the first three bands
</para>
</refsect1>
</refentry>

View File

@ -0,0 +1,151 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
]>
<refentry id="using-cli">
<refmeta>
<refentrytitle>VIPS from the command-line</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo>VIPS Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Using VIPS</refname>
<refpurpose>How to use the VIPS library</refpurpose>
</refnamediv>
<refsect1 id="using-command-line">
<title>Using VIPS from the command-line</title>
<para>
Use the <command>vips</command> command to execute VIPS operations from
the command-line. You can show all classes with:
<literallayout>
<userinput>vips list classes</userinput>
</literallayout>
This produces output something like:
<literallayout>
<userinput>VipsOperation (operation), operations</userinput>
<userinput> VipsSystem (system), run an external command</userinput>
<userinput> VipsArithmetic (arithmetic), arithmetic operations</userinput>
<userinput> VipsBinary (binary), binary operations</userinput>
<userinput> VipsAdd (add), add two images</userinput>
<userinput> .... and so on</userinput>
</literallayout>
Each line shows the canonical name of the class (for example
<literal>VipsAdd</literal>), the class nickname
(<literal>add</literal> in this case), and a short description.
Some subclasses of operation will show more, for example subclasses of
<literal>VipsForeign</literal> will show some of the extra flags
supported by the file load/save operations.
You can get help on a specific operation by running it with no arguments,
for example:
<literallayout>
<userinput>vips gamma</userinput>
</literallayout>
produces the output:
<literallayout>
<userinput>gamma an image</userinput>
<userinput>usage:</userinput>
<userinput> gamma in out</userinput>
<userinput>where:</userinput>
<userinput> in - Input image, input VipsImage</userinput>
<userinput> out - Output image, output VipsImage</userinput>
<userinput>optional arguments:</userinput>
<userinput> exponent - Gamma factor, input gdouble</userinput>
<userinput>operation flags: sequential-unbuffered</userinput>
</literallayout>
<command>vips gamma</command> applies a gamma factor to an image. By
default, it uses 2.4, the sRGB gamma factor, but you can specify any
gamma with the <literal>exponent</literal> option. You can use the
C API docs for <function>vips_gamma()</function> if you need more
information.
Use it from the command-line like this:
<literallayout>
<userinput>vips gamma k2.jpg x.jpg --exponent 0.42</userinput>
</literallayout>
This will read file <literal>k2.jpg</literal>, un-gamma it, and
write the result to file <literal>x.jpg</literal>.
Some operations take arrays of values as arguments, for example,
<command>vips affine</command> needs an array of four numbers for the
2x2 transform matrix. You pass arrays as space-separated lists, for
example:
<literallayout>
<userinput>vips affine k2.jpg x.jpg "2 0 0 1"</userinput>
</literallayout>
Or <command>vips bandjoin</command> needs an array of input images to
join, run it like this:
<literallayout>
<userinput>vips bandjoin "k2.jpg k4.jpg" x.tif</userinput>
</literallayout>
<command>vips</command> will automatically convert between image file
formats for you. Input images are detected by sniffing their first few
bytes; output formats are set from the filename suffix. You can see a
list of all the supported file formats with something like:
<literallayout>
<userinput>vips list classes | grep -i foreign</userinput>
</literallayout>
Then get a list of the options a format supports with, for example:
<literallayout>
<userinput>vips jpegsave</userinput>
</literallayout>
You can pass options to the implicit load and save operations enclosed
in square brackets after the filename. For example:
<literallayout>
<userinput>vips affine k2.jpg x.jpg[Q=90,strip] "2 0 0 1"</userinput>
</literallayout>
Will write <literal>x.jpg</literal> at quality level 90 and will
strip all metadata from the image.
Finally, <command>vips</command> has a couple of useful extra options.
<itemizedlist>
<listitem>
<para>
Use <option>--vips-progress</option> to get
<command>vips</command> to display a simple progress indicator.
</para>
</listitem>
<listitem>
<para>
Use <option>--vips-leak</option> and <command>vips</command> will
leak-test on exit, and also display an estimate of peak memory use.
</para>
</listitem>
</itemizedlist>
</para>
<para>
VIPS comes with a couple of other useful programs.
<command>vipsheader</command> is a command which can print image header
fields. <command>vipsedit</command> can change fields in vips format
images. <command>vipsthumbnail</command> can make image thumbnails
quickly.
</para>
</refsect1>
</refentry>

View File

@ -131,6 +131,10 @@ vips_get_argv0( void )
*
* <itemizedlist>
* <listitem>
* <para>checks that the libvips your program is expecting is
* binary-compatible with the vips library you're running against</para>
* </listitem>
* <listitem>
* <para>initialises any libraries that VIPS is using, including GObject
* and the threading system, if neccessary</para>
* </listitem>

View File

@ -63,24 +63,46 @@
* It also maintains a cache of recent operations. You can tune the cache
* behaviour in various ways, see vips_cache_set_max() and friends.
*
* Use vips_call() to call any vips operation from C. For example:
* vips_call(), vips_call_split() and vips_call_split_option_string() are used
* by vips to implement the C API. They can execute any #VipsOperation,
* passing in a set of required and optional arguments. Normally you would not
* use these functions directly: every operation has a tiny wrapper function
* which provides type-safety for the required arguments. For example,
* vips_embed() is defined as:
*
* |[
* VipsImage *in = ...
* VipsImaghe *out;
* int
* vips_embed( VipsImage *in, VipsImage **out,
* int x, int y, int width, int height, ... )
* {
* va_list ap;
* int result;
*
* if( vips_call( "embed", in, &out, 10, 10, 100, 100,
* "extend", VIPS_EXTEND_COPY,
* NULL ) )
* ...
* va_start( ap, height );
* result = vips_call_split( "embed", ap, in, out, x, y, width, height );
* va_end( ap );
*
* return( result );
* }
* ]|
*
* Will execute vips_embed() setting the optional `extend` property to
* #VIPS_EXTEND_COPY.
* If you are writing a language binding, you won't need these. Instead, make
* a new operation with vips_operation_new() (all it does is look up the
* operation by name with vips_type_find(), then call g_object_new() for you),
* then use vips_argument_map() and friends to loop over the operation's
* arguments setting them. Once you have set all arguments, use
* vips_cache_operation_build() to look up the operation in the cache and
* either build or dup it. If something goes wrong, you'll need to use
* vips_object_unref_outputs() and g_object_unref(). :wq
*
* If you want to search for operations, see what arguments they need, and
* test argument properties, see
* <link linkend="libvips-object">object</link>.
*
* Use vips_call() to call any vips operation from C. If you want to search
* for operations, see what arguments they need, and test argument
* properties, see
* <link linkend="libvips-object">object</link>. Each operation also has a
* wrapper function, of course, to give type safety for required arguments.
*
* vips_call_split() lets you run an operation with the optional and required
* arguments split into separate lists. vips_call_split_option_string() lets
@ -752,6 +774,36 @@ vips_call_by_name( const char *operation_name,
return( result );
}
/**
* vips_call:
* @operation_name:
* @...: required args, then a %NULL-terminated list of argument/value pairs
*
* vips_call() calls the named operation, passing in required arguments, and
* then setting any optional ones from the remainder of the arguments as a set
* of name/value pairs.
*
* For example, vips_embed() takes six required arguments, @in, @out, @x, @y,
* @width, @height; and has two optional arguments, @extend and @background.
* You can run it with vips_call() like this:
*
* |[
* VipsImage *in = ...
* VipsImage *out;
*
* if( vips_call( "embed", in, &out, 10, 10, 100, 100,
* "extend", VIPS_EXTEND_COPY,
* NULL ) )
* ... error
* ]|
*
* Normally of course you'd just use the vips_embed() wrapper function and get
* type-safety for the required arguments.
*
* See also: vips_call_split(), vips_call_options().
*
* Returns: 0 on success, -1 on error
*/
int
vips_call( const char *operation_name, ... )
{
@ -760,7 +812,7 @@ vips_call( const char *operation_name, ... )
va_list required;
va_list optional;
if( !(operation = vips_operation_new( operation_name ) ) )
if( !(operation = vips_operation_new( operation_name )) )
return( -1 );
/* We have to break the va_list into separate required and optional