Added remix_channels

This commit is contained in:
Josh Yelon 2007-02-13 22:39:06 +00:00
parent 1e6729a1e7
commit fbd72a9000
2 changed files with 22 additions and 0 deletions

View File

@ -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

View File

@ -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);