]> git.imager.perl.org - imager.git/commitdiff
added double/sample image support
authorTony Cook <tony@develop=help.com>
Sun, 7 Oct 2001 22:46:49 +0000 (22:46 +0000)
committerTony Cook <tony@develop=help.com>
Sun, 7 Oct 2001 22:46:49 +0000 (22:46 +0000)
Changes
Imager.pm
Imager.xs
MANIFEST
Makefile.PL
datatypes.h
image.h
img16.c
t/t021sixteen.t

diff --git a/Changes b/Changes
index 68ecdc248060690a0d134f7b04b3a71944366f67..420acd9bf7ef5b88806fdaeded9ce15cc109963d 100644 (file)
--- a/Changes
+++ b/Changes
@@ -522,6 +522,7 @@ Revision history for Perl extension Imager.
           arial.ttf at 14pixels)
         - Added tga.c to read targa images
         - Added i_bumpmap_complex to do more accurate bumpmapping
+        - added an image type with doubles as samples
 
 =================================================================
 
index 3ba16cf6cd812e73f985bc31150c48daa92d3376..a6231c718146e7999e6815b17af2b337b589c393 100644 (file)
--- a/Imager.pm
+++ b/Imager.pm
@@ -562,6 +562,9 @@ sub img_set {
     $self->{IMG} = i_img_pal_new($hsh{xsize}, $hsh{ysize}, $hsh{channels},
                                  $hsh{maxcolors} || 256);
   }
+  elsif ($hsh{bits} eq 'double') {
+    $self->{IMG} = i_img_double_new($hsh{xsize}, $hsh{ysize}, $hsh{channels});
+  }
   elsif ($hsh{bits} == 16) {
     $self->{IMG} = i_img_16_new($hsh{xsize}, $hsh{ysize}, $hsh{channels});
   }
@@ -2237,15 +2240,22 @@ Warning: if you draw on a paletted image with colors that aren't in
 the palette, the image will be internally converted to a normal image.
 
 For improved color precision you can use the bits parameter to specify
-16 bites per channel:
+16 bit per channel:
 
   $img = Imager->new(xsize=>200, ysize=>200, channels=>3, bits=>16);
 
-Note that as of this writing all functions should work on 16-bit
-images, but at only 8-bit/channel precision.
+or for even more precision:
+
+  $img = Imager->new(xsize=>200, ysize=>200, channels=>3, bits=>'double');
+
+to get an image that uses a double for each channel.
+
+Note that as of this writing all functions should work on images with
+more than 8-bits/channel, but many will only work at only
+8-bit/channel precision.
 
-Currently only 8 and 16/bit per channel image types are available,
-this may change later.
+Currently only 8-bit, 16-bit, and double per channel image types are
+available, this may change later.
 
 Color objects are created by calling the Imager::Color->new()
 method:
index 17683fc5bc86289ca4d563221c32eab7ebe0acce..b8fe938402ebcd86b732b07402eb73e496b15a13 100644 (file)
--- a/Imager.xs
+++ b/Imager.xs
@@ -2788,6 +2788,12 @@ i_img_16_new(x, y, ch)
         int y
         int ch
 
+Imager::ImgRaw
+i_img_double_new(x, y, ch)
+        int x
+        int y
+        int ch
+
 undef_int
 i_tags_addn(im, name, code, idata)
         Imager::ImgRaw im
index f4d7804d2ed4a5f97d489745113c9014a236a9fd..c9183a2b1da1cb4237ed0e3ee399ed8a33d479e5 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -23,6 +23,7 @@ datatypes.h
 datatypes.c
 feat.h
 img16.c
+imgdouble.c     Implements double/sample images
 io.c
 io.h
 log.c
@@ -72,6 +73,7 @@ t/t00basic.t
 t/t01introvert.t
 t/t020masked.t
 t/t021sixteen.t
+t/t022double.t          Test double/sample images
 t/t05error.t
 t/t101jpeg.t
 t/t102png.t
index b4d2817c9beb23611c5e9004c8563b2e5c3bf2f1..84e9611b3c8250fb43d3562abf6fd0d5c2a20bbb 100644 (file)
@@ -63,7 +63,7 @@ if (defined $Config{'d_dlsymun'}) { $OSDEF  .= ' -DDLSYMUN'; }
           filters.o dynaload.o stackmach.o datatypes.o
           regmach.o trans2.o quant.o error.o convert.o
           map.o tags.o palimg.o maskimg.o img16.o rotate.o
-           bmp.o tga.o color.o fills.o);
+           bmp.o tga.o color.o fills.o imgdouble.o);
 
 %opts=(
        'NAME'         => 'Imager',
index 78f6398f40abd467631b89c52b4a8421505ceedf..13bdbe82ca33dfcdaa7138bc527b1034d4410b3f 100644 (file)
@@ -57,7 +57,7 @@ typedef enum {
   /* a paletted image might have one bit per sample */
   i_8_bits = 8,
   i_16_bits = 16,
-  i_double_bits = 64
+  i_double_bits = sizeof(double) * 8,
 } i_img_bits_t;
 
 typedef struct {
diff --git a/image.h b/image.h
index b9a6fa4ccc3864f007c8244d62c197d28dcf588a..11d83e758af656c5532a1c2c5ec673b089f82ed7 100644 (file)
--- a/image.h
+++ b/image.h
@@ -511,6 +511,8 @@ extern i_img *i_img_masked_new(i_img *targ, i_img *mask, int x, int y,
                                int w, int h);
 extern i_img *i_img_16_new(int x, int y, int ch);
 extern i_img *i_img_16_new_low(i_img *im, int x, int y, int ch);
+extern i_img *i_img_double_new(int x, int y, int ch);
+extern i_img *i_img_double_new_low(i_img *im, int x, int y, int ch);
 
 #ifdef HAVE_LIBJPEG
 i_img *   
diff --git a/img16.c b/img16.c
index 3d8f2c5d342d1e5b99854d026899b4c056630f1b..3d02b1e91544b4353183bffeb8f62f1803ca7aa3 100644 (file)
--- a/img16.c
+++ b/img16.c
@@ -135,6 +135,8 @@ typedef unsigned short i_sample16_t;
 =item i_img_16_new(int x, int y, int ch)
 
 Creates a new 16-bit per sample image.
+
+=cut
 */
 i_img *i_img_16_new_low(i_img *im, int x, int y, int ch) {
   mm_log((1,"i_img_16_new(x %d, y %d, ch %d)\n", x, y, ch));
index 09a8b5b946883c95e7f71c4977da1c196b069c7c..3f55b3fc873f44fbbe2eb7fe4448f5ff5add717c 100644 (file)
@@ -7,7 +7,7 @@ use Imager qw(:all :handy);
 #use Data::Dumper;
 $loaded = 1;
 print "ok 1\n";
-init_log("testout/t021sixteen.t", 1);
+init_log("testout/t021sixteen.log", 1);
 
 use Imager::Color::Float;