[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libcvd-members] libcvd cvd/internal/load_and_save.h cvd/interna...
From: |
Edward Rosten |
Subject: |
[libcvd-members] libcvd cvd/internal/load_and_save.h cvd/interna... |
Date: |
Sat, 02 Aug 2008 00:17:21 +0000 |
CVSROOT: /cvsroot/libcvd
Module name: libcvd
Changes by: Edward Rosten <edrosten> 08/08/02 00:17:20
Modified files:
cvd/internal : load_and_save.h
cvd/internal/io: tiff.h
pnm_src : tiff.cxx
Log message:
Added bool support to TIFF.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/internal/load_and_save.h?cvsroot=libcvd&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/internal/io/tiff.h?cvsroot=libcvd&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/libcvd/pnm_src/tiff.cxx?cvsroot=libcvd&r1=1.8&r2=1.9
Patches:
Index: cvd/internal/load_and_save.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/internal/load_and_save.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- cvd/internal/load_and_save.h 2 Aug 2008 00:06:03 -0000 1.8
+++ cvd/internal/load_and_save.h 2 Aug 2008 00:17:19 -0000 1.9
@@ -21,7 +21,7 @@
#ifndef CVD_LOAD_AND_SAVE_H
#define CVD_LOAD_AND_SAVE_H
-#include <vector>
+#include <cvd/internal/simple_vector.h>
#include <cvd/exceptions.h>
#include <cvd/image_convert.h>
@@ -163,6 +163,7 @@
};
+
////////////////////////////////////////////////////////////////////////////////
//
// Read data and process if necessary.
@@ -172,7 +173,7 @@
{
static void exec(BasicImage<PixelType>& im,
ImageLoader& r)
{
- std::vector<DiskPixelType> rowbuf(r.size().x);
+ simple_vector<DiskPixelType> rowbuf(r.size().x);
for(int row = 0; row < r.size().y; row++)
{
Index: cvd/internal/io/tiff.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/internal/io/tiff.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- cvd/internal/io/tiff.h 2 Aug 2008 00:06:03 -0000 1.4
+++ cvd/internal/io/tiff.h 2 Aug 2008 00:17:20 -0000 1.5
@@ -46,6 +46,7 @@
ImageRef size();
+ void get_raw_pixel_lines(bool*, unsigned long nlines);
void get_raw_pixel_lines(unsigned char*, unsigned long
nlines);
void get_raw_pixel_lines(unsigned short*, unsigned long
nlines);
void get_raw_pixel_lines(float*, unsigned long nlines);
@@ -65,7 +66,8 @@
std::string name();
- typedef TypeList<byte,
+ typedef TypeList<bool,
+ TypeList<byte,
TypeList<unsigned short,
TypeList<float,
TypeList<double,
@@ -77,7 +79,7 @@
TypeList<Rgba<unsigned short>,
TypeList<Rgba<float>,
TypeList<Rgba<double>,
- Head> > > > > > >
> > > > > Types;
+ Head> > > > > > >
> > > > > > Types;
private:
TIFFPimpl* t;
Index: pnm_src/tiff.cxx
===================================================================
RCS file: /cvsroot/libcvd/libcvd/pnm_src/tiff.cxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- pnm_src/tiff.cxx 2 Aug 2008 00:06:03 -0000 1.8
+++ pnm_src/tiff.cxx 2 Aug 2008 00:17:20 -0000 1.9
@@ -135,6 +135,7 @@
}
void attempt_invert(...) {}
+void attempt_invert(bool* data, long num) { invert(data, num);}
void attempt_invert(unsigned char* data, long num) { invert(data, num);}
void attempt_invert(unsigned short* data, long num) { invert(data, num);}
void attempt_invert(float* data, long num) { invert(data, num);}
@@ -255,7 +256,9 @@
//Figure out the basic datatype
if(sampleformat == SAMPLEFORMAT_UINT)
{
- if(bitspersample == 8)
+ if(bitspersample == 1)
+ type = PNM::type_name<bool>::name();
+ else if(bitspersample == 8)
type = PNM::type_name<unsigned char>::name();
else if(bitspersample == 16)
type = PNM::type_name<unsigned short>::name();
@@ -361,12 +364,11 @@
};
//Mechanically generate the pixel reading calls.
-#define GENF(X)\
-void tiff_reader::get_raw_pixel_lines(X*d, unsigned long
n){t->get_raw_pixel_lines(d, n);}\
-void tiff_reader::get_raw_pixel_lines(Rgb<X>*d, unsigned long
n){t->get_raw_pixel_lines(d, n);}\
-void tiff_reader::get_raw_pixel_lines(Rgba<X>*d, unsigned long
n){t->get_raw_pixel_lines(d, n);}
-
-GENF(unsigned char)
-GENF(unsigned short)
-GENF(float)
-GENF(double)
+#define GEN1(X) void tiff_reader::get_raw_pixel_lines(X*d, unsigned long
n){t->get_raw_pixel_lines(d, n);}
+#define GEN3(X) GEN1(X) GEN1(Rgb<X>) GEN1(Rgba<X>)
+
+GEN1(bool)
+GEN3(unsigned char)
+GEN3(unsigned short)
+GEN3(float)
+GEN3(double)