Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

TextureImage Class Reference

This represents a single source texture that is referenced by one or more egg files. More...

#include <textureImage.h>

Inheritance diagram for TextureImage:

ImageFile Namable TypedWritable TypedObject List of all members.

Public Member Functions

 TextureImage ()
void note_egg_file (EggFile *egg_file)
 Records that a particular egg file references this texture.

void assign_groups ()
 Assigns the texture to all of the PaletteGroups the various egg files that use it need.

const PaletteGroupsget_groups () const
 Once assign_groups() has been called, this returns the actual set of groups the TextureImage has been assigned to.

TexturePlacementget_placement (PaletteGroup *group) const
 Gets the TexturePlacement object which represents the assignment of this texture to the indicated group.

void force_replace ()
 Removes the texture from any PaletteImages it is assigned to, but does not remove it from the groups.

void mark_eggs_stale ()
 Marks all the egg files that reference this texture stale.

void pre_txa_file ()
 Updates any internal state prior to reading the .txa file.

void post_txa_file ()
 Once the .txa file has been read and the TextureImage matched against it, considers applying the requested size change.

bool got_txa_file () const
 Returns true if this TextureImage has been looked up in the .txa file this session, false otherwise.

void determine_placement_size ()
 Calls determine_size() on each TexturePlacement for the texture, to ensure that each TexturePlacement is still requesting the best possible size for the texture.

bool get_omit () const
 Returns true if the user specifically requested to omit this texture via the "omit" keyword in the .txa file, or false otherwise.

double get_coverage_threshold () const
 Returns the appropriate coverage threshold for this texture.

int get_margin () const
 Returns the appropriate margin for this texture.

bool is_surprise () const
 Returns true if this particular texture is a 'surprise', i.e.

bool is_used () const
 Returns true if this particular texture has been placed somewhere, anywhere, or false if it is not used.

EggRenderMode::AlphaMode get_alpha_mode () const
 Returns the alpha mode that should be used to render objects with this texture, as specified by the user or as determined from examining the texture's alpha channel.

SourceTextureImageget_source (const Filename &filename, const Filename &alpha_filename, int alpha_file_channel)
 Returns the SourceTextureImage corresponding to the given filename(s).

SourceTextureImageget_preferred_source ()
 Determines the preferred source image for examining size and reading pixels, etc.

void clear_source_basic_properties ()
 Calls clear_basic_properties() on each source texture image used by this texture, to reset the properties in preparation for re-applying them from the set of all known egg files.

void copy_unplaced (bool redo_all)
 Copies the texture to whichever destination directories are appropriate for the groups in which it has been unplaced.

const PNMImageread_source_image ()
 Reads in the original image, if it has not already been read, and returns it.

void read_header ()
 Causes the header part of the image to be reread, usually to confirm that its image properties (size, number of channels, etc.) haven't changed.

bool is_newer_than (const Filename &reference_filename)
 Returns true if the source image is newer than the indicated file, false otherwise.

void write_source_pathnames (ostream &out, int indent_level=0) const
 Writes the list of source pathnames that might contribute to this texture to the indicated output stream, one per line.

void write_scale_info (ostream &out, int indent_level=0)
 Writes the list of source pathnames that might contribute to this texture to the indicated output stream, one per line.

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.

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.

virtual TypeHandle get_type () const
void make_shadow_image (const string &basename)
 Sets up the ImageFile as a "shadow image" of a particular PaletteImage.

bool is_size_known () const
 Returns true if the size of the image file is known, false otherwise.

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.

int get_num_channels () const
 Returns the number of channels of the image.

const TexturePropertiesget_properties () const
 Returns the grouping properties of the image.

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.

void update_properties (const TextureProperties &properties)
 If the indicate TextureProperties structure is more specific than this one, updates this one.

void set_filename (PaletteGroup *group, const string &basename)
 Sets the filename, and if applicable, the alpha_filename, from the indicated basename.

void set_filename (const string &dirname, const string &basename)
 Sets the filename, and if applicable, the alpha_filename, from the indicated basename.

const Filenameget_filename () const
 Returns the primary filename of the image file.

const Filenameget_alpha_filename () const
 Returns the alpha filename of the image file.

