2010年5月20日木曜日

2Dグラフィクスの構造体(型)

グラフィクス系の構造体には以下のものがあるようです。なお、ここにないCGFloatは、CPUが32bit/64bitかに応じてfloatかdoubleになる。

CGPoint

A structure that contains a point in a two-dimensional coordinate system.
struct CGPoint {
   CGFloat x;
   CGFloat y;
};
typedef struct CGPoint CGPoint;
Fields
x
The x-coordinate of the point.
y
The y-coordinate of the point.
Availability
  • Available in iPhone OS 2.0 and later.
Declared In
CGGeometry.h

CGRect

矩形の位置と寸法を含む構造体
struct CGRect {
   CGPoint origin;
   CGSize size;
};
typedef struct CGRect CGRect;
Fields
origin
CGPoint 構造体で、矩形の始点座業を示す。始点は矩形の左下の位置となるとAppleのリファレンスにあるが、左上かもしれない。
size
CGSize 構造体で、矩形の高さと幅を示す。
CGSize
A structure that contains width and height values.
struct CGSize {
   CGFloat width;
   CGFloat height;
};
typedef struct CGSize CGSize;
Fields
width
A width value.
height
A height value.
Availability
  • Available in iPhone OS 2.0 and later.
Declared In
CGGeometry.h

0 件のコメント:

コメントを投稿