]> git.imager.perl.org - imager.git/commitdiff
- added README for samples directory, describes interleave.pl and
authorTony Cook <tony@develop=help.com>
Wed, 16 Mar 2005 13:48:51 +0000 (13:48 +0000)
committerTony Cook <tony@develop=help.com>
Wed, 16 Mar 2005 13:48:51 +0000 (13:48 +0000)
  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

Changes
Imager.xs
MANIFEST
TODO
samples/README [new file with mode: 0644]
t/t01introvert.t

diff --git a/Changes b/Changes
index 41cd2be8940d005e1368115b17235875a28f2d75..b0a5a950927623bf12cab904922d543d8a177a7a 100644 (file)
--- 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 
 
 =================================================================
 
index c374f94de7bd571160781c40d5eb54622718f1c3..b0666a45fb71b30687d49757030f5634e00ef4ee 100644 (file)
--- 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);
index fb7019a74a5b88487b6b935f2104600fefb2110c..6f04611743bafdcbb51e6dc64499a5cf082c5d88 100644 (file)
--- 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 b3c92eca0a5922978d15ed96fb5f2d8299dbc5fd..9fcd5d57f702abe5542fd73ffb78ff29c6b5afb0 100644 (file)
--- 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<library>-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 (file)
index 0000000..deaa278
--- /dev/null
@@ -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.
index e6dce3b69ad670cb51dac17942c44fb6bd8f47f2..e41de5e35e84b549919bd9906ec6496fa3fd23de 100644 (file)
@@ -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);