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 050cbfbf2c0d6aec3c941a20c6ea16d467a72751 (commit) via 75e84dc25b607438e0141db5710fd678a6e0c4a8 (commit) via 1528b95aef19ee5bb49272d83c3ac7d91f6ce727 (commit) via c02f7e5b2c18615e370b15581cd1b29c18a4bc79 (commit) from 0c37dfaea46213d3c1564499de0849c451e1f326 (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/050cbfbf2c0d6aec3c941a20c6ea16d467a72...
commit 050cbfbf2c0d6aec3c941a20c6ea16d467a72751 Author: Cyril Hrubis metan@ucw.cz Date: Wed Jun 12 22:57:44 2013 +0200
doc: general: Update BMP implementation state.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/doc/general.txt b/doc/general.txt index a8b6438..23de40d 100644 --- a/doc/general.txt +++ b/doc/general.txt @@ -88,7 +88,7 @@ images into various standard formats (PNG, JPEG, GIF, BMP, PNM, etc...).
| BMP | | [green]*Yes* | - [green]#RLE and RGB Bitfields not implemented# | + [green]#RLE4 and some less common bitfiels not supported# | [green]#RGB888 only#
| TIFF |
http://repo.or.cz/w/gfxprim.git/commit/75e84dc25b607438e0141db5710fd678a6e0c...
commit 75e84dc25b607438e0141db5710fd678a6e0c4a8 Author: Cyril Hrubis metan@ucw.cz Date: Wed Jun 12 22:57:32 2013 +0200
doc: Update core docs.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/doc/core.txt b/doc/core.txt index eb38437..ec172a2 100644 --- a/doc/core.txt +++ b/doc/core.txt @@ -17,12 +17,18 @@ GP_MIN(a, b);
GP_MAX(a, b);
+GP_MAX3(a, b, c); + GP_ABS(a);
GP_SWAP(a, b);
GP_SIGN(a);
+GP_ARRAY_SIZE(arr); + +GP_CONTAINER_OF(ptr, structure, member); + -------------------------------------------------------------------------------
These common macros implements basic functions such as minimum, maximum, @@ -30,6 +36,12 @@ absolute value, swap and sign.
All macros use 'typeof()' in order to evaluate their arguments exactly once.
+The 'GP_ARRAY_SIZE()' macro computes size of statically defined array (i.e. +returns +sizeof(array) / sizeof(elem)+). + +The 'GP_CONTAINER_OF()' macro computes pointer to a structure given pointer to +its member. + [source,c] ------------------------------------------------------------------------------- #include <core/GP_Clamp.h>
http://repo.or.cz/w/gfxprim.git/commit/1528b95aef19ee5bb49272d83c3ac7d91f6ce...
commit 1528b95aef19ee5bb49272d83c3ac7d91f6ce727 Author: Cyril Hrubis metan@ucw.cz Date: Wed Jun 12 22:50:58 2013 +0200
doc: Update pixels docs.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/doc/pixels.txt b/doc/pixels.txt index b226453..d6c18e8 100644 --- a/doc/pixels.txt +++ b/doc/pixels.txt @@ -1,15 +1,11 @@ Pixel Description -----------------
-This pages describes library core functions for handling pixels. +This pages describes library core functions for handling pixel types.
Pixel Type ~~~~~~~~~~
-Pixels are described by a pixel type, which is enumeration type. The enum is -defined at the generated 'GP_Pixel.gen.h' header and must contain at least -following members: - [source,c] ------------------------------------------------------------------------------- #include <GP.h> @@ -26,13 +22,28 @@ typedef enum GP_PixelType { GP_PIXEL_G2, GP_PIXEL_G4, GP_PIXEL_G8, + ... GP_PIXEL_MAX, } GP_PixelType;
+/* + * The same values are also defined as macros so it's possible to + * use them with ifdef as follows. + */ +#ifdef GP_PIXEL_RGB555 + +... + +#endif /* GP_PIXEL_RGB555 */ + -------------------------------------------------------------------------------
-Each pixel type has accompanying record in global array of pixel types -declared as follows: +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. + +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'.
[source,c] ------------------------------------------------------------------------------- @@ -46,12 +57,21 @@ typedef struct { uint8_t size; /* Bit-size */ } GP_PixelTypeChannel;
+typedef enum GP_PixelFlags { + GP_PIXEL_HAS_ALPHA = 0x01, + GP_PIXEL_IS_RGB = 0x02, + GP_PIXEL_IS_PALETTE = 0x04, + GP_PIXEL_IS_CMYK = 0x08, + GP_PIXEL_IS_GRAYSCALE = 0x10, +} GP_PixelFlags; + typedef struct { GP_PixelType type; /* Number of the type */ const char name[16]; /* Name */ uint8_t size; /* Size in bits */ GP_BIT_ENDIAN bit_endian; /* Order of pixels in a byte */ uint8_t numchannels; /* Number of channels */ + GP_PixelFlags flags; /* String describing the bit-representaton (as in "RRRRRGGGGGGBBBBB")*/ const char bitmap[GP_PIXEL_BITS + 1]; /* Individual channels */ @@ -60,13 +80,44 @@ typedef struct {
extern const GP_PixelTypeDescription const GP_PixelTypes[];
+const GP_PixelTypeDescription *GP_PixelTypeDesc(GP_PixelType type); + const char *GP_PixelTypeName(GP_PixelType type);
uint32_t GP_PixelSize(GP_PixelType type); + +int GP_PixelHasFlags(GP_PixelType pixel_type, GP_PixelFlags flags); -------------------------------------------------------------------------------
-There are also pixel matching functions that returns pixel type given RGB -channel masks or sizes and offsets: +Each pixel type has accompanying record in global array describing pixel types. + +You should not use this array directly, use the 'GP_PixelTypeDesc()' function +to query the pixel type description. + +The 'GP_PixelTypeName()' function returns static string with pixel type name. + +The 'GP_PixelSize()' returns pixel size in bits. + +The 'GP_PixelHasFlags()' function returns true if particular pixel type +contains the bitmask of pixel flags. + +[source,c] +------------------------------------------------------------------------------- +#include <GP.h> +/* or */ +#include <core/GP_Pixel.h> + +void GP_PixelPrint(GP_Pixel pixel, GP_PixelType type); + +void GP_PixelSNPrint(char *buf, size_t len, GP_Pixel pixel, GP_PixelType type); +------------------------------------------------------------------------------- + +Pretty print pixel value given the pixel type. + +.Sample output from the functions +------------------------------------------------------------------------------- +RGB888 0xffffff R=255 G=255 B=255 +-------------------------------------------------------------------------------
[source,c] ------------------------------------------------------------------------------- @@ -85,3 +136,5 @@ GP_PixelType GP_PixelRGBLookup(uint32_t rsize, uint32_t roff, uint8_t bits_per_pixel); -------------------------------------------------------------------------------
+Returns pixel type given either RGB masks or RGB sizes and offsets. If no +matching pixel was found 'GP_PIXEL_UNKNOWN' is returned.
http://repo.or.cz/w/gfxprim.git/commit/c02f7e5b2c18615e370b15581cd1b29c18a4b...
commit c02f7e5b2c18615e370b15581cd1b29c18a4bc79 Author: Cyril Hrubis metan@ucw.cz Date: Wed Jun 12 22:15:16 2013 +0200
demos: c_simple: Add pretty print example.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/demos/c_simple/Makefile b/demos/c_simple/Makefile index 3202c84..e086f75 100644 --- a/demos/c_simple/Makefile +++ b/demos/c_simple/Makefile @@ -18,7 +18,7 @@ APPS=backend_example loaders_example loaders filters_symmetry gfx_koch v4l2_show v4l2_grab convolution weighted_median shapetest koch input_example fileview linetest randomshapetest fonttest loaders_register blittest textaligntest abort sin_AA x11_windows- debug_handler gaussian_noise byte_utils version + debug_handler gaussian_noise byte_utils version pretty_print
ifeq ($(HAVE_LIBSDL),yes) APPS+=SDL_glue diff --git a/demos/c_simple/pretty_print.c b/demos/c_simple/pretty_print.c new file mode 100644 index 0000000..ef010da --- /dev/null +++ b/demos/c_simple/pretty_print.c @@ -0,0 +1,43 @@ +/***************************************************************************** + * This file is part of gfxprim library. * + * * + * Gfxprim is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * Gfxprim is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with gfxprim; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * + * Boston, MA 02110-1301 USA * + * * + * Copyright (C) 2009-2013 Cyril Hrubis metan@ucw.cz * + * * + *****************************************************************************/ + +/* + + Pretty print function for pixel and context. + + */ + +#include <GP.h> + +int main(void) +{ + GP_Context *ctx = GP_ContextAlloc(100, 100, GP_PIXEL_RGB888); + GP_Pixel pix = ~(GP_Pixel)0; + + /* Pretty prints pixel values */ + GP_PixelPrint(pix, GP_PIXEL_RGB888); + + /* Pretty prints context info */ + GP_ContextPrintInfo(ctx); + + return 0; +}
-----------------------------------------------------------------------
Summary of changes: demos/c_simple/Makefile | 2 +- demos/c_simple/{version.c => pretty_print.c} | 12 +++- doc/core.txt | 12 ++++ doc/general.txt | 2 +- doc/pixels.txt | 71 ++++++++++++++++++++++--- 5 files changed, 85 insertions(+), 14 deletions(-) copy demos/c_simple/{version.c => pretty_print.c} (86%)
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.