Bitmaps

This is a discussion on Bitmaps within the Windows Programming forums, part of the Platform Specific Boards category; hmm... never heard of flip(). It sound interesting, so I'll probably look it up. But still, you haven't really got ...

  1. #16
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    hmm... never heard of flip(). It sound interesting, so I'll probably look it up.

    But still, you haven't really got the point about not just making dcBack an exact copy of dcBitmap. What I mean is that if I don't just want to display one bitmap, then stop redrawing the screen... well, to erase the screen, you draw a big rectangle. Then you BitBlt() a bitmap or something on top of the rectangle. Then, you stick that on the screen. That way you can just keep drawing the updated image all the time. But if you only have the bitmap in dcBack, then you will have to erase the screen before BitBlt()'ing the bitmap on... If you're only updating the screen once in a while it's ok, but for Space Invaders it has to be updated every like, .2 second. That's where it flickers, because the screen gets erased so you don't see the bitmap, then the bitmap gets drawn back, so you see it... and so on.

    But if I have the rectangle AND the bitmap already on top of it, and BitBlt() the completed image to the screen, then the bitmap never disappears.
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  2. #17
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    I don't know about the memcopy(). Use BitBlt()
    I would say you have a problem in one of your BitBlt() or Create__ (CreateCompatibleBitmap() ect ) lines.

    The black image is a 'not init' bitmap (like an array has rubbish in it till you fill it). Have you used bitmap with anything on it?

    Try painting it with

    FillRect() or FrameRect()

    or use the WHITENESS flag as the last param of BitBlt() to set the bitmap white.

    Remember to 'catch' all GDI resources (fonts, brush, bitmap ect) returned from SelectObject() and replace before DeleteDC() or ReleaseDC() is called. Remember that the DC may contain a bitmap when created.

    The reason to use a screen buffer system is, apart from what you have pointed out, so small areas of the screen can be updated without the whole having to be redrawn. In fact the app can be drawing to the buffer in one thread, drawing to the screen with another, while collecting user input with a third.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #18
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    ahhhh, never mind. The problem was: when I was creating something (I think it was the bitmap) I used a RECT structure, but instead of using scrnRect.bottom for the height, I used scrnRect.left. So the problem was... the bitmap (or whatever it was, I can't remember right now) had a height of 0 :P
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Drawing bitmaps efficiently
    By scwizzo in forum Windows Programming
    Replies: 28
    Last Post: 06-30-2009, 08:25 PM
  2. DX9 Not Displaying Bitmaps
    By Sentral in forum Game Programming
    Replies: 9
    Last Post: 01-31-2006, 04:35 AM
  3. MFC: Multiple clicks shows multiple bitmaps - how?
    By BrianK in forum Windows Programming
    Replies: 0
    Last Post: 06-20-2004, 07:25 PM
  4. Loading bitmaps with createfile() +CreateDIBSection
    By Stevo in forum Windows Programming
    Replies: 7
    Last Post: 05-13-2004, 09:22 PM
  5. using standard bitmaps in the toolbar editor
    By Kibble in forum Windows Programming
    Replies: 0
    Last Post: 12-23-2002, 07:43 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21