A few drawing woes.
-
Hi, I have 2 GDI drawing problems and I was hoping you guys could help me out. 1. I have several bitmaps (8x8, 16x16 and 32x32) that I use in PatBlt to set the background of my view to mimic zooming. Everything else is drawn on top. The 8x8 and 16x16 bitmaps tile the background perfectly. However, the 32x32 doesn't work at all! Instead the back of the view is completely corrupted (almost like returning FALSE from OnEraseBkGrnd and whizzing windows over it). Anyone know if PatBlt has a limit on the size of the bitmap it can use or what the problem might be? 2. I implemented the double buffering ideas put about on this and other sites to draw to an offscreen buffer and then blit it back to remove flicker. However, when I resize the window or my view is redrawn, the flicker is as bad as normal. According to the examples, I'm not missing anything, so what might have I done wrong? Thanks for any help, Simon
-
Hi, I have 2 GDI drawing problems and I was hoping you guys could help me out. 1. I have several bitmaps (8x8, 16x16 and 32x32) that I use in PatBlt to set the background of my view to mimic zooming. Everything else is drawn on top. The 8x8 and 16x16 bitmaps tile the background perfectly. However, the 32x32 doesn't work at all! Instead the back of the view is completely corrupted (almost like returning FALSE from OnEraseBkGrnd and whizzing windows over it). Anyone know if PatBlt has a limit on the size of the bitmap it can use or what the problem might be? 2. I implemented the double buffering ideas put about on this and other sites to draw to an offscreen buffer and then blit it back to remove flicker. However, when I resize the window or my view is redrawn, the flicker is as bad as normal. According to the examples, I'm not missing anything, so what might have I done wrong? Thanks for any help, Simon
As long as you are using an OS newer than Windows 95 you can do brushes larger than 8x8. As far as the flicker when you resize your window, it may help to make sure that you frame window that contains the view does not have the CS_HREDRAW or CS_VREDRAW styles set.
-
Hi, I have 2 GDI drawing problems and I was hoping you guys could help me out. 1. I have several bitmaps (8x8, 16x16 and 32x32) that I use in PatBlt to set the background of my view to mimic zooming. Everything else is drawn on top. The 8x8 and 16x16 bitmaps tile the background perfectly. However, the 32x32 doesn't work at all! Instead the back of the view is completely corrupted (almost like returning FALSE from OnEraseBkGrnd and whizzing windows over it). Anyone know if PatBlt has a limit on the size of the bitmap it can use or what the problem might be? 2. I implemented the double buffering ideas put about on this and other sites to draw to an offscreen buffer and then blit it back to remove flicker. However, when I resize the window or my view is redrawn, the flicker is as bad as normal. According to the examples, I'm not missing anything, so what might have I done wrong? Thanks for any help, Simon
Are all your images same in color depth..? I dunno if PatBlt will blit 265 color images or not, I don't see why it wouldn't BitBlt does. Maybe try all 16 colors images and see what happens. Double buffering...flicker free drawing is a pain or is that paint...? If you sit down and think about it you'll figure it out if you haven't already. If you don't fully understand everything thats going I would suggest using CMemDC found here on CP or maybe read the article FLicker free drawing By Keith Rule...??? I have used all the double buffering classes and implemented myself both MFC and SDK and I couldn't figure out why my screen still flickered when I overrode OnEraseBkgnd() and OnPaint/OnDraw. Seems you can't have both painting...Tell me is you figure it out. Cheers! :) "An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
-
Are all your images same in color depth..? I dunno if PatBlt will blit 265 color images or not, I don't see why it wouldn't BitBlt does. Maybe try all 16 colors images and see what happens. Double buffering...flicker free drawing is a pain or is that paint...? If you sit down and think about it you'll figure it out if you haven't already. If you don't fully understand everything thats going I would suggest using CMemDC found here on CP or maybe read the article FLicker free drawing By Keith Rule...??? I have used all the double buffering classes and implemented myself both MFC and SDK and I couldn't figure out why my screen still flickered when I overrode OnEraseBkgnd() and OnPaint/OnDraw. Seems you can't have both painting...Tell me is you figure it out. Cheers! :) "An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
Hockey, The image is identical for PatBlt, just different sizes (so therefore the same colors). I used DevStudio to create the bitmap resources (just by inserting a new resource), so I think it safe to assume all bitmap resources have the same color depth. I have another application that uses my own (the same as this app) off-screen drawing DC class and it works fine! The only difference is that app is a MDI app, this one is SDI. Do you know why SDI and MDI GDI calls might behave differently? Simon
-
Hockey, The image is identical for PatBlt, just different sizes (so therefore the same colors). I used DevStudio to create the bitmap resources (just by inserting a new resource), so I think it safe to assume all bitmap resources have the same color depth. I have another application that uses my own (the same as this app) off-screen drawing DC class and it works fine! The only difference is that app is a MDI app, this one is SDI. Do you know why SDI and MDI GDI calls might behave differently? Simon
The GDI is independant of the SDI/MDI architecture i'd think...it's wrapped in the CDC classes. Thats strange...real strange...then again...anything is strange when you don't understand it... :) "An expert is someone who has made all the mistakes in his or her field" - Niels Bohr