mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
Added remix_channels
This commit is contained in:
parent
1e6729a1e7
commit
fbd72a9000
@ -191,6 +191,26 @@ alpha_fill_val(xelval alpha) {
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PNMImage::remix_channels
|
||||
// Access: Published
|
||||
// Description: Transforms every pixel using the operation
|
||||
// (Ro,Go,Bo) = conv.xform_point(Ri,Gi,Bi);
|
||||
// Input must be a color image.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
void PNMImage::
|
||||
remix_channels(LMatrix4f &conv) {
|
||||
int nchannels = get_num_channels();
|
||||
nassertv((nchannels >= 3) && (nchannels <= 4));
|
||||
for (int y = 0; y < get_y_size(); y++) {
|
||||
for (int x = 0; x < get_x_size(); x++) {
|
||||
LVector3f inv(get_red(x,y),get_green(x,y),get_blue(x,y));
|
||||
LVector3f outv(conv.xform_point(inv));
|
||||
set_xel(x,y,outv[0],outv[1],outv[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: PNMImage::read
|
||||
// Access: Published
|
||||
|
@ -83,6 +83,8 @@ PUBLISHED:
|
||||
INLINE void fill(double red, double green, double blue);
|
||||
INLINE void fill(double gray = 0.0);
|
||||
|
||||
void remix_channels(LMatrix4f &conv);
|
||||
|
||||
void fill_val(xelval red, xelval green, xelval blue);
|
||||
INLINE void fill_val(xelval gray = 0);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user