diff options
| -rwxr-xr-x | indra/integration_tests/llimage_libtest/llimage_libtest.cpp | 4 | ||||
| -rwxr-xr-x | indra/llimage/llimage.cpp | 31 | ||||
| -rwxr-xr-x | indra/llimage/llimage.h | 1 | 
3 files changed, 36 insertions, 0 deletions
| diff --git a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp index e485136f58..cbd6ccebbf 100755 --- a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp +++ b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp @@ -602,6 +602,10 @@ int main(int argc, char** argv)          {              raw_image->filterGrayScale();          } +        else if (filter_name == "saturate") +        { +            raw_image->filterSaturate(2.0f); +        }  		// Save file  		if (out_file != out_end) diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 73e6f48a8d..4028514898 100755 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -955,6 +955,37 @@ void LLImageRaw::filterSepia()      colorTransform(sepia);  } +void LLImageRaw::filterSaturate(F32 saturation) +{ +    // Matrix to Lij +    LLMatrix3 r_a; +    LLMatrix3 r_b; + +    // 45 degre rotation around z +    r_a.setRows(LLVector3(0.7071,  0.7071, 0.0), +                LLVector3(-0.7071,  0.7071, 0.0), +                LLVector3(0.0,     0.0,    1.0)); +    // 54.73 degre rotation around y +    r_b.setRows(LLVector3(0.5773,  0.0, -0.8165), +                LLVector3(0.0,     1.0,  0.0), +                LLVector3(0.8165,  0.0,  0.5773)); + +    // Coordinate conversion +    LLMatrix3 Lij = r_b * r_a; +    LLMatrix3 Lij_inv = Lij; +    Lij_inv.transpose(); +     +    // Local saturation transform +    LLMatrix3 s; +    s.setRows(LLVector3(saturation, 0.0,  0.0), +              LLVector3(0.0,  saturation, 0.0), +              LLVector3(0.0,        0.0,  1.0)); + +    // Global saturation transform +    LLMatrix3 transfo = Lij_inv * s * Lij; +    colorTransform(transfo); +} +  // Filter Primitives  void LLImageRaw::colorTransform(const LLMatrix3 &transform)  { diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index d6b7e65c76..1742cf8a71 100755 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -260,6 +260,7 @@ public:      // Filter Operations      void filterGrayScale();      void filterSepia(); +    void filterSaturate(F32 s);      // Filter Primitives      void colorTransform(const LLMatrix3 &transform); | 
