Skip to main content
Participant
December 31, 2010
Question

using parameters in convolutionfilter

  • December 31, 2010
  • 1 reply
  • 554 views

hi;

I want to use a convolutionfilter on a bitmap and i copied the following code:

this._emboss = new ConvolutionFilter(3, 3, [
                2, 0, 0,
                0, -1, 0,
                0, 0, -1
            ], 3, 0x80);
   this.findata.applyFilter(this.findata, findata.rect, new Point(0,0), this._emboss)

but i get an embossed gray image and i have not the colors of my image.What can i do;

i think it's a matter of alpha.

i don't understand the use of parameters:in convolutionfilter ,there are 9 parametersin the function;how can i manage if i want use only 5 parameters

as in the given example.

What are the parameters in the example?

i would write:

this._emboss = new ConvolutionFilter(3, 3, [
                2, 0, 0,
                0, -1, 0,
                0, 0, -1
            ], 3, 0x80,null,null,null,null);
or

this._emboss = new ConvolutionFilter(3, 3, [
                2, 0, 0,
                0, -1, 0,
                0, 0, -1
            ], 3,null,null,null, 0x80,null);

if 0x80 is corresponding to the color parameter

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
December 31, 2010

if you're happy with the last 4 default parameters of the convolutionfilter constructor, you need only pass the first 5 parameters.

if you're not happy with your filter, alter some of its parameters.  the following is a good start to apply an emboss effect:

var matrix = [ -2, -1, 0,
               -1, 1, 1,
                0, 1, 2 ]

kapacAuthor
Participant
December 31, 2010

thank you for your answer but

new question:in the 4default parameters if i want to change the second: clamp to false .How can i manage?

kglad
Community Expert
Community Expert
December 31, 2010

you must pass all parameters up to and including the last parameter you want to change from the default.