PDA

View Full Version : Draw 32 Bit icons with alpha channel


Houser
15th February 2008, 01:45 PM
How can I draw an icon with 32 bit (24 + 8 Bit Alpha) correctly.
When I use the LoadImage() and DrawIcon() API the alpha
channel info is lost and the icon is drawn normal.
Thanks for any information.

Houser

joshrys
15th February 2008, 03:09 PM
i've been using a program called iIcon and GIMP to edit my icons...

Houser
15th February 2008, 03:10 PM
Edit and creation of icons is not my problem.
I want to display them with alpha on the device.

Houser

levenum
16th February 2008, 09:55 PM
What format are you using?
I needed to do Alpha blended buttons for some project a while back and found that the only (or at least the fastest) way to get it done in a native C++ app was using OpengGL ES and png files.

To my knowledge there are no native windows APIs to handle Alpha blending.
There are also GDI+ (if you can use .NET) and DirectDraw (which I understand is not implemented on all devices OS versions). I am not certain about their capabilities.

tene
17th February 2008, 12:45 PM
Look at IImage and interfaces that comes with it. It's rather slow but can do the job. (native programming of course).

A faster approach would be doing the drawing yourself using DIBSection (or ddraw).

smuook
17th February 2008, 02:08 PM
It would help to have more information, like what type of image file you're trying to produce? Are you trying to do transparency?

bitmap = no alpha + no transparency
png = multiple alpha + transparency
jpg = apha (jpeg2000) + no transparency
gif = single alpha + transparency

You can create all the alpha channels you want in photoshop or paint shop pro, but if you save it as a bitmap it's lost.

Hope this helps, not sure because your question doesn't give much details to your problem.

Houser
25th February 2008, 08:56 AM
Look at IImage and interfaces that comes with it. It's rather slow but can do the job. (native programming of course).

A faster approach would be doing the drawing yourself using DIBSection (or ddraw).

I have used Imaging API and IImage for displaying PNG images with alpha successfull.
Have tried this for icon files with alpha but the icon is not displayed when I use
the IImage interface.

IImagingFactory* m_pImgFactory;
IImage* m_pImage;

m_pImgFactory->CreateImageFromFile( TEXT("file.ico"), &m_pImage );
m_pImage->Draw( m_hDC, &rc, NULL );


Houser

Houser
26th February 2008, 03:10 PM
Ok i have managed to display the icon.
But now I am trying to load and icon from an *.ICO file.
The LoadImage() API cannot be used for this because the
flag LR_LOADFROMFILE is not supported under CE.

Has anybody loaded an icon from file and not from resource?
Thanks!

Houser

tra_la_la_la
15th December 2009, 12:28 AM
Ok i have managed to display the icon.
hello. can you tell how did you solved alpha-channel problem?

sorry for my french