Results 1 to 6 of 6

Thread: I need help with MaskBlt...

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516

    Unhappy

    Will someone PLEASE tell me how to use MaskBlt, because I
    think it's what the game I'm planning to make is going to
    use. I know the list of what you should put in, but the
    return value is always 0 and nothing happens.

    Should MaskBlt refer to the same picture for picture and mask?
    What do I put in the hbmMask bit?

    Will someone please help?

    Well, I'll leave you to it.

    Bye!
    Courgettes.

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    What am I doing wrong? I only need 2 blts to make transparent stuff

  3. #3
    Lively Member
    Join Date
    Apr 2000
    Location
    Hell
    Posts
    89
    Well, it depends.
    If the transparent area of your image is black (rgb 0 0 0), you only need two blits, the AND mask, then the XOR mask. However, if the transparent area of your image is any other color (which is often the case if you use an unused color to generate the mask), then you need three blits - the XOR mask, the AND mask, and the XOR mask again.
    - Steve

    Real programmers use COPY CON PROGRAM.EXE

  4. #4
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    I see.
    Well, I took white as transparent...

  5. #5
    Lively Member
    Join Date
    Apr 2000
    Location
    Hell
    Posts
    89
    Err, it might be black. The point is, if you pick a color like RGB(255,0,255) (bright pink/purple), two Blits will leave the transparent area a bit...colored.
    - Steve

    Real programmers use COPY CON PROGRAM.EXE

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516
    Ah, well. Next time I need to set a value to zero I'll use MaskBlt

    Thanks for the advice

    I'm just going to add another question:

    I made a function MyBitBlt, which basically makes a sprite
    The function goes like this:

    Code:
    Function MyBitBlt(Dst As PictureBox, Src As PictureBox, Mask As PictureBox, ByVal X As Long, ByVal Y As Long)
    Call BitBlt(Dst.hDC, X, Y, Mask.ScaleWidth, Mask.ScaleHeight, Mask.hDC, _
    0, 0, vbSrcAnd)
    Call BitBlt(Dst.hDC, X, Y, Mask.ScaleWidth, Mask.ScaleHeight, Src.hDC, _
    0, 0, vbSrcInvert)
    End Function
    So why is is soooo f************ slow?

    Any advice form you VB pros?



    Courgettes.

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