Computer Science Canada

how to import images

Author:  ilovelolli [ Fri Jun 02, 2006 2:30 pm ]
Post subject:  how to import images

hey i was wondering how to import images thats on ur hard drive

code:

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)


i know its like that but i dont know what numberrs go where and such,

can someone help me out

Author:  Cervantes [ Fri Jun 02, 2006 3:27 pm ]
Post subject: 

If you want an answer, you'll need to ask a question.

You're first sentance indicates that you don't know about Pic.FileNew, yet the code you show says you do.

Author:  HellblazerX [ Fri Jun 02, 2006 5:04 pm ]
Post subject: 

Actually, Cervantes, that's the example given in the Turing help manual, so he's probably asking how that piece of code works. Well, you really only need one of the parts:
code:
var picID : int
picID := Pic.FileNew ("mypic.bmp")

You use Pic.FileNew to load up a new picture from the hard drive, and then store in an int variable. The other parts are just to randomly draw the image in different positions.

Author:  ilovelolli [ Fri Jun 02, 2006 5:46 pm ]
Post subject: 

well where do u put the x and y co-ordinates then?

Author:  Dan [ Fri Jun 02, 2006 6:01 pm ]
Post subject: 

ilovelolli wrote:
well where do u put the x and y co-ordinates then?


You only need x and y co-ordiantes when drawing the pic to the screen using Pic.Draw.

code:

Pic.Draw (picID, x, y, picCopy)


Where x is where the x co-ordinate goses and y is where the y one goses.


: