C言語でグラフィックス | ||
【2】図形の描画と消去 |
(5)四角形(GWrect関数)
サンプルプログラム 〔gr206.c〕
四角形を描画するプログラムを作成する。(描画部分のみを示す)
#include <GrWin.h> int main(void) { int width = 640, height = 400; GWopen(0); GWsize(-5, &width, &height); GWsize(-3, NULL, NULL); GWvport(0.0, 0.0, (float)width / (float)height, 1.0); GWindow(0.0, 0.0, (float)width - 1.0, (float)height - 1.0); /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */ GWclear(-1); GWrect(50.0, 350.0, 100.0, 250.0); /* 四角形描画 */ /* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */ GWquit(); return 0; }
int GWrect(float X1, float Y1, float X2, float Y2); |
Copyright © 2005 Hiroshi Masuda |