14 #ifndef PNMFILETYPETGA_H 15 #define PNMFILETYPETGA_H 33 class EXPCL_PANDA_PNMIMAGETYPES PNMFileTypeTGA :
public PNMFileType {
37 virtual std::string get_name()
const;
39 virtual int get_num_extensions()
const;
41 virtual std::string get_suggested_extension()
const;
44 const std::string &magic_number = std::string());
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;
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 );
85 void put_mono (
pixel* pP, pixval maxval );
87 void put_rgb (
pixel* pP, pixval maxval );
91 struct ImageHeader *tgaHeader;
101 static void register_with_read_factory();
110 static void init_type() {
111 PNMFileType::init_type();
113 PNMFileType::get_class_type());
116 return get_class_type();
118 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
Base class for objects that can be written to and read from Bam files.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the base class of a family of classes that represent particular image file types that PNMImag...
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.
get_extension
Returns the nth possible filename extension associated with this particular file type,...
This is an abstract base class that defines the interface for writing image files of various types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.