int get_alpha_file_channel () const
 Returns the particular channel number of the alpha image file from which the alpha channel should be extracted.

bool exists () const
 Returns true if the file or files named by the image file exist, false otherwise.

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 write (const PNMImage &image) const
 Writes out the image in the indicated PNMImage to the _filename and/or _alpha_filename.

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 output_filename (ostream &out) const
 Writes the filename (or pair of filenames) to the indicated output stream.

virtual void finalize ()
virtual TypeHandle force_init_type (void)
int get_type_index () const
bool is_of_type (TypeHandle handle) const
bool is_exact_type (TypeHandle handle) const
void set_name (const string &name)
void clear_name ()
bool has_name () const
const string & get_name () const
void output (ostream &out) const

Static Public Member Functions

void register_with_read_factory ()
 Registers the current object as something that can be read from a Bam file.

TypeHandle get_class_type ()
void init_type ()

Static Public Attributes

TypedWritable *const Null

Protected Member Functions

void fillin (DatagramIterator &scan, BamReader *manager)
 Reads the binary data from the given datagram iterator, which was written by a previous call to write_datagram().


Static Protected Member Functions

TypedWritablemake_TextureImage (const FactoryParams &params)
 This method is called by the BamReader when an object of this type is encountered in a Bam file; it should allocate and return a new object with all the data read.


Protected Attributes

TextureProperties _properties
Filename _filename
Filename _alpha_filename
int _alpha_file_channel
bool _size_known
int _x_size
int _y_size
string _name

Private Types

typedef pset< EggFile * > EggFiles
typedef pvector< EggFile * > WorkingEggs
typedef pmap< string, SourceTextureImage * > Sources
typedef pmap< string, DestTextureImage * > Dests
typedef pmap< PaletteGroup *,
TexturePlacement * > 
Placement
enum  AlphaBits { AB_one = 0x01, AB_mid = 0x02, AB_zero = 0x04, AB_all = 0x07 }

Private Member Functions

void assign_to_groups (const PaletteGroups &groups)
 Assigns the texture to the indicated set of groups.

void consider_grayscale ()
 Examines the actual contents of the image to determine if it should maybe be considered a grayscale image (even though it has separate rgb components).

void consider_alpha ()
 Examines the actual contents of the image to determine what alpha properties it has.

void remove_old_dests (const Dests &a, const Dests &b)
 Removes all of the filenames named in b that are not also named in a.

void copy_new_dests (const Dests &a, const Dests &b)
 Copies a resized texture into each filename named in a that is not also listed in b, or whose corresponding listing in b is out of date.

string get_source_key (const Filename &filename, const Filename &alpha_filename, int alpha_file_channel)
 Returns the key that a SourceTextureImage should be stored in, given its one or two filenames.


Static Private Member Functions

int compute_egg_count (PaletteGroup *group, const WorkingEggs &egg_files)
 Counts the number of egg files in the indicated set that will be satisfied if a texture is assigned to the indicated group.


Private Attributes

TextureRequest _request
TextureProperties _pre_txa_properties
EggRenderMode::AlphaMode _pre_txa_alpha_mode
SourceTextureImage_preferred_source
bool _is_surprise
bool _ever_read_image
bool _forced_grayscale
int _alpha_bits
EggRenderMode::AlphaMode _alpha_mode
PaletteGroups _explicitly_assigned_groups
PaletteGroups _actual_assigned_groups
EggFiles _egg_files
Placement _placement
Sources _sources
Dests _dests
bool _read_source_image
PNMImage _source_image
bool _got_txa_file
int _num_placement
int _num_sources
int _num_dests

Static Private Attributes

TypeHandle _type_handle

Friends

class TxaLine

Detailed Description

This represents a single source texture that is referenced by one or more egg files.

It may be assigned to multiple PaletteGroups, and thus placed on multiple PaletteImages (up to one per PaletteGroup).

Since a TextureImage may be referenced by multiple egg files that are each assigned to a different set of groups, it tries to maximize sharing between egg files and minimize the number of different PaletteGroups it is assigned to.

Definition at line 71 of file textureImage.h.


Member Typedef Documentation

