gLib/window.h File Reference

グラフィック用ワールド座標系サポート ヘッダ More...

#include "graph.h"
Include dependency graph for window.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void setWindow (WSGraph vp, double x1, double y1, double x2, double y2)
void wSetPixel (WSGraph vp, double x1, double y1, int cc)
int wGetPixel (WSGraph vp, double x1, double y1)
void wLine (WSGraph vp, double x1, double y1, double x2, double y2, int cc)
void wMove (double x1, double y1)
void wDraw (WSGraph vp, double x1, double y1, int cc)
void wMove_Rel (double x1, double y1)
void wDraw_Rel (WSGraph vp, double x1, double y1, int cc)

Variables

double X_Dx
 ワールド座標系の x成分1ドットに対するスクリーン座標系のドット数.
double X_Dy
 ワールド座標系の y成分1ドットに対するスクリーン座標系のドット数.
double X_Wx
 スクリーン座標系の原点に対するワールド座標系の x成分.
double X_Wy
 スクリーン座標系の原点に対するワールド座標系の y成分.
double X_Now
 ペンの現地点の x成分(ワールド座標系)
double Y_Now
 ペンの現地点の y成分(ワールド座標系)

Detailed Description

Version:
2.1
Author:
Fumi.Iseki (C)

Definition in file window.h.


Function Documentation

void setWindow ( WSGraph  vp,
double  x1,
double  y1,
double  x2,
double  y2 
)

void setWindow(WSGraph vp, double x1, double y1, double x2, double y2)

2Dのワールド座標系に表示用の窓(ビューポート)を設定する.

Parameters:
vp 窓(ビューポート)を割り付ける 2Dグラフィックデータ.
x1 窓(ビューポート)の一つの角の座標の x成分.
y1 窓(ビューポート)の一つの角の座標の y成分.
x2 窓(ビューポート)の(x1,y1)の対角の座標の x成分.
y2 窓(ビューポート)の(x1,y1)の対角の座標の y成分.

Definition at line 28 of file window.c.

References Max, Min, X_Dx, X_Dy, X_Wx, X_Wy, Xabs, WSGraph::xs, and WSGraph::ys.

00029 {
00030     if (x1==x2 || y1==y2) return;
00031 
00032     X_Dx = (vp.xs - 1)/Xabs(x2 - x1);
00033     X_Dy = (vp.ys - 1)/Xabs(y2 - y1);
00034     X_Wx = Min(x1, x2);
00035     X_Wy = Max(y1, y2);
00036 }

void wDraw ( WSGraph  vp,
double  x1,
double  y1,
int  cc 
)

void wDraw(WSGraph vp, double x1, double y1, int cc)

ワールド座標系で現地点から指定した地点へ線を引く. 指定した地点が現地点となる.

Parameters:
vp 操作対象のグラフィックデータ.
x1 線の終点の x座標(ワールド座標系).
y1 線の終点の y座標(ワールド座標系).
cc 線の輝度値.

Definition at line 138 of file window.c.

References wLine(), X_Now, and Y_Now.

00139 {
00140     wLine(vp, X_Now, Y_Now, x1, y1, cc);
00141 
00142     X_Now = x1;
00143     Y_Now = y1;
00144 }

Here is the call graph for this function:

void wDraw_Rel ( WSGraph  vp,
double  x1,
double  y1,
int  cc 
)

void wDraw_Rel(WSGraph vp, double x1, double y1, int cc)

ワールド座標系で現地点を起点として相対的に線を引く. 線の終点が現地点となる.

Parameters:
vp 操作対象のグラフィックデータ.
x1 現地点から x方向への移動距離(ワールド座標系).
y1 現地点から x方向への移動距離(ワールド座標系).
cc 線の輝度値.

Definition at line 175 of file window.c.

References wLine(), X_Now, and Y_Now.

00176 {
00177     double x2, y2;
00178  
00179     x2 = X_Now + x1;
00180     y2 = Y_Now + y1;
00181 
00182     wLine(vp, X_Now, Y_Now, x2, y2, cc);
00183 
00184     X_Now = x2;
00185     Y_Now = y2;
00186 }

Here is the call graph for this function:

int wGetPixel ( WSGraph  vp,
double  x,
double  y 
)

int wGetPixel(WSGraph vp, double x, double y)

ワールド座標系に点を打つ.

