A component for drawing (Gao graph, bar chart, various shape image components)

Source: Internet
Author: User
Tags definition textout
Pie chart Why say is a good thing, everyone look at the following introduction to know
The component has two versions, one is a registered version, and one is a non-registered version
Non-registered version features: (although unregistered, but can always use the Oh, this is also a

What I strongly recommend for one of the reasons)
1. Graphics files can be generated in JPEG format
2. A graphic file that produces transparent GIF format
3. Graphic files that can be generated in interlaced GIF format
4. There are two ways to save a graphics file: One is to generate a graphic file directly
The other is to save it in an array and output it directly to the WWW page.
5. You can draw text graphics and support the text of any font installed on your machine
6. You can export and preview documents generated by OLE service programs, such as Ms Word,excel, and so on.
7. You can use bitmaps to freely zoom, mirror, rotate, and cut graphics
8. You can use the local graphics cache
9. Can zoom pictures
10. Can get more information on any JPEG, GIF, BMP format file
11. Can do Windows grab screen
12. Animated GIF can be generated
The non-registered version is limited as follows:
1. You can only use up to 8 colors, but I think it's not a limit for most people,

Oh
2. The maximum graphic size that can be generated is 320x240
If it is a registered version:
13. Available to modify existing GIF, JPEG, and BMP files online
14. Customizable palette
15. Loop-screened GIF animation

Example program:
Examples of VBScript:

Set 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"
Example code for 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

So how to draw the animation, the steps are as follows:
1.Create a "Shotgraph.image" object
2. Just draw something and see your idea.
3. Call the Trackadd function
4. Repeat 2, 3 steps to know the number you want.
5. If you want to repeat the animation, call the Trackloop method, but only the registered version has this feature
6. Invoke the Trackplay method to generate this dynamic file
The example code is as follows:
Set Obj=createobject ("Shotgraph.image")
xsize=400
Ysize=50

Obj. CreateImage xsize,ysize,256
Obj. Initclipboard xsize,ysize*2
Obj. Selectclipboard True
Obj. Readimage "Frame1.gif", pal1,0,0
Obj. Readimage "Frame2.gif", pal2,0,ysize
Obj. Buildpalette 0

Obj. Copy 0,0,xsize,ysize,0,0, "Srccopy"
Obj. trackadd-1,0,0,0,0,xsize,ysize,50
Obj. Copy 0,0,xsize,ysize,0,ysize, "Srccopy"
Obj. trackadd-1,0,0,0,0,xsize,ysize,50

Obj. Trackloop 0
Obj. Trackplay "Frames12.gif"

How to draw the text, hehe, the process is as follows:
When used, note fontsmoothing this property:
It is used to define whether the text is anti aliased.
0-Use system default settings
1-Anti-alias
2-Anti-aliasing
The code is as follows:

<%
Response.contenttype= "Image/gif"
Set g=createobject ("Shotgraph.image")
G.createimage 320,200,16
G.setcolor 0,255,255,255
G.setcolor 1,0,0,0
G.setbgcolor 0
G.settextcolor 1
G.fillrect 0,0,320,200
G.fontsmoothing=1
G.createfont "Arial", 0,42,0,true,false,false,false
G.textout 0,30, "non-antialiased"
g.fontsmoothing=2
G.createfont "Arial", 0,42,0,true,false,false,false
G.textout 0,120, "antialiased"
G.buildpalette 2
Response.BinaryWrite G.gifimage ( -1,0, "")
%>

Download Address:
http://download.proxy.ru/mike/shotgraph/
http://www.geocities.com/SiliconValley/Foothills/9219/shotgraph/
--------------------------
Above excerpted from www.Chinaasp.com

Through this article, we can understand that the key is to output data before the need to explicitly output a file class

Definition of the type.
This way the browser will know that you are not sending text but pictures, or other things, such as sound, movies.


Response.contenttype= "image/gif"/output file type

...//Here you can replace the read into the hard drive picture file binary data

Response.BinaryWrite G.gifimage ( -1,0, "")//Picture data can be replaced by writing to your two
In-process data

...


--------------------------
Above excerpted from www.Chinaasp.com

Through this article, we can understand that the key is to output data before the need to explicitly output a file class
Definition of the type.
Response.contenttype= "Image/gif"//File type
.....
Response.BinaryWrite G.gifimage ( -1,0, "")//Picture data

So the browser will know that you sent over the text is not a picture, or something else, such as sound, movie.



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.