Returns the color at a particular point on the canvas.



outColor = Canvas.GetColor(inPoint)


Name   Type   Description


The point to be sampled.

This value is represented as a comma delimited string.



The color at the point.

This value is returned as a standard comma delimited color string.



You may wish to find the color of the Canvas at a particular point. Pass in a point and this function will return the color.


See Also

Specifying Colors.
XColor object.



Set ca = Server.CreateObject("ImageGlue7.Canvas")
ca.Width = 200
ca.Height = 200
myparams = " Size=100,100 Operation=both"
ca.DrawShape "rect", "Pos=0,0 PaintColor=red PenColor=red" & myparams
ca.DrawShape "rect", "Pos=100,0 PaintColor=green PenColor=green" & myparams
ca.DrawShape "rect", "Pos=0,100 PaintColor=blue PenColor=blue" & myparams
ca.DrawShape "rect", "Pos=100,100 PaintColor=yellow PenColor=yellow" & myparams
ca.SaveAs Server.MapPath("getcolor.gif"), ""
Response.Write("Top Left Color is " & ca.GetColor("50,50") & "<br>" & vbCrLf)
Response.Write("Top Right Color is " & ca.GetColor("150,50") & "<br>" & vbCrLf)
Response.Write("Bottom Left Color is " & ca.GetColor("50,150") & "<br>" & vbCrLf)
Response.Write("Bottom Left Color is " & ca.GetColor("150,150") & "<br>" & vbCrLf)

The graphics file and text output that this produces is shown below. Note that the names of colors map onto what might be described as a typical value rather than a 100% saturated value. For instance green is not a 100% saturated green with no other components (this looks rather garish) but a rather more typical green color.


Top Left Color is 86.7,3.1,2.4,0.0
Top Right Color is 0.0,39.2,6.7,0.0
Bottom Left Color is 0.0,0.0,83.1,0.0
Bottom Left Color is 98.8,95.3,2.0,0.0