This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via b751bfc9b78d8dc25a503efce8582a8f6df10af7 (commit)
via 1479708a43cb28eada03dbf962fe98a623cd68d6 (commit)
from 76f73128753ed19cefe7e80e55520edccbb01b9a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/b751bfc9b78d8dc25a503efce8582a8f6df1…
commit b751bfc9b78d8dc25a503efce8582a8f6df10af7
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun May 11 14:06:56 2014 +0200
doc: Add resize filters to python docs.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/demos/py_simple/resize.py b/demos/py_simple/resize.py
index 38a5b783..7d11e229 100755
--- a/demos/py_simple/resize.py
+++ b/demos/py_simple/resize.py
@@ -10,13 +10,10 @@ def main():
print("USAGE: %s imput_image output_image" % sys.argv[0]);
sys.exit(1)
- # Turns on debug messages
- core.SetDebugLevel(10);
-
# Load Image
src = loaders.Load(sys.argv[1])
# Resize image to the half of the original
- res = src.filters.ResizeAlloc(src.w//2, src.h//2, 2)
+ res = src.filters.ResizeLFIntAlloc(src.w//2, src.h//2)
# Save Image
res.loaders.Save(sys.argv[2])
diff --git a/doc/example_py_resize.txt b/doc/example_py_resize.txt
new file mode 100644
index 00000000..06504964
--- /dev/null
+++ b/doc/example_py_resize.txt
@@ -0,0 +1,8 @@
+Resize
+------
+A simple program that loads image, resizes it to half and saves result.
+
+[source,python]
+------------------------------------------------------------------
+include::../demos/py_simple/resize.py[]
+------------------------------------------------------------------
diff --git a/doc/filters_python.txt b/doc/filters_python.txt
index c1dadb84..fc202fbb 100644
--- a/doc/filters_python.txt
+++ b/doc/filters_python.txt
@@ -8,9 +8,10 @@ The filter functions could be called directly as +filters.Foo(img, ..)+ or
from submodule as +img.filters.Foo(..)+. Note that in the second case the
image is passed automatically as a first parameter.
-If filter has been aborted from callback 'OSError' with errno set to
-'ECANCELED' is raised, see progress callback
-link:core_python.html#Progress_Callback[documentation] for more information.
+If filter is aborted from a callback 'OSError' with errno set to
+'ECANCELED' is raised, see
+link:core_python.html#Progress_Callback[progress callback] for more
+information.
Point Filters
~~~~~~~~~~~~~
@@ -402,3 +403,29 @@ respectively y pixel neighbors from each side so the result is median of
rectangle of +2 * x + 1+ x +2 * y + 1+ pixels.
include::images/median/images.txt[]
+
+Resize
+~~~~~~
+
+[source,python]
+-------------------------------------------------------------------------------
+import gfxprim.core as core
+import gfxprim.filters as filters
+
+ # Nearest neighbour resize, fastest but lowest quality
+ res = img.ResizeNNAlloc(100, 100, callback=None)
+
+ # Fast and good quality with low pass on downscaling
+ res = img.ResizeLinearLFIntAlloc(100, 100, callback=None)
+
+ # Cubic interpolation, needs low pass (blur) applied before downscaling
+ res = img.ResizeCubicIntAlloc(100, 100, callback=None)
+
+ # All of the above, TYPE is numeric enum
+ res = img.ResizeAlloc(100, 100, TYPE, callback=None)
+
+-------------------------------------------------------------------------------
+
+Functions to resize (resample) image.
+
+TIP: See link:example_py_resize.html[resize example].
http://repo.or.cz/w/gfxprim.git/commit/1479708a43cb28eada03dbf962fe98a623cd…
commit 1479708a43cb28eada03dbf962fe98a623cd68d6
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun May 11 14:00:20 2014 +0200
pywrap: filters: Add ResizeCubicInt
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/pylib/gfxprim/filters/filters.i b/pylib/gfxprim/filters/filters.i
index a504f76a..3aeba03b 100644
--- a/pylib/gfxprim/filters/filters.i
+++ b/pylib/gfxprim/filters/filters.i
@@ -92,6 +92,10 @@ FILTER_FUNC(ResizeLinearInt);
FILTER_FUNC(ResizeLinearLFInt);
%include "GP_ResizeLinear.h"
+FILTER_FUNC(ResizeCubic);
+FILTER_FUNC(ResizeCubicInt);
+%include "GP_ResizeCubic.h"
+
/* Ditherings */
FILTER_FUNC(FloydSteinberg);
FILTER_FUNC(GP_FilterHilbertPeano);
-----------------------------------------------------------------------
Summary of changes:
demos/py_simple/resize.py | 5 +--
...mple_py_showimage.txt => example_py_resize.txt} | 8 ++--
doc/filters_python.txt | 33 ++++++++++++++++++--
pylib/gfxprim/filters/filters.i | 4 ++
4 files changed, 39 insertions(+), 11 deletions(-)
copy doc/{example_py_showimage.txt => example_py_resize.txt} (53%)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via ac5ab1fc384840bd63b923cd8d02043176676d01 (commit)
from 34edb5f159d98fccc62cfdcd268f51109320dafd (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/ac5ab1fc384840bd63b923cd8d0204317667…
commit ac5ab1fc384840bd63b923cd8d02043176676d01
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri Apr 25 23:37:17 2014 +0200
spiv: Fix slow blit for images with alpha channel
The pattern_fill() function that draws chessboard like pattern before
images with alpha channel are blitted was drawing the pattern pixel by
pixel, which is quite slow and caused dropped events when moving such
image in the spiv window.
This commit optimizes the function a bit (about then times faster) which
fixes the problem.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/demos/spiv/spiv.c b/demos/spiv/spiv.c
index 6d26c600..d4785e0a 100644
--- a/demos/spiv/spiv.c
+++ b/demos/spiv/spiv.c
@@ -171,26 +171,21 @@ static GP_Context *load_image(int elevate)
static void pattern_fill(GP_Context *ctx, unsigned int x0, unsigned int y0,
unsigned int w, unsigned int h)
{
- unsigned int x, y;
+ unsigned int x, y, i, j = 0;
+ GP_Pixel col[2];
- GP_Pixel g1 = GP_RGBToContextPixel(0x64, 0x64, 0x64, ctx);
- GP_Pixel g2 = GP_RGBToContextPixel(0x80, 0x80, 0x80, ctx);
+ col[0] = GP_RGBToContextPixel(0x64, 0x64, 0x64, ctx);
+ col[1] = GP_RGBToContextPixel(0x80, 0x80, 0x80, ctx);
- unsigned int wm = w/10 < 10 ? 10 : w/10;
- unsigned int hm = h/10 < 10 ? 10 : h/10;
- unsigned int wt = w/20 < 5 ? 5 : w/20;
- unsigned int ht = h/20 < 5 ? 5 : h/20;
+ unsigned int wm = w/20 < 5 ? 5 : w/20;
+ unsigned int hm = h/20 < 5 ? 5 : h/20;
- for (y = 0; y < h; y++) {
- for (x = 0; x < w; x++) {
- GP_Pixel pix;
-
- if ((x % wm < wt) ^ (y % hm < ht))
- pix = g1;
- else
- pix = g2;
-
- GP_PutPixel(ctx, x0 + x, y0 + y, pix);
+ for (y = 0; y < h; y += hm) {
+ i = j;
+ j = !j;
+ for (x = 0; x < w; x += wm) {
+ GP_FillRectXYWH(ctx, x0 + x, y0 + y, wm, hm, col[i]);
+ i = !i;
}
}
}
@@ -323,7 +318,6 @@ static void update_display(struct loader_params *params, GP_Context *img,
} else {
if (GP_PixelHasFlags(img->pixel_type, GP_PIXEL_HAS_ALPHA))
pattern_fill(context, cx, cy, img->w, img->h);
-
GP_Blit_Clipped(img, 0, 0, img->w, img->h, context, cx, cy);
}
-----------------------------------------------------------------------
Summary of changes:
demos/spiv/spiv.c | 30 ++++++++++++------------------
1 files changed, 12 insertions(+), 18 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via 34edb5f159d98fccc62cfdcd268f51109320dafd (commit)
from e667b1019551a0036d4ff8e7852bc51e2336440c (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/34edb5f159d98fccc62cfdcd268f51109320…
commit 34edb5f159d98fccc62cfdcd268f51109320dafd
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri Apr 25 22:39:02 2014 +0200
loaders: PNG: Enable 8bit grayscale with alpha.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/libs/loaders/GP_PNG.c b/libs/loaders/GP_PNG.c
index 770bb123..0ea37379 100644
--- a/libs/loaders/GP_PNG.c
+++ b/libs/loaders/GP_PNG.c
@@ -145,6 +145,13 @@ GP_Context *GP_ReadPNG(GP_IO *io, GP_ProgressCallback *callback)
#endif
}
break;
+ case PNG_COLOR_TYPE_GRAY | PNG_COLOR_MASK_ALPHA:
+ switch (depth) {
+ case 8:
+ pixel_type = GP_PIXEL_GA88;
+ break;
+ }
+ break;
case PNG_COLOR_TYPE_RGB:
png_set_bgr(png);
-----------------------------------------------------------------------
Summary of changes:
libs/loaders/GP_PNG.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via c4cb658954c2cd3de44939d096b48eb40438d674 (commit)
via 623d537b03153f26c9e6cc0d68d7dfa70fb62058 (commit)
via e78aa462e49f391bc0cf7fc31bde121063e23f2c (commit)
via 556a69a3e1bb48998da72d810b8daec1af997f49 (commit)
via 9bf5488c204dba601b1f43ab1a20542207f194be (commit)
from 05ec5cc78e822d2d4d45b54280997526d5e1bd64 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/c4cb658954c2cd3de44939d096b48eb40438…
commit c4cb658954c2cd3de44939d096b48eb40438d674
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Tue Mar 18 23:31:08 2014 +0100
loaders: zip: Partial support for stream zip
Some zip files does not have crc, compressed size and uncompressed size
in zip local header but in data descriptor (which is located after the
data).
This commit modifies the decompression rutines to cope with unknown
buffer size (the buffer is reallocated on the fly).
Seeking in the ZIP does not work yet.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/libs/loaders/GP_ZIP.c b/libs/loaders/GP_ZIP.c
index 11e3eed6..7928023d 100644
--- a/libs/loaders/GP_ZIP.c
+++ b/libs/loaders/GP_ZIP.c
@@ -177,30 +177,50 @@ struct deflate_inbuf {
struct deflate_outbuf {
uint32_t crc;
uint32_t size;
+ uint32_t fill;
uint8_t *buf;
};
static unsigned deflate_in(void *in_desc, unsigned char **buf)
{
struct deflate_inbuf *in = in_desc;
- int chunk = in->to_read >= CHUNK ? CHUNK : in->to_read;
+ int chunk, ret;
- if (GP_IORead(in->io, in->buf, chunk) != chunk)
- return 0;
+ if (in->to_read)
+ chunk = in->to_read >= CHUNK ? CHUNK : in->to_read;
+ else
+ chunk = CHUNK;
+
+ ret = GP_IORead(in->io, in->buf, chunk);
+
+ if (ret <= 0)
+ return ret;
*buf = in->buf;
- in->to_read -= chunk;
- return chunk;
+ if (in->to_read)
+ in->to_read -= ret;
+
+ return ret;
}
+#define BUFINC (1024 * 128)
+
static int deflate_out(void *out_desc, unsigned char *buf, unsigned len)
{
struct deflate_outbuf *out = out_desc;
+ if (out->fill + len >= out->size) {
+ out->buf = realloc(out->buf, out->size + GP_MAX(len, BUFINC));
+ if (!out->buf)
+ return 1;
+ out->size += GP_MAX(len, BUFINC);
+ GP_DEBUG(1, "Realloc %u %p", out->size, out->buf);
+ }
+
out->crc = crc32(out->crc, buf, len);
- memcpy(out->buf + out->size, buf, len);
- out->size += len;
+ memcpy(out->buf + out->fill, buf, len);
+ out->fill += len;
return 0;
}
@@ -210,16 +230,12 @@ static int read_deflate(GP_IO *io, struct zip_local_header *header, GP_IO **rio)
uint8_t *window;
int err = 0, ret;
uint8_t *buf;
-
- if (header->flags & FLAG_ZERO_SIZE_CRC) {
- GP_DEBUG(1, "Size not set in local file header");
- return ENOSYS;
- }
+ unsigned int bufsize = header->uncomp_size ? header->uncomp_size : BUFINC;
window = malloc(32 * 1024);
//TODO: Unsafe
- buf = malloc(header->uncomp_size);
+ buf = malloc(bufsize);
if (!window || !buf) {
err = ENOMEM;
@@ -242,7 +258,8 @@ static int read_deflate(GP_IO *io, struct zip_local_header *header, GP_IO **rio)
struct deflate_outbuf outbuf = {
.crc = crc32(0, NULL, 0),
- .size = 0,
+ .size = bufsize,
+ .fill = 0,
.buf = buf,
};
@@ -260,13 +277,31 @@ static int read_deflate(GP_IO *io, struct zip_local_header *header, GP_IO **rio)
goto err2;
}
+ if (header->flags & FLAG_ZERO_SIZE_CRC) {
+ GP_DEBUG(2, "In buffer %i, seeking back", strm.avail_in);
+ GP_IOSeek(io, -(int)strm.avail_in, GP_IO_SEEK_CUR);
+ uint16_t data_desc_header[] = {
+ 'P', 'K', 0x07, 0x08, /* Data desc header */
+ GP_IO_L4, /* CRC */
+ GP_IO_L4, /* Compressed size */
+ GP_IO_L4, /* Uncompressed size */
+ GP_IO_END
+ };
+
+ if (GP_IOReadF(io, data_desc_header, &header->crc,
+ &header->comp_size, &header->uncomp_size) != 7) {
+ GP_DEBUG(1, "Failed to read Data Description Header");
+ goto err2;
+ }
+ }
+
if (outbuf.crc != header->crc) {
GP_DEBUG(1, "CRC does not match");
err = EIO;
goto err2;
}
- if (outbuf.size != header->uncomp_size) {
+ if (outbuf.fill != header->uncomp_size) {
GP_DEBUG(1, "Decompressed size does not match");
err = EIO;
goto err2;
@@ -282,7 +317,7 @@ err2:
inflateBackEnd(&strm);
err1:
free(window);
- free(buf);
+ free(outbuf.buf);
return err;
}
http://repo.or.cz/w/gfxprim.git/commit/623d537b03153f26c9e6cc0d68d7dfa70fb6…
commit 623d537b03153f26c9e6cc0d68d7dfa70fb62058
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Tue Mar 18 19:42:20 2014 +0100
loaders: zip: Add flag defs.
Add flags definitions and print them to debug output.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/libs/loaders/GP_ZIP.c b/libs/loaders/GP_ZIP.c
index ec80e963..11e3eed6 100644
--- a/libs/loaders/GP_ZIP.c
+++ b/libs/loaders/GP_ZIP.c
@@ -73,11 +73,9 @@ struct zip_priv {
struct zip_chunks_table table;
};
-#define GEN_FLAG_ENCRYPTED 0x01
-
struct zip_local_header {
uint16_t ver;
- uint16_t bit_flags;
+ uint16_t flags;
uint16_t comp_type;
uint32_t crc;
@@ -130,6 +128,27 @@ static const char *compress_method_name(enum compress_method comp)
return compress_method_names[comp];
}
+enum zip_flags {
+ /* File is encrypted */
+ FLAG_ENCRYPTED = 0x0001,
+ /* Size and CRC are in data descriptor after the compressed data */
+ FLAG_ZERO_SIZE_CRC = 0x0008,
+ /* Filename and comment fileds are in UTF-8 */
+ FLAG_UTF8 = 0x0800,
+};
+
+static void print_flags(struct zip_local_header *header)
+{
+ if (header->flags & FLAG_ENCRYPTED)
+ GP_DEBUG(2, "File is encrypted");
+
+ if (header->flags & FLAG_ZERO_SIZE_CRC)
+ GP_DEBUG(2, "File size and CRC are after compressed data");
+
+ if (header->flags & FLAG_UTF8)
+ GP_DEBUG(2, "Filename and comment are encoded in UTF-8");
+}
+
static int seek_bytes(GP_IO *io, uint32_t bytes)
{
if (bytes == 0)
@@ -192,7 +211,13 @@ static int read_deflate(GP_IO *io, struct zip_local_header *header, GP_IO **rio)
int err = 0, ret;
uint8_t *buf;
+ if (header->flags & FLAG_ZERO_SIZE_CRC) {
+ GP_DEBUG(1, "Size not set in local file header");
+ return ENOSYS;
+ }
+
window = malloc(32 * 1024);
+
//TODO: Unsafe
buf = malloc(header->uncomp_size);
@@ -307,7 +332,7 @@ static int zip_load_header(GP_IO *io, struct zip_local_header *header)
};
ret = GP_IOReadF(io, zip_local_header,
- &header->ver, &header->bit_flags, &header->comp_type,
+ &header->ver, &header->flags, &header->comp_type,
&header->crc, &header->comp_size, &header->uncomp_size,
&header->fname_len, &header->extf_len);
@@ -334,7 +359,9 @@ static GP_Context *zip_next_file(struct zip_priv *priv,
header.ver/10, header.ver%10,
compress_method_name(header.comp_type));
- if (header.bit_flags & GEN_FLAG_ENCRYPTED) {
+ print_flags(&header);
+
+ if (header.flags & FLAG_ENCRYPTED) {
GP_DEBUG(1, "Can't handle encrypted files");
err = ENOSYS;
goto out;
http://repo.or.cz/w/gfxprim.git/commit/e78aa462e49f391bc0cf7fc31bde121063e2…
commit e78aa462e49f391bc0cf7fc31bde121063e23f2c
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Mar 16 21:51:13 2014 +0100
doc: Update compilation instructions
* Add links to libraries
* Add packages section
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/doc/compilation.txt b/doc/compilation.txt
index b5eb7fc4..35f8bd8a 100644
--- a/doc/compilation.txt
+++ b/doc/compilation.txt
@@ -3,33 +3,35 @@ Dependencies
*Base dependencies*
-* C compiler (tested with 'gcc' or 'clang')
-* GNU make
-* Python (2.6 or newer)
-* Jinja2
+* C compiler (tested with link:http://gcc.gnu.org/[gcc] and
+ link:http://clang.llvm.org/[clang])
+* link:https://www.gnu.org/software/make/[GNU make]
+* link:https://www.python.org/[Python] (2.6 or newer)
+* link:http://jinja.pocoo.org/docs/[Jinja2]
*Optional Image loaders*
* libjpeg
-* libpng
-* giflib
-* libtiff
-* openjpeg >= 2.0.0
-* zlib (usually installed as libpng dependency)
+* link:http://www.libpng.org/[libpng]
+* link:http://sourceforge.net/projects/giflib/[giflib]
+* link:http://www.remotesensing.org/libtiff/[libtiff]
+* link:http://code.google.com/p/openjpeg/[openjpeg] >= 2.0.0
+* link:http://www.zlib.net/[zlib] (usually installed as libpng dependency)
*Optinal Text rendering*
-* FreeType
+* link:http://www.freetype.org/[FreeType]
*Optional Backends*
* X11
-* AA-lib
-* SDL-1.2 (not recomended, known to be slow and buggy)
+* link:http://aa-project.sourceforge.net/aalib/[AA-lib]
+* link:http://www.libsdl.org/[SDL] 1.2
+ (not recomended, known to be slow and buggy)
*Python Bindings*
-* Swig
+* link:http://www.swig.org/[Swig]
* Python (devel library)
Compilation
@@ -61,7 +63,7 @@ The +make install+ command will install GFXprim libraries and devel headers
into your system.
OpenSUSE & Fedora
------------------
+~~~~~~~~~~~~~~~~~
Instruction to install required packages on
link:http://www.opensuse.org/[OpenSUSE].
@@ -102,7 +104,7 @@ zypper in gcc make python-Jinja2 libjpeg-devel libpng-devel giflib-devel
-------------------------------------------------------------------------------
Debian
-------
+~~~~~~
Instruction to install required packages on link:http://www.debian.org[Debian]
and other Debian based distributions.
@@ -138,3 +140,27 @@ apt-get install gcc make python-jinja2 libjpeg-dev libpng-dev libgif-dev
libtiff-dev libfreetype6-dev libx11-dev libxext-dev swig
python-dev
-------------------------------------------------------------------------------
+
+Packages
+--------
+
+RPM
+~~~
+RPM packages as well as specfile are available in
+link:https://build.opensuse.org/package/show/home:metan/gfxprim[build service].
+
+Deb
+~~~
+Deb packages can be build from the GFXprim source (after installing necessary
+devel packages) by:
+
+.Building debian packages
+-------------------------------------------------------------------------------
+# apt-get install devscripts
+# cd gfxprim
+# debuild -i -us -uc
+-------------------------------------------------------------------------------
+
+Gentoo
+~~~~~~
+GFXprim source contains ebuild in 'gentoo/' directory.
http://repo.or.cz/w/gfxprim.git/commit/556a69a3e1bb48998da72d810b8daec1af99…
commit 556a69a3e1bb48998da72d810b8daec1af997f49
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Mar 16 21:19:48 2014 +0100
doc: Remove '' from emphasized words, fixes.
* NULL, stderr, stdout... are now emphasized by default
* A few fixes
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/doc/backends.txt b/doc/backends.txt
index 4196c8f8..9b0c392c 100644
--- a/doc/backends.txt
+++ b/doc/backends.txt
@@ -124,9 +124,9 @@ GP_Backend *GP_BackendX11Init(const char *display, int x, int y,
enum GP_BackendX11Flags flags);
-------------------------------------------------------------------------------
-Returns pointer to initialized X11 backend or in case of failure 'NULL'.
+Returns pointer to initialized X11 backend or in case of failure NULL.
-When display is 'NULL' default display is used (which is what you want most of the
+When display is NULL default display is used (which is what you want most of the
time).
This backends supports multiple windows. Each time you call the initialization
@@ -217,11 +217,11 @@ The 'caption' string is used for window caption, in case of X11 backend or may
be ignored completly in case of framebuffer backend.
If 'params' is set to '"help"' help for all backends is printed into the
-'stderr'.
+stderr.
If initialization was successful pointer to allocated and initialized backend
-is returned otherwise 'NULL' is returned and some helpful information should
-be printed into the 'stderr'.
+is returned otherwise NULL is returned and some helpful information should
+be printed into the stderr.
General Backend API
@@ -458,7 +458,7 @@ Adds a link:input.html#Timers[timer] to the backend timer queue.
Timers added to the backend are processed automatically while you call any of
backend 'Poll' or 'Wait' functions.
-If timer callback is set to 'NULL' a timer event is pushed to the backend
+If timer callback is set to NULL a timer event is pushed to the backend
input queue once timer has expired otherwise timer callback is called.
TIP: For example usage see backend timers
diff --git a/doc/context.txt b/doc/context.txt
index b8213ffe..c59c714e 100644
--- a/doc/context.txt
+++ b/doc/context.txt
@@ -44,8 +44,8 @@ lines (i.e. each image line starts at whole byte and ends at whole byte).
The 'pixels' array starts exactly at upper left corner of the image and is
stored in horizontal lines (each line contains 'w' pixels and there is 'h'
-lines). Each line is 'bytes_per_row' bytes long (which equals to 'w' * 'bpp' /
-8 rouned up to the whole bytes). The first pixel may actually start at
+lines). Each line is 'bytes_per_row' bytes long (which equals to 'w * bpp /
+8' rouned up to the whole bytes). The first pixel may actually start at
'offset' bit in the first byte in each line (but only for some
<<Sub_Context,subcontexts>> for pixel types that are not byte aligned).
@@ -153,7 +153,7 @@ parameters are set to the default values (i.e. rotation flags are all set to
zero, 'free_pixels' flag is not set). Number of bits per pixel and
bytes per row are computed from the given pixel type and size.
-The 'pixels' pointer can be 'NULL' and can be changed later manually (the call
+The 'pixels' pointer can be NULL and can be changed later manually (the call
will *not* try to allocate the pixel memory automatically).
The function returns a pointer to the initialized context (i.e. the same
@@ -224,7 +224,7 @@ Frees the context memory.
If 'free_pixels' flag is set, the pixels buffer is freed too.
-If gamma pointer is not 'NULL' the 'GP_GammaRelease()' is called.
+If gamma pointer is not NULL the 'GP_GammaRelease()' is called.
[[Sub_Context]]
Subcontext
diff --git a/doc/debug.txt b/doc/debug.txt
index 7424064f..e5f0015e 100644
--- a/doc/debug.txt
+++ b/doc/debug.txt
@@ -69,7 +69,7 @@ void GP_DebugPrint(int level, const char *file, const char *function, int line,
Printf-like macros used to print debug messages. All of them calls the
'GP_DebugPrint()' function with slightly different parameters.
-NOTE: 'GP_DebugPrint()' function preserves 'errno'.
+NOTE: 'GP_DebugPrint()' function preserves errno.
[source,c]
-------------------------------------------------------------------------------
@@ -101,7 +101,7 @@ void GP_SetDebugHandler(void (*handler)(const struct GP_DebugMsg *msg));
-------------------------------------------------------------------------------
-By default debug messages are printed into the 'stderr' you can redirect them
+By default debug messages are printed into the stderr you can redirect them
to your debug handler by this function.
NOTE: For more information see debug message handler
diff --git a/doc/environment_variables.txt b/doc/environment_variables.txt
index 26d72095..85b6758d 100644
--- a/doc/environment_variables.txt
+++ b/doc/environment_variables.txt
@@ -37,7 +37,7 @@ messages are printed. Current the maximum used in GFXprim sources is 4, this
may change in the future. Use 'GP_DEBUG=10' to enable all debug messages for
sure.
-The output is, by default, written to 'stderr' and will look like:
+The output is, by default, written to stderr and will look like:
------------------------------------------------------------------------------
1: GP_Debug.c:GP_DebugPrint():67: Using debug level GP_DEBUG=10 from enviroment variable
1: GP_Debug.c:GP_DebugPrint():71: GFXprim library version 1.0.0-rc0
diff --git a/doc/event_queue.txt b/doc/event_queue.txt
index 5b476bd8..b694dc79 100644
--- a/doc/event_queue.txt
+++ b/doc/event_queue.txt
@@ -46,7 +46,7 @@ The initialization functions takes pointer to a memory large enough to hold an
event queue structure and array of queue_size events.
The last function allocates and initializes an event queue. If allocation has
-failed 'NULL' is returned.
+failed NULL is returned.
[source,c]
-------------------------------------------------------------------------------
@@ -153,5 +153,5 @@ void GP_EventQueuePush(struct GP_EventQueue *self,
-------------------------------------------------------------------------------
Following functions are used for puting events into the event queue. If
-pointer to the timeval structure is 'NULL' the event 'time' will be filled
+pointer to the timeval structure is NULL the event 'time' will be filled
with exact time the event was added to the queue.
diff --git a/doc/filters.txt b/doc/filters.txt
index 8cedbf9b..1ed37f09 100644
--- a/doc/filters.txt
+++ b/doc/filters.txt
@@ -22,12 +22,12 @@ For convenience, the filters API is unified:
* And the last argument is link:progress_callback.html[progress callback]
When using allocating version of the filter, pointer to the newly allocated
-context is returned, or in case of failure 'NULL' is returned.
+context is returned, or in case of failure NULL is returned.
-If 'malloc()' has failed 'NULL' is returned.
+If 'malloc()' has failed NULL is returned.
If filter has been interrupted by a callback, all allocated memory is freed,
-and 'NULL' is returned.
+and NULL is returned.
When using non-allocating variant of the filter, the destination context must
have correct pixel type and the size must be big enough to store the result.
diff --git a/doc/filters_dithering.txt b/doc/filters_dithering.txt
index 2f2605b3..94c82033 100644
--- a/doc/filters_dithering.txt
+++ b/doc/filters_dithering.txt
@@ -52,11 +52,11 @@ GP_Context *GP_FilterFloydSteinbergAlloc(const GP_Context *src,
Returns pointer to allocated context of given pixel_type.
-If 'malloc(2)' has failed, or operation was aborted by a callback 'NULL' is
+If 'malloc(2)' has failed, or operation was aborted by a callback NULL is
returned.
Not all pixel types all supported. If particular combination is not supported
-the function returns 'NULL' and sets errno to 'ENOSYS'.
+the function returns NULL and sets errno to 'ENOSYS'.
Hilbert-Peano
~~~~~~~~~~~~~
@@ -85,7 +85,7 @@ destination must be at least as large as source.
If operation was aborted by a callback, non-zero is returned.
Not all pixel types all supported. If particular combination is not supported
-the function returns 'NULL' and sets errno to 'ENOSYS'.
+the function returns NULL and sets errno to 'ENOSYS'.
[source,c]
-------------------------------------------------------------------------------
@@ -100,11 +100,11 @@ GP_Context *GP_FilterHilbertPeanoAlloc(const GP_Context *src,
Returns pointer to allocated context of given pixel_type.
-If 'malloc(2)' has failed, or operation was aborted by a callback 'NULL' is
+If 'malloc(2)' has failed, or operation was aborted by a callback NULL is
returned.
Not all pixel types all supported. If particular combination is not supported
-the function returns 'NULL' and sets errno to 'ENOSYS'.
+the function returns NULL and sets errno to 'ENOSYS'.
include::images/convert/images.txt[]
include::images/floyd_steinberg/images.txt[]
diff --git a/doc/filters_python.txt b/doc/filters_python.txt
index 19d50cf8..c1dadb84 100644
--- a/doc/filters_python.txt
+++ b/doc/filters_python.txt
@@ -8,7 +8,7 @@ The filter functions could be called directly as +filters.Foo(img, ..)+ or
from submodule as +img.filters.Foo(..)+. Note that in the second case the
image is passed automatically as a first parameter.
-If filter has been aborted from callback 'OSError' with 'errno' set to
+If filter has been aborted from callback 'OSError' with errno set to
'ECANCELED' is raised, see progress callback
link:core_python.html#Progress_Callback[documentation] for more information.
diff --git a/doc/filters_resize.txt b/doc/filters_resize.txt
index 03310775..6cf65644 100644
--- a/doc/filters_resize.txt
+++ b/doc/filters_resize.txt
@@ -42,15 +42,15 @@ The +GP_FilterReize()+ function resizes 'src' to fit 'dst' exactly.
Both 'src' and 'dst' must have the same pixel type.
-Returns zero on success, non-zero on failure and sets 'errno'.
+Returns zero on success, non-zero on failure and sets errno.
GP_FilterResizeAlloc
^^^^^^^^^^^^^^^^^^^^
The +GP_FilterResizeAlloc()+ allocates the destination give it's size.
-Returns pointer to newly allocated context or 'NULL' in case of failure and
-'errno' is set.
+Returns pointer to newly allocated context or NULL in case of failure and
+errno is set.
Nearest Neighbour Interpolation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/doc/gamma.txt b/doc/gamma.txt
index 317900ae..a38518bd 100644
--- a/doc/gamma.txt
+++ b/doc/gamma.txt
@@ -109,7 +109,7 @@ Returns pointer to gamma table for particular pixel_type and gamma value.
The same gamma is used for all channels.
-May fail and return 'NULL' if 'malloc()' has failed.
+May fail and return NULL if 'malloc()' has failed.
[source,c]
-------------------------------------------------------------------------------
diff --git a/doc/grabbers.txt b/doc/grabbers.txt
index 06ff7913..21285921 100644
--- a/doc/grabbers.txt
+++ b/doc/grabbers.txt
@@ -124,5 +124,5 @@ that width and height, but the driver may return different values if chosen
width and height are not supported.
Returns either pointer to the initialized grabber or, in case of failure,
-'NULL' and 'errno' is set.
+NULL and errno is set.
diff --git a/doc/input.txt b/doc/input.txt
index 08b0816d..13299979 100644
--- a/doc/input.txt
+++ b/doc/input.txt
@@ -191,7 +191,7 @@ Event API
void GP_EventDump(struct GP_Event *ev);
-------------------------------------------------------------------------------
-The 'GP_EventDump' dumps event in human-readable format into the 'stdout'.
+The 'GP_EventDump' dumps event in human-readable format into the stdout.
[source,c]
-------------------------------------------------------------------------------
diff --git a/doc/loaders.txt b/doc/loaders.txt
index 7d43aa8a..c1d94e8e 100644
--- a/doc/loaders.txt
+++ b/doc/loaders.txt
@@ -73,7 +73,7 @@ functions for each format that implements signature matching. If image
signature is recognized, image loader it is called and the result is returned.
If file extension disagrees with file signature (which is quite common on the
-internet) a warning is printed into the 'stderr'.
+internet) a warning is printed into the stderr.
The resulting link:context.html[Context] should be later freed with
link:context.html#ContextFree[GP_ContextFree()].
diff --git a/doc/loaders_io.txt b/doc/loaders_io.txt
index e12e7468..2e010bbc 100644
--- a/doc/loaders_io.txt
+++ b/doc/loaders_io.txt
@@ -57,7 +57,7 @@ case of failure a negative number (-1).
Return value from 'Close' is zero on success and non-zero on IO failure.
-NOTE: Make sure 'errno' is set if any of the operations has failed.
+NOTE: Make sure errno is set if any of the operations has failed.
[source,c]
-------------------------------------------------------------------------------
@@ -73,7 +73,7 @@ This is a wrapper to 'io->Read()'.
Reads at most 'size' bytes from an 'IO' stream and stores them into the
buffer. Returns number of bytes read.
-On failure the return value is negative and 'errno' is set.
+On failure the return value is negative and errno is set.
[source,c]
@@ -90,7 +90,7 @@ This is a wrapper to 'io->Write()'.
Writes at most 'size' bytes from an 'IO' stream and stores them into the
buffer. Returns number of bytes read.
-On failure the return value is negative and 'errno' is set.
+On failure the return value is negative and errno is set.
[source,c]
-------------------------------------------------------------------------------
@@ -106,7 +106,7 @@ This is a wrapper to 'io->Close()'.
Finalizes reading/writing, closes file descriptors (in case of file IO), frees
memory buffers.
-Returns zero on success, non-zero on IO failure and 'errno' is set.
+Returns zero on success, non-zero on IO failure and errno is set.
[source,c]
@@ -146,7 +146,7 @@ off_t GP_IORewind(GP_IO *io)
Wrapper to 'GP_IOSeek()', rewinds to the start of the IO stream.
-Returns zero on success, non-zero on failure and 'errno' is set.
+Returns zero on success, non-zero on failure and errno is set.
[source,c]
@@ -160,11 +160,11 @@ GP_IO *GP_IOMem(void *buf, size_t size, void (*free)(void *));
Creates an read-only IO from a memory buffer.
-Returns initialized IO or in case of failure 'NULL' and 'errno' is set.
+Returns initialized IO or in case of failure NULL and errno is set.
The 'buf' is pointer to the start of the buffer, the 'size' is size in bytes.
-The 'free()' callback if not 'NULL' is called with the start of the buffer as
+The 'free()' callback if not NULL is called with the start of the buffer as
an argument on 'IOClose()'.
TIP: See link:example_memory_io.html[memory IO example].
@@ -186,5 +186,5 @@ GP_IO *GP_IOFile(const char *path, enum GP_IOFileMode mode);
Creates an IO stream from a file.
-Returns a pointer to initialized IO stream, or in case of failure 'NULL' and
-'errno' is set.
+Returns a pointer to initialized IO stream, or in case of failure NULL and
+errno is set.
diff --git a/doc/loaders_python.txt b/doc/loaders_python.txt
index 6ffaaa6a..a73d1f0e 100644
--- a/doc/loaders_python.txt
+++ b/doc/loaders_python.txt
@@ -35,7 +35,7 @@ fails files signature is used.
|===============================================================================
| May raise 'OSError' with errno set to 'EPERM', 'EISDIR', 'ENOENT' or any other
- 'errno' set by 'open(2)', 'read(2)', 'seek(2)'.
+ errno set by 'open(2)', 'read(2)', 'seek(2)'.
| May raise 'OSError' with errno set to 'ENOSYS' on unsupported or not recognized
format or if specific loader was disabled upon compilation.
@@ -71,7 +71,7 @@ For the Save() method the file format is derived from the extension.
|===============================================================================
| May raise 'OSError' with errno set to 'EPERM', 'EISDIR', 'ENOENT', 'ENOSPC'
- or any other 'errno' set by 'open(2)', 'write(2)', 'seek(2)'.
+ or any other errno set by 'open(2)', 'write(2)', 'seek(2)'.
| May raise 'OSError' with errno set to 'ENOSYS' if pixel type is not supported
by the format or if the save method is not implemented (possibly disabled upon
compilation).
@@ -88,4 +88,4 @@ import gfxprim.loaders as loaders
-------------------------------------------------------------------------------
-Prints all loaders and their capabilites into the 'stdout'.
+Prints all loaders and their capabilites into the stdout.
diff --git a/doc/pixels.txt b/doc/pixels.txt
index 37553c47..ffc3fa1e 100644
--- a/doc/pixels.txt
+++ b/doc/pixels.txt
@@ -39,12 +39,12 @@ typedef enum GP_PixelType {
-------------------------------------------------------------------------------
-Pixels are described by a pixel type, which is enumeration type. The enum is
-defined in the generated 'GP_Pixel.gen.h' header and must contain at least the
-members listed above.
+Pixels are described by a pixel type, which is an enumeration type.
-The same names as are the enum values are also defined (to themselves) as
-macros so that it's possible to use them with 'ifdef'.
+The enum is defined in the 'GP_Pixel.gen.h' header link:gen.html[generated]
+from a configuration file.
+
+The header and must contain at least the members listed above.
[source,c]
-------------------------------------------------------------------------------
diff --git a/doc/progress_callback.txt b/doc/progress_callback.txt
index e12dccf2..9a0e50da 100644
--- a/doc/progress_callback.txt
+++ b/doc/progress_callback.txt
@@ -33,7 +33,7 @@ periodically and the percentage field is updated.
The return value from callback could abort the execution. If a non-zero value
is returned operation is aborted, all memory freed etc., in case of pixmap
-loaders 'errno' is set to 'ECANCELED' and in case of pixmap savers the newly
+loaders errno is set to 'ECANCELED' and in case of pixmap savers the newly
created file is removed too.
The callback, if supported, is the last parameter of a function.
diff --git a/doc/text.txt b/doc/text.txt
index 3acdd81e..3f3a5e70 100644
--- a/doc/text.txt
+++ b/doc/text.txt
@@ -42,7 +42,7 @@ GP_Size GP_VPrint(GP_Context *context, const GP_TextStyle *style,
Draws text at the position x and y; the alignment of the text in relation
to the point is specified by alignment flags.
-If the 'style' argument is 'NULL', a default style is used.
+If the 'style' argument is NULL, a default style is used.
The text size can be computed by following functions:
http://repo.or.cz/w/gfxprim.git/commit/9bf5488c204dba601b1f43ab1a20542207f1…
commit 9bf5488c204dba601b1f43ab1a20542207f194be
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Sun Mar 16 21:17:02 2014 +0100
doc: Update loaders, add TIFF.
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/doc/asciidoc.conf b/doc/asciidoc.conf
index cd6e25b3..8babf754 100644
--- a/doc/asciidoc.conf
+++ b/doc/asciidoc.conf
@@ -1,10 +1,14 @@
[specialwords]
-emphasizedwords=GFXprim
+emphasizedwords=GFXprim errno stdout stdin stderr NULL
[attributes]
# use image icons
icons
+# Redefine <<>> xref macro
+[xref2-inlinemacro]
+<a href="#{1}">{2={1}}</a>
+
[header]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
diff --git a/doc/asciidoc.css b/doc/asciidoc.css
index 09829b1f..a863bdb7 100644
--- a/doc/asciidoc.css
+++ b/doc/asciidoc.css
@@ -1,6 +1,6 @@
/* Default font. */
body {
- font-family: Georgia,serif;
+ font-family: Georgia,Serif;
background: #bbb;
}
diff --git a/doc/loaders.txt b/doc/loaders.txt
index 2a257ca3..7d43aa8a 100644
--- a/doc/loaders.txt
+++ b/doc/loaders.txt
@@ -3,8 +3,9 @@ Context loaders
This part of GFXprim library implements API to load and save images for common
image file formats.
-Currently we support 'JPEG', 'PNG', 'BMP', 'TIFF' and 'PNM' images for loading
-and saving and 'GIF', 'JPEG2000', 'PCX', 'CBZ', 'PSD' and 'PSP' for loading.
+Currently we support <<JPEG>>, <<PNG>>, <<BMP>>, <<TIFF>> and <<PNM>> images for
+loading and saving and <<GIF>>, <<JPEG2000>>, <<PCX>>, 'CBZ', <<PSD>> and
+<<PSP>> for loading.
Have a look at the link:about.html#Loaders[supported formats] for more
detailed information.
@@ -16,7 +17,7 @@ Loading functions exists in at least two flavors. One that works with a path
to a file and one that reads data from an link:loaders_io.html[IO stream].
All loading functions returns a pointer to newly allocated and loaded image or
-upon a failure 'NULL' and 'errno' is set.
+upon a failure NULL and errno is set.
The link:context.html[Context] returned by the loaders should be later freed
with link:context.html#ContextFree[GP_ContextFree()].
@@ -29,17 +30,19 @@ The signature matching functions takes a 32 bytes long buffer and looks for a
valid link:signatures.html[image signature]. If signature is found non-zero is
returned.
-In case of a failure 'errno' is set, possible 'errno' values are:
-
-* anything returned by +open()+, +close()+, +lseek()+, +read()+, +write()+, ...
- - 'ENOENT' if file doesn't exist
- - 'EACCES' if process doesn't have rights
- - etc.
-
-* 'ENOSYS' if GFXprim wasn't compiled with particular library support
-* 'ENOMEM' if returned by +malloc()+
-* 'EIO', 'EINVAL' invalid image data (wrong signature, wrong or too short header or image data)
-* 'ECANCELED' action canceled by returning non-zero from within a callback
+.Possible errno values
+|===============================================================================
+| Any errno returned by underlying 'open()', 'close()', 'lseek()', 'read()',
+ 'write()', ...
+| 'ENOENT' if file doesn't exist
+| 'EACCES' if process doesn't have rights to open the file
+| 'ENOSYS' if GFXprim wasn't compiled with particular library support
+| 'ENOMEM' if returned by 'malloc()'
+| 'EIO', 'EINVAL' invalid image data (wrong signature, wrong or too short
+ header or image data)
+| 'ECANCELED' action canceled by returning non-zero from within a
+ link:progress_callback.html[callback].
+|===============================================================================
You can get more information about the error condition by turning on GFXprim
link:environment_variables.html#GP_DEBUG[debug messages].
@@ -90,13 +93,13 @@ Saves a link:context.html[Context] into a file.
The file format is matched accordingly to the file extension.
-If extension is not found non-zero is returned and 'errno' is set to 'EINVAL'.
+If extension is not found non-zero is returned and errno is set to 'EINVAL'.
If extension was found but support for saving the image format is not
-implemented 'errno' is set to 'ENOSYS' (this may happen in case that GFXprim
+implemented errno is set to 'ENOSYS' (this may happen in case that GFXprim
wasn't compiled with support for this image type).
-If context pixel type is not supported by the format 'errno' is set to
+If context pixel type is not supported by the format errno is set to
'EINVAL'.
[[Register_Loader]]
@@ -160,13 +163,13 @@ void GP_LoaderUnregister(GP_Loader *self);
The 'GP_Loader' structure describes an image loader.
-The 'Load', 'Save' and 'Match' functions could be 'NULL' if the particular
+The 'Load', 'Save' and 'Match' functions could be NULL if the particular
functionality is not implemented.
The 'fmt_name' is a short string that describes the format. For example:
'Netbpm portable pixmap'.
-The extensions is 'NULL'-terminated array of strings that holds all possible
+The extensions is NULL-terminated array of strings that holds all possible
extensions that are commonly used for this image format.
All internal loaders are all described in list of this structures which is
@@ -189,7 +192,7 @@ link:example_loader_registration.html[example].
const GP_Loader *GP_MatchSignature(const void *buf)
-------------------------------------------------------------------------------
-Returns pointer to image loader accordingly to image signature or 'NULL' if no
+Returns pointer to image loader accordingly to image signature or NULL if no
suitable loader was found. The buf pointer must point to a buffer at least 32
bytes long.
@@ -209,9 +212,11 @@ string after the dot) and matches it against known extensions.
WARNING: If you attempt to modify the content of the structure the behavior is
undefined. Most likely the program will crash.
+[[PNG]]
PNG Loader
~~~~~~~~~~
-The 'PNG' image support is implemented by the libpng library.
+The 'PNG' image support is implemented by the
+link:http://www.libpng.org/[libpng library].
[source,c]
-------------------------------------------------------------------------------
@@ -226,7 +231,7 @@ Reads a 'PNG' image from readable 'GP_IO'. The link:loaders_io.html[IO stream]
is expected to start exactly at the 'PNG' file signature.
Returns newly allocated context (containing decompressed image) or in case of
-failure 'NULL' and 'errno' is set.
+failure NULL and errno is set.
The resulting link:context.html[Context] should be later freed with
link:context.html#ContextFree[GP_ContextFree()].
@@ -243,7 +248,7 @@ GP_Context *GP_LoadPNG(const char *src_path, GP_ProgressCallback *callback);
Loads a 'PNG' image from a file.
Returns a pointer to newly allocated loaded image, or in case of failure
-'NULL' and 'errno' is set.
+NULL and errno is set.
The resulting link:context.html[Context] should be later freed with
link:context.html#ContextFree[GP_ContextFree()].
@@ -259,7 +264,7 @@ int GP_SavePNG(const GP_Context *src, const char *dst_path,
-------------------------------------------------------------------------------
Saves a link:context.html[Context] as a 'PNG' image, in case particular pixel
-type is not supported non-zero is returned and 'errno' is set to 'ENOSYS'.
+type is not supported non-zero is returned and errno is set to 'ENOSYS'.
Supports 'G1', 'G2', 'G4', 'G8', 'G16', and 8-bit 'RGB' and 'RGBA' pixel
types.
@@ -275,6 +280,7 @@ int GP_MatchPNG(const void *buf);
Matches a 'PNG' link:signatures.html[file signature]. Returns non-zero if found.
+[[JPEG]]
JPEG Loader
~~~~~~~~~~~
The 'JPEG' image support is implemented by the jpeg library.
@@ -292,7 +298,7 @@ Reads a 'JPEG' image from readable 'GP_IO'. The link:loaders_io.html[IO
stream] is expected to start exactly at the 'JPEG' file signature.
Returns newly allocated context (containing decompressed image) or in case of
-failure 'NULL' and 'errno' is set.
+failure NULL and errno is set.
The resulting link:context.html[Context] should be later freed with
link:context.html#ContextFree[GP_ContextFree()].
@@ -309,7 +315,7 @@ GP_Context *GP_LoadJPG(const char *src_path, GP_ProgressCallback *callback);
Loads a 'JPEG' image from a file.
Returns a pointer to newly allocated loaded image, or in case of failure
-'NULL' and 'errno' is set.
+NULL and errno is set.
The resulting link:context.html[Context] should be later freed with
link:context.html#ContextFree[GP_ContextFree()].
@@ -340,6 +346,7 @@ int GP_MatchJPG(const void *buf);
Matches a 'JPEG' link:signatures.html[file signature]. Returns non-zero if
found.
+[[JPEG2000]]
JPEG 2000 Loader
~~~~~~~~~~~~~~~~
The 'JPEG 2000' image support is implemented using the openjpeg library.
@@ -357,7 +364,7 @@ Reads a 'JPEG2000' image from readable 'GP_IO'. The link:loaders_io.html[IO
stream] is expected to start exactly at the 'JPEG2000' file signature.
Returns newly allocated context (containing decompressed image) or in case of
-failure 'NULL' and 'errno' is set.
+failure NULL and errno is set.
The resulting link:context.html[Context] should be later freed with
link:context.html#ContextFree[GP_ContextFree()].
@@ -392,10 +399,12 @@ int GP_MatchJP2(const void *buf);
Matches a 'JPEG2000' link:signatures.html[file signature]. Returns non-zero if
found.
+[[GIF]]
GIF Loader
~~~~~~~~~~
-The 'GIF' image support is implemented by the giflib library.
+The 'GIF' image support is implemented using the
+link:http://sourceforge.net/projects/giflib/[giflib library].
[source,c]
-------------------------------------------------------------------------------
@@ -410,7 +419,7 @@ Reads a 'GIF' image from readable 'GP_IO'. The link:loaders_io.html[IO stream]
is expected to start exactly at the 'GIF' file signature.
Returns newly allocated context (containing decompressed image) or in case of
-failure 'NULL' and 'errno' is set.
+failure NULL and errno is set.
The resulting link:context.html[Context] should be later freed with
link:context.html#ContextFree[GP_ContextFree()].
@@ -443,6 +452,7 @@ int GP_MatchGIF(const void *buf);
Matches a 'GIF' link:signatures.html[file signature]. Returns non-zero if
found.
+[[BMP]]
BMP Loader
~~~~~~~~~~
@@ -462,7 +472,7 @@ Reads a 'BMP' image from readable 'GP_IO'. The link:loaders_io.html[IO stream]
is expected to start exactly at the 'BMP' file signature.
Returns newly allocated context (containing decompressed image) or in case of
-failure 'NULL' and 'errno' is set.
+failure NULL and errno is set.
The resulting link:context.html[Context] should be later freed with
link:context.html#ContextFree[GP_ContextFree()].
@@ -507,6 +517,77 @@ int GP_MatchBMP(const void *buf);
Matches a 'BMP' link:signatures.html[file signature]. Returns non-zero if
found.
+[[TIFF]]
+TIFF Loader
+~~~~~~~~~~~
+
+The 'TIFF' loader support is done using the
+link:http://www.remotesensing.org/libtiff/[tiff library].
+
+Currently only subset of 'tiff' images could be loaded, tiles does not work
+yet.
+
+[source,c]
+-------------------------------------------------------------------------------
+#include <loaders/GP_TIFF.h>
+/* or */
+#include <GP.h>
+
+GP_Context *GP_ReadTIFF(GP_IO *io, GP_ProgressCallback *callback);
+-------------------------------------------------------------------------------
+
+Reads a 'TIFF' image from readable 'GP_IO'. The link:loaders_io.html[IO stream]
+is expected to start exactly at the 'TIFF' file signature.
+
+Returns newly allocated context (containing decompressed image) or in case of
+failure NULL and errno is set.
+
+The resulting link:context.html[Context] should be later freed with
+link:context.html#ContextFree[GP_ContextFree()].
+
+[source,c]
+-------------------------------------------------------------------------------
+#include <loaders/GP_TIFF.h>
+/* or */
+#include <GP.h>
+
+GP_Context *GP_LoadTIFF(const char *src_path, GP_ProgressCallback *callback);
+-------------------------------------------------------------------------------
+
+Loads a 'TIFF' image from a file.
+
+The resulting link:context.html[Context] should be later freed with
+link:context.html#ContextFree[GP_ContextFree()].
+
+[source,c]
+-------------------------------------------------------------------------------
+#include <loaders/GP_TIFF.h>
+/* or */
+#include <GP.h>
+
+int GP_SaveTIFF(const GP_Context *src, const char *dst_path,
+ GP_ProgressCallback *callback);
+-------------------------------------------------------------------------------
+
+Saves a link:context.html[Context] as a 'TIFF' image.
+
+Supports 'G1', 'G2', 'G4' and 'G8' grayscale and 8-bit 'RGB' pixel types.
+
+The image is saved in stripes.
+
+[source,c]
+-------------------------------------------------------------------------------
+#include <loaders/GP_TIFF.h>
+/* or */
+#include <GP.h>
+
+int GP_MatchTIFF(const void *buf);
+-------------------------------------------------------------------------------
+
+Matches a 'TIFF' link:signatures.html[file signature]. Returns non-zero if
+found.
+
+[[PSP]]
PSP Loader
~~~~~~~~~~
@@ -526,7 +607,7 @@ link:loaders_io.html[IO stream] is expected to start exactly at the 'PSP' file
signature.
Returns newly allocated context (containing decompressed image) or in case of
-failure 'NULL' and 'errno' is set.
+failure NULL and errno is set.
The resulting link:context.html[Context] should be later freed with
link:context.html#ContextFree[GP_ContextFree()].
@@ -557,6 +638,7 @@ int GP_MatchPSP(const void *buf);
Matches a 'PSP' link:signatures.html[file signature]. Returns non-zero if
found.
+[[PSD]]
PSD Loader
~~~~~~~~~~
@@ -578,7 +660,7 @@ Reads a 'PSD' image from readable 'GP_IO'. The link:loaders_io.html[IO stream]
is expected to start exactly at the 'PSD' file signature.
Returns newly allocated context (containing decompressed image) or in case of
-failure 'NULL' and 'errno' is set.
+failure NULL and errno is set.
The resulting link:context.html[Context] should be later freed with
link:context.html#ContextFree[GP_ContextFree()].
@@ -597,7 +679,7 @@ Loads a merged image (if present) from a 'PSD' file.
Fallbacks to thumbnail if merged image is not present or has unsupported pixel
type.
-Returns 'NULL' (TODO ERRNO) if merged image is not present/supported and
+Returns NULL (TODO ERRNO) if merged image is not present/supported and
thumbnail is not present either.
The resulting link:context.html[Context] should be later freed with
@@ -615,6 +697,7 @@ int GP_MatchPSD(const void *buf);
Matches a 'PSD' link:signatures.html[file signature]. Returns non-zero if
found.
+[[PNM]]
PNM Loaders
~~~~~~~~~~~
@@ -734,6 +817,7 @@ The 'PNM' matches all of the formats. i.e. 'PBM', 'PGM' and 'PPM'.
All functions return non-zero if found.
+[[PCX]]
PCX Loader
~~~~~~~~~~
@@ -752,7 +836,7 @@ Reads a 'PCX' image from readable 'GP_IO'. The link:loaders_io.html[IO stream]
is expected to start exactly at the 'PCX' file signature.
Returns newly allocated context (containing decompressed image) or in case of
-failure 'NULL' and 'errno' is set.
+failure NULL and errno is set.
The resulting link:context.html[Context] should be later freed with
link:context.html#ContextFree[GP_ContextFree()].
-----------------------------------------------------------------------
Summary of changes:
doc/asciidoc.conf | 6 ++-
doc/asciidoc.css | 2 +-
doc/backends.txt | 12 ++--
doc/compilation.txt | 56 +++++++++++----
doc/context.txt | 8 +-
doc/debug.txt | 4 +-
doc/environment_variables.txt | 2 +-
doc/event_queue.txt | 4 +-
doc/filters.txt | 6 +-
doc/filters_dithering.txt | 10 ++--
doc/filters_python.txt | 2 +-
doc/filters_resize.txt | 6 +-
doc/gamma.txt | 2 +-
doc/grabbers.txt | 2 +-
doc/input.txt | 2 +-
doc/loaders.txt | 154 +++++++++++++++++++++++++++++++---------
doc/loaders_io.txt | 18 +++---
doc/loaders_python.txt | 6 +-
doc/pixels.txt | 10 ++--
doc/progress_callback.txt | 2 +-
doc/text.txt | 2 +-
libs/loaders/GP_ZIP.c | 94 +++++++++++++++++++++----
22 files changed, 293 insertions(+), 117 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project gfxprim.git.
The branch, master has been updated
via 05ec5cc78e822d2d4d45b54280997526d5e1bd64 (commit)
from c2fb0ec9b8d440b7128d76344907b20ad292885e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/gfxprim.git/commit/05ec5cc78e822d2d4d45b54280997526d5e1…
commit 05ec5cc78e822d2d4d45b54280997526d5e1bd64
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Fri Mar 14 00:13:22 2014 +0100
doc: loaders: Fixed + add signatures.txt
Signed-off-by: Cyril Hrubis <metan(a)ucw.cz>
diff --git a/doc/Makefile b/doc/Makefile
index ac8868c2..2b56050d 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -5,7 +5,7 @@ SOURCES=index.html about.txt context.txt loaders.txt filters.txt get_put_pixel.txt blits.txt progress_callback.txt text.txt event_queue.txt compilation.txt filters_resize.txt filters_dithering.txt filters_python.txt spiv.txt core_common.txt - convert.txt news_1_0_0-rc1.txt loaders_io.txt
+ convert.txt news_1_0_0-rc1.txt loaders_io.txt signatures.txt
SOURCES+=core_python.txt gfx_python.txt loaders_python.txt backends_python.txt
diff --git a/doc/context.txt b/doc/context.txt
index 0d42abde..b8213ffe 100644
--- a/doc/context.txt
+++ b/doc/context.txt
@@ -210,6 +210,7 @@ flags are set to zero.
The 'free_pixels' flag for the resulting context is set.
+[[ContextFree]]
[source,c]
-------------------------------------------------------------------------------
#include <core/GP_Context.h>
diff --git a/doc/loaders.txt b/doc/loaders.txt
index af588cb9..2a257ca3 100644
--- a/doc/loaders.txt
+++ b/doc/loaders.txt
@@ -1,28 +1,33 @@
Context loaders
---------------
-This part of GFXprim library aims to create API to load and save images
-from/to common image file formats.
+This part of GFXprim library implements API to load and save images for common
+image file formats.
Currently we support 'JPEG', 'PNG', 'BMP', 'TIFF' and 'PNM' images for loading
-and saving and 'GIF', 'JPEG2000' and 'PSP' for loading.
+and saving and 'GIF', 'JPEG2000', 'PCX', 'CBZ', 'PSD' and 'PSP' for loading.
-Have a look at the link:about.html#Loaders[supported formats].
+Have a look at the link:about.html#Loaders[supported formats] for more
+detailed information.
Image Loaders and Savers
~~~~~~~~~~~~~~~~~~~~~~~~
-All loading functions exists in at least two flavors. One that works with a
-path to a file and one that reads from an link:loaders_io.html[IO stream].
+Loading functions exists in at least two flavors. One that works with a path
+to a file and one that reads data from an link:loaders_io.html[IO stream].
-All loading functions returns a pointer to newly allocated and loaded image
-or upon a failure 'NULL' and 'errno' is set.
+All loading functions returns a pointer to newly allocated and loaded image or
+upon a failure 'NULL' and 'errno' is set.
-All saving functions returns zero on success and non-zero on failure. If
-image saving is aborted by a callback, the opened file is closed and removed
-from a file-system before the call returns.
+The link:context.html[Context] returned by the loaders should be later freed
+with link:context.html#ContextFree[GP_ContextFree()].
-The signature matching functions takes a 32 bytes long buffer and looks for a
-valid image signature. If signature is found non-zero is returned.
+All saving functions returns zero on success and non-zero on failure. If image
+saving is aborted by a callback, the opened file is closed and removed from a
+file-system before the call returns.
+
+The signature matching functions takes a 32 bytes long buffer and looks for a
+valid link:signatures.html[image signature]. If signature is found non-zero is
+returned.
In case of a failure 'errno' is set, possible 'errno' values are:
@@ -39,6 +44,9 @@ In case of a failure 'errno' is set, possible 'errno' values are:
You can get more information about the error condition by turning on GFXprim
link:environment_variables.html#GP_DEBUG[debug messages].
+General interface
+^^^^^^^^^^^^^^^^^
+
[[Load_Image]]
[source,c]
-------------------------------------------------------------------------------
@@ -51,19 +59,21 @@ GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback);
Loads an image from a file.
-The image format is first guessed by the file extension. If loader for the
-file extension is found it's called and if it succeeds the image data is
-returned.
+The image format is first guessed by the file extension. If loader is found
+and if it succeeds to load the image the newly loaded image is returned.
If file extension based guess fails either because the extension wasn't
-matched or if the loader for the extension failed; the signature based method
-is used. The loader loads several bytes (currently 32) from the file and
-calls signature matching functions for each format that implements signature
-matching. If image signature is found image loader it is called and the result
-is returned.
+matched or if the loader for the extension failed; the
+link:signatures.html[file signature] based method is used. The loader loads
+several bytes (currently 32) from the file and calls signature matching
+functions for each format that implements signature matching. If image
+signature is recognized, image loader it is called and the result is returned.
+
+If file extension disagrees with file signature (which is quite common on the
+internet) a warning is printed into the 'stderr'.
-If file extension disagrees with file signature on the file format a warning
-is printed into the 'stderr'.
+The resulting link:context.html[Context] should be later freed with
+link:context.html#ContextFree[GP_ContextFree()].
[[Save_Image]]
[source,c]
@@ -76,7 +86,7 @@ int GP_SaveImage(GP_Context *src, const char *dst_path,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Saves a context into a file.
+Saves a link:context.html[Context] into a file.
The file format is matched accordingly to the file extension.
@@ -90,8 +100,8 @@ If context pixel type is not supported by the format 'errno' is set to
'EINVAL'.
[[Register_Loader]]
-Advanced Loaders usage
-^^^^^^^^^^^^^^^^^^^^^^
+Advanced Interface
+^^^^^^^^^^^^^^^^^^
[source,c]
-------------------------------------------------------------------------------
@@ -218,6 +228,9 @@ is expected to start exactly at the 'PNG' file signature.
Returns newly allocated context (containing decompressed image) or in case of
failure 'NULL' and 'errno' is set.
+The resulting link:context.html[Context] should be later freed with
+link:context.html#ContextFree[GP_ContextFree()].
+
[source,c]
-------------------------------------------------------------------------------
#include <loaders/GP_PNG.h>
@@ -232,6 +245,9 @@ Loads a 'PNG' image from a file.
Returns a pointer to newly allocated loaded image, or in case of failure
'NULL' and 'errno' is set.
+The resulting link:context.html[Context] should be later freed with
+link:context.html#ContextFree[GP_ContextFree()].
+
[source,c]
-------------------------------------------------------------------------------
#include <loaders/GP_PNG.h>
@@ -242,8 +258,8 @@ int GP_SavePNG(const GP_Context *src, const char *dst_path,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Saves a 'Context' into a 'PNG' image, in case particular pixel type is not
-supported non-zero is returned and 'errno' is set to 'ENOSYS'.
+Saves a link:context.html[Context] as a 'PNG' image, in case particular pixel
+type is not supported non-zero is returned and 'errno' is set to 'ENOSYS'.
Supports 'G1', 'G2', 'G4', 'G8', 'G16', and 8-bit 'RGB' and 'RGBA' pixel
types.
@@ -257,7 +273,7 @@ types.
int GP_MatchPNG(const void *buf);
-------------------------------------------------------------------------------
-Matches a 'PNG' file signature. Returns non-zero if found.
+Matches a 'PNG' link:signatures.html[file signature]. Returns non-zero if found.
JPEG Loader
~~~~~~~~~~~
@@ -278,6 +294,9 @@ stream] is expected to start exactly at the 'JPEG' file signature.
Returns newly allocated context (containing decompressed image) or in case of
failure 'NULL' and 'errno' is set.
+The resulting link:context.html[Context] should be later freed with
+link:context.html#ContextFree[GP_ContextFree()].
+
[source,c]
-------------------------------------------------------------------------------
#include <loaders/GP_JPG.h>
@@ -287,11 +306,14 @@ failure 'NULL' and 'errno' is set.
GP_Context *GP_LoadJPG(const char *src_path, GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Loads an 'JPEG' image from a file.
+Loads a 'JPEG' image from a file.
Returns a pointer to newly allocated loaded image, or in case of failure
'NULL' and 'errno' is set.
+The resulting link:context.html[Context] should be later freed with
+link:context.html#ContextFree[GP_ContextFree()].
+
[source,c]
-------------------------------------------------------------------------------
#include <loaders/GP_JPG.h>
@@ -302,9 +324,7 @@ int GP_SaveJPG(const GP_Context *src, const char *dst_path,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Writes a 'Context' into a 'JPEG' image. If aborted by a callback, the opened
-file is closed and removed before the call returns non-zero and 'errno' is set
-to 'ECANCELED'.
+Saves a link:context.html[Context] as a 'JPEG' image.
The 'JPEG' format could store either 'G8' or 8-bit 'RGB' pixel-types.
@@ -317,7 +337,8 @@ The 'JPEG' format could store either 'G8' or 8-bit 'RGB' pixel-types.
int GP_MatchJPG(const void *buf);
-------------------------------------------------------------------------------
-Matches a 'JPEG' file signature. Returns non-zero if found.
+Matches a 'JPEG' link:signatures.html[file signature]. Returns non-zero if
+found.
JPEG 2000 Loader
~~~~~~~~~~~~~~~~
@@ -338,6 +359,9 @@ stream] is expected to start exactly at the 'JPEG2000' file signature.
Returns newly allocated context (containing decompressed image) or in case of
failure 'NULL' and 'errno' is set.
+The resulting link:context.html[Context] should be later freed with
+link:context.html#ContextFree[GP_ContextFree()].
+
NOTE: Due to limitations of the openjpeg library progress callback does not work.
[source,c]
@@ -349,7 +373,10 @@ NOTE: Due to limitations of the openjpeg library progress callback does not work
GP_Context *GP_LoadJP2(const char *src_path, GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Loads 'JPEG2000' image from a file.
+Loads a 'JPEG2000' image from a file.
+
+The resulting link:context.html[Context] should be later freed with
+link:context.html#ContextFree[GP_ContextFree()].
NOTE: Due to limitations of the openjpeg library progress callback does not work.
@@ -362,7 +389,8 @@ NOTE: Due to limitations of the openjpeg library progress callback does not work
int GP_MatchJP2(const void *buf);
-------------------------------------------------------------------------------
-Matches a 'JPEG2000' file signature. Returns non-zero if found.
+Matches a 'JPEG2000' link:signatures.html[file signature]. Returns non-zero if
+found.
GIF Loader
~~~~~~~~~~
@@ -384,6 +412,9 @@ is expected to start exactly at the 'GIF' file signature.
Returns newly allocated context (containing decompressed image) or in case of
failure 'NULL' and 'errno' is set.
+The resulting link:context.html[Context] should be later freed with
+link:context.html#ContextFree[GP_ContextFree()].
+
NOTE: Currently this function loads only first image from the 'GIF' container.
[source,c]
@@ -395,7 +426,10 @@ NOTE: Currently this function loads only first image from the 'GIF' container.
GP_Context *GP_LoadGIF(const char *src_path, GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Loads 'GIF' image from a file.
+Loads a 'GIF' image from a file.
+
+The resulting link:context.html[Context] should be later freed with
+link:context.html#ContextFree[GP_ContextFree()].
[source,c]
-------------------------------------------------------------------------------
@@ -406,7 +440,8 @@ Loads 'GIF' image from a file.
int GP_MatchGIF(const void *buf);
-------------------------------------------------------------------------------
-Matches a 'GIF' file signature. Returns non-zero if found.
+Matches a 'GIF' link:signatures.html[file signature]. Returns non-zero if
+found.
BMP Loader
~~~~~~~~~~
@@ -429,6 +464,9 @@ is expected to start exactly at the 'BMP' file signature.
Returns newly allocated context (containing decompressed image) or in case of
failure 'NULL' and 'errno' is set.
+The resulting link:context.html[Context] should be later freed with
+link:context.html#ContextFree[GP_ContextFree()].
+
[source,c]
-------------------------------------------------------------------------------
#include <loaders/GP_BMP.h>
@@ -438,7 +476,10 @@ failure 'NULL' and 'errno' is set.
GP_Context *GP_LoadBMP(const char *src_path, GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Loads 'BMP' image from a file.
+Loads a 'BMP' image from a file.
+
+The resulting link:context.html[Context] should be later freed with
+link:context.html#ContextFree[GP_ContextFree()].
[source,c]
-------------------------------------------------------------------------------
@@ -450,9 +491,9 @@ int GP_SaveBMP(const GP_Context *src, const char *dst_path,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Writes a 'Context' into a 'BMP' file.
+Saves a link:context.html[Context] as a 'BMP' image.
-Currently only 8-bit 'RGB' formats are supported.
+Currently only 8-bit 'RGB' pixel types are supported.
[source,c]
-------------------------------------------------------------------------------
@@ -463,7 +504,8 @@ Currently only 8-bit 'RGB' formats are supported.
int GP_MatchBMP(const void *buf);
-------------------------------------------------------------------------------
-Matches a 'BMP' file signature. Returns non-zero if found.
+Matches a 'BMP' link:signatures.html[file signature]. Returns non-zero if
+found.
PSP Loader
~~~~~~~~~~
@@ -479,12 +521,16 @@ The 'PSP' loader can load a composite image from a Paint Shop Pro Image Files.
GP_Context *GP_ReadPSP(GP_IO *io, GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Reads a 'PSP' image from readable 'GP_IO'. The link:loaders_io.html[IO stream]
-is expected to start exactly at the 'PSP' file signature.
+Reads a 'PSP' composite image from readable 'GP_IO'. The
+link:loaders_io.html[IO stream] is expected to start exactly at the 'PSP' file
+signature.
Returns newly allocated context (containing decompressed image) or in case of
failure 'NULL' and 'errno' is set.
+The resulting link:context.html[Context] should be later freed with
+link:context.html#ContextFree[GP_ContextFree()].
+
[source,c]
-------------------------------------------------------------------------------
#include <loaders/GP_PSP.h>
@@ -496,6 +542,9 @@ GP_Context *GP_LoadPSP(const char *src_path, GP_ProgressCallback *callback);
Loads a composite image from a 'PSP' file.
+The resulting link:context.html[Context] should be later freed with
+link:context.html#ContextFree[GP_ContextFree()].
+
[source,c]
-------------------------------------------------------------------------------
#include <loaders/GP_PSP.h>
@@ -505,7 +554,8 @@ Loads a composite image from a 'PSP' file.
int GP_MatchPSP(const void *buf);
-------------------------------------------------------------------------------
-Matches a 'PSP' file signature. Returns non-zero if found.
+Matches a 'PSP' link:signatures.html[file signature]. Returns non-zero if
+found.
PSD Loader
~~~~~~~~~~
@@ -524,12 +574,15 @@ RGB).
GP_Context *GP_ReadPSD(GP_IO *io, GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Reads a 'PSP' image from readable 'GP_IO'. The link:loaders_io.html[IO stream]
+Reads a 'PSD' image from readable 'GP_IO'. The link:loaders_io.html[IO stream]
is expected to start exactly at the 'PSD' file signature.
Returns newly allocated context (containing decompressed image) or in case of
failure 'NULL' and 'errno' is set.
+The resulting link:context.html[Context] should be later freed with
+link:context.html#ContextFree[GP_ContextFree()].
+
[source,c]
-------------------------------------------------------------------------------
#include <loaders/GP_PSD.h>
@@ -547,6 +600,9 @@ type.
Returns 'NULL' (TODO ERRNO) if merged image is not present/supported and
thumbnail is not present either.
+The resulting link:context.html[Context] should be later freed with
+link:context.html#ContextFree[GP_ContextFree()].
+
[source,c]
-------------------------------------------------------------------------------
#include <loaders/GP_PSD.h>
@@ -556,7 +612,8 @@ thumbnail is not present either.
int GP_MatchPSD(const void *buf);
-------------------------------------------------------------------------------
-Matches a 'PSD' file signature. Returns non-zero if found.
+Matches a 'PSD' link:signatures.html[file signature]. Returns non-zero if
+found.
PNM Loaders
~~~~~~~~~~~
@@ -567,6 +624,28 @@ PNM Loaders
/* or */
#include <GP.h>
+GP_Context *GP_ReadPBM(GP_IO *io, GP_ProgressCallback *callback);
+
+GP_Context *GP_ReadPGM(GP_IO *io, GP_ProgressCallback *callback);
+
+GP_Context *GP_ReadPPM(GP_IO *io, GP_ProgressCallback *callback);
+
+GP_Context *GP_ReadPNM(GP_IO *io, GP_ProgressCallback *callback);
+-------------------------------------------------------------------------------
+
+Reads a ASCII or Rawbits (binary) 'PBM', 'PGM' and 'PPM' image from readable
+'GP_IO'. The link:loaders_io.html[IO stream] is expected to start exactly at
+the file signature.
+
+The resulting link:context.html[Context] should be later freed with
+link:context.html#ContextFree[GP_ContextFree()].
+
+[source,c]
+-------------------------------------------------------------------------------
+#include <loaders/GP_PNM.h>
+/* or */
+#include <GP.h>
+
GP_Context *GP_LoadPBM(const char *src_path, GP_ProgressCallback *callback);
GP_Context *GP_LoadPGM(const char *src_path, GP_ProgressCallback *callback);
@@ -578,7 +657,10 @@ GP_Context *GP_LoadPNM(const char *src_path, GP_ProgressCallback *callback);
Loads either ASCII or Rawbits (binary) 'PBM', 'PGM' and 'PPM'.
-The 'PNM' can load all of them i.e. 'PBM', 'PGM' and 'PPM'.
+The 'PNM' loader can load all of them i.e. 'PBM', 'PGM' and 'PPM'.
+
+The resulting link:context.html[Context] should be later freed with
+link:context.html#ContextFree[GP_ContextFree()].
[source,c]
-------------------------------------------------------------------------------
@@ -590,7 +672,7 @@ GP_Context *GP_SavePBM(const GP_Context *src, const char *dst_path,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Saves 'G1' (1 bit grayscale) image into ASCII 'PBM'.
+Saves 'G1' (1 bit grayscale) image as ASCII 'PBM'.
[source,c]
-------------------------------------------------------------------------------
@@ -602,7 +684,7 @@ GP_Context *GP_SavePGM(const GP_Context *src, const char *dst_path,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Saves 'G1', 'G2', 'G4' and 'G8' (1, 2, 4 and 8 bit grayscale) image into ASCII
+Saves 'G1', 'G2', 'G4' and 'G8' (1, 2, 4 and 8 bit grayscale) image as ASCII
'PGM'.
[source,c]
@@ -615,7 +697,7 @@ GP_Context *GP_SavePPM(const GP_Context *src, const char *dst_path,
GP_ProgressCallback *callback);
-------------------------------------------------------------------------------
-Saves 'RGB888' (24 bit RGB) image into ASCII 'PPM'.
+Saves 'RGB888' (24 bit RGB) image as ASCII 'PPM'.
[source,c]
-------------------------------------------------------------------------------
@@ -628,7 +710,7 @@ GP_Context *GP_SavePNM(const GP_Context *src, const char *dst_path,
-------------------------------------------------------------------------------
Saves 'G1', 'G2', 'G4' and 'G8' (1, 2, 4, 8 bit grayscale) or 'RGB888' (24 bit
-RGB) image into ASCII 'PNM'.
+RGB) image as ASCII 'PNM'.
[source,c]
-------------------------------------------------------------------------------
@@ -645,8 +727,8 @@ int GP_MatchPPM(const void *buf);
int GP_MatchPNM(const void *buf);
-------------------------------------------------------------------------------
-Matches either ASCII or Rawbits (binary) 'PBM', 'PGM' and 'PPM' file
-signatures.
+Matches either ASCII or Rawbits (binary) 'PBM', 'PGM' and 'PPM'
+link:signatures.html[file signatures].
The 'PNM' matches all of the formats. i.e. 'PBM', 'PGM' and 'PPM'.
@@ -672,6 +754,9 @@ is expected to start exactly at the 'PCX' file signature.
Returns newly allocated context (containing decompressed image) or in case of
failure 'NULL' and 'errno' is set.
+The resulting link:context.html[Context] should be later freed with
+link:context.html#ContextFree[GP_ContextFree()].
+
[source,c]
-------------------------------------------------------------------------------
#include <loaders/GP_PCX.h>
@@ -683,6 +768,9 @@ GP_Context *GP_LoadPCX(const char *src_path, GP_ProgressCallback *callback);
Loads a 'PCX' image from a file.
+The resulting link:context.html[Context] should be later freed with
+link:context.html#ContextFree[GP_ContextFree()].
+
[source,c]
-------------------------------------------------------------------------------
#include <loaders/GP_PCX.h>
@@ -692,4 +780,5 @@ Loads a 'PCX' image from a file.
int GP_MatchPCX(const void *buf);
-------------------------------------------------------------------------------
-Matches a 'PCX' file signature. Returns non-zero if found.
+Matches a 'PCX' link:signatures.html[file signature]. Returns non-zero if
+found.
diff --git a/doc/signatures.txt b/doc/signatures.txt
new file mode 100644
index 00000000..fce2bf93
--- /dev/null
+++ b/doc/signatures.txt
@@ -0,0 +1,36 @@
+File signatures
+---------------
+
+File signature is a short well defined sequence of bytes usually situated at
+the beginning of the file.
+
+.Table of image file signatures used by GFXprim loaders
+[options="autowidth,header"]
+|=============================================================================
+| Extension | Format Name | Signature | Signature in Hex
+| *JPEG* | | | +0xff 0xd8 0xff+
+| *PNG* | Portable Network Graphics | +211PNGrn032n+ |
+ +89 50 4e 47 0d 0a 1a 0a+
+| *GIF* | Graphics Interchange Format | +GIF87a or GIF89a+ |
+| *BMP* | | +BM+ | +42 4d+
+| *TIFF* | Tagged Image File Format | +II*0 or MM0*+ | +49 49 2a 00 or
+ 4d 4d 2a 00+
+| *PSP* | Paint Shop Pro Image |
+ +Paint Shop Pro Image Filenx1a00000000+ |
+| *PSD* | Adobe Photoshop Image | +8BPS0x01+ |
+| *PBM* | Netpbm portable bitmap | +P1 or P4+ |
+| *PGM* | Netpbm portable graymap | +P2 or P5+ |
+| *PPM* | Netpbm portable pixmap | +P3 or P6+ |
+| *PNM* | Netpbm portable anymap | +P1, P2, P3, P4, P5, P6+ |
+| *JP2* | JPEG 2000 |
++000x0cjPx20x20x0dx0ax87x0a+ | +00 00 00 0c 6a 50 20 20 0d 0a 87 0a+
+| *PCX* | ZSoft PCX || +0a [01-05] 0x01 {01, 02, 04, 08}+
+| *CBZ* | Comic Book Archive (ZIP) | +PK0304+ |
+|=============================================================================
+
+
+Explanation
+~~~~~~~~~~~
+ * Signature strings are written in C string syntax
+ * The [A-B] denotes any number from interval
+ * The {A, B, C} denotes any number from the set
-----------------------------------------------------------------------
Summary of changes:
doc/Makefile | 2 +-
doc/context.txt | 1 +
doc/loaders.txt | 199 +++++++++++++++++++++++++++++++++++++--------------
doc/signatures.txt | 36 ++++++++++
4 files changed, 182 insertions(+), 56 deletions(-)
create mode 100644 doc/signatures.txt
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos(a)gmail.com
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
gfxprim.git ("A simple 2D graphics library with emphasis on correctness and well-defined operation.")