From: Tony Cook Date: Wed, 16 Mar 2005 13:48:51 +0000 (+0000) Subject: - added README for samples directory, describes interleave.pl and X-Git-Tag: Imager-0.48^2~195 X-Git-Url: http://git.imager.perl.org/imager.git/commitdiff_plain/12b1fac2bb02ce7d7abc20cb0c2f0d92724541dc - added README for samples directory, describes interleave.pl and anaglyph.pl to start. - the XS for the internal i_glin() function wasn't copying the pixel values across to the returned color objects. http://rt.cpan.org/NoAuth/Bug.html?id=11860 --- diff --git a/Changes b/Changes index 41cd2be8..b0a5a950 100644 --- a/Changes +++ b/Changes @@ -1036,6 +1036,11 @@ Revision history for Perl extension Imager. http://rt.cpan.org/NoAuth/Bug.html?id=9672 - correct email addresses in the README file, and include bug reporting information there too +- added README for samples directory, describes interleave.pl and + anaglyph.pl to start. +- the XS for the internal i_glin() function wasn't copying the pixel + values across to the returned color objects. + http://rt.cpan.org/NoAuth/Bug.html?id=11860 ================================================================= diff --git a/Imager.xs b/Imager.xs index c374f94d..b0666a45 100644 --- a/Imager.xs +++ b/Imager.xs @@ -3785,6 +3785,7 @@ i_glin(im, l, r, y) for (i = 0; i < count; ++i) { SV *sv; i_color *col = mymalloc(sizeof(i_color)); + *col = vals[i]; sv = sv_newmortal(); sv_setref_pv(sv, "Imager::Color", (void *)col); PUSHs(sv); diff --git a/MANIFEST b/MANIFEST index fb7019a7..6f046117 100644 --- a/MANIFEST +++ b/MANIFEST @@ -101,6 +101,9 @@ regmach.h regops.perl rgb.c Reading and writing SGI rgb files rotate.c +samples/README +samples/anaglyph.pl +samples/interleave.pl spot.perl For making an ordered dither matrix from a spot function stackmach.c stackmach.h diff --git a/TODO b/TODO index b3c92eca..9fcd5d57 100644 --- a/TODO +++ b/TODO @@ -8,7 +8,7 @@ not commitments. 0.45: (march 2005?) - audit pnm.c (done) -- audit tga.c +- audit tga.c (done) - audit rgb.c and add tests - capture TIFF read warnings (i_warnings tag?) (done) - add Imager::Cookbook with at least 5 recipes @@ -26,7 +26,7 @@ not commitments. - handle probing for libraries better (use pkg-config or I-config where possible (freetype2 and libpng)) (done) - add concept index to Imager.pm pod (done, still working it) -- replace testimg/penguin-base.ppm with a smaller image +- replace testimg/penguin-base.ppm with a smaller image (done) - add a sample CGI HTML and image generation scripts that work together, with appropriate security management - add sample CGI that handles an uploaded image diff --git a/samples/README b/samples/README new file mode 100644 index 00000000..deaa278d --- /dev/null +++ b/samples/README @@ -0,0 +1,22 @@ +This directory includes example code for Imager. + +If you have sample code to contribute, please contact the maintainer. + +The notes here just provide a basic description and the functions +used. + +anaglyph.pl + + Produce a color, grey or pure anaglyph image given left and right + images of a stereoscopic pair. + + Uses transform2() and convert(). + +interleave.pl + + Produce an interleaved image given the left and right images of a + stereoscopic pair. Note that the source images must be pre-scaled. + + This includes 3 different implementations, first using transform2(), + the second using the internal i_copyto() function and the third using + the internal i_glin() and i_plin() functions. diff --git a/t/t01introvert.t b/t/t01introvert.t index e6dce3b6..e41de5e3 100644 --- a/t/t01introvert.t +++ b/t/t01introvert.t @@ -4,7 +4,7 @@ use strict; use lib 't'; -use Test::More tests=>95; +use Test::More tests=>98; BEGIN { use_ok(Imager => qw(:handy :all)) } @@ -244,6 +244,17 @@ cmp_ok(Imager->errstr, '=~', qr/channels must be between 1 and 4/, cmp_ok($warning, '=~', 't01introvert\\.t', "correct file"); } +{ # http://rt.cpan.org/NoAuth/Bug.html?id=11860 + my $im = Imager->new(xsize=>2, ysize=>2); + $im->setpixel(x=>0, 'y'=>0, color=>$red); + $im->setpixel(x=>1, 'y'=>0, color=>$blue); + + my @row = Imager::i_glin($im->{IMG}, 0, 2, 0); + is(@row, 2, "got 2 pixels from i_glin"); + ok(color_cmp($row[0], $red) == 0, "red first"); + ok(color_cmp($row[1], $blue) == 0, "then blue"); +} + sub check_add { my ($im, $color, $expected) = @_; my $index = Imager::i_addcolors($im, $color);