typedef pmap<string, DestTextureImage *> TextureImage::Dests [private]
 

Definition at line 115 of file textureImage.h.

typedef pset<EggFile *> TextureImage::EggFiles [private]
 

Definition at line 112 of file textureImage.h.

typedef pmap<PaletteGroup *, TexturePlacement *> TextureImage::Placement [private]
 

Definition at line 157 of file textureImage.h.

typedef pmap<string, SourceTextureImage *> TextureImage::Sources [private]
 

Definition at line 114 of file textureImage.h.

typedef pvector<EggFile *> TextureImage::WorkingEggs [private]
 

Definition at line 113 of file textureImage.h.


Member Enumeration Documentation

enum TextureImage::AlphaBits [private]
 

Enumeration values:
AB_one 
AB_mid 
AB_zero 
AB_all 

Definition at line 141 of file textureImage.h.


Constructor & Destructor Documentation

TextureImage::TextureImage  ) 
 

Definition at line 50 of file textureImage.cxx.

References _alpha_bits, _alpha_mode, _forced_grayscale, _got_txa_file, and EggRenderMode::AM_unspecified.


Member Function Documentation

void TextureImage::assign_groups  ) 
 

Assigns the texture to all of the PaletteGroups the various egg files that use it need.

Attempts to choose the minimum set of PaletteGroups that satisfies all of the egg files.

Definition at line 96 of file textureImage.cxx.

References _egg_files.

void TextureImage::assign_to_groups const PaletteGroups groups  )  [private]
 

Assigns the texture to the indicated set of groups.

If the texture was previously assigned to any of these groups, keeps the same TexturePlacement object for the assignment; at the same time, deletes any TexturePlacement objects that represent groups we are no longer assigned to.

Definition at line 1121 of file textureImage.cxx.

References _alpha_mode, and EggRenderMode::AM_dual.

Referenced by note_egg_file().

void ImageFile::clear_basic_properties  )  [inherited]
 

Resets the properties to a neutral state, for instance in preparation for calling update_properties() with all the known contributing properties.

Definition at line 187 of file imageFile.cxx.

void TextureImage::clear_source_basic_properties  ) 
 

Calls clear_basic_properties() on each source texture image used by this texture, to reset the properties in preparation for re-applying them from the set of all known egg files.

Definition at line 743 of file textureImage.cxx.

References _read_source_image, Filename::compare_timestamps(), ImageFile::get_filename(), get_preferred_source(), and NULL.

int TextureImage::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 1506 of file textureImage.cxx.

int TextureImage::compute_egg_count PaletteGroup group,
const WorkingEggs egg_files
[static, private]
 

Counts the number of egg files in the indicated set that will be satisfied if a texture is assigned to the indicated group.

Definition at line 1088 of file textureImage.cxx.

References _alpha_bits, and AB_mid.

void TextureImage::consider_alpha  )  [private]
 

Examines the actual contents of the image to determine what alpha properties it has.

Definition at line 1240 of file textureImage.cxx.

void TextureImage::consider_grayscale  )  [private]
 

Examines the actual contents of the image to determine if it should maybe be considered a grayscale image (even though it has separate rgb components).

Definition at line 1194 of file textureImage.cxx.

void TextureImage::copy_new_dests const Dests a,
const Dests b
[private]
 

Copies a resized texture into each filename named in a that is not also listed in b, or whose corresponding listing in b is out of date.

Definition at line 1363 of file textureImage.cxx.

Referenced by get_preferred_source().

void TextureImage::copy_unplaced bool  redo_all  ) 
 

Copies the texture to whichever destination directories are appropriate for the groups in which it has been unplaced.

Also removes the old filenames for previous sessions where it was unplaced, but is no longer.

If redo_all is true, this recopies the texture whether it needed to or not.

Definition at line 774 of file textureImage.cxx.

References TextureProperties::get_num_channels(), ImageFile::get_properties(), ImageFile::get_x_size(), ImageFile::get_y_size(), TextureProperties::has_num_channels(), indent(), ImageFile::is_size_known(), and ImageFile::output_filename().

void TextureImage::determine_placement_size  ) 
 

