2008-01-31 06:11:00     Unsupported alpha channel for png in nano-x/microwin

Document created by Aaronwu Employee on Aug 5, 2013
Version 1Show Document
  • View in full screen mode

2008-01-31 06:11:00     Unsupported alpha channel for png in nano-x/microwin

Paolo Miroglio (ITALY)

Message: 50423    I have a BF537-STAMP with 2.6.19.3-ADI-2007R1.1-svn

 

I'm making a software for nano-x, png rendering works but not when i use images with alpha channels.

 

i simply load the image with:

  (*icn).icon = GrLoadImageFromFile(path, flags);

 

Image is ugly in parts related to the transparency.

So i checked for the flags of this commands: for png decoder these are discarded and not used.

Then i checked in the function GdDecodePNG(buffer_t * src, PMWIMAGEHDR pimage)

 

it gets the header:     png_get_IHDR(state, pnginfo, &width, &height, &bit_depth, &colourtype,

                            NULL, NULL, NULL);

in colourtype is stored if an alpha channel is present, but this is what causes the problem

    if(colourtype & PNG_COLOR_MASK_ALPHA)

        png_set_strip_alpha(state);

 

Alpha channel is present in the image but skipped and not used...

There is a way to make work transparency for png too? As i could saw on microwin code, only .xpm format supports alpha at the moment, but that format is ten times bigger...

 

Hope someone have a solution, maybe a microwin patch or something else...

Best Regards

Miroglio Paolo

TranslateQuoteReplyEditDelete

 

 

2008-01-31 09:35:59     Re: Unsupported alpha channel for png in nano-x/microwin

Robin Getz (UNITED STATES)

Message: 50471    Paolo:

 

I'm not sure if anyone here is enough of a nano-x guru to help. You might try the nano-x mailing list:

http://www.linuxhacker.org/nanogui/

 

It seems to be pretty active.

 

-Robin

QuoteReplyEditDelete

 

 

2008-01-31 22:32:13     Re: Unsupported alpha channel for png in nano-x/microwin

Yi Li (CHINA)

Message: 50534    nano-x uses libpng. And I found the manual of libpng may help you some:

http://www.libpng.org/pub/png/libpng-1.2.5-manual.html

 

"f, for some reason, you don't need the alpha channel on an image, and you want to remove it rather than combining it with the background (but the image author certainly had in mind that you *would* combine it with the background, so that's what you should probably do):

 

    if (color_type & PNG_COLOR_MASK_ALPHA)

        png_set_strip_alpha(png_ptr);

 

"

So I think you can just remove this line of code and have a try..

Attachments

    Outcomes