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 | |
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')
-rwxr-xr-x | indra/llimage/llimage.cpp | 20 | ||||
-rwxr-xr-x | indra/llimage/llimage.h | 3 |
2 files changed, 23 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(); diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index 2277afc585..96c37f5436 100755 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -255,6 +255,9 @@ public: // Src and dst are same size. Src has 4 components. Dst has 3 components. void compositeUnscaled4onto3( LLImageRaw* src ); + + // Filter operations + void colorTransform(); protected: // Create an image from a local file (generally used in tools) |