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
| Name | Type | Description |
CLSID | string | CLSID of Direct2D effect. See Effects for effects' CLSID. |
CLSID: string = ""
Description: string
Description string for this effect.
InputCount: number
Get/Set input count for effect.
Name: string = ""
Human-readable name of effect.
GetInput(index)
Returns the bitmap currently connected to the specified input, or null when the input does not contain a bitmap.
Parameters
| Name | Type | Description |
index | number | Index of effect input |
GetPropertyType(index)
Parameters
| Name | Type | Description |
index | number | Index of effect property. See Effects |
GetValue(index)
Gets effect property value by index.
Parameters
| Name | Type | Description |
index | number | Index of input property. See Effects |
GetValueByName(name)
Gets effect property value by name.
Parameters
| Name | Type | Description |
index | number | Index of input property. See Effects |
SetInput(index, bitmap, invalidate)
Parameters
| Name | Type | Description |
index | number | Index of effect input |
bitmap | D2DBitmap | Input image |
invalidate = trueoptional | boolean | 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);
}
SetInputEffect(index, effect, invalidate)
Parameters
| Name | Type | Description |
index | number | Index of effect input |
effect | D2DEffect | Input effect |
invalidate = trueoptional | boolean | 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);
}
SetValue(index, value)
Sets the corresponding property by index.
Parameters
| Name | Type | Description |
index | number | Index of input property. See Effects |
value | Object | Property value of corresponding type. See D2DEffectPropertyType |
SetValueByName(name, value)
Sets the corresponding property by name.
Parameters
| Name | Type | Description |
name | string | Index of input property. See Effects |
value | Object | Property value of corresponding type. See D2DEffectPropertyType |