selectobject

selectobject

Post by Russell E. Holcom » Tue, 18 May 1999 04:00:00



I am selecting a transparent bitmap from my main form into a memory dc and
bitblt it to screen.  It is not longer transparent when I do this.  Does
someone know how to maintain transparency while using bitblt?  Thanks

Russ

 
 
 

selectobject

Post by Sean Docker » Wed, 19 May 1999 04:00:00


Transparent bitmaps are not really transparent.  Transparency is achieved
through several raster operations on an background image that make the
result look as if the transparent image has been pasted on top of the
background image.

The traditional method of transparency blitting involves three different
BitBlt calls:  the first applies the transparency mask, the second applies
the image, and the third undoes the transparency mask.

A second method (which I use) has been coined as the black source method.
It eliminates one of the BitBlt calls in the traditional method.  It
requires a monochrome mask; a transparency mask has colour information, and
a monochrome mask does not.  It also requires some modification of the
source image.  Basically, you replace your transparency colour with
black--hence, black source.

What this means is that (one way or another) you are going to require a mask
which can be applied before you blit your real image.  I highly recommend
that you look through all of the following Microsoft knowledge base articles
about transparency; the second article applies to an API behaviour issue
Windows 95 and NT 3.51 client machines.

SAMPLE: TRANSBLT Demonstrates Bitmaps with Transparency
http://www.veryComputer.com/

PRB: Trouble Using DIBSection as a Monochrome Mask
http://www.veryComputer.com/

HOWTO: Drawing Transparent Bitmaps
http://www.veryComputer.com/

Here's my recommendations

1.  Use the black source method if you can.  It is easier and faster.
2.  Generate your monochrome mask and black source images at design time.
It is more reliable.

PS:  If you need help after reading the examples provided by Microsoft, I
would be happy to help you out if you get stuck.

Good luck.
--
Sean Dockery
*surf Corp, Interactive Media Division

http://www.*surf.net/



Quote:> I am selecting a transparent bitmap from my main form into a memory dc and
> bitblt it to screen.  It is not longer transparent when I do this.  Does
> someone know how to maintain transparency while using bitblt?  Thanks

> Russ


 
 
 

selectobject

Post by Russell E. Holcom » Thu, 20 May 1999 04:00:00


I got it working.  My problem was I had several small hidden bitmaps of LEDs
on the form.  I would selectobject of the handle and bitblt.  I turned off
transparency and now create bitmaps using the non visible form bitmaps as a
template and replace lower left pixel colored pixels with the system color
for the control I am on.  They are small and I only have to do it once at
start up or at system color change.  Minimal overhead ( 4 15x15 pixel
bitmaps) and a single bitblt call to show.  Works well.  Thanks for the help

Russ


> Transparent bitmaps are not really transparent.  Transparency is achieved
> through several raster operations on an background image that make the
> result look as if the transparent image has been pasted on top of the
> background image.

> The traditional method of transparency blitting involves three different
> BitBlt calls:  the first applies the transparency mask, the second applies
> the image, and the third undoes the transparency mask.

> A second method (which I use) has been coined as the black source method.
> It eliminates one of the BitBlt calls in the traditional method.  It
> requires a monochrome mask; a transparency mask has colour information,
and
> a monochrome mask does not.  It also requires some modification of the
> source image.  Basically, you replace your transparency colour with
> black--hence, black source.

> What this means is that (one way or another) you are going to require a
mask
> which can be applied before you blit your real image.  I highly recommend
> that you look through all of the following Microsoft knowledge base
articles
> about transparency; the second article applies to an API behaviour issue
> Windows 95 and NT 3.51 client machines.

> SAMPLE: TRANSBLT Demonstrates Bitmaps with Transparency
> http://www.veryComputer.com/

> PRB: Trouble Using DIBSection as a Monochrome Mask
> http://www.veryComputer.com/

> HOWTO: Drawing Transparent Bitmaps
> http://www.veryComputer.com/

> Here's my recommendations

> 1.  Use the black source method if you can.  It is easier and faster.
> 2.  Generate your monochrome mask and black source images at design time.
> It is more reliable.

> PS:  If you need help after reading the examples provided by Microsoft, I
> would be happy to help you out if you get stuck.

> Good luck.
> --
> Sean Dockery
> *surf Corp, Interactive Media Division

> http://www.*surf.net/



> > I am selecting a transparent bitmap from my main form into a memory dc
and
> > bitblt it to screen.  It is not longer transparent when I do this.  Does
> > someone know how to maintain transparency while using bitblt?  Thanks

> > Russ

 
 
 

1. SaveDC/RestoreDC vs SelectObject

If I SelectObject a single GDI object into a DC, would using a
SaveDC/RestoreDC have a significant amount more overhead than
SelectObject-ing the original GDI object back into the DC?

Also...if I do this:
ret=SelectObject(George W. Bush)
into DC would "ret" hold "Bill Clinton"??  Oh, I kill me!! <big silly grin>

Thanks,
Chris

2. Drag And Drop from Win95/Shell..

3. SelectObject: What does it do?

4. newbie question on layers - yellow hightlight marker

5. SelectObject

6. How to make two way shininess?

7. SelectObject returns null

8. spatial subdivison

9. HELP!!! Accessing an ImageList's ListImages .Picture objects via API (CCDC/SelectObject)