version 1.2, 2002/01/04 01:35:24 |
version 1.4, 2002/07/10 08:40:58 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2000/lib/glib,v 1.1 2001/12/10 05:02:46 takayama Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2000/lib/glib,v 1.3 2002/06/07 06:00:28 noro Exp $ */ |
/* $Id$ */ |
/* $Id$ */ |
|
|
/* Todo: |
/* Todo: |
Line 150 def glib_putpixel(X,Y) { |
|
Line 150 def glib_putpixel(X,Y) { |
|
if (Glib_canvas < 0) glib_open(); |
if (Glib_canvas < 0) glib_open(); |
glib_check(); |
glib_check(); |
glib_check_arg(X,Y); |
glib_check_arg(X,Y); |
draw_obj(Glib_process,Glib_canvas, |
C = getopt(color); |
|
if ( type(C) != -1 ) |
|
draw_obj(Glib_process,Glib_canvas, |
[floor(Glib_xmag*(X+Glib_xoffset)), |
[floor(Glib_xmag*(X+Glib_xoffset)), |
|
floor(Glib_ymag*(Y+Glib_yoffset))],C); |
|
else |
|
draw_obj(Glib_process,Glib_canvas, |
|
[floor(Glib_xmag*(X+Glib_xoffset)), |
floor(Glib_ymag*(Y+Glib_yoffset))]); |
floor(Glib_ymag*(Y+Glib_yoffset))]); |
} |
} |
|
|
def glib_line(X0,Y0,X1,Y1) { |
def glib_line(X0,Y0,X1,Y1) { |
extern Glib_xmag, Glib_ymag, Glib_xoffset, Glib_yoffset; |
extern Glib_xmag, Glib_ymag, Glib_xoffset, Glib_yoffset; |
|
C = getopt(color); |
glib_check_arg(X0,Y0); |
glib_check_arg(X0,Y0); |
glib_check_arg(X1,Y1); |
glib_check_arg(X1,Y1); |
glib_clip_line(floor(Glib_xmag*(X0+Glib_xoffset)), |
glib_clip_line(floor(Glib_xmag*(X0+Glib_xoffset)), |
floor(Glib_ymag*(Y0+Glib_yoffset)), |
floor(Glib_ymag*(Y0+Glib_yoffset)), |
floor(Glib_xmag*(X1+Glib_xoffset)), |
floor(Glib_xmag*(X1+Glib_xoffset)), |
floor(Glib_ymag*(Y1+Glib_yoffset))); |
floor(Glib_ymag*(Y1+Glib_yoffset)),C); |
} |
} |
|
|
def glib_clip_line(X0,Y0,X1,Y1) { |
def glib_clip_line(X0,Y0,X1,Y1,Color) { |
/* X0, Y0, X1, Y1 should be integers. |
/* X0, Y0, X1, Y1 should be integers. |
Coordinates are already translated. */ |
Coordinates are already translated. */ |
extern Glib_process, Glib_canvas, Glib_canvas_x, Glib_canvas_y; |
extern Glib_process, Glib_canvas, Glib_canvas_x, Glib_canvas_y; |
Line 209 def glib_clip_line(X0,Y0,X1,Y1) { |
|
Line 216 def glib_clip_line(X0,Y0,X1,Y1) { |
|
#endif |
#endif |
#endif |
#endif |
glib_check(); |
glib_check(); |
draw_obj(Glib_process,Glib_canvas, |
if ( type(Color) != -1 ) |
|
draw_obj(Glib_process,Glib_canvas, |
|
[floor(X0),floor(Y0),floor(X1),floor(Y1)],Color); |
|
else |
|
draw_obj(Glib_process,Glib_canvas, |
[floor(X0),floor(Y0),floor(X1),floor(Y1)]); |
[floor(X0),floor(Y0),floor(X1),floor(Y1)]); |
|
|
} |
} |
|
|
def glib_clip0_x(X0,Y0,X1,Y1,Clip) { |
def glib_clip0_x(X0,Y0,X1,Y1,Clip) { |
Line 253 def glib_clip1_y(X0,Y0,X1,Y1,Clip) { |
|
Line 263 def glib_clip1_y(X0,Y0,X1,Y1,Clip) { |
|
return([X0,Y0,X1+(Clip-Y1)*(X0-X1)/(Y0-Y1),Clip]); |
return([X0,Y0,X1+(Clip-Y1)*(X0-X1)/(Y0-Y1),Clip]); |
} |
} |
return([X0,Y0,X1,Y1]); |
return([X0,Y0,X1,Y1]); |
|
} |
|
|
|
/*&usage begin:glib_print(X,Y,Text|color) |
|
It put a string {Text} at [{X},{Y}] on the glib canvas. |
|
example: glib_print(100,100,"Hello Worlds" | color=0xff0000); |
|
end: */ |
|
def glib_print(X,Y,Text) { |
|
extern Glib_process, Glib_canvas, |
|
Glib_xoffset, Glib_yoffset, Glib_xmag, Glib_ymag; |
|
if (Glib_canvas < 0) glib_open(); |
|
glib_check(); |
|
glib_check_arg(X,Y); |
|
if (type(Text) != 7) error("glib_print(X,Y,Text): Text must be a string."); |
|
C = getopt(color); |
|
if ( type(C) != -1 ) |
|
draw_string(Glib_process,Glib_canvas, |
|
[X,Y],Text,C); |
|
else |
|
draw_string(Glib_process,Glib_canvas, |
|
[X,Y],Text); |
} |
} |
end$ |
end$ |
|
|