Computer Science Canada

Saving?

Author:  wrectify [ Tue Jun 03, 2003 1:07 pm ]
Post subject:  Saving?

I have made a paintbrush type program and i was wondering how to save the picture. Can anyone help me?

Author:  Andy [ Tue Jun 03, 2003 2:09 pm ]
Post subject: 

i'm not sure, but i don't think you can

Author:  Tony [ Tue Jun 03, 2003 2:38 pm ]
Post subject: 

yeah you can. You can save picture using Pic.New(x1,y1,x2,y2)

then there's some command to save that variable as a bmp file, but I dont know the exact syntax. Pic.something

Author:  Asok [ Tue Jun 03, 2003 4:31 pm ]
Post subject: 

it's Pic.Save

code:
% Program to save a picture in mypic.bmp
        var picID: int
        var x, y : int
        Draw.FillBox (50, 50, 150, 150, red)
        Draw.FillStar (50, 50, 150, 150, green)
        Draw.FillOval (100, 100, 50, 50, blue)
        picID := Pic.New (50, 50, 150, 150)
        Pic.Save (picID, "mypic.bmp")
        Pic.Free (picID)


        % Program to load the picture back again and draw 50 copies
        var picID: int
        var x, y : int
       
        picID := Pic.FileNew ("mypic.bmp")
        for i : 1 .. 50
            x := Rand.Int (0, maxx)     % Random x
            y := Rand.Int (0, maxy)     % Random y
            Pic.Draw (picID, x, y, picCopy)
        end for
        Pic.Free (picID)

Author:  wrectify [ Wed Jun 04, 2003 12:53 pm ]
Post subject: 

Yo thanks alot Asok you helped out quite a bit


: