15 #ifndef PALETTEIMAGE_H
16 #define PALETTEIMAGE_H
18 #include "pandatoolbase.h"
20 #include "imageFile.h"
66 bool setup_filename();
67 bool find_hole(
int &x,
int &y,
int x_size,
int y_size)
const;
72 void get_swapped_image(
int index);
73 void get_swapped_images();
81 ClearedRegion(
const ClearedRegion ©);
82 void operator = (
const ClearedRegion ©);
109 unsigned _swapped_image;
136 static void init_type() {
137 ImageFile::init_type();
138 register_type(_type_handle,
"PaletteImage",
139 ImageFile::get_class_type());
142 return get_class_type();
static void register_with_read_factory()
Registers the current object as something that can be read from a Bam file.
The name of this class derives from the fact that we originally implemented it as a layer on top of t...
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
PalettePage * get_page() const
Returns the particular PalettePage this image is associated with.
Base class for objects that can be written to and read from Bam files.
void write_placements(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...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
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.
This is a particular collection of textures, within a PaletteGroup, that all share the same TexturePr...
bool place(TexturePlacement *placement)
Attempts to place the indicated texture on the image.
void optimal_resize()
Attempts to resize the palette image to as small as it can go.
void check_solitary()
To be called after all textures have been placed on the image, this checks to see if there is only on...
bool is_empty() const
Returns true if there are no textures, or only one "solitary" texture, placed on the image...
void reset_image()
Unpacks each texture that has been placed on this image, resetting the image to empty.
This is the base class of both TextureImage and PaletteImage.
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...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
This corresponds to a particular assignment of a TextureImage with a PaletteGroup, and specifically describes which PaletteImage (if any), and where on the PaletteImage, the TextureImage has been assigned to.
double count_utilization() const
Returns the fraction of the PaletteImage that is actually used by any textures.
void setup_shadow_image()
Ensures the _shadow_image has the correct filename and image types, based on what was supplied on the...
double count_coverage() const
Returns the a weighted average of the fraction of coverage represented by all of the textures placed ...
This is a single palette image, one of several within a PalettePage, which is in turn one of several ...
void unplace(TexturePlacement *placement)
Removes the texture from the image.
A class to retrieve the individual data elements previously stored in a Datagram. ...
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...
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...
TypeHandle is the identifier used to differentiate C++ class types.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
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...