Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Forcas

Blitting Bitmapswith DX7

This topic is 6509 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I fixed the color thing..... but it''s still warped and it has fuzzy stuff all over it.

Share this post


Link to post
Share on other sites
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 )

Share this post


Link to post
Share on other sites
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);
}


Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!