-
Slice Up A Bitmap
I have a picture of a deck of cards laid out in rows and columns. In VB6, there was a way to get a certain "cell" from that bitmap. That way, when I need a certain card, I just get some pixels from my picture that has ALL of the cards. I don't remember the name of the control that did that in VB6 but I assume there's something similar in VB2005.
What is it and how does it work?
-
Re: Slice Up A Bitmap
Image List? You need to split the images up, but you could load all 52 card images into the image list, and then when you want to access any of the you use imageList.Image[22] to get the 23rd card (the array start at 0, so imageList.Image[0] is the first card).
-
Re: Slice Up A Bitmap
How are you planning on drawing these cards?
To draw a "cell", you first figure out the height and width of each card in your sprite sheet. For example, if you have a 2x2 grid of cards, and the picture is 32x48, then you know that each card has a height of 24 pixels, and a width of 16 pixels.
Now, if you wanted to draw the bottom right card, you would tell your drawing function to start drawing from 16,24, with a width and height of 16,24.
Does that make sense?
chem
-
Re: Slice Up A Bitmap
Good suggestions so far.
BitBlt would be good for this, you can specify a source x and y position so the calculations would be as ChemicalNova stated above.
Have a look in my sig for BitBlt help.
Pino