[<<] [<] Page 1 of 1 [>] [>>] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Transparent pixmap
From: ####@####.#### Date: 24 Feb 2008 15:28:37 -0000 Message-Id: <20080224092834.magty7j5usckokgk@localhost> Hello, i want to copy the contents of a pixmap on to the screen. The pixmap contains a gif with a transparent background (=> alpha = 0). When i copy the pixmap to the screen the transparent background is visible. I run nano-x for the Linux-X86 platform using the X11 library. When drawing the gif directly to the screen the transparent background is, correctly, not visisble. I attach a simple example which demonstrates the problem. In the example i do not load the gif, instead i have two pixmaps: one painted with red color (alpha = 0) and the other with blue (alpha = 255). Still, the red is visible. I also tried the SRCTRANSCOPY mode as arhument in the GrCopyArea, but i am not sure if this mode of operation is actually implemented. Any help is greatly appreciated. ----------------------------------------------------------------------------- #include <stdio.h> #include <stdlib.h> #define MWINCLUDECOLORS #include "nano-X.h" int main(int argc, char **argv) { GR_WINDOW_ID pid1, pid2; GR_GC_ID gc; GR_EVENT event; int width, height; char c; if( GrOpen() < 0 ) { printf("cannot open graphics\n"); exit(1); } width = height = 100; GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_KEY_DOWN); gc = GrNewGC(); pid1 = GrNewPixmap(width, height, NULL); GrSetGCForeground(gc, MWARGB(0,255,0,0)); GrFillRect(pid1, gc, 0, 0, width, height); pid2 = GrNewPixmap(width, height, NULL); GrSetGCForeground(gc, MWARGB(255,0,0,255)); GrFillRect(pid2, gc, 0, 0, width, height); GrCopyArea(GR_ROOT_WINDOW_ID, gc, 100, 100, width, height, pid2, 0, 0, MWMODE_COPY); GrCopyArea(GR_ROOT_WINDOW_ID, gc, 150, 150, width, height, pid1, 0, 0, MWMODE_COPY); while(1) { GrGetNextEvent(&event); switch (event.type) { case GR_EVENT_TYPE_KEY_DOWN: c = event.keystroke.ch; if(c == 'q') { GrClose(); exit(0); } break; default: break; } } } -------------------------------------------------------------------------- Thanks in advance | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Transparent pixmap
From: ####@####.#### Date: 24 Feb 2008 15:44:09 -0000 Message-Id: <32829.127.0.0.1.1203867837.squirrel@localhost> Hello, i want to copy the contents of a pixmap on to the screen. The pixmap contains a gif with a transparent background (=> alpha = 0). When i copy the pixmap to the screen the transparent background is visible. I run nano-x for the Linux-X86 platform using the X11 library. When drawing the gif directly to the screen the transparent background is, correctly, not visisble. I attach a simple example which demonstrates the problem. In the example i do not load the gif, instead i have two pixmaps: one painted with red color (alpha = 0) and the other with blue (alpha = 255). Still, the red is visible. I also tried the SRCTRANSCOPY mode as arhument in the GrCopyArea, but i am not sure if this mode of operation is actually implemented. Any help is greatly appreciated. ------------------------------------------------------------------------- #include <stdio.h> #include <stdlib.h> #define MWINCLUDECOLORS #include "nano-X.h" int main(int argc, char **argv) { GR_WINDOW_ID pid1, pid2; GR_GC_ID gc; GR_EVENT event; int width, height; char c; if( GrOpen() < 0 ) { printf("cannot open graphics\n"); exit(1); } width = height = 100; GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_KEY_DOWN); gc = GrNewGC(); pid1 = GrNewPixmap(width, height, NULL); GrSetGCForeground(gc, MWARGB(0,255,0,0)); GrFillRect(pid1, gc, 0, 0, width, height); pid2 = GrNewPixmap(width, height, NULL); GrSetGCForeground(gc, MWARGB(255,0,0,255)); GrFillRect(pid2, gc, 0, 0, width, height); GrCopyArea(GR_ROOT_WINDOW_ID, gc, 100, 100, width, height, pid2, 0, 0, MWMODE_COPY); GrCopyArea(GR_ROOT_WINDOW_ID, gc, 150, 150, width, height, pid1, 0, 0, MWMODE_COPY); while(1) { GrGetNextEvent(&event); switch (event.type) { case GR_EVENT_TYPE_KEY_DOWN: c = event.keystroke.ch; if(c == 'q') { GrClose(); exit(0); } break; default: break; } } } -------------------------------------------------------------------------- Thanks in advance | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] Transparent pixmap
From: Fredrik Johansson ####@####.#### Date: 25 Feb 2008 06:47:22 -0000 Message-Id: <47C26500.2020307@sectra.se> Hi I'm rather new to Nano-X so I do not know if this applies but you could try using: GrSetGCUseBackground (gc, GR_FALSE); Regards Fredrik Johansson ####@####.#### skrev: > Hello, > > i want to copy the contents of a pixmap on to the screen. The pixmap > contains a gif with a transparent background (=> alpha = 0). When i > copy the pixmap to the screen the transparent background is visible. I > run nano-x for the Linux-X86 platform using the X11 library. When > drawing the gif directly to the screen the transparent background is, > correctly, not visisble. I attach a simple example which demonstrates > the problem. In the example i do not load the gif, instead i have two > pixmaps: one painted with red color (alpha = 0) and the other with > blue (alpha = 255). Still, the red is visible. I also tried the > SRCTRANSCOPY mode as arhument in the GrCopyArea, but i am not sure if > this mode of operation is actually implemented. Any help is greatly > appreciated. > > ------------------------------------------------------------------------- > #include <stdio.h> > #include <stdlib.h> > #define MWINCLUDECOLORS > #include "nano-X.h" > > int main(int argc, char **argv) > { > GR_WINDOW_ID pid1, pid2; > GR_GC_ID gc; > GR_EVENT event; > int width, height; > char c; > > if( GrOpen() < 0 ) > { > printf("cannot open graphics\n"); > exit(1); > } > > width = height = 100; > > GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_KEY_DOWN); > > gc = GrNewGC(); > > pid1 = GrNewPixmap(width, height, NULL); > GrSetGCForeground(gc, MWARGB(0,255,0,0)); > GrFillRect(pid1, gc, 0, 0, width, height); > > pid2 = GrNewPixmap(width, height, NULL); > GrSetGCForeground(gc, MWARGB(255,0,0,255)); > GrFillRect(pid2, gc, 0, 0, width, height); > > GrCopyArea(GR_ROOT_WINDOW_ID, gc, 100, 100, width, height, pid2, 0, > 0, MWMODE_COPY); > > GrCopyArea(GR_ROOT_WINDOW_ID, gc, 150, 150, width, height, pid1, 0, > 0, MWMODE_COPY); > > while(1) > { > GrGetNextEvent(&event); > switch (event.type) > { > case GR_EVENT_TYPE_KEY_DOWN: > c = event.keystroke.ch; > if(c == 'q') > { > GrClose(); > exit(0); > } > break; > default: > break; > } > } > } > -------------------------------------------------------------------------- > > Thanks in advance > > --------------------------------------------------------------------- > To unsubscribe, e-mail: ####@####.#### > For additional commands, e-mail: ####@####.#### > > E | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Transparent pixmap
From: "Nikos Zarokostas" ####@####.#### Date: 25 Feb 2008 20:09:30 -0000 Message-Id: <f5852aee0802251209r62f7ec94xdb112c05fdb8a8d9@mail.gmail.com> Hello, i want to copy the contents of a pixmap on to the screen. The pixmap contains a gif with a transparent background (=> alpha = 0). When i copy the pixmap to the screen the transparent background is visible. I run nano-x for the Linux-X86 platform using the X11 library. When drawing the gif directly to the screen the transparent background is, correctly, not visisble. I attach a simple example which demonstrates the problem. In the example i do not load the gif, instead i have two pixmaps: one painted with red color (alpha = 0) and the other with blue (alpha = 255). Still, the red is visible. I also tried the SRCTRANSCOPY mode as arhument in the GrCopyArea, but i am not sure if this mode of operation is actually implemented. Any help is greatly appreciated. ------------------------------------------------------------------------- #include <stdio.h> #include <stdlib.h> #define MWINCLUDECOLORS #include "nano-X.h" int main(int argc, char **argv) { GR_WINDOW_ID pid1, pid2; GR_GC_ID gc; GR_EVENT event; int width, height; char c; if( GrOpen() < 0 ) { printf("cannot open graphics\n"); exit(1); } width = height = 100; GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_KEY_DOWN); gc = GrNewGC(); pid1 = GrNewPixmap(width, height, NULL); GrSetGCForeground(gc, MWARGB(0,255,0,0)); GrFillRect(pid1, gc, 0, 0, width, height); pid2 = GrNewPixmap(width, height, NULL); GrSetGCForeground(gc, MWARGB(255,0,0,255)); GrFillRect(pid2, gc, 0, 0, width, height); GrCopyArea(GR_ROOT_WINDOW_ID, gc, 100, 100, width, height, pid2, 0, 0, MWMODE_COPY); GrCopyArea(GR_ROOT_WINDOW_ID, gc, 150, 150, width, height, pid1, 0, 0, MWMODE_COPY); while(1) { GrGetNextEvent(&event); switch (event.type) { case GR_EVENT_TYPE_KEY_DOWN: c = event.keystroke.ch; if(c == 'q') { GrClose(); exit(0); } break; default: break; } } } -------------------------------------------------------------------------- Thanks in advance | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] Transparent pixmap
From: "Greg Haerr" ####@####.#### Date: 29 Feb 2008 00:53:05 -0000 Message-Id: <104601c87a6d$638fc6d0$6401a8c0@gregnewport> > I > run nano-x for the Linux-X86 platform using the X11 library. This means the driver you will have to check for SRCTRANSCOPY support will be drivers/scr_x11.c, see below. > When > drawing the gif directly to the screen the transparent background is, > correctly, not visisble. I attach a simple example which demonstrates > the problem. In the example i do not load the gif, instead i have two > pixmaps: one painted with red color (alpha = 0) and the other with > blue (alpha = 255). Still, the red is visible. I also tried the > SRCTRANSCOPY mode as arhument in the GrCopyArea, but i am not sure if > this mode of operation is actually implemented. You'll want to use the SRCTRANSCOPY rather than MWMODE_COPY to get the transparent blit. However, not all drivers implement this. You should look at the code in drivers/fblin16.c, as I think that driver (RGB565) implements it (I don't have the source here, I'm traveling). Of course, your running on X11 which means that scr_x11.c needs to have the support. When I return I can look at this more deeply for you. Also look at the code in engine/devdraw.c::GdBlit(), as that's what GrCopyArea calls (check in nanox/srvfunc.c) Regards, Greg Any help is greatly > appreciated. > > ------------------------------------------------------------------------- > #include <stdio.h> > #include <stdlib.h> > #define MWINCLUDECOLORS > #include "nano-X.h" > > int main(int argc, char **argv) > { > GR_WINDOW_ID pid1, pid2; > GR_GC_ID gc; > GR_EVENT event; > int width, height; > char c; > > if( GrOpen() < 0 ) > { > printf("cannot open graphics\n"); > exit(1); > } > > width = height = 100; > > GrSelectEvents(GR_ROOT_WINDOW_ID, GR_EVENT_MASK_KEY_DOWN); > > gc = GrNewGC(); > > pid1 = GrNewPixmap(width, height, NULL); > GrSetGCForeground(gc, MWARGB(0,255,0,0)); > GrFillRect(pid1, gc, 0, 0, width, height); > > pid2 = GrNewPixmap(width, height, NULL); > GrSetGCForeground(gc, MWARGB(255,0,0,255)); > GrFillRect(pid2, gc, 0, 0, width, height); > > GrCopyArea(GR_ROOT_WINDOW_ID, gc, 100, 100, width, height, pid2, 0, > 0, MWMODE_COPY); > > GrCopyArea(GR_ROOT_WINDOW_ID, gc, 150, 150, width, height, pid1, 0, > 0, MWMODE_COPY); > > while(1) > { > GrGetNextEvent(&event); > switch (event.type) > { > case GR_EVENT_TYPE_KEY_DOWN: > c = event.keystroke.ch; > if(c == 'q') > { > GrClose(); > exit(0); > } > break; > default: > break; > } > } > } > -------------------------------------------------------------------------- > > Thanks in advance > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: [nanogui] Transparent pixmap
From: "Greg Haerr" ####@####.#### Date: 29 Feb 2008 00:54:51 -0000 Message-Id: <105101c87a6d$9c9714b0$6401a8c0@gregnewport> > I do not know if this applies but you could > try using: > > GrSetGCUseBackground (gc, GR_FALSE); Depending on the driver, this may be required. In the beginning, it was, as we didn't support the more advanced SRCTRANSCOPY arguments to blit, and it was faked by setting a background color checking GrSetGCUseBackground in the driver. Regards, Greg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[<<] [<] Page 1 of 1 [>] [>>] |