【原创】web画图工具ShotGraph攻略
来源:互联网 发布:windows计数器 编辑:程序博客网 时间:2024/06/05 12:45
5iChina.Net原创,尊重知识
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 基本知识
通过你的程序创建的ShotGraph对象的实例大部分都有图像空间(imagespace), 图像空间是一种用来存储ShotGraph对象创建的数据结构,而ShotGraph对象控制和操作图像的数据。因此,如果你想用ShotGraph来创建或者操作图像文件,就应当创建图像空间。
创建的对象最多有两个图像空间。一个是首要图像空间(primary imagespace),另外一个就是次要图像空间(secondary imagespace)。首要图像空间由CreateImage方法创建。事实上,这个方法可以在几乎所有的script脚本中可以调用。
次要图像空间,也叫‘本地粘贴板(local clipboard)’由InitClipboard方法创建。次要图像空间作为一个缓存来保持图像的整体或者部分地转换,例如:拷贝、伸展、透明等操作。
画图要使用首要图像空间和次要图像空间来,从已经存在的图片中装载,只需要使用首要图像空间的GifImage,JpegImage等方法。
Step by step
这是一个图像创建的基本功能: 写文本,基本图形等等.
- 首先建立一个对象 "shotgraph.image".
- 调用 CreateImage 方法定义必要的首要图像空间大小。
- ReadImage. 用ReadImage 方法调用一个已经存在的图像到首要图像空间中作为背景。
- 调用 SetColor 方法来定义颜色。
- FillRect 方法用来清除图像空间。
- 调用必要的方法来画图.
- 调用GifImage (JpegImage etc.) 方法来写文件
VBScript 中的代码:
'Creating the object
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中的代码:
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
Perl中的代码:
$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")
api大全
http://www.shotgraph.com/api.htm
组件下载地址
http://www.shotgraph.com/download.htm
注意:如果要用到ShotGraph的全部功能,就要money了,不过基本的功能,应该可以满足大家的大部分需求了。呵呵。。。
更多内容可以参看网站
http://www.shotgraph.com/
- 【原创】web画图工具ShotGraph攻略
- 推荐一款web画图工具
- [C#]画图全攻略
- [C#]画图全攻略
- word画图攻略
- 画图工具
- 画图工具
- 画图工具
- 画图工具
- 画图(原创)
- ShotGraph例程
- MediaPlayer9 ActiveX 攻略(原创)
- ASP.NET画图全攻略
- Java矢量画图工具
- Java矢量画图工具
- GNUPLOT画图工具
- mfc笔记-画图工具
- 论文画图工具
- 时间管理1
- 骗术大全
- 4-19毕业设计
- 手机,见证我们的爱情
- 嵌套事务的问题
- 【原创】web画图工具ShotGraph攻略
- 推荐参考图书, 杂志和网站
- 谁知道window核心编程哪些书最好!
- TextBox中只输入数字的方法
- Windows平台下简单运行Java程序的方法
- ASP常用函数表
- 一只特立独行的猪
- 爱国热贴
- 收藏 的一些 正则表达式