Description
Create a new translucent image with given percentage of translucence.
Returns
Image object
History
ColdFusion 10: Added this function
Syntax
imageMakeTranslucent ( img , percent__)
Properties
Parameter
|
Description
|
img
|
Required. The ColdFusion image on which this operation is performed.
|
percentage
|
Required. The percent of translucence:
- 0 = opaque
- 100 = transparent
Decimal values are supported.
|
Example
The following example illustrates three images with the second one translucent than first and the thrid one translucent than the second.
<cfset myImage=ImageNew("",200,110)>
<!--- Set the drawing color to green. --->
<cfset ImageSetDrawingColor(myImage,"green")>
<!--- Turn on antialiasing to improve image quality. --->
<cfset ImageSetAntialiasing(myImage,"on")>
<!--- Draw a filled green oval on the image. --->
<cfset ImageDrawOval(myImage,5,5,190,100,"yes")>
<!--- Display the image in a browser. --->
<cfoutput>PNG image<br></cfoutput>
<cfset ImageWrite(myImage,"#expandpath('.')#/png.png")>
<cfset myImage = ImageRead("#expandpath('.')#/png.png")>
<cfimage source="#myImage#" action="writeToBrowser" >
<cfset x =ImageMakeTranslucent(myImage,50)>
<cfimage source="#x#" action="writeToBrowser" >
<cfset x =ImageMakeTranslucent(myImage,75)>
<cfimage source="#x#" action="writeToBrowser" >
<cfset x =ImageMakeTranslucent(myImage,100)>
<cfimage source="#x#" action="writeToBrowser" >
|