Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Wed, 23 Jul 2008 14:34:55 -0400,    group: microsoft.public.platformsdk.gdi        back       


Why does GDI+ not support alpha channel in icons?   
Using Bitmap with the overload of the constructor that takes an HICON

Bitmap::Bitmap(hicon)
    Creates a Bitmap object based on an icon.

    Bitmap(
          HICON hicon
    );

Parameters
    hicon
        [in] Handle to a GDI icon.


i know GDI+ has plenty of support for alpha transparency. Is this just a 
shortcoming of the implementation? i cannot imagine there's any technical 
reason for it, but there's no other good enough excuse.


Why does GDI+ not support alpha channel in icons?


Is there any accepted workaround? i would mutliply the alpha, but you have 
no pixel access to a bitmap that is actually an HICON.
date: Wed, 23 Jul 2008 14:34:55 -0400   author:   Ian Boyd

Re: Why does GDI+ not support alpha channel in icons?   
"Ian Boyd"  wrote in message 
news:#im#OLP7IHA.1196@TK2MSFTNGP05.phx.gbl...
> Using Bitmap with the overload of the constructor that takes an HICON
>
> Bitmap::Bitmap(hicon)
>    Creates a Bitmap object based on an icon.
>
>    Bitmap(
>          HICON hicon
>    );
>
> Parameters
>    hicon
>        [in] Handle to a GDI icon.
>
>
> i know GDI+ has plenty of support for alpha transparency. Is this just a 
> shortcoming of the implementation? i cannot imagine there's any technical 
> reason for it, but there's no other good enough excuse.
>
>
> Why does GDI+ not support alpha channel in icons?


I didn't know icons could have alpha channel data.

You could create a 32bpp ARGB bitmap of the appropriate dimensions, create a 
Graphics from the bitmap, clear the bitmap to transparent, and draw the icon 
on the Graphics object.
At that point you'd have a Bitmap with alpha-channel data.

Mark

-- 
Mark Salsbery
Microsoft MVP - Visual C++



>
>
> Is there any accepted workaround? i would mutliply the alpha, but you have 
> no pixel access to a bitmap that is actually an HICON.
>
date: Wed, 23 Jul 2008 12:34:54 -0700   author:   Mark Salsbery [MVP] MarkSalsbery[MVP]@newsgroup.nospam

Re: Why does GDI+ not support alpha channel in icons?   
Mark Salsbery [MVP] wrote:
> "Ian Boyd"  wrote in message 
> news:#im#OLP7IHA.1196@TK2MSFTNGP05.phx.gbl...
>> Using Bitmap with the overload of the constructor that takes an HICON
>>
>> Bitmap::Bitmap(hicon)
>>    Creates a Bitmap object based on an icon.
>>
>>    Bitmap(
>>          HICON hicon
>>    );
>>
>> Parameters
>>    hicon
>>        [in] Handle to a GDI icon.
>>
>>
>> i know GDI+ has plenty of support for alpha transparency. Is this just 
>> a shortcoming of the implementation? i cannot imagine there's any 
>> technical reason for it, but there's no other good enough excuse.
>>
>>
>> Why does GDI+ not support alpha channel in icons?
> 
> 
> I didn't know icons could have alpha channel data.

All the XP style icons have a "32bit" version which VS6 shows as having 
a thick black shadow which I assume is the alpha channel.

-- 
Dean Earley (dean.earley@icode.co.uk)
i-Catcher Development Team

iCode Systems
date: Thu, 24 Jul 2008 16:21:56 +0100   author:   Dean Earley

Re: Why does GDI+ not support alpha channel in icons?   
"Dean Earley"  wrote in message 
news:#PmrDEa7IHA.5440@TK2MSFTNGP02.phx.gbl...
> Mark Salsbery [MVP] wrote:
>> "Ian Boyd"  wrote in message 
>> news:#im#OLP7IHA.1196@TK2MSFTNGP05.phx.gbl...
>>> Using Bitmap with the overload of the constructor that takes an HICON
>>>
>>> Bitmap::Bitmap(hicon)
>>>    Creates a Bitmap object based on an icon.
>>>
>>>    Bitmap(
>>>          HICON hicon
>>>    );
>>>
>>> Parameters
>>>    hicon
>>>        [in] Handle to a GDI icon.
>>>
>>>
>>> i know GDI+ has plenty of support for alpha transparency. Is this just a 
>>> shortcoming of the implementation? i cannot imagine there's any 
>>> technical reason for it, but there's no other good enough excuse.
>>>
>>>
>>> Why does GDI+ not support alpha channel in icons?
>>
>>
>> I didn't know icons could have alpha channel data.
>
> All the XP style icons have a "32bit" version which VS6 shows as having a 
> thick black shadow which I assume is the alpha channel.



*smacking forehead*  Duh - now I remember why I use 3rd party software for 
icon creation....because the dev environment doesn't work with them.

I'm an idiot :-)  Thanks Dean!

Mark

-- 
Mark Salsbery
Microsoft MVP - Visual C++



>
> -- 
> Dean Earley (dean.earley@icode.co.uk)
> i-Catcher Development Team
>
> iCode Systems
date: Thu, 24 Jul 2008 09:21:18 -0700   author:   Mark Salsbery [MVP] MarkSalsbery[MVP]@newsgroup.nospam

Re: Why does GDI+ not support alpha channel in icons?   
> You could create a 32bpp ARGB bitmap of the appropriate dimensions, create 
> a Graphics from the bitmap, clear the bitmap to transparent, and draw the 
> icon on the Graphics object.
> At that point you'd have a Bitmap with alpha-channel data.

Twenty-odd hours of work, most of that spent discovering the bug in
http://support.microsoft.com/kb/318876

only to be thwarted by the fact that GDI+ doesn't support 32bpp ARGB 
HBITMAPS.

Ugh.


My original question still stands: Why does GDI+ not support alpha channel 
in icons?

Although the answer is becoming more apparent to me, i still would have 
though the point of GDI+ was to support things like transparency.
date: Fri, 25 Jul 2008 14:27:15 -0400   author:   Ian Boyd

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us