Calls determine_size() on each TexturePlacement for the texture, to ensure that each TexturePlacement is still requesting the best possible size for the texture.

Definition at line 469 of file textureImage.cxx.

References _is_surprise.

bool ImageFile::exists  )  const [inherited]
 

Returns true if the file or files named by the image file exist, false otherwise.

Definition at line 361 of file imageFile.cxx.

References ImageFile::_alpha_filename, TextureProperties::_alpha_type, TextureProperties::_color_type, ImageFile::_filename, ImageFile::_properties, Filename::empty(), Filename::exists(), PNMImage::get_maxval(), PNMImage::get_x_size(), PNMImage::get_y_size(), PNMImage::has_alpha(), Filename::make_dir(), FilenameUnifier::make_user_filename(), nassertr, nout, NULL, Filename::unlink(), PNMImage::write(), x, and y.

Referenced by is_used().

void TextureImage::fillin DatagramIterator scan,
BamReader manager
[protected]
 

Reads the binary data from the given datagram iterator, which was written by a previous call to write_datagram().

Reimplemented from ImageFile.

Definition at line 1585 of file textureImage.cxx.

void TextureImage::force_replace  ) 
 

Removes the texture from any PaletteImages it is assigned to, but does not remove it from the groups.

It will be re-placed within each group when PaletteGroup::place_all() is called.

Definition at line 261 of file textureImage.cxx.

References NULL.

int ImageFile::get_alpha_file_channel  )  const [inherited]
 

Returns the particular channel number of the alpha image file from which the alpha channel should be extracted.

This is normally 0 to represent the grayscale combination of r, g, and b; or it may be a 1-based channel number (for instance, 4 for the alpha channel of a 4-component image).

Definition at line 345 of file imageFile.cxx.

const Filename & ImageFile::get_alpha_filename  )  const [inherited]
 

Returns the alpha filename of the image file.

This is the name of the file that contains the alpha channel, if it is stored in a separate file, or the empty string if it is not.

Definition at line 322 of file imageFile.cxx.

EggRenderMode::AlphaMode TextureImage::get_alpha_mode void   )  const
 

Returns the alpha mode that should be used to render objects with this texture, as specified by the user or as determined from examining the texture's alpha channel.

Definition at line 591 of file textureImage.cxx.

TypeHandle TextureImage::get_class_type void   )  [inline, static]
 

Reimplemented from Namable.

Definition at line 187 of file textureImage.h.

double TextureImage::get_coverage_threshold  )  const
 

Returns the appropriate coverage threshold for this texture.

This is either the Palettizer::_coverage_threshold parameter, given globally via -r, or a particular value for this texture as supplied by the "coverage" keyword in the .txa file.

Definition at line 513 of file textureImage.cxx.

References _sources.

const Filename & ImageFile::get_filename  )  const [inherited]
 

Returns the primary filename of the image file.

Definition at line 303 of file imageFile.cxx.

References ImageFile::_properties, and nout.

Referenced by clear_source_basic_properties(), get_preferred_source(), is_newer_than(), is_used(), and PaletteImage::unplace().

const PaletteGroups & TextureImage::get_groups  )  const
 

Once assign_groups() has been called, this returns the actual set of groups the TextureImage has been assigned to.

Definition at line 217 of file textureImage.cxx.

References _placement.

Referenced by EggFile::build_cross_links(), and EggFile::is_stale().

int TextureImage::get_margin  )  const
 

Returns the appropriate margin for this texture.

This is either the Palettizer::_margin parameter, or a particular value for this texture as supplied by the "margin" keyword in the .txa file.

Definition at line 532 of file textureImage.cxx.

References _preferred_source, and NULL.

int ImageFile::get_num_channels  )  const [inherited]
 

Returns the number of channels of the image.

It is an error to call this unless has_num_channels() returns true.

Definition at line 155 of file imageFile.cxx.

References ImageFile::_properties.

Referenced by mark_eggs_stale().

bool TextureImage::get_omit  )  const
 

Returns true if the user specifically requested to omit this texture via the "omit" keyword in the .txa file, or false otherwise.

Definition at line 490 of file textureImage.cxx.

