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);
75 if (dest_image.has_alpha()) {
76 dest_image.alpha_fill(1.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);
bool write(const PNMImage &image) const
Writes out the image in the indicated PNMImage to the _filename and/or _alpha_filename.
static void register_with_read_factory()
Registers the current object as something that can be read from a Bam file.
This represents a texture filename as it has been resized and copied to the map directory (e....
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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...
PaletteGroup * get_group() const
Returns the group that this placement represents.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
int get_y_size() const
Returns the size of the image file in pixels in the Y direction.
Base class for objects that can be written to and read from Bam files.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void quick_filter_from(const PNMImage ©, int xborder=0, int yborder=0)
Resizes from the given image, with a fixed radius of 0.5.
SourceTextureImage * get_preferred_source()
Determines the preferred source image for examining size and reading pixels, etc.
bool is_valid() const
Returns true if the image has been read in or correctly initialized with a height and width.
virtual void write_datagram(BamWriter *writer, Datagram &datagram)
Fills the indicated datagram up with a binary representation of the current object,...
const TextureProperties & get_properties() const
Returns the grouping properties of the image.
bool set_filename(PaletteGroup *group, const std::string &basename)
Sets the filename, and if applicable, the alpha_filename, from the indicated basename.
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
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.
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 get_num_channels() const
Returns the number of channels of the image.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This corresponds to a particular assignment of a TextureImage with a PaletteGroup,...
This is a texture image reference as it appears in an egg file: the source image of the texture.
void copy(TextureImage *texture)
Unconditionally copies the source texture into the appropriate filename.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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,...
TextureImage * get_texture() const
Returns the texture that this placement represents.
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
const PNMImage & read_source_image()
Reads in the original image, if it has not already been read, and returns it.
A class to retrieve the individual data elements previously stored in a Datagram.
This represents a single source texture that is referenced by one or more egg files.
TypeHandle is the identifier used to differentiate C++ class types.
void fill(float red, float green, float blue)
Sets the entire image (except the alpha channel) to the given color.
const Filename & get_filename() const
Returns the primary filename of the image file.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
virtual void write_datagram(BamWriter *writer, Datagram &datagram)
Fills the indicated datagram up with a binary representation of the current object,...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void release_source_image()
Frees the memory that was allocated by a previous call to read_source_image().