r10612 - in /trunk/libimager-perl: debian/ debian/changelog debian/compat debian/control debian/copyright debian/rules debian/watch gaussian.c render.c
gregoa-guest at users.alioth.debian.org
gregoa-guest at users.alioth.debian.org
Sat Dec 1 17:53:01 UTC 2007
Author: gregoa-guest
Date: Sat Dec 1 17:53:01 2007
New Revision: 10612
URL: http://svn.debian.org/wsvn/?sc=1&rev=10612
Log:
[svn-inject] Applying Debian modifications to trunk
Added:
trunk/libimager-perl/debian/
trunk/libimager-perl/debian/changelog
trunk/libimager-perl/debian/compat
trunk/libimager-perl/debian/control
trunk/libimager-perl/debian/copyright
trunk/libimager-perl/debian/rules (with props)
trunk/libimager-perl/debian/watch
trunk/libimager-perl/gaussian.c
trunk/libimager-perl/render.c
Added: trunk/libimager-perl/debian/changelog
URL: http://svn.debian.org/wsvn/trunk/libimager-perl/debian/changelog?rev=10612&op=file
==============================================================================
--- trunk/libimager-perl/debian/changelog (added)
+++ trunk/libimager-perl/debian/changelog Sat Dec 1 17:53:01 2007
@@ -1,0 +1,76 @@
+libimager-perl (0.58-1) unstable; urgency=low
+
+ * New upstream release
+ * Fixes CVE 2007-2413 and CVE 2007-2459 (Closes: #421582)
+ * Adds zoso as co-maint
+
+ -- Jay Bonci <jaybonci at debian.org> Thu, 24 May 2007 01:57:26 -0400
+
+libimager-perl (0.54-1) unstable; urgency=low
+
+ * New upstream release (Closes: #388575)
+ * Bumped compat to 5
+ * Bumped Policy-Version to 3.7.2
+ * Added libtest-pod-perl and libtest-pod-coverage-perl to Build-Depends
+ * Bumped debhelper to 5
+ * Remove /usr/share/perl5
+ * Thanks to Kjetil Kjersmo <kjetilk at opera.com> for preparing the upload
+
+ -- Jay Bonci <jaybonci at debian.org> Mon, 04 Dec 2006 00:42:10 -0500
+
+libimager-perl (0.50-1) unstable; urgency=low
+
+ * New upstream release (Closes: #359661)
+ * Bumped Policy-Version to 3.6.2.2 (No other changes)
+
+ -- Jay Bonci <jaybonci at debian.org> Thu, 30 Mar 2006 15:26:20 -0500
+
+libimager-perl (0.47-1) unstable; urgency=low
+
+ * New upstream release (Closes: #345760 #335971)
+
+ -- Jay Bonci <jaybonci at debian.org> Fri, 20 Jan 2006 10:05:45 -0500
+
+libimager-perl (0.45-1) unstable; urgency=low
+
+ * New upstream release
+ * Policy version bump (No other changes)
+ * Removed Michael Edwards as Maintainer
+ * New maintainer (Closes: #300233)
+
+ -- Jay Bonci <jaybonci at debian.org> Thu, 7 Jul 2005 17:19:09 -0400
+
+libimager-perl (0.44-1) unstable; urgency=low
+
+ * New upstream version
+
+ -- Jay Bonci <jaybonci at debian.org> Wed, 29 Dec 2004 00:48:23 -0500
+
+libimager-perl (0.43-1) unstable; urgency=low
+
+ * New upstream version
+ * Adds debian/watch file so uscan will work
+
+ -- Jay Bonci <jaybonci at debian.org> Wed, 27 Oct 2004 14:57:07 -0400
+
+libimager-perl (0.42-2) unstable; urgency=low
+
+ * Acknowledged NMU (Closes: #262846)
+ * Removed libtiff2 dependancy by rebuild (Closes: #265127)
+
+ -- Jay Bonci <jaybonci at debian.org> Tue, 14 Sep 2004 01:06:58 -0400
+
+libimager-perl (0.42-1.1) unstable; urgency=medium
+
+ * Non-maintainer upload.
+ * Medium urgency to facilitate the libtiff transition.
+ * Rebuild against libtiff4 (closes: #262846).
+
+ -- Steve Langasek <vorlon at debian.org> Mon, 9 Aug 2004 22:56:18 -0700
+
+libimager-perl (0.42-1) unstable; urgency=low
+
+ * Initial Release.
+
+ -- Michael K. Edwards <medwards-debian at sane.net> Tue, 20 Jan 2004 01:44:53 -0800
+
Added: trunk/libimager-perl/debian/compat
URL: http://svn.debian.org/wsvn/trunk/libimager-perl/debian/compat?rev=10612&op=file
==============================================================================
--- trunk/libimager-perl/debian/compat (added)
+++ trunk/libimager-perl/debian/compat Sat Dec 1 17:53:01 2007
@@ -1,0 +1,1 @@
+5
Added: trunk/libimager-perl/debian/control
URL: http://svn.debian.org/wsvn/trunk/libimager-perl/debian/control?rev=10612&op=file
==============================================================================
--- trunk/libimager-perl/debian/control (added)
+++ trunk/libimager-perl/debian/control Sat Dec 1 17:53:01 2007
@@ -1,0 +1,19 @@
+Source: libimager-perl
+Section: perl
+Priority: optional
+Build-Depends: debhelper (>= 5), perl (>= 5.8.0-7), libungif4-dev, libtiff4-dev, libpng12-dev, libjpeg62-dev, libfreetype6-dev, libt1-dev, libtest-pod-perl, libtest-pod-coverage-perl
+Maintainer: Jay Bonci <jaybonci at debian.org>
+Uploaders: Esteban Manchado Velázque <zoso at debian.org>
+Standards-Version: 3.7.2
+
+Package: libimager-perl
+Architecture: any
+Depends: ${perl:Depends}, ${shlibs:Depends}
+Description: Perl extension for Generating 24 bit Images
+ Imager is a module for creating and altering images. It can read and
+ write various image formats, draw primitive shapes like lines,and
+ polygons, blend multiple images together in various ways, scale, crop,
+ render text and more.
+ .
+ Imager also has convenience functions for things like RGB<->HSV color
+ space conversion.
Added: trunk/libimager-perl/debian/copyright
URL: http://svn.debian.org/wsvn/trunk/libimager-perl/debian/copyright?rev=10612&op=file
==============================================================================
--- trunk/libimager-perl/debian/copyright (added)
+++ trunk/libimager-perl/debian/copyright Sat Dec 1 17:53:01 2007
@@ -1,0 +1,19 @@
+This is the debian package for the Imager module.
+It was created by Michael K. Edwards <medwards-debian at sane.net> using dh-make-perl.
+
+The upstream author is:
+
+Arnar M. Hrafnkelsson (addi at imager.perl.org) and Tony Cook
+(tony at imager.perl.org) See the README for a complete list..
+
+Copyright:
+
+Copyright (c) 1999-2004 Arnar M. Hrafnkelsson.
+All rights reserved. This program is free software; you can redistribute
+it and/or modify it under the same terms as Perl itself.
+
+Perl is distributed under your choice of the GNU General Public License or
+the Artistic License. On Debian GNU/Linux systems, the complete text of the
+GNU General Public License can be found in `/usr/share/common-licenses/GPL'
+and the Artistic Licence in `/usr/share/common-licenses/Artistic'.
+
Added: trunk/libimager-perl/debian/rules
URL: http://svn.debian.org/wsvn/trunk/libimager-perl/debian/rules?rev=10612&op=file
==============================================================================
--- trunk/libimager-perl/debian/rules (added)
+++ trunk/libimager-perl/debian/rules Sat Dec 1 17:53:01 2007
@@ -1,0 +1,95 @@
+#!/usr/bin/make -f
+#-*- makefile -*-
+# Made with the aid of dh_make, by Craig Small
+# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
+# Some lines taken from debmake, by Christoph Lameter.
+
+# Uncomment this to turn on verbose mode.
+# export DH_VERBOSE=1
+
+# If set to a true value then MakeMaker's prompt function will
+# always return the default without waiting for user input.
+export PERL_MM_USE_DEFAULT=1
+
+PACKAGE=$(shell dh_listpackages)
+
+ifndef PERL
+PERL = /usr/bin/perl
+endif
+
+ifndef DESTDIR
+DESTDIR=..
+endif
+TMP =`pwd`/debian/$(PACKAGE)
+
+OPTIMIZE = -O2 -Wall
+ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
+OPTIMIZE += -g
+endif
+
+build: build-stamp
+build-stamp:
+ dh_testdir
+
+
+ # Add here commands to compile the package.
+ echo n | $(PERL) Makefile.PL INSTALLDIRS=vendor
+ $(MAKE) OPTIMIZE="$(OPTIMIZE)" LD_RUN_PATH=""
+
+ touch build-stamp
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp
+ rm -f imconfig.h
+ rm -f ICO/testout/*
+ # Add here commands to clean up after the build process.
+ -$(MAKE) realclean
+
+ dh_clean
+
+install:
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/tmp.
+ #$(MAKE) install DESTDIR=`pwd`/debian/tmp
+ $(MAKE) test install PREFIX=$(TMP)/usr
+ rmdir --ignore-fail-on-non-empty --parents $(TMP)/usr/share/perl5
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installdocs README
+ dh_installexamples
+ dh_installmenu
+# dh_installemacsen
+# dh_installinit
+ dh_installcron
+ dh_installman
+ dh_installchangelogs Changes
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+# dh_makeshlibs
+ dh_installdeb
+ dh_perl
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb --destdir=$(DESTDIR)
+
+source diff:
+ @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary
Propchange: trunk/libimager-perl/debian/rules
------------------------------------------------------------------------------
svn:executable = *
Added: trunk/libimager-perl/debian/watch
URL: http://svn.debian.org/wsvn/trunk/libimager-perl/debian/watch?rev=10612&op=file
==============================================================================
--- trunk/libimager-perl/debian/watch (added)
+++ trunk/libimager-perl/debian/watch Sat Dec 1 17:53:01 2007
@@ -1,0 +1,3 @@
+version=2
+http://www.cpan.org/modules/by-module/Imager/Imager-([0-9].*)\.tar.gz \
+ debian uupdate
Added: trunk/libimager-perl/gaussian.c
URL: http://svn.debian.org/wsvn/trunk/libimager-perl/gaussian.c?rev=10612&op=file
==============================================================================
--- trunk/libimager-perl/gaussian.c (added)
+++ trunk/libimager-perl/gaussian.c Sat Dec 1 17:53:01 2007
@@ -1,0 +1,159 @@
+#line 1 "gaussian.im"
+#include "imager.h"
+#include <math.h>
+
+static double
+gauss(int x, double std) {
+ return 1.0/(sqrt(2.0*PI)*std)*exp(-(double)(x)*(float)(x)/(2*std*std));
+}
+
+/* Counters are as follows
+ l: lines
+ i: columns
+ c: filter coeffs
+ ch: channels
+ pc: coeff equalization
+*/
+
+
+
+int
+i_gaussian(i_img *im, double stddev) {
+ int i,l,c,ch;
+ double pc;
+ double *coeff;
+ double res[MAXCHANNELS];
+ i_img *timg;
+ int radius, diameter;
+
+ mm_log((1,"i_gaussian(im %p, stdev %.2f)\n",im,stddev));
+ i_clear_error();
+
+ if (stddev <= 0) {
+ i_push_error(0, "stddev must be positive");
+ return 0;
+ }
+ /* totally silly cutoff */
+ if (stddev > 1000) {
+ stddev = 1000;
+ }
+
+ timg = i_sametype(im, im->xsize, im->ysize);
+
+ if (im->bits <= 8)
+ radius = ceil(2 * stddev);
+ else
+ radius = ceil(3 * stddev);
+
+ diameter = 1 + radius * 2;
+
+ coeff = mymalloc(sizeof(double) * diameter);
+
+ for(i=0;i <= radius;i++)
+ coeff[radius + i]=coeff[radius - i]=gauss(i, stddev);
+ pc=0;
+ for(i=0; i < diameter; i++)
+ pc+=coeff[i];
+ for(i=0;i < diameter;i++)
+ coeff[i] /= pc;
+
+
+#line 60 "gaussian.im"
+ if (im->bits <= 8) {
+#undef IM_EIGHT_BIT
+#define IM_EIGHT_BIT 1
+#line 61 "gaussian.im"
+ i_color rcolor;
+ for(l=0;l<im->ysize;l++) {
+ for(i=0;i<im->xsize;i++) {
+ pc=0.0;
+ for(ch=0;ch<im->channels;ch++)
+ res[ch]=0;
+ for(c = 0;c < diameter; c++)
+ if (i_gpix(im,i+c-radius,l,&rcolor)!=-1) {
+ for(ch=0;ch<im->channels;ch++)
+ res[ch]+= rcolor.channel[ch] * coeff[c];
+ pc+=coeff[c];
+ }
+ for(ch=0;ch<im->channels;ch++) {
+ double value = res[ch] / pc;
+ rcolor.channel[ch] = value > 255 ? 255 : value;
+ }
+ i_ppix(timg,i,l,&rcolor);
+ }
+ }
+
+ for(l=0;l<im->xsize;l++) {
+ for(i=0;i<im->ysize;i++) {
+ pc=0.0;
+ for(ch=0; ch<im->channels; ch++)
+ res[ch]=0;
+ for(c=0; c < diameter; c++)
+ if (i_gpix(timg,l,i+c-radius,&rcolor)!=-1) {
+ for(ch=0;ch<im->channels;ch++)
+ res[ch]+= rcolor.channel[ch] * coeff[c];
+ pc+=coeff[c];
+ }
+ for(ch=0;ch<im->channels;ch++) {
+ double value = res[ch]/pc;
+ rcolor.channel[ch] = value > 255 ? 255 : value;
+ }
+ i_ppix(im,l,i,&rcolor);
+ }
+ }
+ }
+ else {
+#undef IM_EIGHT_BIT
+#line 61 "gaussian.im"
+ i_fcolor rcolor;
+ for(l=0;l<im->ysize;l++) {
+ for(i=0;i<im->xsize;i++) {
+ pc=0.0;
+ for(ch=0;ch<im->channels;ch++)
+ res[ch]=0;
+ for(c = 0;c < diameter; c++)
+ if (i_gpixf(im,i+c-radius,l,&rcolor)!=-1) {
+ for(ch=0;ch<im->channels;ch++)
+ res[ch]+= rcolor.channel[ch] * coeff[c];
+ pc+=coeff[c];
+ }
+ for(ch=0;ch<im->channels;ch++) {
+ double value = res[ch] / pc;
+ rcolor.channel[ch] = value > 1.0 ? 1.0 : value;
+ }
+ i_ppixf(timg,i,l,&rcolor);
+ }
+ }
+
+ for(l=0;l<im->xsize;l++) {
+ for(i=0;i<im->ysize;i++) {
+ pc=0.0;
+ for(ch=0; ch<im->channels; ch++)
+ res[ch]=0;
+ for(c=0; c < diameter; c++)
+ if (i_gpixf(timg,l,i+c-radius,&rcolor)!=-1) {
+ for(ch=0;ch<im->channels;ch++)
+ res[ch]+= rcolor.channel[ch] * coeff[c];
+ pc+=coeff[c];
+ }
+ for(ch=0;ch<im->channels;ch++) {
+ double value = res[ch]/pc;
+ rcolor.channel[ch] = value > 1.0 ? 1.0 : value;
+ }
+ i_ppixf(im,l,i,&rcolor);
+ }
+ }
+ }
+#line 99 "gaussian.im"
+ myfree(coeff);
+ i_img_destroy(timg);
+
+ return 1;
+}
+
+
+
+
+
+
+
Added: trunk/libimager-perl/render.c
URL: http://svn.debian.org/wsvn/trunk/libimager-perl/render.c?rev=10612&op=file
==============================================================================
--- trunk/libimager-perl/render.c (added)
+++ trunk/libimager-perl/render.c Sat Dec 1 17:53:01 2007
@@ -1,0 +1,346 @@
+#line 1 "render.im"
+/*
+Render utilities
+*/
+#include "imager.h"
+
+#define RENDER_MAGIC 0x765AE
+
+typedef void (*render_color_f)(i_render *, int, int, int, unsigned char const *src, i_color const *color);
+
+#undef IM_EIGHT_BIT
+#define IM_EIGHT_BIT 1
+#line 11 "render.im"
+
+static void render_color_alpha_8(i_render *r, int x, int y, int width, unsigned char const *src, i_color const *color);
+static void render_color_13_8(i_render *r, int x, int y, int width, unsigned char const *src, i_color const *color);
+
+static render_color_f render_color_tab_8[] =
+ {
+ NULL,
+ render_color_13_8,
+ render_color_alpha_8,
+ render_color_13_8,
+ render_color_alpha_8,
+ };
+
+#undef IM_EIGHT_BIT
+#line 11 "render.im"
+
+static void render_color_alpha_double(i_render *r, int x, int y, int width, unsigned char const *src, i_color const *color);
+static void render_color_13_double(i_render *r, int x, int y, int width, unsigned char const *src, i_color const *color);
+
+static render_color_f render_color_tab_double[] =
+ {
+ NULL,
+ render_color_13_double,
+ render_color_alpha_double,
+ render_color_13_double,
+ render_color_alpha_double,
+ };
+
+#line 24 "render.im"
+
+void
+i_render_init(i_render *r, i_img *im, int width) {
+ r->magic = RENDER_MAGIC;
+ r->im = im;
+ r->width = width;
+ r->line_8 = NULL;
+ r->line_double = NULL;
+#line 33 "render.im"
+ if (im->bits <= 8) {
+#undef IM_EIGHT_BIT
+#define IM_EIGHT_BIT 1
+#line 34 "render.im"
+ r->line_8 = mymalloc(sizeof(i_fcolor) * width);
+ }
+ else {
+#undef IM_EIGHT_BIT
+#line 34 "render.im"
+ r->line_double = mymalloc(sizeof(i_fcolor) * width);
+ }
+#line 35 "render.im"
+}
+
+void
+i_render_done(i_render *r) {
+ if (r->line_8)
+ myfree(r->line_8);
+ else
+ myfree(r->line_double);
+ r->magic = 0;
+}
+
+void
+i_render_color(i_render *r, int x, int y, int width, unsigned char const *src,
+ i_color const *color) {
+ i_img *im = r->im;
+ if (y < 0 || y >= im->ysize)
+ return;
+ if (x < 0) {
+ width += x;
+ src -= x;
+ x = 0;
+ }
+ if (x + width > im->xsize) {
+ width = im->xsize - x;
+ }
+ if (x >= im->xsize || x + width <= 0 || width <= 0)
+ return;
+
+ /* avoid as much work as we can */
+ while (width > 0 && *src == 0) {
+ --width;
+ ++src;
+ ++x;
+ }
+ while (width > 0 && src[width-1] == 0) {
+ --width;
+ }
+ if (!width)
+ return;
+
+ /* make sure our line buffer is big enough */
+ if (width > r->width) {
+ int new_width = r->width * 2;
+ if (new_width < width)
+ new_width = width;
+
+ if (r->line_8)
+ r->line_8 = myrealloc(r->line_8, sizeof(i_color) * new_width);
+ else
+ r->line_double = myrealloc(r->line_double, sizeof(i_fcolor) * new_width);
+ }
+
+#line 88 "render.im"
+ if (r->im->bits <= 8) {
+#undef IM_EIGHT_BIT
+#define IM_EIGHT_BIT 1
+#line 89 "render.im"
+ (render_color_tab_8[im->channels])(r, x, y, width, src, color);
+ }
+ else {
+#undef IM_EIGHT_BIT
+#line 89 "render.im"
+ (render_color_tab_double[im->channels])(r, x, y, width, src, color);
+ }
+#line 90 "render.im"
+}
+
+static void
+dump_src(const char *note, unsigned char const *src, int width) {
+ int i;
+ printf("%s - %p/%d\n", note, src, width);
+ for (i = 0; i < width; ++i) {
+ printf("%02x ", src[i]);
+ }
+ putchar('\n');
+}
+
+#undef IM_EIGHT_BIT
+#define IM_EIGHT_BIT 1
+#line 104 "render.im"
+
+static
+void
+render_color_13_8(i_render *r, int x, int y, int width,
+ unsigned char const *src, i_color const *color) {
+ i_img *im = r->im;
+ i_color *linep = r->line_8;
+ int ch, channels = im->channels;
+ int fetch_offset;
+#undef STORE_COLOR
+#ifdef IM_EIGHT_BIT
+#define STORE_COLOR (*color)
+#else
+ i_fcolor fcolor;
+
+ for (ch = 0; ch < channels; ++ch) {
+ fcolor.channel[ch] = color->channel[ch] / 255.0;
+ }
+#define STORE_COLOR fcolor
+#endif
+
+ fetch_offset = 0;
+ while (fetch_offset < width && *src == 0xFF) {
+ *linep++ = STORE_COLOR;
+ ++src;
+ ++fetch_offset;
+ }
+ i_glin(im, x+fetch_offset, x+width, y, linep);
+ while (fetch_offset < width) {
+#ifdef IM_EIGHT_BIT
+ int alpha = *src++;
+#else
+ int alpha = *src++ / 255.0;
+#endif
+ if (alpha == 255)
+ *linep = STORE_COLOR;
+ else if (alpha) {
+ for (ch = 0; ch < channels; ++ch) {
+ linep->channel[ch] = (linep->channel[ch] * (255 - alpha)
+ + STORE_COLOR.channel[ch] * alpha) / 255;
+ }
+ }
+ ++linep;
+ ++fetch_offset;
+ }
+ i_plin(im, x, x+width, y, r->line_8);
+}
+
+static
+void
+render_color_alpha_8(i_render *r, int x, int y, int width,
+ unsigned char const *src, i_color const *color) {
+ i_color *linep = r->line_8;
+ int ch;
+ int alpha_channel = r->im->channels - 1;
+ int fetch_offset;
+#undef STORE_COLOR
+#ifdef IM_EIGHT_BIT
+#define STORE_COLOR (*color)
+#else
+ i_fcolor fcolor;
+
+ for (ch = 0; ch < r->im->channels; ++ch) {
+ fcolor.channel[ch] = color->channel[ch] / 255.0;
+ }
+#define STORE_COLOR fcolor
+#endif
+
+ fetch_offset = 0;
+ while (fetch_offset < width && *src == 0xFF) {
+ *linep++ = STORE_COLOR;
+ ++src;
+ ++fetch_offset;
+ }
+ i_glin(r->im, x+fetch_offset, x+width, y, linep);
+ while (fetch_offset < width) {
+#ifdef IM_EIGHT_BIT
+ int src_alpha = *src++;
+#else
+ int src_alpha = *src++ / 255.0;
+#endif
+ if (src_alpha == 255)
+ *linep = STORE_COLOR;
+ else if (src_alpha) {
+ int remains = - src_alpha;
+ int orig_alpha = linep->channel[alpha_channel];
+ int dest_alpha = src_alpha + (remains * orig_alpha) / 255;
+ for (ch = 0; ch < alpha_channel; ++ch) {
+ linep->channel[ch] = ( src_alpha * STORE_COLOR.channel[ch]
+ + remains * linep->channel[ch] * orig_alpha / 255
+ ) / dest_alpha;
+ }
+ linep->channel[alpha_channel] = dest_alpha;
+ }
+ ++linep;
+ ++fetch_offset;
+ }
+ i_plin(r->im, x, x+width, y, r->line_8);
+}
+
+#undef IM_EIGHT_BIT
+#line 104 "render.im"
+
+static
+void
+render_color_13_double(i_render *r, int x, int y, int width,
+ unsigned char const *src, i_color const *color) {
+ i_img *im = r->im;
+ i_fcolor *linep = r->line_double;
+ int ch, channels = im->channels;
+ int fetch_offset;
+#undef STORE_COLOR
+#ifdef IM_EIGHT_BIT
+#define STORE_COLOR (*color)
+#else
+ i_fcolor fcolor;
+
+ for (ch = 0; ch < channels; ++ch) {
+ fcolor.channel[ch] = color->channel[ch] / 255.0;
+ }
+#define STORE_COLOR fcolor
+#endif
+
+ fetch_offset = 0;
+ while (fetch_offset < width && *src == 0xFF) {
+ *linep++ = STORE_COLOR;
+ ++src;
+ ++fetch_offset;
+ }
+ i_glinf(im, x+fetch_offset, x+width, y, linep);
+ while (fetch_offset < width) {
+#ifdef IM_EIGHT_BIT
+ double alpha = *src++;
+#else
+ double alpha = *src++ / 255.0;
+#endif
+ if (alpha == 1.0)
+ *linep = STORE_COLOR;
+ else if (alpha) {
+ for (ch = 0; ch < channels; ++ch) {
+ linep->channel[ch] = (linep->channel[ch] * (1.0 - alpha)
+ + STORE_COLOR.channel[ch] * alpha) / 1.0;
+ }
+ }
+ ++linep;
+ ++fetch_offset;
+ }
+ i_plinf(im, x, x+width, y, r->line_double);
+}
+
+static
+void
+render_color_alpha_double(i_render *r, int x, int y, int width,
+ unsigned char const *src, i_color const *color) {
+ i_fcolor *linep = r->line_double;
+ int ch;
+ int alpha_channel = r->im->channels - 1;
+ int fetch_offset;
+#undef STORE_COLOR
+#ifdef IM_EIGHT_BIT
+#define STORE_COLOR (*color)
+#else
+ i_fcolor fcolor;
+
+ for (ch = 0; ch < r->im->channels; ++ch) {
+ fcolor.channel[ch] = color->channel[ch] / 255.0;
+ }
+#define STORE_COLOR fcolor
+#endif
+
+ fetch_offset = 0;
+ while (fetch_offset < width && *src == 0xFF) {
+ *linep++ = STORE_COLOR;
+ ++src;
+ ++fetch_offset;
+ }
+ i_glinf(r->im, x+fetch_offset, x+width, y, linep);
+ while (fetch_offset < width) {
+#ifdef IM_EIGHT_BIT
+ double src_alpha = *src++;
+#else
+ double src_alpha = *src++ / 255.0;
+#endif
+ if (src_alpha == 1.0)
+ *linep = STORE_COLOR;
+ else if (src_alpha) {
+ double remains = - src_alpha;
+ double orig_alpha = linep->channel[alpha_channel];
+ double dest_alpha = src_alpha + (remains * orig_alpha) / 1.0;
+ for (ch = 0; ch < alpha_channel; ++ch) {
+ linep->channel[ch] = ( src_alpha * STORE_COLOR.channel[ch]
+ + remains * linep->channel[ch] * orig_alpha / 1.0
+ ) / dest_alpha;
+ }
+ linep->channel[alpha_channel] = dest_alpha;
+ }
+ ++linep;
+ ++fetch_offset;
+ }
+ i_plinf(r->im, x, x+width, y, r->line_double);
+}
+
+#line 204 "render.im"
More information about the Pkg-perl-cvs-commits
mailing list