Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

using parameters in convolutionfilter

New Here ,
Dec 31, 2010 Dec 31, 2010

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

TOPICS
ActionScript
530
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 31, 2010 Dec 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 ]

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 31, 2010 Dec 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 31, 2010 Dec 31, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 14, 2020 Mar 14, 2020
LATEST

 

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines