Jump to content
Xtreme .Net Talk

Recommended Posts

  • *Experts*
Posted

Do not use TransparentBlt! It has a fairly bad memory leak in it. The only good GDI32 way to do transparency is with masks.

 

I wrote 3 (vb6) GDI32 tutorials, the third one covering BitBlt and transparency. You can see it at EliteVB in the Graphics section. :)

  • *Experts*
Posted

Well, you're pretty much out of luck then... Do you want different *levels* of transparency (i.e. multiple alpha channels?)

 

Perhaps I don't know what you mean by "solid color backgrounds". Can you attach the image you want to be made transparent and which sections you want transparent?

Posted

It could be any image and anywhere on the image. My form that I am drawing the images on is gradient right now but could also be hatched...

 

If you use DrawImage and have painted the brush in places with Color.FromArgb(0,0,0,0);, those areas would be transparent.

C#
  • *Experts*
Posted

Ohhh, I see what you mean. No, you can use gradients *behind* the image. A mask just uses white areas for the parts of your sprite image you want transparent and black areas for the solid bits.

 

Read the tutorial, and you'll see. :)

  • Leaders
Posted

Just so people know, I looked this up on microsoft.com

 

transparentblit's memory leak was fixed in windows 98 or Me. You COULD use it, it just wouldnt be nice to people using win95.

[sIGPIC]e[/sIGPIC]
  • Leaders
Posted

The memory leak was fixed in Me. But i found this when looking up transparentblt on microsoft.com:

 

 

Note that this is a VB6 declaration:

Public Declare Function AlphaBlend _
       Lib "msimg32" _
            (Byval hDcDest As Long, _
             Byval intLeftDest As Integer, _
             Byval intTopDest As Integer, _
             Byval intWidthDest As Integer, _
             Byval intHeightDest As Integer, _
             Byval hDcSource As Long, _
             Byval intLeftSource As Integer, _
             Byval intTopSource As Integer, _
             Byval intWidthSource As Integer, _
             Byval intHeightSource As Integer, _
             Byval lngBlendFunctionStruc As Long) _
             As Long 

 

I don't know if this is what aewarnick was looking for

[sIGPIC]e[/sIGPIC]
Posted

Thanks, m_e, I had already found that though and have been using it. The only problem with it is that it is not the same as TransparentBlt. It fades the whole image. Not just the Transparent parts.

 

VF already led me to use MaskBlt which will do what I want.

 

Thank you.

C#
Posted

I just read in two places that MaskBlt does not work on win98. If that I true, I will need another solution if there is one.

 

The two sites I saw it on had an alternative but it was very slow. Can anyone think of anything else I could use?

C#
  • Leaders
Posted
You can use bitblt with masks, just blit the mask using the and raster op and then blit the sprite using the or raster op (unless that is the very slow alternative)
[sIGPIC]e[/sIGPIC]
Posted
The sites had methods that involved blitting 7 times. Two times is great! How do you do that? Let me make sure of this...You are not suggesting using MaskBlt are you or is this what VF was talking about? I forgot all about what VF said when I saw MaskBlt.
C#
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...