47 if (pal->_force_power_2) {
48 _x_size = to_power_2(_x_size);
49 _y_size = to_power_2(_y_size);
51 _x_size = std::max(_x_size, 1);
52 _y_size = std::max(_y_size, 1);
74 dest_image.
fill(1.0, 0.0, 0.0);
101 if (source !=
nullptr &&
111 int DestTextureImage::
112 to_power_2(
int value) {
114 while ((x << 1) <= value) {
126 register_factory(get_class_type(), make_DestTextureImage);
150 me->fillin(scan, manager);
158 void DestTextureImage::
160 ImageFile::fillin(scan, manager);
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
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 ...
This represents a texture filename as it has been resized and copied to the map directory (e....
void copy(TextureImage *texture)
Unconditionally copies the source texture into the appropriate filename.
static void register_with_read_factory()
Registers the current object as something that can be read from a Bam file.
virtual void write_datagram(BamWriter *writer, Datagram &datagram)
Fills the indicated datagram up with a binary representation of the current object,...
void copy_if_stale(const DestTextureImage *other, TextureImage *texture)
Copies the source texture into the appropriate filename only if the indicated old reference,...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
int compare_timestamps(const Filename &other, bool this_missing_is_old=true, bool other_missing_is_old=true) const
Returns a number less than zero if the file named by this object is older than the given file,...
int get_num_channels() const
Returns the number of channels of the image.
bool write(const PNMImage &image) const
Writes out the image in the indicated PNMImage to the _filename and/or _alpha_filename.
bool set_filename(PaletteGroup *group, const std::string &basename)
Sets the filename, and if applicable, the alpha_filename, from the indicated basename.
int get_x_size() const
Returns the size of the image file in pixels in the X direction.
const TextureProperties & get_properties() const
Returns the grouping properties of the image.
const Filename & get_filename() const
Returns the primary filename of the image file.
virtual void write_datagram(BamWriter *writer, Datagram &datagram)
Fills the indicated datagram up with a binary representation of the current object,...
bool is_size_known() const
Returns true if the size of the image file is known, false otherwise.
int get_y_size() const
Returns the size of the image file in pixels in the Y direction.
The name of this class derives from the fact that we originally implemented it as a layer on top of t...
void alpha_fill(float alpha=0.0)
Sets the entire alpha channel to the given level.
void quick_filter_from(const PNMImage ©, int xborder=0, int yborder=0)
Resizes from the given image, with a fixed radius of 0.5.
void fill(float red, float green, float blue)
Sets the entire image (except the alpha channel) to the given color.
bool is_valid() const
Returns true if the image has been read in or correctly initialized with a height and width.
This is a texture image reference as it appears in an egg file: the source image of the texture.
This represents a single source texture that is referenced by one or more egg files.
SourceTextureImage * get_preferred_source()
Determines the preferred source image for examining size and reading pixels, etc.
void release_source_image()
Frees the memory that was allocated by a previous call to read_source_image().
const PNMImage & read_source_image()
Reads in the original image, if it has not already been read, and returns it.
This corresponds to a particular assignment of a TextureImage with a PaletteGroup,...
PaletteGroup * get_group() const
Returns the group that this placement represents.
TextureImage * get_texture() const
Returns the texture that this placement represents.
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.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.