SetBrushImage

The SetBrushImage function defines a custom image in the shotgraph imagespace, main or secondary. After such image is set, the custom brush can be created by CreateBrush function with the first parameter "BS_IMAGE".

SetBrushImage startX,startY,width,height

Parameters

startX
The x coordinate of top left corner of the image.

startY
The y coordinate of top left corner of the image.

width
Width of the image.

height
Height of the image.

Remarks

This function will define the image to use it as custom brush. The image data can be retrieved either from primary or secondary imagespace depending on which imagespace is selected. See the SelectClipboard function for details. If you want to define the custom image from external image file, you should read that image into appropriate imagespace using the ReadImage function and then call the SetBrushImage.

Example
This example uses the smile.gif file to draw the ellipse filled by smile signs. All checkings are omitted to make example simplier. The image size is 31x31.
View result

<%
Response.Contenttype="image/jpeg"
Response.Expires=0
Set g=CreateObject("shotgraph.image")
xsize=320
ysize=200
g.CreateImage xsize,ysize,4
g.SetColor 0,238,238,238
g.SetColor 1,0,0,0
g.SetBgColor 0
g.SetDrawColor 1
g.FillRect 0,0,xsize-1,ysize-1
' Create secondary imagespace
g.InitClipboard 31,31
' Make secondary imagespace active
g.SelectClipboard True
' Read image into secondary imagespace
g.ReadImage "c:\images\smile.gif",pal,0,0
' Create custom brush image from secondary imagespace
g.SetBrushImage 0,0,31,31
' Make primary imagespace active.
g.SelectClipboard False
' Set brush for primary imagespace
g.CreateBrush "BS_IMAGE",0,0
g.Ellipse 0,0,xsize-1,ysize-1
Response.BinaryWrite g.JpegImage 90,0,""
%>