Re: alpha channel

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



What does this mean, pre-multiplied ?

Pre-multiplying normalizes that intensities of the colors in each channel.

You will see that multiplying a transparent alpha byte of 0 against each
color results in a color intensity of 0.
If the alpha byte is 255, then the color intensity of each color channel
remains unchanged.

Blue = (BYTE)(( Blue * Alpha) / 255.0f);
Green = (BYTE)((Green * Alpha ) /255.0f);
Red = (BYTE)((Red * Alpha ) /255.0f);

a loop for each scanline and each ARGB pixel.something like this article
shows ? http://support.microsoft.com/kb/318876

Yes.

"Peter Lakatos" <news@xxxxxxx> wrote in message
news:%23TdYBUp9HHA.1484@xxxxxxxxxxxxxxxxxxxxxxx
You have two choices to save as a bitmap:

1) Save the bitmap uncompressed(i.e., BI_RGB) with the alpha channel
pre-multiplied against the other three color channels.

What does this mean, pre-multiplied ?
I have a TempDC (CDC) on which i use following

CDC *TempDC = new CDC;
TempDC->CreateCompatibleDC(pDC);
CBitmap bitmap;
bitmap.CreateCompatibleBitmap(pDC, m_nTransBmpWidth, m_nTransBmpHeight);
TempDC->SelectObject( &bitmap );
TempDC->BitBlt(0,0, m_nTransBmpWidth, m_nTransBmpHeight, pDC, 10, 10,
SRCCOPY);
TempDC->BitBlt(0,0,m_nTransBmpWidth,m_nTransBmpHeight,m_pMaskMemDC,0,0,SRCAND);
TempDC->BitBlt(0,0,m_nTransBmpWidth,m_nTransBmpHeight,m_pTransMemDC,0,0,SRCPAINT);then
i do have my Bitmap which i create like this CBitmap anotherBmp;
anotherBmp.CreateCompatibleBitmap(TempDC,
m_nTransBmpWidth,m_nTransBmpHeight); CBitmap *pOldBitmap =
TempDC->SelectObject(&anotherBmp);what have i change to pre-multiply ?> 2)
Save the bitmap with version 5.0 of the
BITMAPINFOHEADER(i.e.,BITMAPV5HEADER) which allows you to specify masks
for the ARGB channels.can i create this somewhere out of the code i wrote
before ?> Using gdiplus allows you to set the alpha channel all at once
with aColorMatrix. If you do not want to use gdiplus, then you must do
the workyourself in a loop for each scanline and each ARGB pixel.something
like this article shows ? http://support.microsoft.com/kb/318876> If you
do not want to do any work at all, then simply save the bitmap anddisplay
it with MaskBlt or BitBlt. You would define the grey color astransparent
and create XOR color and AND mask for display purposesmy goal is to create
an AVIFile out of the 32bpp HBITMAP's i create this wayHBITMAP hBackBitmap
= (HBITMAP)*pOldBitmap;Is this possible at all ?----- Original
Message -----From: "Michael Phillips, Jr."
<mphillips53@xxxxxxxxxxxxxxx>Newsgroups:
microsoft.public.win32.programmer.gdiSent: Thursday, September 13, 2007
10:16 PMSubject: Re: alpha channel>> How can i get rid of this grey color
and change it transparent alphachannel?>> Assuming that you wish to save
this bitmap as 32bpp, you would need tomark each grey color pixel as
transparent by setting the alpha byte to 0.>> Each opaque pixel should be
marked as opaque with 0xff(i.e., 255) in theapha channel byte.>> You have
two choices to save as a bitmap:>> 1) Save the bitmap uncompressed(i.e.,
BI_RGB) with the alpha channelpre-multiplied against the other three color
channels.> 2) Save the bitmap with version 5.0 of the
BITMAPINFOHEADER(i.e.,BITMAPV5HEADER) which allows you to specify masks
for the ARGB channels.>> Using gdiplus allows you to set the alpha channel
all at once with aColorMatrix. If you do not want to use gdiplus, then
you must do the workyourself in a loop for each scanline and each ARGB
pixel.>> If you do not want to do any work at all, then simply save the
bitmap anddisplay it with MaskBlt or BitBlt. You would define the grey
color astransparent and create XOR color and AND mask for display
purposes.>> "Peter Lakatos" <news@xxxxxxx> wrote in
messagenews:OM80Q4j9HHA.5360@xxxxxxxxxxxxxxxxxxxxxxx>> Hi,>>>> i can
create bitmaps with transparency, and with BitBlt they appeartransparent
on my application.>> In my case, i have a white Bitmap with a red box. i
can create atransparent Bitmap>> out of it, and on the grey CDC there
appears a red box.>>>> But how can i get the Transparent Bitmap out of my
CDC ?>>>> I already was able to create a Bitmap out of the CDC but it
always showthe grey background of the application with a red box.>>>> How
can i get rid of this grey color and change it transparent alphachannel
?>>>> Thank you all>>>>>>



.



Relevant Pages

  • Re: alpha channel
    ... None of Microsoft's bitmap encoders, including the new WIC component will ... and above to scan the pixels to determing if a usefull alpha channel exists. ... mark each grey color pixel as transparent by setting the alpha byte to 0. ...
    (microsoft.public.win32.programmer.gdi)
  • Re: alpha channel
    ... Assuming that you wish to save this bitmap as 32bpp, ... mark each grey color pixel as transparent by setting the alpha byte to 0. ... apha channel byte. ...
    (microsoft.public.win32.programmer.gdi)
  • Re: alpha channel
    ... Assuming that you wish to save this bitmap as 32bpp, ... each grey color pixel as transparent by setting the alpha byte to 0. ... apha channel byte. ...
    (microsoft.public.win32.programmer.gdi)
  • Re: Translucent billboards
    ... If I just used the first stage, the transparent areas showed up transparent ... When I instigate the second stage, the whole bitmap becomes translucent ... D3DTA_TFACTOR seemed to overwrite all the alpha values throughout the whole ... I thought that I could set the texture of the second stage to the original ...
    (microsoft.public.win32.programmer.directx.graphics)
  • Re: PhotoWorks is driving me nuts!
    ... white or use an image format that will save the background as an alpha ... channel and it will be transparent. ... As for the background colour this is the clients corporate colour ...
    (comp.cad.solidworks)