4D v14

SVG_Filter_Blend

Home

 
4D v14
SVG_Filter_Blend

SVG_Filter_Blend 


 

SVG_Filter_Blend ( filterRef ; picture ; backgroundPict {; mode {; name}} ) -> Function result 
Parameter Type   Description
filterRef  SVG_Ref in Reference of filter
picture  String in Picture source
backgroundPict  String in Background picture source
mode  String in Mixing mode
name  String in Target of filter primitive
Function result  SVG_Ref in Reference of primitive

The SVG_Filter_Blend command sets a blend filter for the filterRef filter and returns its reference. If filterRef is not a filter reference, an error is generated.

This filter is made up of two sources, backgroundPict and picture, with the help of the mixing modes currently used by the imaging software.

The optional mode parameter can be used to set the combination mode of the pixels used for the blend (see the specification). Its value must be: "normal" (default value), "multiply", "screen", "darken" or "lighten".

The optional name parameter is the name, if any, assigned to the result of this filter primitive.

Note: Under Windows, this command requires the prior disabling of Direct2D (see the Direct2D disabled constant in the description of the SET DATABASE PARAMETER command).

Example  

In a form, we display two identical SVG pictures then we create a "blend" filter and assign to the one on the right. This filter is a combination of the "offset" and "blur" filters:

 $root:=SVG_New(400;400;"filters test") //definition of first (left) picture
 $rect:=SVG_New_rect($root;10;10;380;100;0;0;"darkblue";"white";1)
 SVG_SET_FILL_BRUSH($root;"orange")
 $textAreaRef:=SVG_New_textArea($root;"Hello World!";10;10;380;100;"arial";60;Normal;Align center)
 <>pict1:=SVG_Export_to_picture($root//display first picture
 
 $root2:=SVG_New(400;400;"filters test") //definition of identical (right) picture
 
  //create filter
 $filter:=SVG_Define_filter($root2;"MyShadow")
 $vGraph:=True //applied on graphic layer - pass False to apply to the alpha layer
 If($vGraph)
    $ref1:=SVG_Filter_Blur($filter;2;"sourceGraphic";"blurResult") //"blurResult" will be used as the "input" of the offset filter
 Else
    $ref1:=SVG_Filter_Blur($filter;2;"sourceAlpha";"blurResult") //"blurResult" will be used as the "input" of the offset filter
 End if
  //Adding offset filter
 $ref2:=SVG_Filter_Offset($filter;5;5;"blurResult";"alphaBlurOffset")
  //Adding blend filter
 $ref3:=SVG_Filter_Blend($filter;"sourceGraphic";"alphaBlurOffset";"normal";"finalFilter";)
 
 $rect2:=SVG_New_rect($root2;10;10;380;100;0;0;"darkblue";"white";1)
 SVG_SET_FILL_BRUSH($root2;"orange")
 $textAreaRef2:=SVG_New_textArea($root2;"Hello World!";10;10;380;100;"arial";60;Normal;Align center)
 
 SVG_SET_FILTER($textAreaRef2;"MyShadow") //apply final filter
 <>pict2:=SVG_Export_to_picture($root2//display second picture

Result (blur input filter = sourceGraphic):

Result (blur input filter = sourceAlpha):

 
PROPERTIES 

Product: 4D
Theme: Filters
Number: 65923

Windows specific

 
HISTORY 

Created: Composant 4D SVG v11.3

 
SEE ALSO 

SVG_Filter_Blur
SVG_Filter_Offset

 
ARTICLE USAGE

4D SVG Component ( 4D v13)
4D SVG Component ( 4D v12)
4D SVG Component ( Composant 4D SVG v11.4)
4D SVG Component ( 4D v14 R2)
4D SVG Component ( 4D v14)
4D SVG Component ( 4D v14 R3)
4D SVG Component ( 4D v14 R4)