Panda3D

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
SourceTextureImage Class Reference

This is a texture image reference as it appears in an egg file: the source image of the texture. More...

`#include "sourceTextureImage.h"`

Inheritance diagram for SourceTextureImage:

## Public Member Functions
| SourceTextureImage (TextureImage *texture, const Filename &filename, const Filename &alpha_filename, int alpha_file_channel)
virtual int | complete_pointers (TypedWritable **p_list, BamReader *manager)
| Called after the object is otherwise completely read from a Bam file, this function's job is to store the pointers that were retrieved from the Bam file for each pointer object written.
int | get_egg_count () const
| Returns the number of egg files that share this SourceTextureImage.
bool | get_size ()
| Determines the size of the SourceTextureImage, if it is not already known.
TextureImage * | get_texture () const
| Returns the particular texture that this image is one of the sources for.
virtual TypeHandle | get_type () const
void | increment_egg_count ()
| Increments by one the number of egg files that are known to reference this SourceTextureImage.
bool | read_header ()
| Reads the actual image header to determine the image properties, like its size.
void | set_header (const PNMImageHeader &header)
| Sets the header information associated with this image, as if it were loaded from the disk.
virtual void | write_datagram (BamWriter *writer, Datagram &datagram)
| Fills the indicated datagram up with a binary representation of the current object, in preparation for writing to a Bam file.
Public Member Functions inherited from ImageFile
void | clear_basic_properties ()
| Resets the properties to a neutral state, for instance in preparation for calling update_properties() with all the known contributing properties.
bool | exists () const
| Returns true if the file or files named by the image file exist, false otherwise.
int | get_alpha_file_channel () const
| Returns the particular channel number of the alpha image file from which the alpha channel should be extracted.
const Filename & | get_alpha_filename () const
| Returns the alpha filename of the image file.
const Filename & | get_filename () const
| Returns the primary filename of the image file.
int | get_num_channels () const
| Returns the number of channels of the image.
const TextureProperties & | get_properties () const
| Returns the grouping properties of the image.
int | get_x_size () const
| Returns the size of the image file in pixels in the X direction.
int | get_y_size () const
| Returns the size of the image file in pixels in the Y direction.
bool | has_num_channels () const
| Returns true if the number of channels in the image is known, false otherwise.
bool | is_size_known () const
| Returns true if the size of the image file is known, false otherwise.
bool | make_shadow_image (const std::string &basename)
| Sets up the ImageFile as a "shadow image" of a particular PaletteImage.
void | output_filename (std::ostream &out) const
| Writes the filename (or pair of filenames) to the indicated output stream.
bool | read (PNMImage &image) const
| Reads in the image (or images, if the alpha_filename is separate) and stores it in the indicated PNMImage.
bool | set_filename (const std::string &dirname, const std::string &basename)
| Sets the filename, and if applicable, the alpha_filename, from the indicated basename.
bool | set_filename (PaletteGroup *group, const std::string &basename)
| Sets the filename, and if applicable, the alpha_filename, from the indicated basename.
void | unlink ()
| Deletes the image file or files.
void | update_egg_tex (EggTexture *egg_tex) const
| Sets the indicated EggTexture to refer to this file.
void | update_properties (const TextureProperties &properties)
| If the indicate TextureProperties structure is more specific than this one, updates this one.
bool | write (const PNMImage &image) const
| Writes out the image in the indicated PNMImage to the _filename and/or _alpha_filename.
Public Member Functions inherited from TypedWritable
| TypedWritable (const TypedWritable &copy)
virtual ReferenceCount * | as_reference_count ()
| Returns the pointer cast to a ReferenceCount pointer, if it is in fact of that type.
vector_uchar | encode_to_bam_stream () const
| Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a bytes object.
bool | encode_to_bam_stream (vector_uchar &data, BamWriter *writer=nullptr) const
| Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.
virtual void | finalize (BamReader *manager)
| Called by the BamReader to perform any final actions needed for setting up the object after all objects have been read and all pointers have been completed.
virtual TypeHandle | force_init_type ()
UpdateSeq | get_bam_modified () const
| Returns the current bam_modified counter.
void | mark_bam_modified ()
| Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams.
void | operator= (const TypedWritable &copy)
virtual bool | require_fully_complete () const
| Some objects require all of their nested pointers to have been completed before the objects themselves can be completed.
virtual void | update_bam_nested (BamWriter *manager)
| Called by the BamWriter when this object has not itself been modified recently, but it should check its nested objects for updates.
Public Member Functions inherited from TypedObject
| TypedObject (const TypedObject &copy)=default
TypedObject * | as_typed_object ()
| Returns the object, upcast (if necessary) to a TypedObject pointer.
const TypedObject * | as_typed_object () const
| Returns the object, upcast (if necessary) to a TypedObject pointer.
int | get_best_parent_from_Set (const std::set< int > &) const
int | get_type_index () const
| Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.
bool | is_exact_type (TypeHandle handle) const
| Returns true if the current object is the indicated type exactly.
bool | is_of_type (TypeHandle handle) const
| Returns true if the current object is or derives from the indicated type.
TypedObject & | operator= (const TypedObject &copy)=default
Public Member Functions inherited from MemoryBase
void | operator delete (void *, void *)
void | operator delete (void *ptr)
void | operator delete[] (void *, void *)
void | operator delete[] (void *ptr)
void * | operator new (size_t size)
void * | operator new (size_t size, void *ptr)
void * | operator new[] (size_t size)
void * | operator new[] (size_t size, void *ptr)

