mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
use alpha channel if alpha image has it
This commit is contained in:
parent
402b679d1e
commit
b6eefd9e23
@ -246,9 +246,17 @@ read(const Filename &fullpath, const Filename &alpha_fullpath) {
|
|||||||
|
|
||||||
// Make the original image a 4-component image
|
// Make the original image a 4-component image
|
||||||
image.add_alpha();
|
image.add_alpha();
|
||||||
for (int x = 0; x < image.get_x_size(); x++) {
|
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_gray(x, y));
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,9 +293,17 @@ read(PNMImage &image) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
image.add_alpha();
|
image.add_alpha();
|
||||||
for (int y = 0; y < image.get_y_size(); y++) {
|
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_gray(x, 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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user