14#ifndef PNMFILETYPESGI_H
15#define PNMFILETYPESGI_H
28class EXPCL_PANDA_PNMIMAGETYPES PNMFileTypeSGI :
public PNMFileType {
32 virtual std::string get_name()
const;
41 virtual PNMReader *
make_reader(std::istream *file,
bool owns_file =
true,
42 const std::string &magic_number = std::string());
43 virtual PNMWriter *
make_writer(std::ostream *file,
bool owns_file =
true);
46 class Reader :
public PNMReader {
48 Reader(PNMFileType *type, std::istream *file,
bool owns_file, std::string magic_number);
51 virtual bool supports_read_row()
const;
52 virtual bool read_row(xel *array, xelval *alpha,
int x_size,
int y_size);
66 class Writer :
public PNMWriter {
68 Writer(PNMFileType *type, std::ostream *file,
bool owns_file);
71 virtual bool supports_write_row()
const;
72 virtual bool write_header();
73 virtual bool write_row(xel *array, xelval *alpha);
80 typedef short ScanElem;
87 TabEntry &Table(
int chan) {
88 return table[chan * _y_size + current_row];
91 void write_rgb_header(
const char *imagename);
93 void write_channels(ScanLine channel[],
void (*put)(std::ostream *,
short));
94 void build_scanline(ScanLine output[], xel *row_data, xelval *alpha_data);
95 ScanElem *compress(ScanElem *temp, ScanLine &output);
96 int rle_compress(ScanElem *inbuf,
int size);
111 static void register_with_read_factory();
114 static TypedWritable *make_PNMFileTypeSGI(
const FactoryParams ¶ms);
117 static TypeHandle get_class_type() {
120 static void init_type() {
121 PNMFileType::init_type();
123 PNMFileType::get_class_type());
125 virtual TypeHandle get_type()
const {
126 return get_class_type();
128 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
131 static TypeHandle _type_handle;
This is the base class of a family of classes that represent particular image file types that PNMImag...
virtual bool has_magic_number() const
Returns true if this particular file type uses a magic number to identify it, false otherwise.
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,...
virtual bool matches_magic_number(const std::string &magic_number) const
Returns true if the indicated "magic number" byte stream (the initial few bytes read from the file) m...
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(),...