for(unsigned int index_Y = 0; index_Y < ddsd.dwHeight;index_Y++)
{
for(unsigned int index_X = 0; index_X < ddsd.dwWidth;index_X++)
{
UCHAR Blue = (BitmapData.Buffer[index_Y*ddsd.dwWidth*3 + index_X*3+0]);
UCHAR Red = (BitmapData.Buffer[index_Y*ddsd.dwWidth*3 + index_X*3+1]);
UCHAR Green = (BitmapData.Buffer[index_Y*ddsd.dwWidth*3 + index_X*3+2]);
//Assemble the pixel
DWORD Pixel = _RGB32BIT(0,Red,Green,Blue);
//write the data
Surface[index_X + (index_Y*ddsd.lPitch >> 2)] = Pixel;
}//end for index_x
}//end for index_y
a really dumb question i'm sure, but...
whats wrong with this loop?
BitmapData.Buffer is some memory that has a bitmap file in it.
it compiles and runs, but the bitmap turns out to be a sort of an off white with one pixel missing at the top.
any help?
thanks in advance.
--MattS423
EDIT: I kan't spell
[edited by - MattS423 on November 17, 2002 9:14:49 PM]
Programmers of the world, UNTIE!
This could completely prove my ignorance (...though I hope not), but don''t you need a semicolon after a "for" statement? For example:
for (arg){loop stuff};
Lol, I hope I didn''t just make a complete idiot of myself.
~del
for (arg){loop stuff};
Lol, I hope I didn''t just make a complete idiot of myself.
~del
~del
Nope you don''t, unless you have a single statement instead of the code block.
ie:
ie:
// Thisfor() { statement;}// or this:for() statement;
Are the pixels padded to 4 bytes instead if 3?
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
BitmapData.BitmapInfoHeader.biBitCount == 24
i padded it to 32 bpp in the RGB32BIT thing.
i think this should work...i don''t know why it doesn''t.
i padded it to 32 bpp in the RGB32BIT thing.
i think this should work...i don''t know why it doesn''t.
Programmers of the world, UNTIE!
Your red and green pixels are flipped. In the bitmap format, pixels are stored GRB. Or if it is an internal storage mechanism, they will either be stored RGBA or ARGB or BGRA or ABGR. Green is always in the middle of red and blue, unless some user defined his own format.
Make it work, then
make it fast.
"I’m happy to share what I can, because I’m in it for the love of programming. The Ferraris are just gravy, honest!" --John Carmack: Forward to Graphics Programming Black Book
Make it work, then
make it fast.
"I’m happy to share what I can, because I’m in it for the love of programming. The Ferraris are just gravy, honest!" --John Carmack: Forward to Graphics Programming Black Book
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][LWJGL Tutorials for NeHe][LWJGL Wiki][jMonkey Engine]
well, there would still be SOME type of image there right?
well, it''s pretty fast, but it sure doesn''t work.
quote:
Make it work, then
make it fast.
well, it''s pretty fast, but it sure doesn''t work.
Programmers of the world, UNTIE!
I would really like to know why this doesn''t work. thanks.
Programmers of the world, UNTIE!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement