Jump to content
  • Advertisement
Sign in to follow this  
kingpinzs

Win32 api, C++ and smeared images while blitting

This topic is 4306 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

I am getting smired images when they move on the screen. Any one know how to fix that issue?
 case WM_PAINT://the window needs repainting
        {
			

HANDLE       hOld;
HDC          hdc;
            //a variable needed for painting information
            PAINTSTRUCT ps;
           


			
            //start painting
            hdc=BeginPaint(hWndMain,&ps);
    
    
            //redraw the map
           BitBlt(hdc,0,0,
                   640,
                  480,
                   bmoMap,
                   0,0,
                   SRCCOPY);
		 //  InvalidateRect(hWndMain,NULL,FALSE);
                 
ReleaseDC(hWndMain,hdc);

            //end painting
            EndPaint(hWndMain,&ps);
					
            //handled message, so return 0
            return(0);
        }break;




void DrawMap()//draw screen
{
	//place the toolbar
//mask first
BitBlt(bmoMap,640,0,640,480,bmoMap,0,0,SRCAND);
//then image
BitBlt(bmoMap,640,480,640,480,bmoMap,0,0,SRCCOPY);

    bmoBall.Load(NULL,"ball.bmp");
    bmoback.Load(NULL,"ballmask.bmp");
    
 
 // blits a transpairent image to the screen
 BitBlt(bmoMap,Ball.x ,Ball.y,70,70,bmoback,0,0,SRCAND);
 BitBlt(bmoMap,Ball.x,Ball.y,70,70,bmoBall,0,0,SRCPAINT);
 

Paddlemove(Paddle.px,Paddle.py);

Share this post


Link to post
Share on other sites
Advertisement
You're call to ReleaseDC() in WM_PAINT is bad and is probably doing something terrible. The DC you get from BeginPaint() should not be destroyed or released.

Share this post


Link to post
Share on other sites
I would look into the mask your using for the transparency. Instead of using a mask, look into TransparentBitBlt(). Just add this into your WinMain.h (or your defines header file): #pragma comment(lib, "msimg32.lib") and that will get TransparentBitBlt() it work.

[Edited by - LostSource on October 3, 2006 12:31:39 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!