integer BLACK, YELLOW, GREEN, CYAN, WHITE, ON
parameter (BLACK=0, YELLOW=3, GREEN=2, CYAN=6, WHITE=7, ON=-1)
call vinit('X11')
call color(BLACK)
call clear()
call color(YELLOW)
call rect(-0.5,-0.5,0.5,0.5)
call color(GREEN)
call circle(0.0, 0.0, 0.5)
call color(WHITE)
call closs
call font('times.rb')
call color(CYAN)
call move2(0.7, 0.1)
call drawstr('X axis')
call move2(0.1, 0.9)
call drawstr('Y axis')
x=getkey()
call vexit
stop
end
subroutine closs()
call move2(-1.0, 0.0)
call draw2( 1.0, 0.0)
call move2( 0.0,-1.0)
call draw2( 0.0, 1.0)
end
#include <vogle.h>
#define BLACK 0
#define GREEN 2
#define YELLOW 3
#define CYAN 6
#define WHITE 7
#define ON -1
main()
{
vinit("X11");
color(BLACK);
clear();
color(YELLOW); rect(-0.5,-0.5,0.5,0.5);
color(GREEN); circle(0.0, 0.0, 0.5);
color(WHITE); closs();
font("times.rb");
color(CYAN);
move2(0.7, 0.1); drawstr("X axis");
move2(0.1, 0.9); drawstr("Y axis");
getkey();
vexit();
}
closs()
{
move2(-1.0, 0.0);
draw2( 1.0, 0.0);
move2( 0.0,-1.0);
draw2( 0.0, 1.0);
}
% f77 -L/usr/meiji/lib sample.f -o sample -lvogle
% cc -L/usr/meiji/lib -I/usr/meiji/include/vogle sample.c
-o sample -lvogle -lm
% sample
file=example/sample.ps,height=5cm
ウィンドウ上の出力結果を xdpr というコマンドを用いるとプリンタへ出力す ることが出来る。
xdpr -Pprinter名 -frame -portrait -device ps
また、画面のハードコピーではなく、もっと奇麗な出力を得たい時には、sample.f(c) の一部を書き直して、出力を直接プリンタへ送るという方法もある。
call vinit('X11') を call vinit('postscript') に変更(FORTRANの場合)
vinit("X11"); を vinit("postscript"); に変更(Cの場合)
sample | lpr -Pprinter名
○ 注意