Skip to main content
GameDev.net gamedev.net
🔒 Locked

Ripping Apart Bitmaps

Started by andyb716 Jul 12, 2004 at 3:12 PM 0 replies 450+ views
Original Post
andyb716
andyb716
I'm quite new to graphics, and I've seen code that takes one bitmap with, lets say number or letters on it, or even different animations, and they only display one area of the bitmap. I've seen it on the web with languages like &#106avascript. And i've seen it when people make a font class in c++. My question is do they just say display a part of the image? What would be the theory to do that, in any language?
Scorpion
Scorpion
Well if you have the bitmap in some array with color value's the code would be something like:

for (int y=0; y for (int x=0; x {
int c = bmp.color[y * bmp.width + x];
putpixel(x, y, c);
}

by adjusting the start value (0) or endvalue (height / width) you can draw a small part of the bitmap

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.