## Static Public Member Functions
static TypeHandle | get_class_type ()
static void | init_type ()
static void | register_with_read_factory ()
| Registers the current object as something that can be read from a Bam file.
Static Public Member Functions inherited from ImageFile
static TypeHandle | get_class_type ()
static void | init_type ()
Static Public Member Functions inherited from TypedWritable
static bool | decode_raw_from_bam_stream (TypedWritable *&ptr, ReferenceCount *&ref_ptr, vector_uchar data, BamReader *reader=nullptr)
| Reads the bytes created by a previous call to encode_to_bam_stream(), and extracts the single object on those bytes.
static TypeHandle | get_class_type ()
static void | init_type ()
Static Public Member Functions inherited from TypedObject
static TypeHandle | get_class_type ()
static void | init_type ()
| This function is declared non-inline to work around a compiler bug in g++ 2.96.

## Additional Inherited Members
Public Attributes inherited from TypedObject
| get_type
Static Public Attributes inherited from TypedWritable
static TypedWritable *const | Null = nullptr

## Detailed Description

This is a texture image reference as it appears in an egg file: the source image of the texture.

Definition at line 28 of file sourceTextureImage.h.

## Constructor & Destructor Documentation

## ◆ SourceTextureImage()

SourceTextureImage::SourceTextureImage | ( | TextureImage * | texture,
|  | const Filename & | filename,
|  | const Filename & | alpha_filename,
|  | int | alpha_file_channel )

Definition at line 41 of file sourceTextureImage.cxx.

## Member Function Documentation

## ◆ complete_pointers()

int SourceTextureImage::complete_pointers | ( | TypedWritable ** | p_list,
|  | BamReader * | manager )
| virtual

Called after the object is otherwise completely read from a Bam file, this function's job is to store the pointers that were retrieved from the Bam file for each pointer object written.

The return value is the number of pointers processed from the list.

Reimplemented from ImageFile.

Definition at line 177 of file sourceTextureImage.cxx.

References ImageFile::complete_pointers().

## ◆ get_class_type()

static TypeHandle SourceTextureImage::get_class_type | ( |  | ) |
| inline static

Definition at line 63 of file sourceTextureImage.h.

## ◆ get_egg_count()

int SourceTextureImage::get_egg_count | ( |  | ) | const

Returns the number of egg files that share this SourceTextureImage.

Definition at line 74 of file sourceTextureImage.cxx.

Referenced by TextureImage::get_preferred_source(), and TextureImage::write_source_pathnames().

## ◆ get_size()

bool SourceTextureImage::get_size | ( |  | ) |

Determines the size of the SourceTextureImage, if it is not already known.

Returns true if the size was successfully determined (or if was already known), or false if the size could not be determined (for instance, because the image file is missing). After this call returns true, get_x_size() etc. may be safely called to return the size.

Definition at line 86 of file sourceTextureImage.cxx.

References read_header().

Referenced by TextureImage::get_preferred_source(), TxaLine::match_texture(), and TextureImage::post_txa_file().

## ◆ get_texture()

TextureImage * SourceTextureImage::get_texture | ( |  | ) | const

Returns the particular texture that this image is one of the sources for.

Definition at line 57 of file sourceTextureImage.cxx.

## ◆ get_type()

virtual TypeHandle SourceTextureImage::get_type | ( |  | ) | const
| inline virtual

Reimplemented from ImageFile.

Definition at line 71 of file sourceTextureImage.h.

## ◆ increment_egg_count()

void SourceTextureImage::increment_egg_count | ( |  | ) |

Increments by one the number of egg files that are known to reference this SourceTextureImage.

Definition at line 66 of file sourceTextureImage.cxx.

## ◆ init_type()

static void SourceTextureImage::init_type | ( |  | ) |
| inline static

Definition at line 66 of file sourceTextureImage.h.

## ◆ read_header()

bool SourceTextureImage::read_header | ( |  | ) |

Reads the actual image header to determine the image properties, like its size.

Returns true if the image header is successfully read (or if has previously been successfully read this session), false otherwise. After this call returns true, get_x_size() etc. may be safely called to return the newly determined size.

Definition at line 101 of file sourceTextureImage.cxx.

References FilenameUnifier::make_user_filename(), PNMImageHeader::read_header(), and set_header().

Referenced by get_size(), and TextureImage::read_header().

## ◆ register_with_read_factory()

void SourceTextureImage::register_with_read_factory | ( |  | ) |
| static

Registers the current object as something that can be read from a Bam file.

Definition at line 149 of file sourceTextureImage.cxx.

References BamReader::get_factory().

Referenced by init_palettizer().

## ◆ set_header()

void SourceTextureImage::set_header | ( | const PNMImageHeader & | header | ) |

Sets the header information associated with this image, as if it were loaded from the disk.

Definition at line 126 of file sourceTextureImage.cxx.

References PNMImageHeader::get_num_channels, PNMImageHeader::get_x_size(), and PNMImageHeader::get_y_size().

Referenced by PT(), and read_header().

## ◆ write_datagram()

void SourceTextureImage::write_datagram | ( | BamWriter * | writer,
|  | Datagram & | datagram )
| virtual

Fills the indicated datagram up with a binary representation of the current object, in preparation for writing to a Bam file.

Reimplemented from ImageFile.

Definition at line 159 of file sourceTextureImage.cxx.

References ImageFile::write_datagram(), and BamWriter::write_pointer().

The documentation for this class was generated from the following files:

- pandatool/src/palettizer/sourceTextureImage.h
- pandatool/src/palettizer/sourceTextureImage.cxx