KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Creating a opaque effect to a picture
PRODUCT: 4D | VERSION: 16 | PLATFORM: Mac & Win
Published On: November 22, 2017

Here is a utility method to create q opaque effect on a picture:

// ----------------------------------------------------------------------
// Name: OPAQUE_EFFECT_TO_PICTURE
// Description: Method will convert a picture to have a opaque effect.
//
// Parameters:
// $1 (PICTURE) - Input of the picture
//
// Output:
// $0 (PICTURE) - Picture that has the opaque effect
// ----------------------------------------------------------------------
C_PICTURE($1;$picture)
C_PICTURE($0;$output)
C_TEXT($svg;$svgNewRect)
C_LONGINT($widthP;$heightP)

$picture:=$1

PICTURE PROPERTIES($picture;$widthP;$heightP)
$svg:=SVG_New
$svgNewRect:=SVG_New_rect ($svg;0;0;$widthP;$heightP)
SVG_SET_OPACITY ($svgNewRect;60;-1)
SVG EXPORT TO PICTURE($svg;$output;Copy XML data source)

$0:=$picture & $output


Here is an example of using the method with this picture:



C_Picture($pic)

$pic:=OPAQUE_EFFECT_TO_PICTURE($pic)