Sets the drawing stroke for points and lines in subsequent ColdFusion images.
imageSetDrawingStroke(name [, attributecollection])
→ returns void
someImage.setDrawingStroke(attributecollection)
This example shows how to create an attribute collection for the imageSetDrawingStroke function and draws a line with those attributes.
<!--- Use the imageNew function to create a ColdFusion image. --->
<cfset myImage=imageNew("",200,200)>
<!--- Create an attribute collection to pass to the imageSetDrawingStroke function. Create a stroke that is 10-pixels wide, has round endcaps, and has a dash pattern of (8,4). --->
<cfset attr = structNew()>
<cfset attr.width = 2>
<cfset attr.endcaps = "round">
<cfset dashPattern = arrayNew(1)>
<cfset dashPattern[1] = 8>
<cfset dashPattern[2] = 4>
<cfset attr.dashArray = dashPattern>
<!--- Apply the attribute collection to the imageSetDrawingStroke function for the image. --->
<cfset imageSetDrawingStroke(myImage,attr)>
<!--- Draw a line on the ColdFusion image with the drawing stroke attributes. --->
<cfset imageDrawLine(myImage,20,20,40,150)>
<!--- Display the image in a browser. --->
<cfimage source="#myImage#" action="writeToBrowser">
CF 11+ Lucee 4.5+ Create a new image. With the new image draw a 'W' with a dashed line stroke
lineAttributes = { width="2", endcaps="round", dashArray=[8,4]};
imgObj = imageNew("",152,152,"rgb","149c82");
imgObj.setDrawingStroke(lineAttributes);
imgObj.drawLines([0,38,76,114,152],[0,152,0,152,0],"no","no");
cfimage(action="writeToBrowser", source=imgObj);
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.