Results 1 to 6 of 6

Thread: BitBlt

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2001
    Posts
    11

    BitBlt

    Ok I am writing a game in VB and have created my board from Bitmap squares, by using the BitBlt function. However I now need to put my character on the board, but make its background transparent so it is not surrounded by a square box.

    The character is in .gif format with a transparent background but when I place it on the board using BitBlt there is still a boarder on it.

    Can it not be done using BitBlt? Is their another way?

  2. #2
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    Make a MASK PICTURE - that is - a picture with black pixels on pixels you want to be painted and white on pixels that you don't. Make sure that your BGColor is black (if you want to draw black pixels, make those pixels black on the mask picture).

    Now, start by BitBlting the mask with the opcode SRCAND. Now, Bitblt the character on with the opcode SRCPAINT.


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  3. #3
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    Alternatively, you can use TransparentBlt (see MSDN for details)


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  4. #4
    Member Yhoko's Avatar
    Join Date
    May 2002
    Posts
    47
    TransparentBlt causes memory lacks, don't use it.
    - Yhoko


    Try my Games
    * [VB6] YDK - Yhoko's Development Kit
    * [VB6] HackV1 - two-player puzzle/strategy
    * [VB6] Xen - extended Gen

  5. #5
    Zaei
    Guest
    I've heard that too. Doing a standard Blt with masks is probably the best bet.

    Z.

  6. #6
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    Originally posted by Yhoko
    TransparentBlt causes memory lacks, don't use it.
    Good point - forgot about that.

    With VB's paintpicture, my game costed approx. 15-25% of my GDI memory overall and with TransparentBlt, 91% and rising!


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width