Results 1 to 9 of 9

Thread: Alright... this little tad of info is the LAST bit I need.

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 1999
    Posts
    65
    How can I make transparent sprites using bitblt? Is there any method like vbsrctransparentpaint or something which will draw all but a certain color? The easiest, not necessarily fastest or most efficient, method would be great.

    I've tried Imagelists and they were too bulky and slow... and transparent GIFs... well.... no. So, can anyone reccomend a quick and easy way?

    Thanks.

    "I'm carrying a Geometry book, but I'm not in Geometry...it's crazy...crazy man!"

  2. #2
    Guest
    The SRCAND will copy all but White and the SRCPAINT will copy all but Black.

    Code:
    Public Const SRCAND = &H8800C6
    Public Const SRCPAINT = &HEE0086

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 1999
    Posts
    65

    Huh...

    No... srcpaint does this translucent piece of trash. It doesn't fully copy my picture. Instead it makes it semi-transparent... as for srcpaint.. Are you sure? You weren't 100% correct on what srcand does, so I want to know if srcpaint really does what you say, and nothing more. If it does... then.... heheh.... I'm good to go.
    "I'm carrying a Geometry book, but I'm not in Geometry...it's crazy...crazy man!"

  4. #4
    Guest
    The reason it does not copy propery is because you did not lay down your Mask. A Sprite is a game graphics that consists of 2 elements. The Mask, and the Sprite. The Sprite is the Graphic itself (with a Black background) and the Mask is exactly the same as the Sprite, except the graphic is coloured black regardless of the original colour and the background is coloured white.

    Now. First you copy down the Mask with SRCAND which leaves out all the white (the background) and only copies down our Black image. Now we copy the Sprite using SRCPAINT. This will copy all but black. Normally we would get that ugly transparent mush, but since we have a Black templete underneath us (the Mask), it adds the black colour back to our image giving it it's true colour. Because we did not copy the background, it has none, therefor, we have a Transparent background.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Oct 1999
    Posts
    65

    Well.

    Ok, so srcpaint copies all but black. So, could I not just make a graphic with a black background.... and use srcpaint?
    "I'm carrying a Geometry book, but I'm not in Geometry...it's crazy...crazy man!"

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Oct 1999
    Posts
    65
    Nevermind. Both srcpaint and srcand do basically the same thing... but srcand treats white as transparent and srcpaint treats black as transparent.

    So.. you say make a black blotch in the same shape as my graphic (a mask). Lay that down, and then over that srcpaint my graphic onto it. Sounds darned easy. Thanks.

    Fox, I know you already said all of this. Just thought I'd make sure.
    "I'm carrying a Geometry book, but I'm not in Geometry...it's crazy...crazy man!"

  7. #7
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Indeed

    Well, there's a mask generator on my page (download der Zirkel demo), or I can mail it if you want.

  8. #8
    Guest
    An easy way to make a Mask Generator (can be slow for larger Images) is just to loop through all of the Pixels in the Image and if it's black, then colour it white. Then you go through each Pixel again and colour them black if they are not white.

  9. #9
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Thats exactly what my mask generator does

    (Using Get- and SetPixel, it isn't that slow)

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