14 #ifndef PALETTEIMAGE_H
15 #define PALETTEIMAGE_H
62 bool setup_filename();
63 bool find_hole(
int &x,
int &y,
int x_size,
int y_size)
const;
68 void get_swapped_image(
int index);
69 void get_swapped_images();
77 ClearedRegion(
const ClearedRegion ©);
78 void operator = (
const ClearedRegion ©);
99 std::string _basename;
105 unsigned _swapped_image;
132 static void init_type() {
133 ImageFile::init_type();
135 ImageFile::get_class_type());
138 return get_class_type();
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
A class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
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 both TextureImage and PaletteImage.
The name of this class derives from the fact that we originally implemented it as a layer on top of t...
This is a single palette image, one of several within a PalettePage, which is in turn one of several ...
bool is_empty() const
Returns true if there are no textures, or only one "solitary" texture, placed on the image.
PalettePage * get_page() const
Returns the particular PalettePage this image is associated with.
void unplace(TexturePlacement *placement)
Removes the texture from the image.
virtual void write_datagram(BamWriter *writer, Datagram &datagram)
Fills the indicated datagram up with a binary representation of the current object,...
void resize_swapped_image(int x_size, int y_size)
Attempts to resize the palette image, and repack all of the textures within the new size.
bool update_filename()
Changes the image filename to match the current naming scheme, assuming something has changed since t...
void reset_image()
Unpacks each texture that has been placed on this image, resetting the image to empty.
void update_image(bool redo_all)
If the palette has changed since it was last written out, updates the image and writes out a new one.
void optimal_resize()
Attempts to resize the palette image to as small as it can go.
void write_placements(std::ostream &out, int indent_level=0) const
Writes a list of the textures that have been placed on this image to the indicated output stream,...
bool resize_image(int x_size, int y_size)
Attempts to resize the palette image, and repack all of the textures within the new size.
bool place(TexturePlacement *placement)
Attempts to place the indicated texture on the image.
void setup_shadow_image()
Ensures the _shadow_image has the correct filename and image types, based on what was supplied on the...
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...
double count_utilization() const
Returns the fraction of the PaletteImage that is actually used by any textures.
static void register_with_read_factory()
Registers the current object as something that can be read from a Bam file.
void check_solitary()
To be called after all textures have been placed on the image, this checks to see if there is only on...
double count_coverage() const
Returns the a weighted average of the fraction of coverage represented by all of the textures placed ...
This is a particular collection of textures, within a PaletteGroup, that all share the same TexturePr...
This corresponds to a particular assignment of a TextureImage with a PaletteGroup,...
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.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...