References _alpha_mode, and EggRenderMode::AlphaMode.

TexturePlacement * TextureImage::get_placement PaletteGroup group  )  const
 

Gets the TexturePlacement object which represents the assignment of this texture to the indicated group.

If the texture has not been assigned to the indicated group, returns NULL.

Definition at line 236 of file textureImage.cxx.

References _placement.

SourceTextureImage * TextureImage::get_preferred_source  ) 
 

Determines the preferred source image for examining size and reading pixels, etc.

This is the largest and most recent of all the available source images.

Definition at line 648 of file textureImage.cxx.

References _dests, _placement, copy_new_dests(), ImageFile::get_filename(), TexturePlacement::get_omit_reason(), Filename::make_canonical(), NULL, OR_none, OR_unknown, remove_old_dests(), and TexturePlacement::set_dest().

Referenced by clear_source_basic_properties(), mark_eggs_stale(), and read_source_image().

const TextureProperties & ImageFile::get_properties  )  const [inherited]
 

Returns the grouping properties of the image.

Definition at line 168 of file imageFile.cxx.

References Palettizer::_map_dirname, PaletteGroup::get_dirname(), NULL, and pal.

Referenced by TextureMemoryCounter::add_texture(), copy_unplaced(), DestTextureImage::DestTextureImage(), and TexturePlacement::get_name().

SourceTextureImage * TextureImage::get_source const Filename filename,
const Filename alpha_filename,
int  alpha_file_channel
 

Returns the SourceTextureImage corresponding to the given filename(s).

If the given filename has never been used as a SourceTexture for this particular texture, creates a new SourceTextureImage and returns that.

Definition at line 613 of file textureImage.cxx.

string TextureImage::get_source_key const Filename filename,
const Filename alpha_filename,
int  alpha_file_channel
[private]
 

Returns the key that a SourceTextureImage should be stored in, given its one or two filenames.

Definition at line 1406 of file textureImage.cxx.

virtual TypeHandle TextureImage::get_type void   )  const [inline, virtual]
 

Reimplemented from ImageFile.

Definition at line 197 of file textureImage.h.

int ImageFile::get_x_size  )  const [inherited]
 

Returns the size of the image file in pixels in the X direction.

It is an error to call this unless is_size_known() returns true.

Definition at line 104 of file imageFile.cxx.

References ImageFile::_properties, and TextureProperties::has_num_channels().

Referenced by copy_unplaced(), DestTextureImage::DestTextureImage(), is_used(), and mark_eggs_stale().

int ImageFile::get_y_size  )  const [inherited]
 

Returns the size of the image file in pixels in the Y direction.

It is an error to call this unless is_size_known() returns true.

Definition at line 122 of file imageFile.cxx.

Referenced by copy_unplaced(), DestTextureImage::DestTextureImage(), is_used(), and mark_eggs_stale().

bool TextureImage::got_txa_file  )  const
 

Returns true if this TextureImage has been looked up in the .txa file this session, false otherwise.

Definition at line 450 of file textureImage.cxx.

References TextureRequest::_margin, and _request.

Referenced by PaletteGroup::is_preferred_over().

bool ImageFile::has_num_channels  )  const [inherited]
 

Returns true if the number of channels in the image is known, false otherwise.

Definition at line 138 of file imageFile.cxx.

References ImageFile::_properties, and TextureProperties::clear_basic().

void TextureImage::init_type void   )  [inline, static]
 

Reimplemented from Namable.

Definition at line 190 of file textureImage.h.

bool TextureImage::is_newer_than const Filename reference_filename  ) 
 

Returns true if the source image is newer than the indicated file, false otherwise.

If the image has already been read, this always returns false.

Definition at line 890 of file textureImage.cxx.

References ImageFile::get_filename(), TexturePlacement::get_image(), indent(), FilenameUnifier::make_user_filename(), nassertv, NULL, and OR_none.

bool ImageFile::is_size_known  )  const [inherited]
 

Returns true if the size of the image file is known, false otherwise.

Definition at line 87 of file imageFile.cxx.

References ImageFile::_y_size, and nassertr.

Referenced by copy_unplaced(), DestTextureImage::DestTextureImage(), TexturePlacement::mark_eggs_stale(), and read_source_image().

