Results 1 to 11 of 11

Thread: How To Mask A Color?

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2002
    Location
    I'll kick yo' @$$!!
    Posts
    44

    How To Mask A Color?

    well... I am using bitblt, how would I mask a color? Cause when the ships over lap in this simple little spaceship game it looks real funny..
    XX The Signature of the Gods XX

  2. #2
    New Member
    Join Date
    Apr 2002
    Posts
    3
    just bitblt a mask (white background, ship figure in all black) with the option (instead of srccopy) SrcAnd and then bitblt your figure (ship) with an all black background. consts for differents options: Public Const SRCAND = &H8800C6
    Public Const SRCCOPY = &HCC0020
    Public Const SRCINVERT = &H660046
    It works best when you bitblt on a buffer .hdc first and then copy the hdc to screen.
    I hope this can be of help to you
    Rampage can be freaky

  3. #3
    New Member
    Join Date
    Apr 2002
    Posts
    3
    i forgot to say that the ship figure has to be bitblt with the srcinvert option
    Rampage can be freaky

  4. #4

    Thread Starter
    Member
    Join Date
    Apr 2002
    Location
    I'll kick yo' @$$!!
    Posts
    44
    Sweet, thnx! heeh first time i bitbltted the ship first, and nothing showed up.. but i got it :P
    XX The Signature of the Gods XX

  5. #5
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    No need to declare the blitting operators, they're all pre-defined in VB:

    VB Code:
    1. vbSrcPaint
    2. vbSrcAnd
    3. vbSrcCopy
    4. aso.

  6. #6

    Thread Starter
    Member
    Join Date
    Apr 2002
    Location
    I'll kick yo' @$$!!
    Posts
    44
    yeah, that' how i usually do it.

    I got another question, I think is simple but I'm not sure; how do I make something partially transpearent?
    XX The Signature of the Gods XX

  7. #7
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    What you can do using BitBlt is a 1-Bit-mask, meaning 100% or 0% visible (nothing between). Search the forums for Transparent blitting or look at the demos on my website ( http://fox.acky.net/vb/ ). If you need translucency I'd recommend you using DDraw because it's way faster. Again there are enough examples around so you might just want to search the forum for this one.

  8. #8
    Fanatic Member
    Join Date
    Oct 2000
    Location
    Oregon
    Posts
    962
    You can use a gray-based mask for partail transperancy. Ue vbSrcAnd for the mask, and vbSrcPaint for the sprite (ship).
    Involved in: Sentience

  9. #9
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Well you can't. The funtions give you something like transluency but it's not what you need I s'pose.

  10. #10
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    Two things I must point out:

    The partial transparency (and it's only partial, it isn't accurate at all) only works with MergePaint/And combo (on many computers I've tested on), and vbMergePaint is the only one that works. The API's MergePaint is incorrect.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  11. #11

    Thread Starter
    Member
    Join Date
    Apr 2002
    Location
    I'll kick yo' @$$!!
    Posts
    44
    ok, i have no time to test that greyscale thing tonight, but i will, in the meantime, would you care to explain this mergepoint thing?
    XX The Signature of the Gods XX

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