RSS
热门关键字:  下载  cms  模版  开源  dedecms
当前位置 :| 主页 > 站长学院 > ASP/VbScript >

ShotGraph普通的画图的原理

来源:互联网 作者:未知 时间:2005-02-13 Tag: 点击:
ShotGraph普通的画图的原理

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


ShotGraph size=3>COOL代码:


  • href="http://www.aspcn.com/aspcn.asp?title=shotgrap_upload">上载文件
  • href="http://www.aspcn.com/aspcn.asp?title=shotgrah_counter">计数器
  • href="http://www.aspcn.com/aspcn.asp?title=shotgrah_gif">画GIF动画图形
  • href="http://www.aspcn.com/aspcn.asp?title=shotgrah_draw">画图形


我们来先来简单的:


Step by step



  1. 首先建立一个对象 "shotgraph.image".
  2. 使用 href="http://www.aspcn.com/aspcn.asp?title=shotgraph_createimage">CreateImage
    方法。
  3. 使用 href="http://www.aspcn.com/aspcn.asp?title=shotgraph_setcolor"
    ?>SetColor 方法一次或者多次来定义画图要使用的颜色。
  4. 清除你图区中的所有内容,必要时使用 href="http://www.aspcn.com/aspcn.asp?title=shotgraph_setcolor">FillRect
    普遍认为方法.
  5. 使用有效的方法画图.
  6. 使用 href="http://www.aspcn.com/aspcn.asp?title=shotgraph_gifimage">GifImage
    函数. 你的图画就完成了!






下面的是一个简单的例子来说怎样用 shotgraph画图。

The size of the image is 201x201.



VBScript 中的代码:


set obj=CreateObject("shotgraph.image")

size=201
'Calling the CreateImage method
obj.CreateImage size,size,4

'Set 4 colors for drawing
obj.SetColor 0,255,255,255
obj.SetColor 1,0,0,0
obj.SetColor 2,255,108,0
obj.SetColor 3,0,0,204

'Crearing the painting area with color 0
obj.SetBgColor 0
obj.FillRect 0,0,size-1,size-1

'Color 0 will be used for drawing
obj.SetDrawColor 1
'Drawing the line
obj.Line size-1,0,0,size-1
'Color 2 will be used for filling
obj.SetBgColor 2
'Draw the big circle
obj.Ellipse 5,5,size-6,size-6
'Color 2 will be used for filling
obj.SetBgColor 3
'Draw the small circle
obj.Ellipse 5,(size-5)/4,size/2,(size-5)*3/4

'Create the image file named test.gif
obj.GifImage 0,1,"test.gif"




下面是在ASP和PERL中的代码:
asp

$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")


最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册
热点关注
相关文章