diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/integration_tests/llimage_libtest/filters/colortransform.xml | 16 | ||||
-rw-r--r-- | indra/integration_tests/llimage_libtest/filters/convolve.xml | 18 | ||||
-rwxr-xr-x | indra/llimage/llimagefilter.cpp | 37 | ||||
-rwxr-xr-x | indra/llimage/llimagefilter.h | 2 |
4 files changed, 64 insertions, 9 deletions
diff --git a/indra/integration_tests/llimage_libtest/filters/colortransform.xml b/indra/integration_tests/llimage_libtest/filters/colortransform.xml new file mode 100644 index 0000000000..de4bebcce2 --- /dev/null +++ b/indra/integration_tests/llimage_libtest/filters/colortransform.xml @@ -0,0 +1,16 @@ +<llsd> + <array> + <array> + <string>colortransform</string> + <real>0.2125</real> + <real>0.7154</real> + <real>0.0721</real> + <real>0.2125</real> + <real>0.7154</real> + <real>0.0721</real> + <real>0.2125</real> + <real>0.7154</real> + <real>0.0721</real> + </array> + </array> +</llsd> diff --git a/indra/integration_tests/llimage_libtest/filters/convolve.xml b/indra/integration_tests/llimage_libtest/filters/convolve.xml new file mode 100644 index 0000000000..6e65b5f88a --- /dev/null +++ b/indra/integration_tests/llimage_libtest/filters/convolve.xml @@ -0,0 +1,18 @@ +<llsd> + <array> + <array> + <string>convolve</string> + <real>1.0</real> + <real>0.0</real> + <real>4.0</real> + <real>1.0</real> + <real>4.0</real> + <real>1.0</real> + <real>0.0</real> + <real>1.0</real> + <real>4.0</real> + <real>1.0</real> + <real>4.0</real> + </array> + </array> +</llsd> diff --git a/indra/llimage/llimagefilter.cpp b/indra/llimage/llimagefilter.cpp index e0dae9fab2..8f7e340d16 100755 --- a/indra/llimage/llimagefilter.cpp +++ b/indra/llimage/llimagefilter.cpp @@ -134,9 +134,9 @@ void LLImageFilter::executeFilter(LLPointer<LLImageRaw> raw_image) { mode = STENCIL_BLEND_MODE_ADD; } - else if (filter_mode == "dodge") + else if (filter_mode == "add_back") { - mode = STENCIL_BLEND_MODE_DODGE; + mode = STENCIL_BLEND_MODE_ABACK; } else if (filter_mode == "fade") { @@ -230,21 +230,42 @@ void LLImageFilter::executeFilter(LLPointer<LLImageRaw> raw_image) else if (filter_name == "sharpen") { LLMatrix3 kernel; - for (S32 i = 0; i < NUM_VALUES_IN_MAT3; i++) + for (S32 k = 0; k < NUM_VALUES_IN_MAT3; k++) for (S32 j = 0; j < NUM_VALUES_IN_MAT3; j++) - kernel.mMatrix[i][j] = -1.0; + kernel.mMatrix[k][j] = -1.0; kernel.mMatrix[1][1] = 9.0; convolve(kernel,false,false); } else if (filter_name == "gradient") { LLMatrix3 kernel; - for (S32 i = 0; i < NUM_VALUES_IN_MAT3; i++) + for (S32 k = 0; k < NUM_VALUES_IN_MAT3; k++) for (S32 j = 0; j < NUM_VALUES_IN_MAT3; j++) - kernel.mMatrix[i][j] = -1.0; + kernel.mMatrix[k][j] = -1.0; kernel.mMatrix[1][1] = 8.0; convolve(kernel,false,true); } + else if (filter_name == "convolve") + { + LLMatrix3 kernel; + S32 index = 1; + bool normalize = (mFilterData[i][index++].asReal() > 0.0); + bool abs_value = (mFilterData[i][index++].asReal() > 0.0); + for (S32 k = 0; k < NUM_VALUES_IN_MAT3; k++) + for (S32 j = 0; j < NUM_VALUES_IN_MAT3; j++) + kernel.mMatrix[k][j] = mFilterData[i][index++].asReal(); + convolve(kernel,normalize,abs_value); + } + else if (filter_name == "colortransform") + { + LLMatrix3 transform; + S32 index = 1; + for (S32 k = 0; k < NUM_VALUES_IN_MAT3; k++) + for (S32 j = 0; j < NUM_VALUES_IN_MAT3; j++) + transform.mMatrix[k][j] = mFilterData[i][index++].asReal(); + transform.transpose(); + colorTransform(transform); + } else { llwarns << "Filter unknown, cannot execute filter command : " << filter_name << llendl; @@ -273,8 +294,8 @@ void LLImageFilter::blendStencil(F32 alpha, U8* pixel, U8 red, U8 green, U8 blue pixel[VGREEN] = llclampb(pixel[VGREEN] + alpha * green); pixel[VBLUE] = llclampb(pixel[VBLUE] + alpha * blue); break; - case STENCIL_BLEND_MODE_DODGE: - // Dodge/burn the incoming color onto the background image + case STENCIL_BLEND_MODE_ABACK: + // Add back background image to the incoming color pixel[VRED] = llclampb(inv_alpha * pixel[VRED] + red); pixel[VGREEN] = llclampb(inv_alpha * pixel[VGREEN] + green); pixel[VBLUE] = llclampb(inv_alpha * pixel[VBLUE] + blue); diff --git a/indra/llimage/llimagefilter.h b/indra/llimage/llimagefilter.h index e392d3215e..d2650c2539 100755 --- a/indra/llimage/llimagefilter.h +++ b/indra/llimage/llimagefilter.h @@ -38,7 +38,7 @@ typedef enum e_stencil_blend_mode { STENCIL_BLEND_MODE_BLEND = 0, STENCIL_BLEND_MODE_ADD = 1, - STENCIL_BLEND_MODE_DODGE = 2, + STENCIL_BLEND_MODE_ABACK = 2, STENCIL_BLEND_MODE_FADE = 3 } EStencilBlendMode; |