[<<] [<] Page 1 of 1 [>] [>>] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
GrArea
From: ####@####.#### Date: 29 Nov 2000 02:48:27 -0000 Message-Id: <200011290251.KAA20082@cape.com.cn> Hello: when I use the function GrArea like this: GrArea(fl_window, fl_gc, 0, 0, WIDTH, HEIGHT, outtable, MWPF_PIXELVAL); the error occured and the error message is : assert "c<psd->ncolors" failor. why?? how should I use the GrArea and GrReadArea? thanks | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: GrArea
From: "Greg Haerr" ####@####.#### Date: 29 Nov 2000 03:55:30 -0000 Message-Id: <060401c059b8$83e8cae0$15320cd0@gregh> : GrArea(fl_window, fl_gc, 0, 0, WIDTH, HEIGHT, outtable, MWPF_PIXELVAL); : the error occured and the error message is : assert "c<psd->ncolors" failor. Typically, you are not sending MWPF_PIXELVAL, which is usually compiled in as an unsigned long. Instead, you are probably sending unsigned short or unsigned char values. If you're running in palette mode, try specifying MWPF_PALETTE instead. Or you can recompile Microwindows with a different value in MWPF_PALETTE= in the config file, and send that value directly. When the blitter picks up the unsigned long value, rather than the differently packed char or short, the assert fails... Regards, Greg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
GrArea
From: ####@####.#### Date: 29 Nov 2000 07:14:48 -0000 Message-Id: <200011290717.PAA20998@cape.com.cn> Hello Greg: thanks a lot! what is the meaning of the variable psd->ncolors ? additional: the code blow is working ,no errors void save() { GR_PIXELVAL intable[WIDTH*HEIGHT]; GrReadArea(fl_window, 0, MENU_HEIGHT, WIDTH, HEIGHT-MENU_HEIGHT, intable); write(handle, intable, 240*300); for(int i=0;i<300;i++) { for(int j=0;j<240;j++) { ;;;;; } } GrArea(fl_window, fl_gc, 0, MENU_HEIGHT, WIDTH, HEIGHT, intable, MWPF_PIXELVAL); redraw(); } but this code blow will occured failure: void save() { GR_PIXELVAL intable[WIDTH*HEIGHT]; GrReadArea(fl_window, 0, MENU_HEIGHT, WIDTH, HEIGHT-MENU_HEIGHT, intable); write(handle, intable, 240*300); for(int i=0;i<300;i++) { for(int j=0;j<240;j++) { intable[i*240+j]+=0x60; } } GrArea(fl_window, fl_gc, 0, MENU_HEIGHT, WIDTH, HEIGHT, intable, MWPF_PIXELVAL);//this line occured the c<psd->ncolors failure; redraw(); } It seems that I cann't change the pixel color very effective via change the intable buffer, isn't it??????? if the type of intable is long then the last argument should be MWPF_TRUECOLOR332, isn't it????? thanks!!! I read the source code the definition of MWPF_PIXELVAL is #define MWPF_RGB 0 /* pseudo, convert from packed 32 bit RGB*/ #define MWPF_PIXELVAL 1 /* pseudo, no convert from packed PIXELVAL*/ #define MWPF_PALETTE 2 /* pixel is packed 8 bits 1, 4 or 8 pal index*/ #define MWPF_TRUECOLOR0888 3 /* pixel is packed 32 bits 8/8/8 truecolor*/ #define MWPF_TRUECOLOR888 4 /* pixel is packed 24 bits 8/8/8 truecolor*/ #define MWPF_TRUECOLOR565 5 /* pixel is packed 16 bits 5/6/5 truecolor*/ #define MWPF_TRUECOLOR332 6 /* pixel is packed 8 bits 3/3/2 truecolor*/. regards!!! . wls | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Subject:
Re: GrArea
From: Morten Rolland ####@####.#### Date: 1 Dec 2000 13:50:32 -0000 Message-Id: <3A27ADB5.CDB000B5@screenmedia.no> ####@####.#### wrote: > > what is the meaning of the variable psd->ncolors ? > Number of colors. It would be 16, 256, 65536 and huge for 4,8,16 and 24 bits respectively IIRC. If you have an 8-bit display, and send color values larger than 255, then the assert fails. I guess this is what goes wrong in your case. > I read the source code the definition of MWPF_PIXELVAL is > #define MWPF_RGB 0 /* pseudo, convert from packed 32 bit RGB*/ > #define MWPF_PIXELVAL 1 /* pseudo, no convert from packed PIXELVAL*/ > #define MWPF_PALETTE 2 /* pixel is packed 8 bits 1, 4 or 8 pal index*/ > #define MWPF_TRUECOLOR0888 3 /* pixel is packed 32 bits 8/8/8 truecolor*/ > #define MWPF_TRUECOLOR888 4 /* pixel is packed 24 bits 8/8/8 truecolor*/ > #define MWPF_TRUECOLOR565 5 /* pixel is packed 16 bits 5/6/5 truecolor*/ > #define MWPF_TRUECOLOR332 6 /* pixel is packed 8 bits 3/3/2 truecolor*/. Notice that the packing that you use for the GrArea call should match the number of bits per pixel of the display, unless MWPF_RGB is used. In this case, I believe you can rely on a translation (possibly slow). We (screen media) uses MWPF_TRUECOLOR565 to avoid translations, and send only as much image bits as needed (16 bit color display). I don't have any experience with GrReadArea. Regards, Morten Rolland | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[<<] [<] Page 1 of 1 [>] [>>] |