=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/plot/plotp.c,v retrieving revision 1.9 retrieving revision 1.13 diff -u -p -r1.9 -r1.13 --- OpenXM_contrib2/asir2000/plot/plotp.c 2001/10/09 01:36:28 1.9 +++ OpenXM_contrib2/asir2000/plot/plotp.c 2005/12/21 23:18:16 1.13 @@ -45,7 +45,7 @@ * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. * - * $OpenXM: OpenXM_contrib2/asir2000/plot/plotp.c,v 1.8 2001/08/22 09:19:21 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/plot/plotp.c,v 1.12 2005/05/18 03:27:00 noro Exp $ */ #include "ca.h" #include "parse.h" @@ -79,7 +79,7 @@ void if_print(DISPLAY *display,double **tab,struct can iy= 0) && ((*px1 <= 0) || (*px2 <= 0))) || ((*px <= 0) && ((*px1 >= 0) || (*px2 >= 0))) ) { - DRAWPOINT(display,pix,drawGC,ix,height-iy-1); + DRAWPOINT(display,pix,cdrawGC,ix,height-iy-1); count_and_flush(); } flush(); @@ -153,7 +153,7 @@ void con_print(DISPLAY *display,double **tab,struct ca flush(); for ( parray = can->pa, iz = 0; iz <= can->nzstep; iz++, parray++ ) for ( pa = parray->pos, len = parray->length, ix = 0; ix < len; ix++ ) { - DRAWPOINT(display,pix,drawGC,XC(pa[ix]),YC(pa[ix])); + DRAWPOINT(display,pix,cdrawGC,XC(pa[ix]),YC(pa[ix])); count_and_flush(); } flush(); @@ -205,6 +205,24 @@ void memory_con_print(double **tab,struct canvas *can, } } +void memory_print(struct canvas *can,BYTEARRAY *bytes) +{ + int len,scan_len,i; + POINT *pa; + char *array; + + /* scan_len = byte length of the scan line */ + scan_len = (can->width+7)/8; + MKBYTEARRAY(*bytes,scan_len*can->height); + array = BDY(*bytes); + + len = can->pa[0].length; + pa = can->pa[0].pos; + for ( i = 0; i < len; i++ ) { + MEMORY_DRAWPOINT(array,scan_len,pa[i].x,pa[i].y); + } +} + void qif_print(DISPLAY *display,char **tab,struct canvas *can) { int ix,iy,width,height; @@ -216,7 +234,7 @@ void qif_print(DISPLAY *display,char **tab,struct canv for( ix = 0; ix < width; ix++ ) for(iy = 0, px = tab[ix]; iy < height ;iy++, px++ ) if ( *px ) { - DRAWPOINT(display,pix,drawGC,ix,height-iy-1); + DRAWPOINT(display,pix,cdrawGC,ix,height-iy-1); count_and_flush(); } flush(); @@ -252,14 +270,9 @@ void draw_point(DISPLAY *display,struct canvas *can,in SetPixel(dc,x,y,(COLORREF)color); ReleaseDC(can->hwnd,dc); #else - if ( color ) { - set_drawcolor(color); - DRAWPOINT(display,can->pix,cdrawGC,x,y); - DRAWPOINT(display,can->window,cdrawGC,x,y); - } else { - DRAWPOINT(display,can->pix,drawGC,x,y); - DRAWPOINT(display,can->window,drawGC,x,y); - } + set_drawcolor(color); + DRAWPOINT(display,can->pix,cdrawGC,x,y); + DRAWPOINT(display,can->window,cdrawGC,x,y); XFlush(display); #endif } @@ -290,14 +303,39 @@ void draw_line(DISPLAY *display,struct canvas *can,int ReleaseDC(can->hwnd,dc); } #else + set_drawcolor(color); + DRAWLINE(display,can->pix,cdrawGC,x,y,u,v); + DRAWLINE(display,can->window,cdrawGC,x,y,u,v); + XFlush(display); +#endif +} + +void draw_character_string(DISPLAY *display,struct canvas *can,int x,int y,char *str,int color) +{ +#if defined(VISUAL) + HDC dc; + COLORREF oldcolor; + if ( color ) { - set_drawcolor(color); - DRAWLINE(display,can->pix,cdrawGC,x,y,u,v); - DRAWLINE(display,can->window,cdrawGC,x,y,u,v); + oldcolor = SetTextColor(can->pix,color); + DRAWSTRING(display,can->pix,drawGC,x,y,str,strlen(str)); + SetTextColor(can->pix,oldcolor); + + dc = GetDC(can->hwnd); + oldcolor = SetTextColor(dc,color); + DRAWSTRING(display,dc,drawGC,x,y,str,strlen(str)); + SetTextColor(dc,oldcolor); + ReleaseDC(can->hwnd,dc); } else { - DRAWLINE(display,can->pix,drawGC,x,y,u,v); - DRAWLINE(display,can->window,drawGC,x,y,u,v); + DRAWSTRING(display,can->pix,drawGC,x,y,str,strlen(str)); + dc = GetDC(can->hwnd); + DRAWSTRING(display,dc,drawGC,x,y,str,strlen(str)); + ReleaseDC(can->hwnd,dc); } +#else + set_drawcolor(color); + DRAWSTRING(display,can->pix,cdrawGC,x,y,str,strlen(str)); + DRAWSTRING(display,can->window,cdrawGC,x,y,str,strlen(str)); XFlush(display); #endif }