Documentation/D2DEffect
classWORKER

D2DEffect

js/d2d.js:350
D2DEffect(CLSID)

Creates Direct2D effect.

Direct2D versions earlier than 1.1 are not supported.
Minimum OS requirements: Windows 8+ or Windows 7 Service Pack 1 with the Platform Update for Windows 7 installed.

Parameters

NameTypeDescription
CLSIDstring

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

propertyWORKERreadonly

CLSID

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

CLSID of this effect.

propertyWORKERreadonly

Description

js/d2d.js:376
Description: string

Description string for this effect.

propertyWORKERreadonly

InputCount

js/d2d.js:384
InputCount: number

Get/Set input count for effect.

propertyWORKERreadonly

Name

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

Human-readable name of effect.

methodWORKER

GetInput

js/d2d.js:414
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

js/d2d.js:453
GetPropertyType(index)

Parameters

NameTypeDescription
indexnumber

Index of effect property. See Effects

Returns

D2DEffectPropertyType —

See D2DEffectPropertyType

methodWORKER

GetValue

js/d2d.js:476
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

js/d2d.js:484
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

js/d2d.js:392
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

js/d2d.js:423
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

js/d2d.js:460
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

js/d2d.js:468
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