"Original" Web Drawing tools shotgraph Raiders __web

Source: Internet
Author: User

5ichina.net Original, Respect knowledge

Shotgraph can be used in the following environments: Visual Basic VBScript Visual Basic for Applications (VBA), Word, Excel, etc. Active Server Pages (ASP) engine with the Internet information Server Perl for Windows others

shotgraph Basic Knowledge

Most instances of Shotgraph objects created by your program have an image space (Imagespace), which is a data structure used to store Shotgraph object creation, while Shotgraph objects control and manipulate the data of the image. Therefore, if you want to use Shotgraph to create or manipulate image files, you should create an image space.

The object created has a maximum of two image spaces. One is the primary image space (primary imagespace) and the other is the secondary image space (secondary imagespace). The primary image space is created by the CreateImage method. In fact, this method can be called in almost all script scripts.

The secondary image space, also known as the ' local pasteboard (native clipboard) ', is created by the Initclipboard method. The secondary image space acts as a cache to maintain the overall or partial conversion of the image, such as copying, stretching, transparency, and so on.

To use the primary image space and the secondary image space to load from an already existing picture, you only need to use methods such as gifimage,jpegimage of the primary image space. Step by Step

This is a basic feature of image creation: Writing text, basic graphics, and so on. First set up an object "Shotgraph.image".  Call the CreateImage method to define the necessary primary image space size. readimage. Use the readimage method to invoke an existing image into the primary image space as the background. Call the SetColor method to define the color. The FillRect method is used to clear the image space. Call the necessary methods to draw. Call Gifimage (Jpegimage etc) method to write the file

the code in 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 'll be used for drawing
Obj. Setdrawcolor 1
' Drawing the line
Obj. Line Size-1,0,0,size-1
' Color 2 'll be used for filling
Obj. Setbgcolor 2
' Draw The Big circle
Obj. Ellipse 5,5,size-6,size-6
' Color 2 'll 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"


code in asp:

Response.contenttype= "Image/gif"
set Obj=server.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

img=obj. Gifimage (0,1, "")
response.binarywrite img
The code in 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 Daquan
Http://www.shotgraph.com/api.htm

Component Download Address
Http://www.shotgraph.com/download.htm

Note: If you want to use the full functionality of the shotgraph, it will be money, but the basic functions, should be able to meet the majority of the needs of everyone. Oh...

More content can be found on the website
http://www.shotgraph.com/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.