shotgraph 能在以下的环境中使用:
- visual basic
- vbscript
- visual basic for applications (vba), word, excel, etc.
- active server pages (asp) engine with internet information server
- perl for windows
- others
shotgraphcool代码:
我们来先来简单的:
step by step
- 首先建立一个对象 "shotgraph.image".
- 使用 createimage 方法。
- 使用 setcolor 方法一次或者多次来定义画图要使用的颜色。
- 清除你图区中的所有内容,必要时使用 fillrect 普遍认为方法.
- 使用有效的方法画图.
- 使用 gifimage 函数. 你的图画就完成了!
下面的是一个简单的例子来说怎样用 shotgraph画图。the size of the image is 201×201. |
vbscript 中的代码:
creating the objectset obj=createobject("shotgraph.image")size=201calling the createimage methodobj.createimage size,size,4set 4 colors for drawingobj.setcolor 0,255,255,255obj.setcolor 1,0,0,0obj.setcolor 2,255,108,0obj.setcolor 3,0,0,204crearing the painting area with color 0obj.setbgcolor 0obj.fillrect 0,0,size-1,size-1color 0 will be used for drawingobj.setdrawcolor 1drawing the lineobj.line size-1,0,0,size-1color 2 will be used for fillingobj.setbgcolor 2draw the big circleobj.ellipse 5,5,size-6,size-6color 2 will be used for fillingobj.setbgcolor 3draw the small circleobj.ellipse 5,(size-5)/4,size/2,(size-5)*3/4create the image file named test.gifobj.gifimage 0,1,"test.gif"
下面是在asp和perl中的代码:
response.contenttype="image/gif"set obj=server.createobject("shotgraph.image")size=201obj.createimage size,size,4obj.setcolor 0,255,255,255obj.setcolor 1,0,0,0obj.setcolor 2,255,108,0obj.setcolor 3,0,0,204obj.setbgcolor 0obj.fillrect 0,0,size-1,size-1obj.setdrawcolor 1obj.line size-1,0,0,size-1obj.setbgcolor 2obj.ellipse 5,5,size-6,size-6obj.setbgcolor 3obj.ellipse 5,(size-5)/4,size/2,(size-5)*3/4img=obj.gifimage(0,1,"")response.binarywrite img
|
$obj=createobject("shotgraph.image")$size=201$obj->createimage($size,$size,4)$obj->setcolor(0,255,255,255)$obj->setcolor(1,0,0,0)$obj->setcolor(2,255,108,0)$obj->setcolor(3,0,0,204)$obj->setbgcolor(0)$obj->fillrect(0,0,$size-1,$size-1)$obj->setdrawcolor(1)$obj->line($size-1,0,0,$size-1)$obj->setbgcolor(2)$obj->ellipse(5,5,$size-6,$size-6)$obj->setbgcolor(3)$obj->ellipse(5,($size-5)/4,$size/2,($size-5)*3/4)$obj->gifimage(0,1,"test.gif")
|
