[<<] [<] Page 1 of 1 [>] [>>] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
[nanogui] PNG and transparency
From: BRACH Vincent ####@####.#### Date: 23 Jul 2009 14:55:29 -0000 Message-Id: <1248360945.4906.57.camel@zoul.intranet.smie.com> Hello, I try to draw transparency PNG images in my nano-X application but all the time the transparency's part of it is displayed in black.. I tried to display it on an window created by GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, 480, 640, 0, WHITE, BLACK); I tried with GrLoadImageFromFile plus GrDrawImageToFit and with GrDrawImageFromFile too, and same result. When I convert this image in .xpm and use the same code (just changing th extension of the file to load) everything gonna be ok. Can anybody help me please ? Regards, Vincent BRACH | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
RE: [nanogui] PNG and transparency
From: BRACH Vincent ####@####.#### Date: 28 Jul 2009 09:12:43 -0000 Message-Id: <1248684675.5326.20.camel@zoul.intranet.smie.com> Hello Steven, and thanks for your message, > I have also experienced this issue. I was able to work around it by editing the PNG file. > > If you open your PNG file in an editor (I used The GIMP) and click on the area that is supposed to be transparent with the color-picker tool, you'll probably see that the RGB color values are: > > R: 0 > G: 0 > B: 0 > Alpha: 0 > > In order for regions to appear transparent in nano-X you need to change the RGB values for the transparent area to: > > R: 255 > G: 255 > B: 255 > Alpha: 0 I done some tests and I noticed some funny results : First time I used the 0.91 : With the "0.91" version I noticed that PNG image with RGB=0,0,0 and Alpha=0 for transparent color was display in black (not transparent) but PNG image with RGB=255,255,255 and Alpha=0 (or no alpha) for transparent color was diplay with ritght transparent at this part. After I download nano-X sources from the CVS repository Version "pre 0.92" and I noticed that there's a different comportment : An image PNG with RGB=0,0,0 (or RGB=255,255,255) and Alpha=0 for transparent color was right display, but normaly an image with RGB=255,255,255 and no Alpha was display in white for parts (and not with transparent colors). Maybe there's several difference between the 0.91 and the "pre 0.92"... Anyway I work now with the last CVS version (pre 0.92), but this difference is strange. Maybe a fixed bug ? Any colors informations was took with gimpĀ· > (In fact, I think any region in a PNG that has a RGB value of (255,255,255) will appear transparent, even if the alpha value isn't 0.) Right ! It's that what I noticed for the 0.91 version (but not with pre 0.92). With this last version alpha seems to be set. > I am not experienced with photo editors, and I had to try several of them before I found one where I could figure out how to modify the RGB values of the transparent region. Without going step-by-step, I was able to do this in The GIMP by selecting the transparent region by color, replacing its color with pure white (255,255,255), and then making the region clear again. > > I'm not super experienced with nano-X so maybe someone else out there has a simpler way to fix this problem. But I hope this is helpful anyway. Thanks again, > Steven Vahl Regards, Vincent BRACH | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] PNG and transparency
From: "Greg Haerr" ####@####.#### Date: 28 Jul 2009 10:27:33 -0000 Message-Id: <05ea01ca0f22$8b72ed30$6464a8c0@winXP> : I try to draw transparency PNG images in my nano-X application but all : the time the transparency's part of it is displayed in black.. Make sure you're using the CVS code, as there were earlier bugs in transparency. v0.90 is definitely buggy. : I tried to display it on an window created by : GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, 480, 640, 0, WHITE, BLACK); Using BLACK here is a bad idea, as you can't tell whether the transparency is being drawn BLACK, or whether BLACK is showing through. I don't have the source code handy, but each image decoder handles transparency differently. I know we support GIF transparency, I'm not sure whether PNG was added. And below you're saying the .xpm works. You can check the source looking for ".transcolor" or "->transcolor" being set to something other than NOCOLOR. The decoders then don't draw a pixel when the image color matches transcolor. : : I tried with GrLoadImageFromFile plus GrDrawImageToFit and with : GrDrawImageFromFile too, and same result. Yes, each of these use the same decoder, depending on image type. Regards, Greg : When I convert this image in .xpm and use the same code (just changing : th extension of the file to load) everything gonna be ok. : : Can anybody help me please ? : : Regards, : : Vincent BRACH : : : : : : : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] PNG and transparency
From: Bajimohanreddy Bandi ####@####.#### Date: 4 Aug 2009 11:32:02 -0000 Message-Id: <6eca7d50908040431o38153e2fpf394cd5ae62ef1fc@mail.gmail.com> 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: // printf("MWPF_TRUECOLOR888\n\n"); pixel = COLOR2PIXEL888(cr); break; case MWPF_TRUECOLOR565: // printf("\nMWPF_TRUECOLOR565:\n\n"); 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;*/ } //alpha=0xFF; gr_background = psd->ReadPixel(psd, x, y); if(psd->pixtype==MWPF_TRUECOLOR8888 || psd->pixtype==MWPF_TRUECOLOR0888 ||psd->pixtype==MWPF_TRUECOLOR888){ 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); } else if(psd->pixtype==MWPF_TRUECOLOR565 ||psd->pixtype==MWPF_TRUECOLOR555) { bs=pixel &0x1f; bb=gr_background & 0x1f; gs=(pixel>>5) & 0x3f; gb=(gr_background>>5)&0x3f; rs=(pixel>>11)&0x1f; rb=(gr_background>>11)&0x1f; blue=(alpha * (bs-bb) >> 8) + bb; red=(alpha * (rs-rb) >> 8) + rb; green=(alpha * (gs-gb) >> 8) + gb; pixel= blue | (green << 5)|(red << 11); } psd->DrawPixel(psd, x, y,pixel); this alpa blending concept working fine with png images. it showing all transparency. this changes in engine/devdraw.c file in GdDrawImage function. regards, Mohan. On Thu, Jul 23, 2009 at 8:25 PM, BRACH Vincent ####@####.#### wrote: > Hello, > > I try to draw transparency PNG images in my nano-X application but all > the time the transparency's part of it is displayed in black.. > I tried to display it on an window created by > GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, 480, 640, 0, WHITE, BLACK); > > I tried with GrLoadImageFromFile plus GrDrawImageToFit and with > GrDrawImageFromFile too, and same result. > When I convert this image in .xpm and use the same code (just changing > th extension of the file to load) everything gonna be ok. > > Can anybody help me please ? > > Regards, > > Vincent BRACH > > > > > > > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[<<] [<] Page 1 of 1 [>] [>>] |