Documentation/D2DEffect
classWORKER

D2DEffect

jsdoc/objects/d2d.js:350
D2DEffect(CLSID)

Creates Direct2D effect.

Parameters

NameTypeDescription
CLSIDstring

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

propertyWORKERreadonly

CLSID

jsdoc/objects/d2d.js:358
CLSID: string = ""

CLSID of this effect.

propertyWORKERreadonly

Description

jsdoc/objects/d2d.js:374
Description: string

Description string for this effect.

propertyWORKERreadonly

InputCount

jsdoc/objects/d2d.js:382
InputCount: number

Get/Set input count for effect.

propertyWORKERreadonly

Name

jsdoc/objects/d2d.js:366
Name: string = ""

Human-readable name of effect.

methodWORKER

GetInput

jsdoc/objects/d2d.js:412
GetInput(index)

Returns the bitmap currently connected to the specified input, or null when the input does not contain a bitmap.

Parameters

NameTypeDescription
indexnumber

Index of effect input

Returns

?D2DBitmap
methodWORKER

GetPropertyType

jsdoc/objects/d2d.js:451
GetPropertyType(index)

Parameters

NameTypeDescription
indexnumber

Index of effect property. See Effects

Returns

D2DEffectPropertyType —

See D2DEffectPropertyType

methodWORKER

GetValue

jsdoc/objects/d2d.js:474
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

methodWORKER

GetValueByName

jsdoc/objects/d2d.js:482
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

methodWORKER

SetInput

jsdoc/objects/d2d.js:390
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);
}
methodWORKER

SetInputEffect

jsdoc/objects/d2d.js:421
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);
}
methodWORKER

SetValue

jsdoc/objects/d2d.js:458
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

methodWORKER

SetValueByName

jsdoc/objects/d2d.js:466
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