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 69fe54806e58e8f78860761e97b90d592199b665 (commit) via f19066b7575762295fe077dd20cbd149a330578d (commit) via 390152eb9ac9b007ca33ab4309e44ab628d04c6a (commit) via e0f1329f8cc9daf32cd26e3cdc80d6fee0feede5 (commit) from fafd7bf50d69b47a22775fcbb166d9c3d48c565f (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/69fe54806e58e8f78860761e97b90d592199b...
commit 69fe54806e58e8f78860761e97b90d592199b665 Author: Cyril Hrubis metan@ucw.cz Date: Fri May 10 15:22:05 2013 +0200
loaders: JPG: Add support for loading CMYK images.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/libs/loaders/GP_JPG.c b/libs/loaders/GP_JPG.c index 0e04ce6..11c34d1 100644 --- a/libs/loaders/GP_JPG.c +++ b/libs/loaders/GP_JPG.c @@ -140,6 +140,9 @@ GP_Context *GP_ReadJPG(FILE *f, GP_ProgressCallback *callback) case JCS_RGB: pixel_type = GP_PIXEL_RGB888; break; + case JCS_CMYK: + pixel_type = GP_PIXEL_CMYK8888; + break; default: pixel_type = GP_PIXEL_UNKNOWN; } @@ -168,22 +171,35 @@ GP_Context *GP_ReadJPG(FILE *f, GP_ProgressCallback *callback) JSAMPROW addr = (void*)GP_PIXEL_ADDR(ret, 0, y); jpeg_read_scanlines(&cinfo, &addr, 1);
- if (pixel_type != GP_PIXEL_RGB888) - continue; + if (pixel_type == GP_PIXEL_RGB888) { + //TODO: fixme bigendian? + /* fix the pixel, as we want in fact BGR */ + unsigned int i; - //TODO: fixme bigendian? - /* fix the pixel, as we want in fact BGR */ - uint32_t i; - - for (i = 0; i < ret->w; i++) { - uint8_t *pix = GP_PIXEL_ADDR(ret, i, y); - GP_SWAP(pix[0], pix[2]); - } + for (i = 0; i < ret->w; i++) { + uint8_t *pix = GP_PIXEL_ADDR(ret, i, y); + GP_SWAP(pix[0], pix[2]); + } - if (GP_ProgressCallbackReport(callback, y, ret->h, ret->w)) { - GP_DEBUG(1, "Operation aborted"); - err = ECANCELED; - goto err2; + if (GP_ProgressCallbackReport(callback, y, ret->h, ret->w)) { + GP_DEBUG(1, "Operation aborted"); + err = ECANCELED; + goto err2; + } + } + + if (pixel_type == GP_PIXEL_CMYK8888) { + unsigned int i; + uint8_t *buf = GP_PIXEL_ADDR(ret, 0, y); + + for (i = 0; i < ret->w; i++) { + unsigned int j = 4 * i; + + buf[j] = 0xff - buf[j]; + buf[j+1] = 0xff - buf[j+1]; + buf[j+2] = 0xff - buf[j+2]; + buf[j+3] = 0xff - buf[j+3]; + } } }
http://repo.or.cz/w/gfxprim.git/commit/f19066b7575762295fe077dd20cbd149a3305...
commit f19066b7575762295fe077dd20cbd149a330578d Author: Cyril Hrubis metan@ucw.cz Date: Fri May 10 15:16:51 2013 +0200
core: Add initial support for CMYK8888.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/doc/gen.txt b/doc/gen.txt index cac6b9d..3f3c0d8 100644 --- a/doc/gen.txt +++ b/doc/gen.txt @@ -181,6 +181,9 @@ class PixelType(object): def is_rgb(self): ...
+ def is_cmyk(self): + ... + def is_gray(self): ...
diff --git a/gfxprim_config.py b/gfxprim_config.py index 1af12c9..dad4bbe 100644 --- a/gfxprim_config.py +++ b/gfxprim_config.py @@ -4,8 +4,8 @@ #
# -# 2011 - Tomas Gavenciak gavento@ucw.cz -# 2011 - Cyril Hrubis metan@ucw.cz +# 2011 Tomas Gavenciak gavento@ucw.cz +# 2011-2013 Cyril Hrubis metan@ucw.cz # # This file is sourced by all the generating scripts. # Moreover, the generated files are sourced by almost all Gfxprim sources, @@ -75,7 +75,16 @@ config = GfxPrimConfig( ('R', 12, 6), ('G', 6, 6), ('B', 0, 6)]), - + + # + # CMYK + # + PixelType(name="CMYK8888", pixelsize=PS_32BPP, chanslist=[ + ('K', 24, 8), + ('Y', 16, 8), + ('M', 8, 8), + ('C', 0, 8)]), + # # Palette types # diff --git a/include/core/GP_Convert.gen.h.t b/include/core/GP_Convert.gen.h.t index 7dc25a9..2f59fc3 100644 --- a/include/core/GP_Convert.gen.h.t +++ b/include/core/GP_Convert.gen.h.t @@ -52,7 +52,25 @@ %% set c1 = pt1.chans['V'] /* {{ c2[0] }}:=V */ GP_SET_BITS({{c2[1]}}+o2, {{c2[2]}}, p2, GP_SCALE_VAL_{{c1[2]}}_{{c2[2]}}(GP_GET_BITS({{c1[1]}}+o1, {{c1[2]}}, p1))); -{# case 5: invalid mapping -#} +{# case 5: CMYK to RGB -#} +%% elif c2[0] in 'RGB' and pt1.is_cmyk() +%% set K = pt1.chans['K'] +{# Get the right channel -#} +%% if c2[0] == 'R' +%% set V = pt1.chans['C'] +%% elif c2[0] == 'G' +%% set V = pt1.chans['M'] +%% else +%% set V = pt1.chans['Y'] +%% endif + GP_SET_BITS({{ c2[1] }}+o2, {{ c2[2] }}, p2,+ GP_SCALE_VAL_{{ K[2] + V[2] }}_{{ c2[2] }}(+ (({{ 2 ** K[2] - 1 }} - GP_GET_BITS({{ K[1] }}+o1, {{ K[2] }}, p1)) * + ({{ 2 ** V[2] - 1 }} - GP_GET_BITS({{ V[1] }}+o1, {{ V[2] }}, p1))))); +{# case 6: RGB to CMYK -#} +%% elif c2[0] in 'CMYK' and pt1.is_rgb() + /* TODO */ +{# case 7: invalid mapping -#} %% else {{ error('Channel conversion ' + pt1.name + ' to ' + pt2.name + ' not supported.') }} %% endif diff --git a/include/core/GP_Pixel.h b/include/core/GP_Pixel.h index ff2d710..4a0806e 100644 --- a/include/core/GP_Pixel.h +++ b/include/core/GP_Pixel.h @@ -97,6 +97,7 @@ 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;
diff --git a/libs/core/GP_Pixel.gen.c.t b/libs/core/GP_Pixel.gen.c.t index 7fad071..0511120 100644 --- a/libs/core/GP_Pixel.gen.c.t +++ b/libs/core/GP_Pixel.gen.c.t @@ -37,6 +37,7 @@ Pixel type definitions and functions {% if pt.is_rgb() %} | GP_PIXEL_IS_RGB{% endif -%} {% if pt.is_palette() %} | GP_PIXEL_IS_PALETTE{% endif -%} {% if pt.is_gray() %} | GP_PIXEL_IS_GRAYSCALE{% endif -%} +{% if pt.is_cmyk() %} | GP_PIXEL_IS_CMYK{% endif -%} %%- endmacro
/* diff --git a/pylib/gp_codegen/pixeltype.py b/pylib/gp_codegen/pixeltype.py index 08e08fe..eaac404 100644 --- a/pylib/gp_codegen/pixeltype.py +++ b/pylib/gp_codegen/pixeltype.py @@ -58,6 +58,11 @@ class PixelType(object):
def is_gray(self): return ('V' in self.chans) + + def is_cmyk(self): + for i in 'CMYK': + if i not in self.chans: return False + return True
def is_alpha(self): return ('A' in self.chans)
http://repo.or.cz/w/gfxprim.git/commit/390152eb9ac9b007ca33ab4309e44ab628d04...
commit 390152eb9ac9b007ca33ab4309e44ab628d04c6a Author: Cyril Hrubis metan@ucw.cz Date: Fri May 10 13:47:39 2013 +0200
filters; Ditherings: Make list of output fmts explicit.
Make the list of output formats explicit so that the code doesn't break when new pixel that is not RGB nor Gray is added.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/libs/filters/GP_FloydSteinberg.gen.c.t b/libs/filters/GP_FloydSteinberg.gen.c.t index e10a326..fde40d9 100644 --- a/libs/filters/GP_FloydSteinberg.gen.c.t +++ b/libs/filters/GP_FloydSteinberg.gen.c.t @@ -46,7 +46,7 @@ %% endmacro
%% for pt in pixeltypes -%% if not pt.is_unknown() and not pt.is_alpha() and not pt.is_palette() +%% if pt.is_gray() or pt.is_rgb() and not pt.is_alpha() /* * Floyd Steinberg RGB888 to {{ pt.name }} */ @@ -127,7 +127,7 @@ int GP_FilterFloydSteinberg_RGB888_Raw(const GP_Context *src, { switch (dst->pixel_type) { %% for pt in pixeltypes -%% if not pt.is_unknown() and not pt.is_alpha() and not pt.is_palette() +%% if pt.is_gray() or pt.is_rgb() and not pt.is_alpha() case GP_PIXEL_{{ pt.name }}: return GP_FilterFloydSteinberg_RGB888_to_{{ pt.name }}_Raw(src, dst, callback); %% endif diff --git a/libs/filters/GP_HilbertPeano.gen.c.t b/libs/filters/GP_HilbertPeano.gen.c.t index 37a79d7..9c84bee 100644 --- a/libs/filters/GP_HilbertPeano.gen.c.t +++ b/libs/filters/GP_HilbertPeano.gen.c.t @@ -49,7 +49,7 @@ static unsigned int count_bits(unsigned int n) }
%% for pt in pixeltypes -%% if not pt.is_unknown() and not pt.is_alpha() and not pt.is_palette() +%% if pt.is_gray() or pt.is_rgb() and not pt.is_alpha() /* * Hilbert Peano RGB888 to {{ pt.name }} */ @@ -137,7 +137,7 @@ int GP_FilterHilbertPeano_RGB888_Raw(const GP_Context *src, { switch (dst->pixel_type) { %% for pt in pixeltypes -%% if not pt.is_unknown() and not pt.is_alpha() and not pt.is_palette() +%% if pt.is_gray() or pt.is_rgb() and not pt.is_alpha() case GP_PIXEL_{{ pt.name }}: return GP_FilterHilbertPeano_RGB888_to_{{ pt.name }}_Raw(src, dst, callback); %% endif
http://repo.or.cz/w/gfxprim.git/commit/e0f1329f8cc9daf32cd26e3cdc80d6fee0fee...
commit e0f1329f8cc9daf32cd26e3cdc80d6fee0feede5 Author: Cyril Hrubis metan@ucw.cz Date: Fri May 10 13:15:15 2013 +0200
configure: Use Popen instead of check_output
Fixes configure with Python 2.6
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/configure b/configure index df8a74f..36450a1 100755 --- a/configure +++ b/configure @@ -5,7 +5,7 @@ import os import sys from optparse import OptionParser -from subprocess import check_output +import subprocess
def header_exists(cfg, filename): fpath = cfg['include_path'][0] + '/' + filename @@ -45,7 +45,9 @@ def python_version(cfg): sys.stderr.write('NAn') return ''
- res = str(check_output("%s --ldflags" % cfg['PYTHON_CONFIG'][0], shell=True)) + cmd = subprocess.Popen([cfg['PYTHON_CONFIG'][0], '--ldflags'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + res = str(cmd.communicate()) res = res[res.find('-lpython')+8:] res = res[:3]
-----------------------------------------------------------------------
Summary of changes: configure | 6 +++- doc/gen.txt | 3 ++ gfxprim_config.py | 15 ++++++++-- include/core/GP_Convert.gen.h.t | 20 +++++++++++++- include/core/GP_Pixel.h | 1 + libs/core/GP_Pixel.gen.c.t | 1 + libs/filters/GP_FloydSteinberg.gen.c.t | 4 +- libs/filters/GP_HilbertPeano.gen.c.t | 4 +- libs/loaders/GP_JPG.c | 44 +++++++++++++++++++++---------- pylib/gp_codegen/pixeltype.py | 5 +++ 10 files changed, 79 insertions(+), 24 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.