15 #ifndef PNMFILETYPETGA_H 16 #define PNMFILETYPETGA_H 18 #include "pandabase.h" 22 #include "pnmFileType.h" 23 #include "pnmReader.h" 24 #include "pnmWriter.h" 26 #include "pnmimage_base.h" 35 class EXPCL_PANDA_PNMIMAGETYPES PNMFileTypeTGA :
public PNMFileType {
39 virtual string get_name()
const;
46 const string &magic_number =
string());
52 Reader(
PNMFileType *type, istream *file,
bool owns_file,
string magic_number);
55 virtual int read_data(
xel *array, xelval *alpha);
58 void readtga ( istream* ifp,
struct ImageHeader* tgaP,
const string &magic_number );
59 void get_map_entry ( istream* ifp,
pixel* Value,
int Size,
61 void get_pixel ( istream* ifp,
pixel* dest,
int Size, gray* alpha_p);
62 unsigned char getbyte ( istream* ifp );
64 int rows, cols, rlencoded, mapped;
65 struct ImageHeader *tga_head;
68 int RLE_count, RLE_flag;
77 Writer(
PNMFileType *type, ostream *file,
bool owns_file);
80 virtual int write_data(
xel *array, xelval *alpha);
83 void writetga (
struct ImageHeader* tgaP,
char*
id );
84 void put_map_entry (
pixel* valueP,
int size, pixval maxval );
85 void compute_runlengths (
int cols,
pixel* pixelrow,
int* runlength );
87 void put_mono (
pixel* pP, pixval maxval );
89 void put_rgb (
pixel* pP, pixval maxval );
93 struct ImageHeader *tgaHeader;
103 static void register_with_read_factory();
112 static void init_type() {
113 PNMFileType::init_type();
114 register_type(_type_handle,
"PNMFileTypeTGA",
115 PNMFileType::get_class_type());
118 return get_class_type();
120 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
virtual string get_extension(int n) const
Returns the nth possible filename extension associated with this particular file type, without a leading dot.
virtual PNMWriter * make_writer(ostream *file, bool owns_file=true)
Allocates and returns a new PNMWriter suitable for reading from this file type, if possible...
Base class for objects that can be written to and read from Bam files.
This is the base class of a family of classes that represent particular image file types that PNMImag...
virtual PNMReader * make_reader(istream *file, bool owns_file=true, const string &magic_number=string())
Allocates and returns a new PNMReader suitable for reading from this file type, if possible...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
This is an abstract base class that defines the interface for reading image files of various types...
This is an abstract base class that defines the interface for writing image files of various types...
TypeHandle is the identifier used to differentiate C++ class types.
virtual int get_num_extensions() const
Returns the number of different possible filename extensions associated with this particular file typ...
virtual string get_suggested_extension() const
Returns a suitable filename extension (without a leading dot) to suggest for files of this type...