14#ifndef PNMFILETYPETGA_H
15#define PNMFILETYPETGA_H
33class EXPCL_PANDA_PNMIMAGETYPES PNMFileTypeTGA :
public PNMFileType {
37 virtual std::string get_name()
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();}
An instance of this class is passed to the Factory when requesting it to do its business and construc...
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,...
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.
Base class for objects that can be written to and read from Bam files.
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(),...