bool TextureImage::is_surprise  )  const
 

Returns true if this particular texture is a 'surprise', i.e.

it wasn't matched by a line in the .txa file that didn't include the keyword 'cont'.

Definition at line 549 of file textureImage.cxx.

References _sources.

bool TextureImage::is_used  )  const
 

Returns true if this particular texture has been placed somewhere, anywhere, or false if it is not used.

Definition at line 572 of file textureImage.cxx.

References Filename::compare_timestamps(), ImageFile::exists(), ImageFile::get_filename(), SourceTextureImage::get_size(), ImageFile::get_x_size(), ImageFile::get_y_size(), and NULL.

void ImageFile::make_shadow_image const string &  basename  )  [inherited]
 

Sets up the ImageFile as a "shadow image" of a particular PaletteImage.

This is a temporary ImageFile that's used to read and write the shadow palette image, which is used to keep a working copy of the palette.

Definition at line 69 of file imageFile.cxx.

References ImageFile::_size_known.

TypedWritable * TextureImage::make_TextureImage const FactoryParams params  )  [static, protected]
 

This method is called by the BamReader when an object of this type is encountered in a Bam file; it should allocate and return a new object with all the data read.

Definition at line 1562 of file textureImage.cxx.

void TextureImage::mark_eggs_stale  ) 
 

Marks all the egg files that reference this texture stale.

Should be called only when the texture properties change in some catastrophic way that will require every egg file referencing it to be regenerated, even if it is not palettized.

Definition at line 285 of file textureImage.cxx.

References TextureRequest::_got_size, _got_txa_file, ImageFile::_properties, _request, ImageFile::_size_known, ImageFile::_x_size, ImageFile::_y_size, ImageFile::get_num_channels(), get_preferred_source(), SourceTextureImage::get_size(), ImageFile::get_x_size(), ImageFile::get_y_size(), NULL, and TextureProperties::set_num_channels().

void TextureImage::note_egg_file EggFile egg_file  ) 
 

Records that a particular egg file references this texture.

This is essential to know when deciding how to assign the TextureImage to the various PaletteGroups.

Definition at line 76 of file textureImage.cxx.

References _egg_files, _explicitly_assigned_groups, assign_to_groups(), and PaletteGroups::empty().

void ImageFile::output_filename ostream &  out  )  const [inherited]
 

Writes the filename (or pair of filenames) to the indicated output stream.

Definition at line 561 of file imageFile.cxx.

Referenced by copy_unplaced(), SourceTextureImage::get_type(), and DestTextureImage::get_type().

void TextureImage::post_txa_file  ) 
 

Once the .txa file has been read and the TextureImage matched against it, considers applying the requested size change.

Updates the TextureImage's size with the size the texture ought to be, if this can be determined.

Definition at line 338 of file textureImage.cxx.

Referenced by PaletteGroup::is_preferred_over().

void TextureImage::pre_txa_file  ) 
 

Updates any internal state prior to reading the .txa file.

Definition at line 303 of file textureImage.cxx.

References _request, ImageFile::_x_size, and ImageFile::_y_size.

Referenced by PaletteGroup::is_preferred_over().

bool ImageFile::read PNMImage image  )  const [inherited]
 

Reads in the image (or images, if the alpha_filename is separate) and stores it in the indicated PNMImage.

Returns true on success, false on failure.

Definition at line 389 of file imageFile.cxx.

void TextureImage::read_header  ) 
 

Causes the header part of the image to be reread, usually to confirm that its image properties (size, number of channels, etc.) haven't changed.

Definition at line 868 of file textureImage.cxx.

const PNMImage & TextureImage::read_source_image  ) 
 

Reads in the original image, if it has not already been read, and returns it.

Definition at line 842 of file textureImage.cxx.

References _placement, Namable::get_name(), get_preferred_source(), indent(), ImageFile::is_size_known(), and NULL.

Referenced by Palettizer::process_command_line_eggs().

void TextureImage::register_with_read_factory void   )  [static]
 

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

Definition at line 1426 of file textureImage.cxx.

