Subject:
Problem when drawing an image in a Pixmap (NanoX)
From:
Jacques MOLY ####@####.####
Date:
17 Jan 2003 16:19:45 -0000
Message-Id: <3E282C92.9745D6E7@noos.fr>
Hi,
I'm trying to display images with NanoX.
I use NanoX on top of X11, on a P4 2GHz, with RedHat 8.0.
At first, I simply displayed images with GrDrawImageFromFile, with a
window as first argument.
It works but it's dramatically slow, and the colors are not very good
when displaying a jpeg.
I'm now trying to draw the image to a pixmap (then I'll use GrCopyArea).
Has somebody already done that ? In my case it crashes when trying to
write to the pixmap (seems that that the stack is corrupted).
Do you have an idea ?
Stack & program follow .
Moreover, do you if there are parameters I should change to have a
better color conversion ?
Many thanks,
Jacques.
Program received signal SIGSEGV, Segmentation fault.
0x08065b23 in linear32_drawpixel (psd=0x8199f20, x=615, y=-1358954927,
c=16776176)
at fblin32.c:39
39 addr[x + y * psd->linelen] = c;
(gdb) where
#0 0x08065b23 in linear32_drawpixel (psd=0x8199f20, x=615,
y=-1358954927, c=16776176)
at fblin32.c:39
#1 0x0805279c in GdDrawImage (psd=0x8199f20, x=615, y=431,
pimage=0xbffff7d0)
at devdraw.c:794
#2 0x08057831 in GdDrawImageToFit (psd=0x8199f20, x=0, y=0, width=640,
height=-1073743920,
id=-1358954927) at devimage.c:398
#3 0x0805a6eb in GdDrawImageFromFile (psd=0x8199f20, x=135896864,
y=135896864,
width=135896864, height=135896864, path=0x1 <Address 0x1 out of
bounds>,
flags=135896864) at devimage.c:217
#4 0x0804d09f in GrDrawImageFromFile (id=3, gc=1000, x=0, y=0,
width=640, height=480,
path=0x807c9c0 "/home/jacques/Images/eurowards.jpg", flags=0) at
srvfunc.c:2170
#5 0x08049d01 in main (argc=1, argv=0xbffff9d4) at test-pixmap.c:48
#6 0x420158d4 in __libc_start_main () from /lib/i686/libc.so.6
if (GrOpen() < 0) {
fprintf(stderr, "cannot open graphics\n");
exit(1);
}
GrGetScreenInfo(&si);
/* print error, but don't exit*/
GrSetErrorHandler(errorcatcher);
myWindow = GrNewWindow(GR_ROOT_WINDOW_ID, 0, 0, si.cols,
si.rows, 0, WHITE, WHITE);
myPixmap = GrNewPixmap(si.cols, si.rows, (void *)dummyArea) ;
GrSelectEvents(myWindow, GR_EVENT_MASK_EXPOSURE);
GrMapWindow(myWindow);
myGc = GrNewGC();
GrDrawImageFromFile(myPixmap, myGc, 0 /* x */, 0 /* y */,
si.cols, si.rows,
"/home/jacques/Images/eurowards.jpg",
0) ;