version 1.10, 2002/07/10 05:29:36 |
version 1.15, 2011/08/11 06:25:06 |
|
|
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* |
* |
* $OpenXM: OpenXM_contrib2/asir2000/plot/plotp.c,v 1.9 2001/10/09 01:36:28 noro Exp $ |
* $OpenXM: OpenXM_contrib2/asir2000/plot/plotp.c,v 1.14 2011/08/10 04:51:58 saito Exp $ |
*/ |
*/ |
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
|
|
static POINT oldpos; |
static POINT oldpos; |
#endif |
#endif |
|
|
|
#if defined(INTERVAL) |
|
unsigned long GetColor(Display *, char *); |
|
|
|
unsigned long GetColor(Display *dis, char *color_name) |
|
{ |
|
Colormap cmap; |
|
XColor near_color, true_color; |
|
|
|
cmap = DefaultColormap( dis, 0 ); |
|
XAllocNamedColor( dis, cmap, color_name, &near_color, &true_color ); |
|
return( near_color.pixel ); |
|
} |
|
|
|
void area_print(DISPLAY *display, int **mask, struct canvas *can, int GXcode) |
|
{ |
|
int ix, iy; |
|
XImage *image; |
|
unsigned long color, black, white; |
|
int wc; |
|
|
|
flush(); |
|
black = GetColor(display, "black"); |
|
white = GetColor(display, "white"); |
|
image = XGetImage(display, can->pix, 0, 0, can->width, can->height, |
|
-1, ZPixmap); |
|
for(iy = 0; iy < can->height; iy++){ |
|
for(ix = 0; ix < can->width; ix++){ |
|
color = XGetPixel(image, ix, iy); |
|
if (color == white) wc = -1; |
|
else if (color == black) wc = 0; |
|
else wc = 1; |
|
if ( wc != 0 ) {//XPutPixel(image,ix,iy,black); |
|
if ( mask[iy][ix] == 0 ) XPutPixel(image, ix, iy, black); |
|
else { |
|
switch (GXcode) { |
|
case 3: /* copy case */ |
|
if (mask[iy][ix] == 1 ) XPutPixel(image, ix, iy, can->color); |
|
else XPutPixel(image, ix, iy, BackPixel); |
|
break; |
|
case 1: /* and case */ |
|
if ((mask[iy][ix] == 1) && (wc == 1)) |
|
XPutPixel(image, ix, iy, can->color); |
|
else XPutPixel(image, ix, iy, BackPixel); |
|
break; |
|
case 7: /* or case */ |
|
if ((mask[iy][ix] == 1) || (wc == 1)) |
|
XPutPixel(image, ix, iy, can->color); |
|
else XPutPixel(image, ix, iy, BackPixel); |
|
break; |
|
case 6: /* xor case */ |
|
if ((mask[iy][ix] == 1) ^ (wc == 1)) |
|
XPutPixel(image, ix, iy, can->color); |
|
else XPutPixel(image, ix, iy, BackPixel); |
|
break; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
XPutImage(display,can->pix,drawGC,image,0,0,0,0,can->width, can->height); |
|
count_and_flush(); |
|
flush(); |
|
} |
|
#endif |
|
|
void if_print(DISPLAY *display,double **tab,struct canvas *can) |
void if_print(DISPLAY *display,double **tab,struct canvas *can) |
{ |
{ |
int ix,iy,width,height; |
int ix,iy,width,height; |
Line 79 void if_print(DISPLAY *display,double **tab,struct can |
|
Line 144 void if_print(DISPLAY *display,double **tab,struct can |
|
iy<height-1 ;iy++, px++, px1++, px2++ ) |
iy<height-1 ;iy++, px++, px1++, px2++ ) |
if ( ((*px >= 0) && ((*px1 <= 0) || (*px2 <= 0))) || |
if ( ((*px >= 0) && ((*px1 <= 0) || (*px2 <= 0))) || |
((*px <= 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(); |
count_and_flush(); |
} |
} |
flush(); |
flush(); |
Line 153 void con_print(DISPLAY *display,double **tab,struct ca |
|
Line 218 void con_print(DISPLAY *display,double **tab,struct ca |
|
flush(); |
flush(); |
for ( parray = can->pa, iz = 0; iz <= can->nzstep; iz++, parray++ ) |
for ( parray = can->pa, iz = 0; iz <= can->nzstep; iz++, parray++ ) |
for ( pa = parray->pos, len = parray->length, ix = 0; ix < len; ix++ ) { |
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(); |
count_and_flush(); |
} |
} |
flush(); |
flush(); |
Line 205 void memory_con_print(double **tab,struct canvas *can, |
|
Line 270 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) |
void qif_print(DISPLAY *display,char **tab,struct canvas *can) |
{ |
{ |
int ix,iy,width,height; |
int ix,iy,width,height; |
Line 216 void qif_print(DISPLAY *display,char **tab,struct canv |
|
Line 299 void qif_print(DISPLAY *display,char **tab,struct canv |
|
for( ix = 0; ix < width; ix++ ) |
for( ix = 0; ix < width; ix++ ) |
for(iy = 0, px = tab[ix]; iy < height ;iy++, px++ ) |
for(iy = 0, px = tab[ix]; iy < height ;iy++, px++ ) |
if ( *px ) { |
if ( *px ) { |
DRAWPOINT(display,pix,drawGC,ix,height-iy-1); |
DRAWPOINT(display,pix,cdrawGC,ix,height-iy-1); |
count_and_flush(); |
count_and_flush(); |
} |
} |
flush(); |
flush(); |
Line 252 void draw_point(DISPLAY *display,struct canvas *can,in |
|
Line 335 void draw_point(DISPLAY *display,struct canvas *can,in |
|
SetPixel(dc,x,y,(COLORREF)color); |
SetPixel(dc,x,y,(COLORREF)color); |
ReleaseDC(can->hwnd,dc); |
ReleaseDC(can->hwnd,dc); |
#else |
#else |
if ( color ) { |
set_drawcolor(color); |
set_drawcolor(color); |
DRAWPOINT(display,can->pix,cdrawGC,x,y); |
DRAWPOINT(display,can->pix,cdrawGC,x,y); |
DRAWPOINT(display,can->window,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); |
|
} |
|
XFlush(display); |
XFlush(display); |
#endif |
#endif |
} |
} |
Line 290 void draw_line(DISPLAY *display,struct canvas *can,int |
|
Line 368 void draw_line(DISPLAY *display,struct canvas *can,int |
|
ReleaseDC(can->hwnd,dc); |
ReleaseDC(can->hwnd,dc); |
} |
} |
#else |
#else |
if ( color ) { |
set_drawcolor(color); |
set_drawcolor(color); |
DRAWLINE(display,can->pix,cdrawGC,x,y,u,v); |
DRAWLINE(display,can->pix,cdrawGC,x,y,u,v); |
DRAWLINE(display,can->window,cdrawGC,x,y,u,v); |
DRAWLINE(display,can->window,cdrawGC,x,y,u,v); |
|
} else { |
|
DRAWLINE(display,can->pix,drawGC,x,y,u,v); |
|
DRAWLINE(display,can->window,drawGC,x,y,u,v); |
|
} |
|
XFlush(display); |
XFlush(display); |
#endif |
#endif |
} |
} |
Line 306 void draw_character_string(DISPLAY *display,struct can |
|
Line 379 void draw_character_string(DISPLAY *display,struct can |
|
{ |
{ |
#if defined(VISUAL) |
#if defined(VISUAL) |
HDC dc; |
HDC dc; |
HPEN pen,oldpen; |
COLORREF oldcolor; |
|
|
if ( color ) { |
if ( color ) { |
pen = CreatePen(PS_SOLID,1,color); |
oldcolor = SetTextColor(can->pix,color); |
oldpen = SelectObject(can->pix,pen); |
|
DRAWSTRING(display,can->pix,drawGC,x,y,str,strlen(str)); |
DRAWSTRING(display,can->pix,drawGC,x,y,str,strlen(str)); |
SelectObject(can->pix,oldpen); |
SetTextColor(can->pix,oldcolor); |
|
|
dc = GetDC(can->hwnd); |
dc = GetDC(can->hwnd); |
oldpen = SelectObject(dc,pen); |
oldcolor = SetTextColor(dc,color); |
DRAWSTRING(display,dc,drawGC,x,y,str,strlen(str)); |
DRAWSTRING(display,dc,drawGC,x,y,str,strlen(str)); |
SelectObject(dc,oldpen); |
SetTextColor(dc,oldcolor); |
ReleaseDC(can->hwnd,dc); |
ReleaseDC(can->hwnd,dc); |
|
|
DeleteObject(pen); |
|
} else { |
} else { |
DRAWSTRING(display,can->pix,drawGC,x,y,str,strlen(str)); |
DRAWSTRING(display,can->pix,drawGC,x,y,str,strlen(str)); |
dc = GetDC(can->hwnd); |
dc = GetDC(can->hwnd); |
Line 328 void draw_character_string(DISPLAY *display,struct can |
|
Line 398 void draw_character_string(DISPLAY *display,struct can |
|
ReleaseDC(can->hwnd,dc); |
ReleaseDC(can->hwnd,dc); |
} |
} |
#else |
#else |
if ( color ) { |
set_drawcolor(color); |
set_drawcolor(color); |
DRAWSTRING(display,can->pix,cdrawGC,x,y,str,strlen(str)); |
DRAWSTRING(display,can->pix,cdrawGC,x,y,str,strlen(str)); |
DRAWSTRING(display,can->window,cdrawGC,x,y,str,strlen(str)); |
DRAWSTRING(display,can->window,cdrawGC,x,y,str,strlen(str)); |
|
} else { |
|
DRAWSTRING(display,can->pix,drawGC,x,y,str,strlen(str)); |
|
DRAWSTRING(display,can->window,drawGC,x,y,str,strlen(str)); |
|
} |
|
XFlush(display); |
XFlush(display); |
#endif |
#endif |
} |
} |