Shotgraph the principle of ordinary drawing

Source: Internet
Author: User
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 Internet information Server
    • Perl for Windows
    • Others

Shotgraph CoolCode:
    • Uploading files
    • Counter
    • Draw an animated GIF graphic
    • Draw graphics

Let's start with a simple: Step by step
    1. First, establish an object "Shotgraph.image".
    2. Use the createimage method.
    3. Use the SetColor method One or more times to define the colors to use for paint.
    4. Clears all content in your plot, using FillRect generally considered method if necessary.
    5. Use a valid method for drawing.
    6. Use the Gifimage function. Your picture is done!

Here is a simple example of how to paint with shotgraph.


The size of the image is 201x201.

Code in VBScript:

' 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 is used for drawingobj. Setdrawcolor 1 ' Drawing the lineobj. Line Size-1,0,0,size-1 ' Color 2 is used for fillingobj. Setbgcolor 2 ' Draw the big circleobj. Ellipse 5,5,size-6,size-6 ' Color 2 is 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"

The following are the code in ASP and Perl:

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



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.