Parameters:
vp 操作対象のグラフィックデータ.
x 点の x座標(ワールド座標系).
y 点の y座標(ワールド座標系).
Returns:
点の輝度値.

Definition at line 73 of file window.c.

References GetPixel, X_Dx, X_Dy, X_Wx, and X_Wy.

00074 {
00075     int  i, j;
00076 
00077     i = (int)((x - X_Wx)*X_Dx + 0.5);
00078     j = (int)((X_Wy - y)*X_Dy + 0.5);
00079 
00080     return GetPixel(vp, i, j);
00081 }

void wLine ( WSGraph  vp,
double  x1,
double  y1,
double  x2,
double  y2,
int  cc 
)

void wLine(WSGraph vp, double x1, double y1, double x2, double y2, int cc)

ワールド座標系に線を引く.

Parameters:
vp 操作対象のグラフィックデータ.
x1 線の始点の x座標(ワールド座標系).
y1 線の始点の y座標(ワールド座標系).
x2 線の終点の x座標(ワールド座標系).
y2 線の終点の y座標(ワールド座標系).
cc 線の輝度値.

Definition at line 97 of file window.c.

References line(), X_Dx, X_Dy, X_Wx, and X_Wy.

Referenced by wDraw(), and wDraw_Rel().

00098 {
00099     int  i1, j1, i2, j2;
00100 
00101     i1 = (int)((x1 - X_Wx)*X_Dx + 0.5);
00102     i2 = (int)((x2 - X_Wx)*X_Dx + 0.5);
00103     j1 = (int)((X_Wy - y1)*X_Dy + 0.5);
00104     j2 = (int)((X_Wy - y2)*X_Dy + 0.5);
00105 
00106     line(vp, i1, j1, i2, j2, cc);
00107 }

Here is the call graph for this function:

Here is the caller graph for this function:

void wMove ( double  x1,
double  y1 
)

void wMove(double x1, double y1)

ワールド座標系で現地点を移動する(線は引かない).

Parameters:
x1 移動する地点の x座標(ワールド座標系).
y1 移動する地点の y座標(ワールド座標系).

Definition at line 119 of file window.c.

References X_Now, and Y_Now.

00120 {
00121     X_Now = x1;
00122     Y_Now = y1;
00123 }

void wMove_Rel ( double  x1,
double  y1 
)

void wMove_Rel(double x1, double y1)

ワールド座標系で相対的に現地点を移動する(線は引かない).

Parameters:
x1 現地点から x方向への移動距離(ワールド座標系).
y1 現地点から y方向への移動距離(ワールド座標系).

Definition at line 156 of file window.c.

References X_Now, and Y_Now.

00157 {
00158     X_Now += x1;
00159     Y_Now += y1;
00160 }

void wSetPixel ( WSGraph  vp,
double  x,
double  y,
int  cc 
)

void wSetPixel(WSGraph vp, double x, double y, int cc)

ワールド座標系に点を打つ.

Parameters:
vp 操作対象のグラフィックデータ.
x 点の x座標(ワールド座標系).
y 点の y座標(ワールド座標系).
cc 点の輝度値.

Definition at line 50 of file window.c.

References SetPixel, X_Dx, X_Dy, X_Wx, and X_Wy.

00051 {
00052     int  i, j;
00053 
00054     i = (int)((x - X_Wx)*X_Dx + 0.5);
00055     j = (int)((X_Wy - y)*X_Dy + 0.5);
00056 
00057     SetPixel(vp, i, j, cc);
00058 }


Variable Documentation

double X_Dx

Definition at line 13 of file window.c.

Referenced by setWindow(), wGetPixel(), wLine(), and wSetPixel().

double X_Dy

Definition at line 13 of file window.c.

Referenced by setWindow(), wGetPixel(), wLine(), and wSetPixel().

double X_Now

Definition at line 14 of file window.c.

Referenced by wDraw(), wDraw_Rel(), wMove(), and wMove_Rel().

double X_Wx

Definition at line 13 of file window.c.

Referenced by setWindow(), wGetPixel(), wLine(), and wSetPixel().

double X_Wy

Definition at line 13 of file window.c.

Referenced by setWindow(), wGetPixel(), wLine(), and wSetPixel().

double Y_Now

Definition at line 14 of file window.c.

Referenced by wDraw(), wDraw_Rel(), wMove(), and wMove_Rel().


Generated on 15 Nov 2023 for JunkBox_Lib by  doxygen 1.6.1