void TextureImage::remove_old_dests const Dests a,
const Dests b
[private]
 

Removes all of the filenames named in b that are not also named in a.

Definition at line 1315 of file textureImage.cxx.

References _placement.

Referenced by get_preferred_source().

void ImageFile::set_filename const string &  dirname,
const string &  basename
[inherited]
 

Sets the filename, and if applicable, the alpha_filename, from the indicated basename.

The extension appropriate to the image file type specified in _color_type (and _alpha_type) is automatically applied.

Definition at line 269 of file imageFile.cxx.

References ImageFile::_alpha_filename, TextureProperties::_alpha_type, ImageFile::_filename, ImageFile::_properties, Filename::empty(), Filename::exists(), NULL, and TextureProperties::uses_alpha().

void ImageFile::set_filename PaletteGroup group,
const string &  basename
[inherited]
 

Sets the filename, and if applicable, the alpha_filename, from the indicated basename.

The extension appropriate to the image file type specified in _color_type (and _alpha_type) is automatically applied.

Definition at line 223 of file imageFile.cxx.

void ImageFile::unlink  )  [inherited]
 

Deletes the image file or files.

Definition at line 513 of file imageFile.cxx.

References ImageFile::_alpha_file_channel, ImageFile::_alpha_filename, ImageFile::_filename, Palettizer::_read_pi_version, and DatagramIterator::get_uint8().

void ImageFile::update_egg_tex EggTexture egg_tex  )  const [inherited]
 

Sets the indicated EggTexture to refer to this file.

Definition at line 533 of file imageFile.cxx.

Referenced by TextureReference::get_placement().

void ImageFile::update_properties const TextureProperties properties  )  [inherited]
 

If the indicate TextureProperties structure is more specific than this one, updates this one.

Definition at line 202 of file imageFile.cxx.

References TextureProperties::_color_type, ImageFile::_filename, ImageFile::_properties, Filename, PNMFileType::get_suggested_extension(), NULL, and Filename::set_extension().

bool ImageFile::write const PNMImage image  )  const [inherited]
 

Writes out the image in the indicated PNMImage to the _filename and/or _alpha_filename.

Returns true on success, false on failure.

Definition at line 459 of file imageFile.cxx.

References ImageFile::_alpha_filename, and ImageFile::_properties.

void TextureImage::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 1444 of file textureImage.cxx.

void TextureImage::write_scale_info ostream &  out,
int  indent_level = 0
 

Writes the list of source pathnames that might contribute to this texture to the indicated output stream, one per line.

Definition at line 992 of file textureImage.cxx.

void TextureImage::write_source_pathnames ostream &  out,
int  indent_level = 0
const
 

Writes the list of source pathnames that might contribute to this texture to the indicated output stream, one per line.

Definition at line 915 of file textureImage.cxx.


Friends And Related Function Documentation

friend class TxaLine [friend]
 

Definition at line 204 of file textureImage.h.


Member Data Documentation

PaletteGroups TextureImage::_actual_assigned_groups [private]
 

Definition at line 153 of file textureImage.h.

int TextureImage::_alpha_bits [private]
 

Definition at line 149 of file textureImage.h.

Referenced by compute_egg_count(), and TextureImage().

int ImageFile::_alpha_file_channel [protected, inherited]
 

Definition at line 84 of file imageFile.h.

Referenced by SourceTextureImage::SourceTextureImage(), and ImageFile::unlink().

Filename ImageFile::_alpha_filename [protected, inherited]
 

Definition at line 83 of file imageFile.h.

Referenced by ImageFile::exists(), ImageFile::set_filename(), SourceTextureImage::SourceTextureImage(), ImageFile::unlink(), and ImageFile::write().

EggRenderMode::AlphaMode TextureImage::_alpha_mode [private]
 

Definition at line 150 of file textureImage.h.

Referenced by assign_to_groups(), get_omit(), and TextureImage().

Dests TextureImage::_dests [private]
 

Definition at line 161 of file textureImage.h.

Referenced by get_preferred_source().

EggFiles TextureImage::_egg_files [private]
 

Definition at line 155 of file textureImage.h.

Referenced by assign_groups(), and note_egg_file().

