Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 selecting only a part of a bitmap
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
GillaMobster




PostPosted: Sun Oct 24, 2004 5:53 pm   Post subject: 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?
Sponsor
Sponsor
Sponsor
sponsor
Delos




PostPosted: Sun Oct 24, 2004 6:21 pm   Post subject: (No subject)

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!

code:

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.

code:

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.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: