Re: alpha channel
- From: "Michael Phillips, Jr." <mphillips53@xxxxxxxxxxxxxxx>
- Date: Fri, 14 Sep 2007 08:50:43 -0400
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>>>>>>
.
- References:
- alpha channel
- From: Peter Lakatos
- Re: alpha channel
- From: Michael Phillips, Jr.
- Re: alpha channel
- From: Peter Lakatos
- alpha channel
- Prev by Date: Re: Background Color Of A Check Box
- Next by Date: Re: alpha channel
- Previous by thread: Re: alpha channel
- Next by thread: Re: alpha channel
- Index(es):
Relevant Pages
|