14#ifndef PNMFILETYPETGA_H
15#define PNMFILETYPETGA_H
33class EXPCL_PANDA_PNMIMAGETYPES PNMFileTypeTGA :
public PNMFileType {
37 virtual std::string get_name()
const;
43 virtual PNMReader *
make_reader(std::istream *file,
bool owns_file =
true,
44 const std::string &magic_number = std::string());
45 virtual PNMWriter *
make_writer(std::ostream *file,
bool owns_file =
true);
48 class Reader :
public PNMReader {
50 Reader(PNMFileType *type, std::istream *file,
bool owns_file, std::string magic_number);
53 virtual int read_data(xel *array, xelval *alpha);
56 void readtga ( std::istream* ifp,
struct ImageHeader* tgaP,
const std::string &magic_number );
57 void get_map_entry ( std::istream* ifp, pixel* Value,
int Size,
59 void get_pixel ( std::istream* ifp, pixel* dest,
int Size, gray* alpha_p);
60 unsigned char getbyte ( std::istream* ifp );
62 int rows, cols, rlencoded, mapped;
63 struct ImageHeader *tga_head;
66 int RLE_count, RLE_flag;
73 class Writer :
public PNMWriter {
75 Writer(PNMFileType *type, std::ostream *file,
bool owns_file);
78 virtual int write_data(xel *array, xelval *alpha);
81 void writetga (
struct ImageHeader* tgaP,
char*
id );
82 void put_map_entry ( pixel* valueP,
int size, pixval maxval );
83 void compute_runlengths (
int cols, pixel* pixelrow,
int* runlength );
84 void put_pixel ( pixel* pP,
int imgtype, pixval maxval, colorhash_table cht );
85 void put_mono ( pixel* pP, pixval maxval );
86 void put_map ( pixel* pP, colorhash_table cht );
87 void put_rgb ( pixel* pP, pixval maxval );
91 struct ImageHeader *tgaHeader;
101 static void register_with_read_factory();
104 static TypedWritable *make_PNMFileTypeTGA(
const FactoryParams ¶ms);
107 static TypeHandle get_class_type() {
110 static void init_type() {
111 PNMFileType::init_type();
113 PNMFileType::get_class_type());
115 virtual TypeHandle get_type()
const {
116 return get_class_type();
118 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
121 static TypeHandle _type_handle;
This is the base class of a family of classes that represent particular image file types that PNMImag...
get_suggested_extension
Returns a suitable filename extension (without a leading dot) to suggest for files of this type,...
virtual PNMReader * make_reader(std::istream *file, bool owns_file=true, const std::string &magic_number=std::string())
Allocates and returns a new PNMReader suitable for reading from this file type, if possible.
get_num_extensions
Returns the number of different possible filename extensions associated with this particular file typ...
virtual PNMWriter * make_writer(std::ostream *file, bool owns_file=true)
Allocates and returns a new PNMWriter suitable for reading from this file type, if possible.
get_extension
Returns the nth possible filename extension associated with this particular file type,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...