diff options
author | Merov Linden <merov@lindenlab.com> | 2013-12-18 15:55:13 -0800 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2013-12-18 15:55:13 -0800 |
commit | 6578144b7eda1dae885e5cc172751203b1d16c2d (patch) | |
tree | cba111f9651c1a96f03196016bd7e2081619ab9b /indra/llimage/llimage.cpp | |
parent | be80b11d3063cc1b394ed604901418ba421cd86c (diff) |
ACME-1236 : WIP : Added Gray Scale as an experimental filter in Flickr. Lots of ugly hacks for now
Diffstat (limited to 'indra/llimage/llimage.cpp')
-rwxr-xr-x | indra/llimage/llimage.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index c8a05e1fae..e5281feff0 100755 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -933,6 +933,26 @@ BOOL LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) return TRUE ; } +// *TODO : Implement real color transform +// Merov : This is temporary code for testing... +void LLImageRaw::colorTransform() +{ + const S32 components = getComponents(); + llassert( components >= 1 && components <= 4 ); + + S32 pixels = getWidth() * getHeight(); + U8* dst_data = getData(); + llinfos << "Merov : Convert the image to Black and White!!! pixels = " << pixels << ", comp = " << components << llendl; + for( S32 i=0; i<pixels; i++ ) + { + U8 gray = (U8)(((U32)(dst_data[0]) + (U32)(dst_data[1]) + (U32)(dst_data[2]))/3); + dst_data[0] = gray; + dst_data[1] = gray; + dst_data[2] = gray; + dst_data += components; + } +} + void LLImageRaw::copyLineScaled( U8* in, U8* out, S32 in_pixel_len, S32 out_pixel_len, S32 in_pixel_step, S32 out_pixel_step ) { const S32 components = getComponents(); |