mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
use alpha channel if alpha image has it
This commit is contained in:
parent
402b679d1e
commit
b6eefd9e23
@ -246,11 +246,19 @@ read(const Filename &fullpath, const Filename &alpha_fullpath) {
|
||||
|
||||
// Make the original image a 4-component image
|
||||
image.add_alpha();
|
||||
if (alpha_image.has_alpha()) {
|
||||
for (int x = 0; x < image.get_x_size(); x++) {
|
||||
for (int y = 0; y < image.get_y_size(); y++) {
|
||||
image.set_alpha(x, y, alpha_image.get_alpha(x, y));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int x = 0; x < image.get_x_size(); x++) {
|
||||
for (int y = 0; y < image.get_y_size(); y++) {
|
||||
image.set_alpha(x, y, alpha_image.get_gray(x, y));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return load(image);
|
||||
}
|
||||
|
@ -293,12 +293,20 @@ read(PNMImage &image) const {
|
||||
}
|
||||
|
||||
image.add_alpha();
|
||||
if (alpha_image.has_alpha()) {
|
||||
for (int y = 0; y < image.get_y_size(); y++) {
|
||||
for (int x = 0; x < image.get_x_size(); x++) {
|
||||
image.set_alpha(x, y, alpha_image.get_alpha(x, y));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int y = 0; y < image.get_y_size(); y++) {
|
||||
for (int x = 0; x < image.get_x_size(); x++) {
|
||||
image.set_alpha(x, y, alpha_image.get_gray(x, y));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user