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

Blitting Bitmapswith DX7

Started by Forcas Nov 24, 2000 at 3:49 PM 8 replies 400+ views
Original Post
Forcas
Forcas
When I try to blit a bitmap from one Direct Draw surface to the primary surface, it shows some colored crap. Any idea what I''m doing wrong?
-Forcas writeln("Does this actually work?");
Andre Luiz Silva
Andre Luiz Silva
If you setup DirectDraw to 256 color mode, all your bitmaps (supposing they are 16bit color) will look strange.

André Luiz Silva
"- To begin with, said the Cat, a dog's not mad. You grant that? - I suppose so, said Alice. - Well, then, - the Cat went on - you see, a dog growls when it's angry, and wags its tail when it's pleased. Now I growl when I'm pleased, and wag my tail when I'm angry. Therefore I'm mad."
norvain
norvain
Does the Blt (BltFast) Execute Correctly? Does the function return any error codes or DD_OK?

Some Possible causes are:

- Primary/Source bitmaps have not been cleared( via a Blt fill )
after init and as a result if the loaded bitmap doesnt fill the entire surface so you will get garbage on the rest of the surface.

- 16bit to 256 colors as stated before
- Bitmap loading function is creating the surface(s) incorrectly (or at worse has failed to load it at all )

- Other Evil DirectDraw Related Problems( Surface Lost, Invalid Rects, Incompatible Surface formats etc, See the DirectX SDK)

=-=-=--==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Mike Cooper(norvain) - Mythical Masterpieces

http://www.okartgallery.com
http://www.leviathan3d.com (my engine page, comming soon)

"Who says computer games affect kids,
imagine if PacMan affected us as kids,
we''d all sit around in a darkened room
munching pills and listening to repetitive music....uh oh!" -Anon

=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=Michael Cooper (Norvain)leviathan3d@hotmail.com Leviathan3D Engine/LeviathanCE PPC Enginehttp://leviathan3d.cfxweb.net
Forcas
Forcas
Blt returns DD_OK. I don''t think the Blt fill thing is my problem, since all my program does is show one bitmap. My surfaces and my bitmap are 256 colors. I blitted some red behind it and I noticed that my picture''s there, but it''s in black. It''s also badly warped.
-Forcas writeln("Does this actually work?");
Shannon Barber
Shannon Barber
Sounds like you''re using the width of the surface, instead of its pitch for pixel twiddling.

pSurfaceMemeory[y*ddsDesc.dwPitch+x] not ddsDesc.dwWidth

And if anyone has functional code use dx7 to do a solid color blt fill, I''d like to see it, I kept getting a invalid parameter error... (ended up just using memset )
The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Forcas
Forcas
Okay. Here it is:


  
void Blit(int x1, int y1, int x2, int y2, int c)
{

DDBLTFX ddbltfx;

memset(&ddbltfx, 0 ,sizeof(DDBLTFX));
ddbltfx.dwSize = sizeof(DDBLTFX);

ddbltfx.dwFillColor = c;

RECT MyRect;

MyRect.left = x1;
MyRect.top = y1;
MyRect.right = x2;
MyRect.bottom = y2;

lpddsprimary->Blt(&MyRect, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);
}


-Forcas writeln("Does this actually work?");
Forcas
Forcas
Am I the only one who didn''t get ddutil.h with their SDK? I even bought the CD. It was 7.0a, though.
-Forcas writeln("Does this actually work?");
Forcas
Forcas
Here''s my prog, just so you can see the problem.

http://www.geocities.com/kev507.geo/dd7.zip
-Forcas writeln("Does this actually work?");
Forcas
Forcas
Im got the fuzzy stuff to go away. The wierd thing is, I can blit 64 X 64s, but not 32 X 32s. 32x32s always get squashed to half their height.
-Forcas writeln("Does this actually work?");

Topic Locked

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

Sign in to reply to this topic.