SetPixel

The SetPixel function sets the pixel at the specified coordinates to the specified color.

SetPixel nX, nY, nColor

Parameters

nX
Specifies the x-coordinate, in pixels, of the point to be set.

nY
Specifies the y-coordinate, in pixels, of the point to be set.

nColor
Specifies the color to be used to paint the point.

Remarks

This function is very slow. Use it only to set separate pixels on the picture. To set a number of pixels use FillRect function.

Example
View result

<%@ Language=VBScript %>
<%
Response.ContentType="image/gif"
set obj=Server.CreateObject("shotgraph.image")

' This example requires a lot of time
' because SetPixel function called a great amount of times.
size=100
obj.CreateImage size,size,256
obj.SetColor 0,255,255,255
obj.SetBgColor 0
obj.FillRect 0,0,size-1,size-1
for i=1 to size-2
	for j=1 to size-2
		obj.SetColor 1,(i-1)*255/size,0,(j-1)*255/size
		obj.SetPixel i,j,1
	next
next
obj.BuildPalette 1

img=obj.GifImage(-1,1,"")
Response.BinaryWrite(img)
%>