Documentation/D2DEffect
class

D2DEffect

js/d2d.js:243
D2DEffect(CLSID)

Creates Direct2D effect.

Parameters

NameTypeDescription
CLSIDstring

CLSID of Direct2D effect. See Effects for effects' CLSID.

propertyreadonly

CLSID

js/d2d.js:250
CLSID: string = ""

CLSID of this effect.

propertyreadonly

Description

js/d2d.js:264
Description: string

Description string for this effect.

propertyreadonly

InputCount

js/d2d.js:271
InputCount: number

Get/Set input count for effect.

propertyreadonly

Name

js/d2d.js:257
Name: string = ""

Human-readable name of effect.

method

GetPropertyType

js/d2d.js:328
GetPropertyType(index)

Parameters

NameTypeDescription
indexnumber

Index of effect property. See Effects

Returns

D2DEffectPropertyType

See D2DEffectPropertyType

method

GetValue

js/d2d.js:348
GetValue(index)

Gets effect property value by index.

Parameters

NameTypeDescription
indexnumber

Index of input property. See Effects

Returns

Object

Property value of corresponding type. See D2DEffectPropertyType

method

GetValueByName

js/d2d.js:355
GetValueByName(name)

Gets effect property value by name.

Parameters

NameTypeDescription
indexnumber

Index of input property. See Effects

Returns

Object

Property value of corresponding type. See D2DEffectPropertyType

method

SetInput

js/d2d.js:278
SetInput(index, bitmap, invalidate)

Parameters

NameTypeDescription
indexnumber

Index of effect input

bitmapD2DBitmap

Input image

invalidate = trueoptionalboolean

Whether to invalidate the graph at the location of the effect input

Example

window.DrawMode = 1;

include(`${fb.ComponentPath}\\docs\\Effects.js`);

const img = d2d.Image(`${fb.ComponentPath}\\samples\\d2d\\images\\Flowers.jpg`);

const effect = d2d.Effect(Effects.Sepia.ID);
effect.SetInput(0, img);
effect.SetValue(Effects.Sepia.Intensity, 0.5);

function on_paint(dgr) {	
    dgr.DrawEffect(effect, 10, 10, 0, 0, img.Width, img.Height);
}
method

SetInputEffect

js/d2d.js:299
SetInputEffect(index, effect, invalidate)

Parameters

NameTypeDescription
indexnumber

Index of effect input

effectD2DEffect

Input effect

invalidate = trueoptionalboolean

Whether to invalidate the graph at the location of the effect input

Example

window.DrawMode = 1;

include(`${fb.ComponentPath}\\docs\\Effects.js`);

const img = d2d.Image(`${fb.ComponentPath}\\samples\\d2d\\images\\Flowers.jpg`);

const sepia = d2d.Effect(Effects.Sepia.ID);
sepia.SetInput(0, img);
sepia.SetValue(Effects.Sepia.Intensity, 0.5);

const contrast = d2d.Effect(Effects.Contrast.ID);
contrast.SetInputEffect(0, sepia);
contrast.SetValue(Effects.Contrast.Contrast, 1.0);

const scale = d2d.Effect(Effects.Scale.ID);
scale.SetInputEffect(0, contrast);
scale.SetValue(Effects.Scale.Scale, [0.7, 0.7]);

function on_paint(dgr) {	
    dgr.DrawEffect(scale, 10, 10, 0, 0, img.Width, img.Height);
}
method

SetValue

js/d2d.js:334
SetValue(index, value)

Sets the corresponding property by index.

Parameters

NameTypeDescription
indexnumber

Index of input property. See Effects

valueObject

Property value of corresponding type. See D2DEffectPropertyType

method

SetValueByName

js/d2d.js:341
SetValueByName(name, value)

Sets the corresponding property by name.

Parameters

NameTypeDescription
namestring

Index of input property. See Effects

valueObject

Property value of corresponding type. See D2DEffectPropertyType