nanogui: Transparency support for 16bit


Previous by date: 12 Jun 2008 04:05:36 -0000 Win32 API for font, ed.hsieh
Next by date: 12 Jun 2008 04:05:36 -0000 Re: Win32 API for font, ed.hsieh
Previous in thread:
Next in thread:

Subject: Transparency support for 16bit
From: mohanreddy.b ####@####.####
Date: 12 Jun 2008 04:05:36 -0000
Message-Id: <002b897e0b45e4f39b81f4e6074a8a81@localhost>

 Hi ,

              I am running micro windows with frame buffer option .In frame
buffer color type is MWPF_TRUECOLOR565

and 16bpp .
                  I am using following code for transparency support for 24
and 32 bit in X11.its working correctly.but its not working properly for 16
bit.Can any one give some idea for transparency support for 16bit.

           engine/devdraw.c 
                              alpha = (cr >>24 );
                        //printf("%s:In Function %s Alpha=%d
\n",__FILE__,__func__,alpha);
                       if (alpha != 0) { /* skip if pixel is fully
transparent*/
                               if (clip == CLIP_VISIBLE || GdClipPoint(psd,
x, y)) {
                                       switch (psd->pixtype) {
                                       case MWPF_PALETTE:
                                       default:
                                               pixel = GdFindColor(psd,
cr);
                                               break;
                                       case MWPF_TRUECOLOR8888:
                                               pixel = COLOR2PIXEL8888(cr);
                                               break;
                                       case MWPF_TRUECOLOR0888:
                                       case MWPF_TRUECOLOR888:
                                               pixel = COLOR2PIXEL888(cr);
                                               break;
                                       case MWPF_TRUECOLOR565:
                                               pixel = COLOR2PIXEL565(cr);
                                               break;
                                       case MWPF_TRUECOLOR555:
                                               pixel = COLOR2PIXEL555(cr);
                                               break;
                                       case MWPF_TRUECOLOR332:
                                               pixel = COLOR2PIXEL332(cr);
                                               break;
                                       /*case MWPF_TRUECOLOR233:
                                               pixel = COLOR2PIXEL233(cr);
                                               break;*/
                                       }

                                        gr_background = psd->ReadPixel(psd,
x, y);
                                    rb = (((pixel& 0x00ff00ff) * (alpha))
+((gr_background & 0x00ff00ff) * (0xff-alpha))) & 0xff00ff00;
                            g = (((pixel& 0x0000ff00) * (alpha))
+((gr_background & 0x0000ff00) * (0xff-alpha))) & 0x00ff0000;
                                    pixel=(pixel& 0xff000000) | ((rb | g)
>> 8);
                                        psd->DrawPixel(psd, x, y,pixel);
                                }
                        }


Thanks & Regards
Mohan.


Previous by date: 12 Jun 2008 04:05:36 -0000 Win32 API for font, ed.hsieh
Next by date: 12 Jun 2008 04:05:36 -0000 Re: Win32 API for font, ed.hsieh
Previous in thread:
Next in thread:


Powered by ezmlm-browse 0.20.