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, generate has been updated
via db2ff5df0a89ee8d2eff8daea4e099c7d3190b28 (commit)
from 9d6d86ef03509cf3135a0ae7aaa6641ff31b83ac (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/db2ff5df0a89ee8d2eff8daea4e099c7d319…
commit db2ff5df0a89ee8d2eff8daea4e099c7d3190b28
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon Oct 31 23:04:16 2011 +0100
fbshow: workaround for grayscale images.
diff --git a/demos/fbshow/fbshow.c b/demos/fbshow/fbshow.c
index 8b399ed..c9d86c8 100644
--- a/demos/fbshow/fbshow.c
+++ b/demos/fbshow/fbshow.c
@@ -61,6 +61,18 @@ static GP_Context *image_to_display(GP_Context *img, uint32_t w, uint32_t h)
float rat = calc_img_size(img->w, img->h, w, h);
// GP_FilterGaussianBlur(img, img, 1, 1, NULL);
+
+ /* Workaround */
+ if (img->pixel_type != GP_PIXEL_RGB888) {
+ GP_Context *tmp;
+ tmp = GP_ContextConvert(img, GP_PIXEL_RGB888);
+
+ GP_ContextFree(img);
+ img = tmp;
+
+ if (img == NULL)
+ return NULL;
+ }
return GP_FilterResize(img, NULL, GP_INTERP_CUBIC, img->w * rat, img->h * rat, NULL);
}
-----------------------------------------------------------------------
Summary of changes:
demos/fbshow/fbshow.c | 12 ++++++++++++
1 files changed, 12 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, generate has been updated
via 9d6d86ef03509cf3135a0ae7aaa6641ff31b83ac (commit)
from 6e1e8b1958b2ce6686c7d2ba446b7ab907f7ebf1 (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/9d6d86ef03509cf3135a0ae7aaa6641ff31b…
commit 9d6d86ef03509cf3135a0ae7aaa6641ff31b83ac
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon Oct 31 22:45:03 2011 +0100
Fix jpeg loader for grayscale images.
diff --git a/libs/loaders/GP_JPG.c b/libs/loaders/GP_JPG.c
index 69ddd55..5958dab 100644
--- a/libs/loaders/GP_JPG.c
+++ b/libs/loaders/GP_JPG.c
@@ -152,6 +152,9 @@ GP_RetCode GP_ReadJPG(FILE *f, GP_Context **res)
JSAMPROW addr = (void*)GP_PIXEL_ADDR(ret, 0, y);
jpeg_read_scanlines(&cinfo, &addr, 1);
+ if (pixel_type != GP_PIXEL_RGB888)
+ continue;
+
//TODO: fixme bigendian?
/* fix the pixel, as we want in fact BGR */
uint32_t i;
-----------------------------------------------------------------------
Summary of changes:
libs/loaders/GP_JPG.c | 3 +++
1 files changed, 3 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, generate has been updated
via 6e1e8b1958b2ce6686c7d2ba446b7ab907f7ebf1 (commit)
from 3e26bede0b9f2319e6f69367ed84be575112022b (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/6e1e8b1958b2ce6686c7d2ba446b7ab907f7…
commit 6e1e8b1958b2ce6686c7d2ba446b7ab907f7ebf1
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon Oct 31 22:21:21 2011 +0100
Add sigabort and print image name into stderr.
diff --git a/demos/fbshow/fbshow.c b/demos/fbshow/fbshow.c
index d15bdbc..8b399ed 100644
--- a/demos/fbshow/fbshow.c
+++ b/demos/fbshow/fbshow.c
@@ -69,6 +69,8 @@ static int show_image(GP_Framebuffer *fb, const char *img_path, int clear)
{
GP_Context *img;
+ fprintf(stderr, "Loading '%s'n", img_path);
+
if (clear) {
char buf[100];
snprintf(buf, sizeof(buf), "Loading '%s'", img_path);
@@ -137,6 +139,7 @@ int main(int argc, char *argv[])
signal(SIGINT, sighandler);
signal(SIGSEGV, sighandler);
signal(SIGBUS, sighandler);
+ signal(SIGABRT, sighandler);
fb = GP_FramebufferInit("/dev/fb0");
-----------------------------------------------------------------------
Summary of changes:
demos/fbshow/fbshow.c | 3 +++
1 files changed, 3 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, generate has been updated
via 3e26bede0b9f2319e6f69367ed84be575112022b (commit)
from e9cc5c1ae7cc5eff7b688fb8659de8ce7d4cc250 (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/3e26bede0b9f2319e6f69367ed84be575112…
commit 3e26bede0b9f2319e6f69367ed84be575112022b
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon Oct 31 22:15:20 2011 +0100
Fix typo in previous commit.
diff --git a/gfxprim_config.py b/gfxprim_config.py
index d603e53..d0de8d1 100644
--- a/gfxprim_config.py
+++ b/gfxprim_config.py
@@ -72,7 +72,7 @@ config = GfxPrimConfig(
('G', 6, 6),
('B', 0, 6)]),
- PixelType(name='xRGB4666', pixelsize=PS_32BPP, chanslist=[
+ PixelType(name='xRGB14666', pixelsize=PS_32BPP, chanslist=[
('R', 12, 6),
('G', 6, 6),
('B', 0, 6)]),
-----------------------------------------------------------------------
Summary of changes:
gfxprim_config.py | 2 +-
1 files changed, 1 insertions(+), 1 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, generate has been updated
via e9cc5c1ae7cc5eff7b688fb8659de8ce7d4cc250 (commit)
from 1ffba0f0fa47f6abe46ab253d786833f512fa79c (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/e9cc5c1ae7cc5eff7b688fb8659de8ce7d4c…
commit e9cc5c1ae7cc5eff7b688fb8659de8ce7d4cc250
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon Oct 31 22:07:10 2011 +0100
Add pixel type for voipac.
diff --git a/gfxprim_config.py b/gfxprim_config.py
index 15b06e7..d603e53 100644
--- a/gfxprim_config.py
+++ b/gfxprim_config.py
@@ -46,7 +46,7 @@ config = GfxPrimConfig(
# Standard RGB types
#
- PixelType(name='RGBx8888', pixelsize=PS_32BPP, chanslist=[
+ PixelType(name='xRGB8888', pixelsize=PS_32BPP, chanslist=[
('R', 16, 8),
('G', 8, 8),
('B', 0, 8)]),
@@ -71,10 +71,14 @@ config = GfxPrimConfig(
('R', 12, 6),
('G', 6, 6),
('B', 0, 6)]),
+
+ PixelType(name='xRGB4666', pixelsize=PS_32BPP, chanslist=[
+ ('R', 12, 6),
+ ('G', 6, 6),
+ ('B', 0, 6)]),
#
# Palette types
#
-
PixelType(name='P2', pixelsize=PS_2BPP_LE, chanslist=[
('P', 0, 2)]),
@@ -87,7 +91,6 @@ config = GfxPrimConfig(
#
# Gray-only pixel types
#
-
PixelType(name='G1', pixelsize=PS_1BPP_LE, chanslist=[
('V', 0, 1)]),
-----------------------------------------------------------------------
Summary of changes:
gfxprim_config.py | 9 ++++++---
1 files changed, 6 insertions(+), 3 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, generate has been updated
via 1ffba0f0fa47f6abe46ab253d786833f512fa79c (commit)
from b6c9637eb54c10672ea89dd044cde74a4ddb4afe (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/1ffba0f0fa47f6abe46ab253d786833f512f…
commit 1ffba0f0fa47f6abe46ab253d786833f512fa79c
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon Oct 31 21:51:58 2011 +0100
Add SIGSEGV and SIGBUS too.
diff --git a/demos/fbshow/fbshow.c b/demos/fbshow/fbshow.c
index 77e84d1..d15bdbc 100644
--- a/demos/fbshow/fbshow.c
+++ b/demos/fbshow/fbshow.c
@@ -135,6 +135,8 @@ int main(int argc, char *argv[])
}
signal(SIGINT, sighandler);
+ signal(SIGSEGV, sighandler);
+ signal(SIGBUS, sighandler);
fb = GP_FramebufferInit("/dev/fb0");
-----------------------------------------------------------------------
Summary of changes:
demos/fbshow/fbshow.c | 2 ++
1 files changed, 2 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, generate has been updated
via b6c9637eb54c10672ea89dd044cde74a4ddb4afe (commit)
from fad5c36eca3675087d21df061b8994f6865299f8 (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/b6c9637eb54c10672ea89dd044cde74a4ddb…
commit b6c9637eb54c10672ea89dd044cde74a4ddb4afe
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon Oct 31 21:34:41 2011 +0100
fbshow: fix the keys.
diff --git a/demos/fbshow/fbshow.c b/demos/fbshow/fbshow.c
index 3b8fb50..77e84d1 100644
--- a/demos/fbshow/fbshow.c
+++ b/demos/fbshow/fbshow.c
@@ -208,13 +208,13 @@ int main(int argc, char *argv[])
continue;
switch (ev.val.key.key) {
+ case GP_KEY_ESC:
case GP_KEY_ENTER:
+ case GP_KEY_Q:
GP_FramebufferExit(fb);
return 0;
break;
- case GP_KEY_ESC:
case GP_KEY_SPACE:
- case GP_KEY_Q:
argn++;
if (argn >= argc)
argn = argf;
-----------------------------------------------------------------------
Summary of changes:
demos/fbshow/fbshow.c | 4 ++--
1 files changed, 2 insertions(+), 2 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, generate has been updated
via 83ea42ee07c41ffa84e4af2cc12dad89d8eb7096 (commit)
from 9be6758838682bf96a52cf189f94b81f18441e80 (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/83ea42ee07c41ffa84e4af2cc12dad89d8eb…
commit 83ea42ee07c41ffa84e4af2cc12dad89d8eb7096
Author: Cyril Hrubis <metan(a)ucw.cz>
Date: Mon Oct 31 16:23:11 2011 +0100
Context docs, yay!
diff --git a/doc/context.txt b/doc/context.txt
index 42c9f8c..89cf55d 100644
--- a/doc/context.txt
+++ b/doc/context.txt
@@ -9,97 +9,130 @@ Data Structure
[source,c]
-------------------------------------------------------------------------------
typedef struct GP_Context {
- uint8_t *pixels; /* Pointer to array of pixels */
- uint8_t bpp; /* Bits per pixel, always be power of two */
- uint32_t bytes_per_row; /* Bytes per row, rows are padded to bytes */
- uint32_t w; /* Width in pixels */
- uint32_t h; /* Height in pixels */
-
- GP_PixelType pixel_type; /* Enum, bitmap pixel type id */
-
- int axes_swap:1; /* Context rotation and mirroring */
- int x_swap:1;
- int y_swap:1;
+ uint8_t *pixels; /* pointer to image pixels */
+ uint8_t bpp; /* pixel length in bits */
+ uint32_t bytes_per_row;
+ uint32_t w; /* width in pixels */
+ uint32_t h; /* height in pixels */
+ /*
+ * Row bit offset. The offset is ignored for byte aligned pixels.
+ * Basically it's used for non aligned pixels with combination
+ * with subcontextes.
+ */
+ uint8_t offset;
+
+ GP_PixelType pixel_type; /* pixel format enum */
+
+ uint8_t axes_swap:1; /* swap axes */
+ uint8_t x_swap:1; /* mirror x */
+ uint8_t y_swap:1; /* mirror y */
+ uint8_t free_pixels:1; /* if set GP_ContextFree() calls free on context->pixels */
} GP_Context;
-------------------------------------------------------------------------------
-The 'GP_Context' holds meta-data needed for bitmaps. The values of pixels
-are stored as bitmap lines (aligned to bytes) in one dimensional array.
-The address of pixel could be determined by GP_PIXEL_ADDRESS(context, x, y)
-which returns byte aligned address for the pixel.
+The 'GP_Context' holds meta-data needed for bitmap drawing. The bitmap is
+stored in one dimensional array in byte-aligned lines.
Rotation
^^^^^^^^
-All gfx functions does honor rotation and mirroring. If you really need drawing
-primitives without it use variants with _Raw suffix.
-So GP_Line() is equal to GP_Line_Raw(), when all axes_swap, x_swap and y_swap
-are set to zero.
+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.
-There are various macros for transforming coordinates and sizes in
-'core/GP_Transform.h'.
+If you don't need this functionality just don't touch these flags the as
+overhead of these transformations is not measurable.
-* *GP_TRANSFORM_POINT(x, y)*
-* *GP_TRANSFORM_RECT(x, y, w, h)*
-* *GP_RETRANSFORM_POINT(x, y)*
+If you really need drawing primitives that do not use the orientation flags,
+you could use variants with _Raw suffix (altghoug this is not recommended).
-Functions
-~~~~~~~~~
+There are various helper macros for transforming coordinates and sizes in
+'core/GP_Transform.h'. And helper functions to "rotate" the context flags
+clock wise and counter clock wise as well as functions to get the context size
+when taking into the accout the widht and height.
[source,c]
-------------------------------------------------------------------------------
-#include <GP.h>
+/* Transforms point user coordinates to bitmap coordinates */
+GP_TRANSFORM_POINT(context, x, y)
-uint32_t GP_ContextW(struct GP_Context *context);
-uint32_t GP_ContextH(struct GP_Context *context);
--------------------------------------------------------------------------------
+/* Transforms rectangular area coordinates and size */
+GP_TRANSFORM_RECT(context, x, y, w, h)
-Functions to get context width and height that do honor rotation flags (swaps
-W and H if axes_swap is set).
+/* Inverse transformation, bitmap coordinates to user coordinates */
+GP_RETRANSFORM_POINT(context, x, y)
+-------------------------------------------------------------------------------
[source,c]
-------------------------------------------------------------------------------
-#include <GP.h>
-
-void GP_ContextFlagsRotateCW(struct GP_Context *context);
-void GP_ContextFlagsRotateCCW(struct GP_Context *context);
+/*
+ * Rotate context flags clock wise.
+ */
+void GP_ContextFlagsRotateCW(GP_Context *context);
+
+/*
+ * Rotate context flags counter clock wise.
+ */
+void GP_ContextFlagsRotateCCW(GP_Context *context);
+
+/*
+ * Returns context W and H taking the rotation flags into the account.
+ */
+GP_Size GP_ContextW(const GP_Context *context);
+GP_Size GP_ContextH(const GP_Context *context);
-------------------------------------------------------------------------------
-Rotate context flags (x_swap, y_swap and axes_swap) clock wise, respectively
-counter clock wise.
+Context base functions
+~~~~~~~~~~~~~~~~~~~~~~
[source,c]
-------------------------------------------------------------------------------
#include <GP.h>
-GP_Context *GP_ContextAlloc(uint32_t w, uint32_t h, GP_PixelType type);
+GP_Context *GP_ContextAlloc(GP_Size w, GP_Size h, GP_PixelType type);
+
+GP_Context *GP_ContextCopy(const GP_Context *src, int flag);
+
+void GP_ContextFree(GP_Context *context);
-------------------------------------------------------------------------------
-Allocates and initializes the 'GP_Context' structure. The size for pixels is
-computed from width, height and pixel type. Moreover the rotation flags are
-set to zero and clipping rectangle is set to whole bitmap.
+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. The bitmap
+(context->pixels) is not initalized.
-The newly allocated context should be later freed with 'GP_ContextFree()'.
+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.
-[source,c]
--------------------------------------------------------------------------------
-#include <GP.h>
+In both cases the resulting context should later be freed with
+'GP_ContextFree()'.
-void GP_ContextFree(GP_Context *context);
--------------------------------------------------------------------------------
+Subcontext
+~~~~~~~~~~
-Free the context allocated memory.
+Given a rectangular area inside of any context subcontext could be created.
+The resulting context could be used for all context operations (including
+subcontext creation). The only difference between allocated context and
+subcontext of such context is that the 'GP_ContextFree()' doesn't call
+'free()' on subcontext pixels (which as a matter of a fact is a pointer that
+points somewhere into to allocated area).
[source,c]
-------------------------------------------------------------------------------
#include <GP.h>
-GP_Context *GP_ContextCopy(GP_Context *context, int flag);
+GP_Context *GP_ContextSubContext(GP_Context *context, GP_Context *subcontext,
+ GP_Coord x, GP_Coord y, GP_Size w, GP_Size h);
-------------------------------------------------------------------------------
-Copy a context. Allocates and initializes a 'GP_Context'. If flag is set to
-GP_CONTEXT_WITH_PIXELS, the actual bitmap is copied from context to newly
-allocated context, otherwise only context meta-data are copied.
+Creates subcontext of a context. The rectangular area must fit into the context.
+
+If subcontext pointer is 'NULL' the context structure is allocated otherwise
+the metadata are filled into the context structure pointed by subcontext
+pointer.
-The newly created context should be later freed with 'GP_ContextFree()'.
+In both cases pointer to subcontext or NULL (in case of 'malloc(2)' failure) is
+returned.
diff --git a/include/core/GP_Context.h b/include/core/GP_Context.h
index ef2940e..d6b0f6a 100644
--- a/include/core/GP_Context.h
+++ b/include/core/GP_Context.h
@@ -133,15 +133,19 @@ void GP_ContextFree(GP_Context *context);
GP_RetCode GP_ContextDump(GP_Context *context, const char *path);
/*
- * Rotates context flags.
+ * Rotates context flags clock wise.
*/
void GP_ContextFlagsRotateCW(GP_Context *context);
+
+/*
+ * Rotates context flags counter clock wise.
+ */
void GP_ContextFlagsRotateCCW(GP_Context *context);
/*
- * Returns context width and height.
+ * Returns context width and height taking the rotation flags into a account.
*/
-static inline uint32_t GP_ContextW(const GP_Context *context)
+static inline GP_Size GP_ContextW(const GP_Context *context)
{
if (context->axes_swap)
return context->h;
@@ -149,7 +153,7 @@ static inline uint32_t GP_ContextW(const GP_Context *context)
return context->w;
}
-static inline uint32_t GP_ContextH(const GP_Context *context)
+static inline GP_Size GP_ContextH(const GP_Context *context)
{
if (context->axes_swap)
return context->w;
-----------------------------------------------------------------------
Summary of changes:
doc/context.txt | 141 ++++++++++++++++++++++++++++-----------------
include/core/GP_Context.h | 12 +++-
2 files changed, 95 insertions(+), 58 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.")