libcvd-members
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libcvd-members] libcvd/cvd/internal/io png.h


From: Edward Rosten
Subject: [libcvd-members] libcvd/cvd/internal/io png.h
Date: Fri, 29 Sep 2006 22:12:19 +0000

CVSROOT:        /cvsroot/libcvd
Module name:    libcvd
Changes by:     Edward Rosten <edrosten>        06/09/29 22:12:19

Modified files:
        cvd/internal/io: png.h 

Log message:
        Fix PNG loading for non specialized types.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/libcvd/cvd/internal/io/png.h?cvsroot=libcvd&r1=1.2&r2=1.3

Patches:
Index: png.h
===================================================================
RCS file: /cvsroot/libcvd/libcvd/cvd/internal/io/png.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- png.h       29 Sep 2006 21:40:28 -0000      1.2
+++ png.h       29 Sep 2006 22:12:19 -0000      1.3
@@ -341,15 +341,15 @@
 //
 
 template<int Components, bool use_16bit> struct PNGType;
-template<> struct PNGType<1,0>{ typedef byte type; typedef enum { Colour = 
png_out::Grey, Depth=8} col;};
-template<> struct PNGType<1,1>{ typedef unsigned short type; typedef enum { 
Colour = png_out::Grey, Depth=16} col;};
-template<> struct PNGType<3,0>{ typedef Rgb<byte> type; typedef enum { Colour 
= png_out::Rgb, Depth=8} col;};
-template<> struct PNGType<3,1>{ typedef Rgb<unsigned short> type; typedef enum 
{ Colour = png_out::Rgb, Depth=16} col;};
-template<> struct PNGType<4,0>{ typedef Rgba<byte> type; typedef enum { Colour 
= png_out::RgbAlpha, Depth=8} col;};
-template<> struct PNGType<4,1>{ typedef Rgba<unsigned short> type; typedef 
enum { Colour = png_out::RgbAlpha, Depth=16} col;};
+template<> struct PNGType<1,0>{ typedef byte type; static const 
png_out::colour_type Colour = png_out::Grey; static const int Depth=8;};
+template<> struct PNGType<1,1>{ typedef unsigned short type; static const 
png_out::colour_type Colour = png_out::Grey; static const int Depth=16;};
+template<> struct PNGType<3,0>{ typedef Rgb<byte> type; static const 
png_out::colour_type Colour = png_out::Rgb; static const int Depth=8;};
+template<> struct PNGType<3,1>{ typedef Rgb<unsigned short> type; static const 
png_out::colour_type Colour = png_out::Rgb; static const int Depth=16;};
+template<> struct PNGType<4,0>{ typedef Rgba<byte> type; static const 
png_out::colour_type Colour = png_out::RgbAlpha; static const int Depth=8;};
+template<> struct PNGType<4,1>{ typedef Rgba<unsigned short> type; static 
const png_out::colour_type Colour = png_out::RgbAlpha; static const int 
Depth=16;};
 
 
-template<class T> class PNGWriter
+template<class T> struct PNGWriter
 {
        static void write(const SubImage<T>& i, std::ostream& o)
        {
@@ -358,7 +358,7 @@
                typedef typename PNGInfo::type Out;
                typedef typename Pixel::Component<Out>::type Comp;
                
-               png_out po(i.size().x, i.size().y, PNGInfo::Colour, 
PNGInfo::Depth, o);
+               png_out po(i.size().x, i.size().y, 
(png_out::colour_type)PNGInfo::Colour, PNGInfo::Depth, o);
                std::vector<Out> row_buf(i.size().x);
                std::vector<const Comp*> rows;
                rows.push_back(reinterpret_cast<const Comp*>(&row_buf[0]));




reply via email to

[Prev in Thread] Current Thread [Next in Thread]