
-----------------------------------
GillaMobster
Sun Oct 24, 2004 5:53 pm

selecting only a part of a bitmap
-----------------------------------
Okay I was wondering If I could load in a bitmap, but instead of loading in th ewhole thing jus a part of it
eg
from (25,50)  to (50,75)
so a square from the 25th pixel over and the 50th pixel down to  the 50th pixel over to the 75th pixel down.
I wanted to just put all my bitmaps of a character in one bigg bitmap file and just load in a part of that bitmap.
If this can't be done can you guys think of and easy way to load in alot of bitmaps, like around 100 or 200?

-----------------------------------
Delos
Sun Oct 24, 2004 6:21 pm


-----------------------------------
Part a:

You'll need to setscreen ("offscreenonly").  Then, draw the picture onto the screen as you usually would.
Next, capture a portion of the screen using Pic.New().
Clear the screen
Draw the resultant picture from Pic.New() somewhere.
"View.Update"

Part b:

This can be done as well!  The only drawback is that you may not be able to store every single picture you draw, only a limited number of 'frames' at a time (Turing has its limitations, you know).
So, you'll create a picture.  Then draw it.  Then comes the cool part.
"Pic.Free (pictureVariableName)"
Now, create new pictures, and draw then, and repeat!


var pic : int

for i : 1 .. 1001
    pic := Pic.FileNew ("pic.bmp")
    Pic.Draw (pic, Rand.Int (-20, maxx), Rand.Int (-30, maxy), picUnderMerge)
end for


This will crash.


var pic : int

for i : 1 .. 8000
    pic := Pic.FileNew ("jag.bmp")
    Pic.Draw (pic, Rand.Int (-20, maxx), Rand.Int (-30, maxy), picUnderMerge)
    Pic.Free(pic)
end for


This will not.
