日期:2008-08-11 浏览次数:21099 次
下面的是一个简单的例子来说怎样用 shotgraph画图。The size of the image is 201x201. |
'Creating the objectset obj=CreateObject("shotgraph.image")size=201'Calling the CreateImage methodobj.CreateImage size,size,4'Set 4 colors for drawingobj.SetColor 0,255,255,255obj.SetColor 1,0,0,0obj.SetColor 2,255,108,0obj.SetColor 3,0,0,204'Crearing the painting area with color 0obj.SetBgColor 0obj.FillRect 0,0,size-1,size-1'Color 0 will be used for drawingobj.SetDrawColor 1'Drawing the lineobj.Line size-1,0,0,size-1'Color 2 will be used for fillingobj.SetBgColor 2'Draw the big circleobj.Ellipse 5,5,size-6,size-6'Color 2 will be used for fillingobj.SetBgColor 3'Draw the small circleobj.Ellipse 5,(size-5)/4,size/2,(size-5)*3/4'Create the image file named test.gifobj.GifImage 0,1,"test.gif"
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") |