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 a1a8790a15c07510bf5d309448cf1a9b460ec344 (commit) via bd082cac18a091c462b65f1f2d9a0adacb9b35fe (commit) via 115391b21612956d9ed1f541d9272001e15c3c83 (commit) via 473dac1a93ecc9a00bcbdc4c3fc1acd110afbd53 (commit) via 268542916484c84a4b205bba09a9b700f3530b76 (commit) via 075f6abdea6c012df7201450896669431336b6eb (commit) from e77e1ccb700947ccd7286bf64c06d2d21d73c175 (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/a1a8790a15c07510bf5d309448cf1a9b460ec...
commit a1a8790a15c07510bf5d309448cf1a9b460ec344 Author: Cyril Hrubis metan@ucw.cz Date: Sat May 5 14:11:40 2012 +0200
doc: Update context docs.
diff --git a/doc/context.txt b/doc/context.txt index 38a8efb..6395eee 100644 --- a/doc/context.txt +++ b/doc/context.txt @@ -1,7 +1,7 @@ Drawing Context ---------------
-GP_Context is data structure for storing 'in memory' bitmaps. +The 'GP_Context' is data structure for storing 'in memory' bitmaps.
Data Structure ~~~~~~~~~~~~~~ @@ -26,6 +26,7 @@ typedef struct GP_Context { uint8_t axes_swap:1; /* swap axes */ uint8_t x_swap:1; /* mirror x */ uint8_t y_swap:1; /* mirror y */ + uint8_t bit_endian:1; /* GP_BIT_ENDIAN */ uint8_t free_pixels:1; /* if set GP_ContextFree() calls free on context->pixels */ } GP_Context; ------------------------------------------------------------------------------- @@ -36,12 +37,12 @@ stored in one dimensional array in byte-aligned lines. Rotation ^^^^^^^^
-The orientation flags affects the gfx and text drawing functions. If some of -the flags is changed the origin and direction of the drawing is changed. Note -that the image pixels are not affected by this at all only the coordinates -passed to drawing functions are transformed accordingly. +The orientation flags affects the gfx and text drawing functions and blits. If +some of the flags is changed the origin and direction of the drawing is +changed. Note that the image pixels are not affected by this at all only the +coordinates passed to drawing functions are transformed accordingly.
-If you don't need this functionality just don't touch these flags the as +If you don't need this functionality just don't touch the flags the as overhead of these transformations is not measurable.
If you really need drawing primitives that do not use the orientation flags, @@ -54,6 +55,10 @@ when taking into the accout the widht and height.
[source,c] ------------------------------------------------------------------------------- +#include <core/GP_Transform.h> +/* or */ +#include <GP.h> + /* Transforms point user coordinates to bitmap coordinates */ GP_TRANSFORM_POINT(context, x, y)
@@ -65,7 +70,11 @@ GP_RETRANSFORM_POINT(context, x, y) -------------------------------------------------------------------------------
[source,c] -------------------------------------------------------------------------------- +------------------------------------------------------------------------------ +#include <core/GP_Context.h> +/* or */ +#include <GP.h> + /* * Rotate context flags clock wise. */ @@ -88,27 +97,60 @@ Context base functions
[source,c] ------------------------------------------------------------------------------- +#include <core/GP_Context.h> +/* or */ +#include <GP.h> + +void GP_ContextInit(GP_Context *context, GP_Size w, GP_Size h, + GP_PixelType type, void *pixels); +------------------------------------------------------------------------------- + +Initalize given context accordingly to parameters, the rest of context +parameters are set to the default values. Eg. rotation flags are all set to +zero as well as the free_pixels flag. The bpp and bytes_per_row are computed +from the given pixel type and size. The pixels pointer may be NULL and could +be changed later manually. + +[source,c] +------------------------------------------------------------------------------- +#include <core/GP_Context.h> +/* or */ #include <GP.h>
GP_Context *GP_ContextAlloc(GP_Size w, GP_Size h, GP_PixelType type); +-------------------------------------------------------------------------------
-GP_Context *GP_ContextCopy(const GP_Context *src, int flag); +The 'GP_ContextAlloc()' allocates context and initalizes a context.
-void GP_ContextFree(GP_Context *context); +The orientation flags are all set to zero, the free_pixels flag is set and the +rest of the metadata are calculated accordingly to width, height and +pixel_type.The contxt->pixels pointer points to newly allocated bitmap with +appropriate size; the initial contents of the bitmap are undefined. + +[source,c] ------------------------------------------------------------------------------- +#include <core/GP_Context.h> +/* or */ +#include <GP.h>
-The 'GP_ContextAlloc()' allocates context and initalizes the context -structure. The orientation flags are all set to 0 and the rest of the metadata -are calculated accordingly to width, height and pixel_type. A bitmap with -appropriate size is allocated and stored in context->pixels; the initial -contents of the bitmap are undefined. +GP_Context *GP_ContextCopy(const GP_Context *src, int flag); +-------------------------------------------------------------------------------
The 'GP_ContextCopy()' allocates and initalizes a copy of the context passed as argument. If 'flag' is not zero, the bitmap (context->pixels) is copied otherwise it's left uninitalized.
-In both cases the resulting context should later be freed with -'GP_ContextFree()'. +[source,c] +------------------------------------------------------------------------------- +#include <core/GP_Context.h> +/* or */ +#include <GP.h> + +void GP_ContextFree(GP_Context *context); +------------------------------------------------------------------------------- + +Frees the context memory. If free_pixels flag is set, the pixels datada are +freed too.
Subcontext ~~~~~~~~~~ @@ -122,6 +164,8 @@ it belongs to another context; it will be freed with the hosting context.
[source,c] ------------------------------------------------------------------------------- +#include <core/GP_Context.h> +/* or */ #include <GP.h>
GP_Context *GP_ContextSubContext(GP_Context *context, GP_Context *subcontext, @@ -142,15 +186,17 @@ Conversions
[source,c] ------------------------------------------------------------------------------- +#include <core/GP_Context.h> +/* or */ #include <GP.h>
GP_Context *GP_ContextConvert(const GP_Context *src, GP_Context *dst, GP_PixelType dst_pixel_type); -------------------------------------------------------------------------------
-Provides basic context conversion functionality. -A newly allocated context is returned. +Provides basic context conversion functionality. A newly allocated context is +returned.
-This fuction does no error distribution but only integer -division/multiplication for each pixel channel. +This fuction does no error distribution but only multiply or rounds the pixel +values. If you need something better use Floyd Steinberg dithering instead.
http://repo.or.cz/w/gfxprim.git/commit/bd082cac18a091c462b65f1f2d9a0adacb9b3...
commit bd082cac18a091c462b65f1f2d9a0adacb9b35fe Author: Cyril Hrubis metan@ucw.cz Date: Sat May 5 14:02:03 2012 +0200
doc: Fix a few typos in basic types.
diff --git a/doc/basic_types.txt b/doc/basic_types.txt index 0ef0930..b3328e9 100644 --- a/doc/basic_types.txt +++ b/doc/basic_types.txt @@ -54,7 +54,7 @@ successful match and conversion and false otherwise.
[source,c] -------------------------------------------------------------------------------- -#include <GP_Color.h> +#include <core/GP_Color.h> /* or */ #include <GP.h>
@@ -75,7 +75,7 @@ returns true if color with such name was found.
[source,c] -------------------------------------------------------------------------------- -#include <GP_Color.h> +#include <core/GP_Color.h> /* or */ #include <GP.h>
http://repo.or.cz/w/gfxprim.git/commit/115391b21612956d9ed1f541d9272001e15c3...
commit 115391b21612956d9ed1f541d9272001e15c3c83 Author: Cyril Hrubis metan@ucw.cz Date: Sat May 5 14:01:27 2012 +0200
doc: Fix a few typos in loaders.
diff --git a/doc/loaders.txt b/doc/loaders.txt index 4b9422c..409c940 100644 --- a/doc/loaders.txt +++ b/doc/loaders.txt @@ -19,6 +19,8 @@ Common Loader
[source,c] ------------------------------------------------------------------------------- +#include <loaders/GP_Loaders.h> +/* or */ #include <GP.h>
GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback); @@ -36,6 +38,8 @@ are not supported yet.
[source,c] ------------------------------------------------------------------------------- +#include <loaders/GP_PNG.h> +/* or */ #include <GP.h>
int GP_OpenPNG(const char *src_path, FILE **f); @@ -51,6 +55,8 @@ This function is semi-internal, you should rather use functions listed below.
[source,c] ------------------------------------------------------------------------------- +#include <loaders/GP_PNG.h> +/* or */ #include <GP.h>
GP_Context *GP_ReadPNG(FILE *f, GP_ProgressCallback *callback); @@ -63,6 +69,8 @@ callback, in such case all memory is freed.
[source,c] ------------------------------------------------------------------------------- +#include <loaders/GP_PNG.h> +/* or */ #include <GP.h>
GP_Context *GP_LoadPNG(const char *src_path, GP_ProgressCallback *callback); @@ -73,6 +81,8 @@ signature. Basically this combines both of the calls above.
[source,c] ------------------------------------------------------------------------------- +#include <loaders/GP_PNG.h> +/* or */ #include <GP.h>
int GP_SavePNG(const char *dst_path, const GP_Context *src, @@ -87,12 +97,14 @@ Currently only 'RGB888' format is supported, you should convert the GP_Context to 'RGB888' before calling this function otherwise non-zero is returned and errno is set to ENOSYS.
-JPG -~~~ -The 'PNG' loading support is optionaly implemented by jpeg library. +JPEG +~~~~ +The 'JPEG' loading support is optionaly implemented by jpeg library.
[source,c] ------------------------------------------------------------------------------- +#include <loaders/GP_JPG.h> +/* or */ #include <GP.h>
int GP_OpenJPG(const char *src_path, FILE **f); @@ -109,6 +121,8 @@ file and the 'GP_ReadJPG()' reads the signature instead.
[source,c] ------------------------------------------------------------------------------- +#include <loaders/GP_JPG.h> +/* or */ #include <GP.h>
GP_Context *GP_ReadJPG(FILE *f, GP_ProgressCallback *callback); @@ -122,6 +136,8 @@ is set to ECANCELED.
[source,c] ------------------------------------------------------------------------------- +#include <loaders/GP_JPG.h> +/* or */ #include <GP.h>
GP_Context *GP_LoadJPG(const char *src_path, GP_ProgressCallback *callback); @@ -132,6 +148,8 @@ signature. Basically this combines both of the calls above.
[source,c] ------------------------------------------------------------------------------- +#include <loaders/GP_JPG.h> +/* or */ #include <GP.h>
int GP_SaveJPG(const char *dst_path, const GP_Context *src, @@ -152,6 +170,8 @@ The 'GIF' format is supported optionaly by giflib library.
[source,c] ------------------------------------------------------------------------------- +#include <loaders/GP_GIF.h> +/* or */ #include <GP.h>
int GP_OpenGIF(const char *src_path, void **f); @@ -165,6 +185,8 @@ This function is semi-internal, you should rather use functions listed below.
[source,c] ------------------------------------------------------------------------------- +#include <loaders/GP_GIF.h> +/* or */ #include <GP.h>
GP_Context *GP_ReadGIF(void *f, GP_ProgressCallback *callback); @@ -179,6 +201,8 @@ Currently this function loads only first image from the gif container.
[source,c] ------------------------------------------------------------------------------- +#include <loaders/GP_GIF.h> +/* or */ #include <GP.h>
GP_Context *GP_LoadGIF(const char *src_path, GP_ProgressCallback *callback); @@ -195,6 +219,8 @@ be fancy RGB compressions and RLE support.
[source,c] ------------------------------------------------------------------------------- +#include <loaders/GP_BMP.h> +/* or */ #include <GP.h>
int GP_OpenBMP(const char *src_path, FILE **f, @@ -209,6 +235,8 @@ This function is semi-internal, you should rather use functions listed below.
[source,c] ------------------------------------------------------------------------------- +#include <loaders/GP_BMP.h> +/* or */ #include <GP.h>
GP_Context *GP_ReadBMP(FILE *f, GP_ProgressCallback *callback); @@ -223,6 +251,8 @@ Currently this function loads only first image from the 'GIF' container.
[source,c] ------------------------------------------------------------------------------- +#include <loaders/GP_BMP.h> +/* or */ #include <GP.h>
GP_Context *GP_LoadBMP(const char *src_path, GP_ProgressCallback *callback);
http://repo.or.cz/w/gfxprim.git/commit/473dac1a93ecc9a00bcbdc4c3fc1acd110afb...
commit 473dac1a93ecc9a00bcbdc4c3fc1acd110afbd53 Author: Cyril Hrubis metan@ucw.cz Date: Sat May 5 13:51:55 2012 +0200
doc: Update basic types docs.
diff --git a/doc/basic_types.txt b/doc/basic_types.txt index 8f7283c..0ef0930 100644 --- a/doc/basic_types.txt +++ b/doc/basic_types.txt @@ -1,63 +1,50 @@ Basic types ----------- -Return Code -~~~~~~~~~~~ +Coordinates and Size/Length +~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Some gfxprim function returns one of following return codes (may be removed in -future): +Most of the drawing functions use typedefed 'GP_Coord' and 'GP_Size' integer +types for parameters.
-[source,c] --------------------------------------------------------------------------------- -typedef enum GP_RetCode { - GP_ESUCCESS, - GP_EINVAL, - GP_ENOIMPL, - GP_EUNPRECISE, - GP_ENULLPTR, /* some argument was unexpectedly NULL */ - GP_EBACKENDLOST, - GP_EBADCONTEXT, /* context contains invalid data */ - GP_EBADFILE, /* error in file, or bad file format */ - GP_ENOENT, /* no such file or another object */ - GP_ENOMEM, /* not enough memory */ - GP_EINTR, /* interrupted by a callback */ - GP_EMAX, -} GP_RetCode; --------------------------------------------------------------------------------- - -Return codes could be translated into an error messages. - -[source,c] --------------------------------------------------------------------------------- -const char *GP_RetCodeName(GP_RetCode code); --------------------------------------------------------------------------------- +The 'GP_Coord' is signed integer which is used for coordinates and the +'GP_Size' is unsigned integer type used for object size, length and so.
-Coord and Size -~~~~~~~~~~~~~~ -For drawing API there are two integer types defined the 'GP_Coord' for -coordinates and 'GP_Size' for size, length or so. +Pixel +~~~~~
-Color and pixel types -~~~~~~~~~~~~~~~~~~~~~ +Pixel value in 'GFXprim' is an integer big enough to hold the actual pixel +values. The default typedef for 'GP_Pixel' is set to 32 bit integer, which may +be changed at compile time to support colors with more than 10 bits per +channel. The 'GP_Pixel' is thus used as opaque value big enough to hold any +supported pixel value.
-The color, in gfxprim is enumeration of symbolic color names while pixel is -integer value or you may say color in format of the target bitmap. +Color +~~~~~
-Color could be converted into given pixel type which will result in integer -value suitable for usage with drawing functions. The color could be also -converted to color name (C string in English language) and C string may be -matched against table of color names. +The 'GP_Color', in gfxprim is enumeration of symbolic color names.
-As all drawing functions works with pixel rather than color the color must be -converted before using function to draw a shape into a bitmap. +Color could be converted for a given 'GP_PixelType' which will result into +'GP_Pixel' value suitable for usage with drawing functions. The color could be +also converted to color name (C string in English language) and C string may +be matched against table of color names.
-The color is defined as follows: +The 'GP_Color' enmum is defined as follows:
[source,c] -------------------------------------------------------------------------------- typedef enum GP_Color { GP_COL_INVALID = -1, GP_COL_BLACK, - ... + GP_COL_RED, + GP_COL_GREEN, + GP_COL_BLUE, + GP_COL_YELLOW, + GP_COL_BROWN, + GP_COL_ORANGE, + GP_COL_GRAY_DARK, + GP_COL_GRAY_LIGHT, + GP_COL_PURPLE, + GP_COL_WHITE, GP_COL_MAX, } GP_Color; -------------------------------------------------------------------------------- @@ -68,6 +55,8 @@ successful match and conversion and false otherwise. [source,c] -------------------------------------------------------------------------------- #include <GP_Color.h> +/* or */ +#include <GP.h>
GP_Pixel GP_ColorToPixel(GP_Color color, GP_PixelType pixel_type); GP_Pixel GP_ColorToContextPixel(GP_Color color, GP_Context *context); @@ -87,6 +76,8 @@ returns true if color with such name was found. [source,c] -------------------------------------------------------------------------------- #include <GP_Color.h> +/* or */ +#include <GP.h>
void GP_ColorLoadPixels(GP_Pixel pixels[], GP_PixelType pixel_type); void GP_ColorLoadContextPixels(GP_Pixel pixels[], GP_Context *context); @@ -98,8 +89,8 @@ the GP_Color enum as 'pixels[GP_COL_BLACK]'. Progress Callback ~~~~~~~~~~~~~~~~~
-Progress callback is a structure that stores user-defined callback function, -pointer to store location of user data and percentage. +The 'GP_ProgressCallback' is a structure that stores user-defined callback +function and user-defined pointer and percentage.
It is passed as last parameter to functions that could take some time to complete and adds capability to track the operation progress as well as to @@ -120,9 +111,7 @@ If non 'NULL' progress callback structure is passed to a function, the callback function is periodically called and the percentage is updated.
The return value from callback could abort the function execution. If non zero -value is returned the filter is aborted, all memory freed etc. and the -function either returns 'NULL' if pointer is returned or 'GP_EINTR' in case -filter returns 'GP_RetCode'. +value is returned the filter is aborted, all memory freed etc.
The callback, if supported, is the last parameter of a function.
http://repo.or.cz/w/gfxprim.git/commit/268542916484c84a4b205bba09a9b700f3530...
commit 268542916484c84a4b205bba09a9b700f3530b76 Author: Cyril Hrubis metan@ucw.cz Date: Sat May 5 13:36:00 2012 +0200
doc: Updated general gfxprim description.
diff --git a/doc/general.txt b/doc/general.txt index 5e6f356..c8b6262 100644 --- a/doc/general.txt +++ b/doc/general.txt @@ -1,43 +1,81 @@ General information ------------------- -Gfxprim is simple 2D bitmap graphics library with emphasis on speed and -correctness. +Gfxprim is simple modular 2D bitmap graphics library with emphasis on speed +and correctness. + +One of the key points of the library is code generation. Most of the graphics +operations are written using 'jinja' templating engine which is used to +generate specialized C code. So, for an example, once you add pixel +definition into configuration file, creating specialized filters, loaders and +conversions to other pixel formats is just a matter of typing "make && make +clean". + +The library also includes, fairly optimized, fixed-point image filters, namely +various resampling algorithms used to resize images, low pass filters, etc...
Implemented features ~~~~~~~~~~~~~~~~~~~~ -* basic graphics primitives (with and without fill) -** line, circle, ellipse, triangle, tetragon -* text drawing -** supports both proportional and non proportional fonts -** basic font is compiled in the library -** font rendering can be altered by style attributes -** font can be loaded from or stored in file -** convertor from bdf is on the way -* various bitmap formats to draw on -* SDL drawing backend -* bitmaps and blitting -** create, destroy bitmap -** bitmap rotation (in order to speed up rotated blits)
-Work in progress -~~~~~~~~~~~~~~~~ +Graphics Rendering +^^^^^^^^^^^^^^^^^^ +* Basic Graphics Primitives (with and without fill) +** PutPixel/GetPixel +** Lines +** Circles +** Elipses +** Polygon + +* Text Drawing +** Supports both proportional and non proportional fonts +** Basic fonts are compiled in the library +** Font rendering can be altered by style attributes +** Supports, for example, pixel multiplication and tracking +** Includes basic suppport for freetype + +* Bitmaps and Blitting +** Create, Destroy bitmap +** Subcontext, rectangular region in one context could be used as a context +** Fast specialized blits (with 90, 180 and 270 degree rotation) + +Bitmap Filters +^^^^^^^^^^^^^^ +* Point filters +** Brightness +** Contrast +** General Point filter
-* bitmaps and blitting -** blit bitmaps (should respect rotation and pixel formats) -** loading bitmaps from image files (jpg, png, bmp, pnm ...) +* Linear filters +** Specialized Gaussian blur +** Separable Convolution +** General Convolution
-* backends -** finish frame-buffer backend (SDL does not work on most of my frame-buffers) -** other than SDL X backend (SDL does support only one window) -** some overall initialization routines +* Arihtmetics filters +** Addition +** Multiplication +** Difference +** Maximum, Minimum + +* Floyd Steinberg dithering + +* Bitmap resampling algorithms +** Nearest Neighbour +** Bilinear +** Cubic + +* Bitmap rotation and mirroring +** 90 180 and 170 degree rotation + +* Histogram generator + +Work in progress +~~~~~~~~~~~~~~~~
-Advanced (and unimplemented) features -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* Python bindings +** basic support works now +** could be combined with PyGTK for GUI drawing (experimental)
-* bitmaps -** alpha channel +* Anti Aliased drawing +** Line and PutPixel are finished
-* gfx primitives -** drawing with alpha channel -** anti aliasing +* Gamma correction and color profiles
http://repo.or.cz/w/gfxprim.git/commit/075f6abdea6c012df7201450896669431336b...
commit 075f6abdea6c012df7201450896669431336b6eb Author: Cyril Hrubis metan@ucw.cz Date: Sat May 5 11:59:44 2012 +0200
doc: Update loaders docs.
diff --git a/doc/loaders.txt b/doc/loaders.txt index 7a752e8..4b9422c 100644 --- a/doc/loaders.txt +++ b/doc/loaders.txt @@ -1,92 +1,101 @@ Context loaders --------------- This part of gfxprim library aims to create API to load/save images from/to -common image fileformats. +common image file formats. + +All loading functions returns a pointer to allocated and loaded image or upon +a failure NULL is returned and errno is set. + +The possible errno values are: + +* anything returned by fopen(), fclose(), fseek(), ... +* ENOSYS if library wasn't compiled with particual library support +* ENOMEM as returned by malloc() +* EIO/EILSEQ invalid image data +* ECANCELED loading canceled from callback
Common Loader ~~~~~~~~~~~~~
[source,c] ------------------------------------------------------------------------------- -#include <GP_Loaders.h> +#include <GP.h>
-GP_RetCode GP_LoadImage(const char *src_path, GP_Context **res, - GP_ProgressCallback *callback); +GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback); -------------------------------------------------------------------------------
-Loads image from a file. The image format is now recognized by the file -filename extension. Format detection using file signature is planned. - -The loading process could be aborted by process callback. +Loads image from a file. The format is now matched by an image file extension. +File sinature loading method is on the TODO.
PNG ~~~ +The 'PNG' loading support is optionaly implemented by libpng.
-Just now, the 'PNG' support is not fully finished, the Alpha channel as well -as palletes doesn't work well or at all, we are working on that. +Just now, the 'PNG' support is not fully finished. Images with alpha channel +are not supported yet.
[source,c] ------------------------------------------------------------------------------- -#include <GP_Loaders.h> +#include <GP.h>
-GP_RetCode GP_OpenPNG(const char *src, FILE **f); +int GP_OpenPNG(const char *src_path, FILE **f); -------------------------------------------------------------------------------
-Opens file and checks for 'PNG' signature upon successful return (file could -be opened, signature matches), the opened file is returned and the file +Opens file and checks for 'PNG' signature. Returns zero on success (file +could be opened, signature matches), the opened file is returned and the file possition points right after the end of the 'PNG' signature.
+Upon failure errno is filled. + This function is semi-internal, you should rather use functions listed below.
[source,c] ------------------------------------------------------------------------------- -#include <GP_Loaders.h> +#include <GP.h>
-GP_RetCode GP_ReadPNG(FILE *f, GP_Context **res, - GP_ProgressCallback *callback); +GP_Context *GP_ReadPNG(FILE *f, GP_ProgressCallback *callback); -------------------------------------------------------------------------------
Loads 'PNG' file into context the file pointer must point to the start of the 'PNG' data stream (eg. should point right after the signature). The context, to store the image to, is allocated. The loading process could by aborted by a -callback, in such case all memory is freed and the call returns 'GP_EINTR'. +callback, in such case all memory is freed.
[source,c] ------------------------------------------------------------------------------- -#include <GP_Loaders.h> +#include <GP.h>
-GP_RetCode GP_LoadPNG(const char *src_path, GP_Context **res, - GP_ProgressCallback *callback); +GP_Context *GP_LoadPNG(const char *src_path, GP_ProgressCallback *callback); -------------------------------------------------------------------------------
Same as abowe but takes path to the file as a parameter and check for the -signature. Basically this combines both of the calls abowe. +signature. Basically this combines both of the calls above.
[source,c] ------------------------------------------------------------------------------- -#include <GP_Loaders.h> +#include <GP.h>
-GP_RetCode GP_SavePNG(const char *dst_path, GP_Context *src, - GP_ProgressCallback *callback); +int GP_SavePNG(const char *dst_path, const GP_Context *src, + GP_ProgressCallback *callback); -------------------------------------------------------------------------------
Writes a Context into a 'PNG' image. If aborted by a callback, the opened file -is closed and removed before the call returns 'GP_EINTR'. +is closed and removed before the call returns non-zero and errno is set to +ECANCELED.
Currently only 'RGB888' format is supported, you should convert the GP_Context -to 'RGB888' before calling this function otherwise 'GP_ENOIMPL' will be -returned. +to 'RGB888' before calling this function otherwise non-zero is returned and +errno is set to ENOSYS.
JPG ~~~ - -The 'JPG' format is supported for both 'G8' as well as 'RGB888' pixel formats. +The 'PNG' loading support is optionaly implemented by jpeg library.
[source,c] ------------------------------------------------------------------------------- -#include <GP_Loaders.h> +#include <GP.h>
-GP_RetCode GP_OpenJPG(const char *src, FILE **f); +int GP_OpenJPG(const char *src_path, FILE **f); -------------------------------------------------------------------------------
Opens file and checks for 'JPG' signature upon successful return (file could @@ -100,23 +109,22 @@ file and the 'GP_ReadJPG()' reads the signature instead.
[source,c] ------------------------------------------------------------------------------- -#include <GP_Loaders.h> +#include <GP.h>
-GP_RetCode GP_ReadJPG(FILE *f, GP_Context **res, - GP_ProgressCallback *callback); +GP_Context *GP_ReadJPG(FILE *f, GP_ProgressCallback *callback); -------------------------------------------------------------------------------
Loads 'JPG' file into context the file pointer must point to the start of the -'JPG' data stream (eg. should point right after the signature). The context, to -store the image to, is allocated. The loading process could by aborted by a -callback, in such case all memory is freed and the call returns 'GP_EINTR'. +'JPG' data stream (eg. should point right after the signature). The context, +to store the image to, is allocated. The loading process could by aborted by a +callback, in such case all memory is freed and the call returns NULL and errno +is set to ECANCELED.
[source,c] ------------------------------------------------------------------------------- -#include <GP_Loaders.h> +#include <GP.h>
-GP_RetCode GP_LoadJPG(const char *src_path, GP_Context **res, - GP_ProgressCallback *callback); +GP_Context *GP_LoadJPG(const char *src_path, GP_ProgressCallback *callback); -------------------------------------------------------------------------------
Same as abowe but takes path to the file as a parameter and check for the @@ -124,96 +132,108 @@ signature. Basically this combines both of the calls above.
[source,c] ------------------------------------------------------------------------------- -#include <GP_Loaders.h> +#include <GP.h>
-GP_RetCode GP_SaveJPG(const char *dst_path, GP_Context *src, - GP_ProgressCallback *callback); +int GP_SaveJPG(const char *dst_path, const GP_Context *src, + GP_ProgressCallback *callback); -------------------------------------------------------------------------------
Writes a Context into a 'JPG' image. If aborted by a callback, the opened file -is closed and removed before the call returns 'GP_EINTR'. +is closed and removed before the call returns non-zero and errno is set to +ECANCELED.
The 'JPG' format could store either 'G8' or 'RGB888' pixeltypes and you must convert the context into one of them before this fucntions is called.
-'TODO:' add parameters to change the encoding settings. - -PBM +GIF ~~~
-PBM -- portable bitmap file format. +The 'GIF' format is supported optionaly by giflib library.
[source,c] ------------------------------------------------------------------------------- -#include <GP_Loaders.h> +#include <GP.h>
-GP_RetCode GP_LoadPBM(const char *src, GP_Context **res); +int GP_OpenGIF(const char *src_path, void **f); -------------------------------------------------------------------------------
-This function allocates and loads a 'GP_Context' with 'GP_PIXEL_G1' pixels. If -the return code is not zero ('GP_ESUCCESS') an error during loading the bitmap -happend. +Opens file and checks for 'GIF' signature upon successful return (file could +be opened, signature matches) zero is returned and gif handle f is set +otherwise non-zero is returned and errno is set.
-The returned 'GP_Context' should be later freed with 'GP_ContextFree()'. +This function is semi-internal, you should rather use functions listed below.
[source,c] ------------------------------------------------------------------------------- -#include <GP_Loaders.h> +#include <GP.h>
-GP_RetCode GP_SavePBM(const char *res, GP_Context *src); +GP_Context *GP_ReadGIF(void *f, GP_ProgressCallback *callback); -------------------------------------------------------------------------------
-Save 'GP_Context' into PBM file. The 'GP_Context' pixel type must be -'GP_PIXEL_G1', otherwise 'GP_ENOIMPL' error is returned. +Loads 'GIF' file into context. The pointer must point to the 'GIF' handle as +returned by 'GP_OpenGIF()' function. The context, to store the image to, is +allocated. The loading process could by aborted by a callback, in such case +all memory is freed and the call returns NULL and errno is set to ECANCELED.
-PGM -~~~ -PBM -- portable graymap file format. +Currently this function loads only first image from the gif container.
[source,c] ------------------------------------------------------------------------------- -#include <GP_Loaders.h> +#include <GP.h>
-GP_RetCode GP_LoadPGM(const char *src, GP_Context **res); +GP_Context *GP_LoadGIF(const char *src_path, GP_ProgressCallback *callback); -------------------------------------------------------------------------------
-While the format allows to have any integer bit depth, only following color -depths are supported: - -* GP_PIXEL_1G -* GP_PIXEL_2G -* GP_PIXEL_4G -* GP_PIXEL_8G +Same as abowe but takes path to the file as a parameter and check for the +signature. Basically this combines both of the calls above.
-This function allocates and loads a 'GP_Context'. If the return code is not -zero ('GP_ESUCCESS') an error during loading the bitmap happend. +BMP +~~~
-The returned 'GP_Context' should be later freed with 'GP_ContextFree()'. +The 'BMP' loading support is nearly complete the only missing features should +be fancy RGB compressions and RLE support.
[source,c] ------------------------------------------------------------------------------- -#include <GP_Loaders.h> +#include <GP.h>
-GP_RetCode GP_SavePGM(const char *res, GP_Context *src); +int GP_OpenBMP(const char *src_path, FILE **f, + GP_Size *w, GP_Size *h, GP_PixelType *pixel_type); -------------------------------------------------------------------------------
-Save 'GP_Context' into PGM file. The pixel type must be one of: +Opens file and checks for 'BMP' signature upon successful return (file could +be opened, signature matches) zero is returned and the parameters, if not +NULL, are initalized. Upon failure non-zero is returned and errno is set.
-* GP_PIXEL_1G -* GP_PIXEL_2G -* GP_PIXEL_4G -* GP_PIXEL_8G +This function is semi-internal, you should rather use functions listed below.
-Otherwise 'GP_ENOIMPL' is returned. +[source,c] +------------------------------------------------------------------------------- +#include <GP.h>
-PNM -~~~ +GP_Context *GP_ReadBMP(FILE *f, GP_ProgressCallback *callback); +-------------------------------------------------------------------------------
-To be implemented. +Loads 'BMP' file into context. The FILE pointer must point to opened 'BMP' +file. The context, to store the image to, is allocated. The loading process +could by aborted by a callback, in such case all memory is freed and the call +returns NULL and errno is set to ECANCELED.
-PPM -~~~ +Currently this function loads only first image from the 'GIF' container.
-To be implemented. +[source,c] +------------------------------------------------------------------------------- +#include <GP.h> + +GP_Context *GP_LoadBMP(const char *src_path, GP_ProgressCallback *callback); +------------------------------------------------------------------------------- + +Same as abowe but takes path to the file as a parameter and check for the +signature. Basically this combines both of the calls above. + +PBM, PGM, PPM +~~~~~~~~~~~~~
+There is a code do load and write PBM, PGM and PPM images too. However it's +not finished and it's API is outdated. Use at your own risk.
-----------------------------------------------------------------------
Summary of changes: doc/basic_types.txt | 91 +++++++++----------- doc/context.txt | 86 +++++++++++++++----- doc/general.txt | 100 +++++++++++++++------- doc/loaders.txt | 230 +++++++++++++++++++++++++++++++-------------------- 4 files changed, 315 insertions(+), 192 deletions(-)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.