bool TextureImage::_ever_read_image [private]
 

Definition at line 138 of file textureImage.h.

PaletteGroups TextureImage::_explicitly_assigned_groups [private]
 

Definition at line 152 of file textureImage.h.

Referenced by note_egg_file().

Filename ImageFile::_filename [protected, inherited]
 

Definition at line 82 of file imageFile.h.

Referenced by ImageFile::exists(), ImageFile::set_filename(), SourceTextureImage::SourceTextureImage(), ImageFile::unlink(), and ImageFile::update_properties().

bool TextureImage::_forced_grayscale [private]
 

Definition at line 139 of file textureImage.h.

Referenced by TextureImage().

bool TextureImage::_got_txa_file [private]
 

Definition at line 165 of file textureImage.h.

Referenced by mark_eggs_stale(), and TextureImage().

bool TextureImage::_is_surprise [private]
 

Definition at line 136 of file textureImage.h.

Referenced by determine_placement_size().

int TextureImage::_num_dests [private]
 

Definition at line 184 of file textureImage.h.

int TextureImage::_num_placement [private]
 

Definition at line 182 of file textureImage.h.

int TextureImage::_num_sources [private]
 

Definition at line 183 of file textureImage.h.

Placement TextureImage::_placement [private]
 

Definition at line 158 of file textureImage.h.

Referenced by get_groups(), get_placement(), get_preferred_source(), read_source_image(), and remove_old_dests().

EggRenderMode::AlphaMode TextureImage::_pre_txa_alpha_mode [private]
 

Definition at line 134 of file textureImage.h.

TextureProperties TextureImage::_pre_txa_properties [private]
 

Definition at line 133 of file textureImage.h.

SourceTextureImage* TextureImage::_preferred_source [private]
 

Definition at line 135 of file textureImage.h.

Referenced by get_margin().

TextureProperties ImageFile::_properties [protected, inherited]
 

Definition at line 81 of file imageFile.h.

Referenced by DestTextureImage::DestTextureImage(), ImageFile::exists(), ImageFile::get_filename(), ImageFile::get_num_channels(), ImageFile::get_x_size(), ImageFile::has_num_channels(), mark_eggs_stale(), ImageFile::set_filename(), ImageFile::update_properties(), and ImageFile::write().

bool TextureImage::_read_source_image [private]
 

Definition at line 163 of file textureImage.h.

Referenced by clear_source_basic_properties().

TextureRequest TextureImage::_request [private]
 

Definition at line 132 of file textureImage.h.

Referenced by got_txa_file(), mark_eggs_stale(), and pre_txa_file().

bool ImageFile::_size_known [protected, inherited]
 

Definition at line 86 of file imageFile.h.

Referenced by DestTextureImage::DestTextureImage(), SourceTextureImage::increment_egg_count(), ImageFile::make_shadow_image(), and mark_eggs_stale().

PNMImage TextureImage::_source_image [private]
 

Definition at line 164 of file textureImage.h.

Sources TextureImage::_sources [private]
 

Definition at line 160 of file textureImage.h.

Referenced by get_coverage_threshold(), and is_surprise().

TypeHandle TextureImage::_type_handle [static, private]
 

Reimplemented from Namable.

Definition at line 40 of file textureImage.cxx.

int ImageFile::_x_size [protected, inherited]
 

Definition at line 87 of file imageFile.h.

Referenced by PaletteImage::check_solitary(), PaletteImage::ClearedRegion::ClearedRegion(), DestTextureImage::DestTextureImage(), mark_eggs_stale(), pre_txa_file(), PaletteImage::setup_shadow_image(), and PaletteImage::unplace().

int ImageFile::_y_size [protected, inherited]
 

Definition at line 87 of file imageFile.h.

Referenced by PaletteImage::check_solitary(), PaletteImage::ClearedRegion::ClearedRegion(), DestTextureImage::DestTextureImage(), ImageFile::is_size_known(), mark_eggs_stale(), pre_txa_file(), PaletteImage::setup_shadow_image(), and PaletteImage::unplace().


The documentation for this class was generated from the following files:
Generated on Fri May 2 03:28:04 2003 for Panda-Tool by doxygen1.3