[转]CPoint+CSize+CRect学习大纲


CPoint+CSize+CRect学习大纲。

熟知CPoint、CSize、CRect类的基类
class CPoint : public tagPOINT
class CSize : public tagSIZE
class CRect : public tagRECT

留意CPoint、CSize、CRect之间的互操作,什么样的操作会涉及这些类型中的两个或多个。
Point - Point => Size
Point - Size  => Point
Point - Rect  => Rect
Point + Point => Point
Point + Size  => Point
Point + Rect  => Rect
Size  - Point => Point
Size  - Size  => Size
Size  - Rect  => Rect
Size  + Point => Point
Size  + Size  => Size
Size  + Rect  => Rect
Rect  - Point => Rect
Rect  - Size  => Rect
Rect  - Rect  => Rect
Rect  + Point => Rect
Rect  + Size  => Rect
Rect  + Rect  => Rect

掌握CPoint类以下成员

// 数据
x
y
// 构造
CPoint
// 运算
Offset
operator –
operator +
operator +=
operator –=
// 比较
operator !=
operator ==

掌握CSize类以下成员

// 数据
cx
cy
// 构造
CSize
// 运算
operator –
operator +
operator +=
operator –=
// 比较
operator !=
operator ==

掌握CRect类以下成员

// 数据
left
top
right
bottom
// 构造
CRect
SetRect
CopyRect
// 属性
TopLeft
BottomRight
Width
Height
Size
CenterPoint
// 存在性
IsRectEmpty
SetRectEmpty
IsRectNull
// 比较
PtInRect
EqualRect
// 修改
MoveToX
MoveToY
MoveToXY
OffsetRect
InflateRect
DeflateRect
NormalizeRect
SubtractRect
IntersectRect
UnionRect
// 运算符
operator LPCRECT
operator LPRECT
operator =
operator !=
operator ==
operator –
operator +
operator &
operator |
operator +=
operator –=
operator &=
operator |=

掌握CPoint、CSize、CRect之间的互操作,什么样的操作会涉及这些类型中的两个或多个。
Point - Point => Size
Point - Size  => Point
Point - Rect  => Rect
Point + Point => Point
Point + Size  => Point
Point + Rect  => Rect
Size  - Point => Point
Size  - Size  => Size
Size  - Rect  => Rect
Size  + Point => Point
Size  + Size  => Size
Size  + Rect  => Rect
Rect  - Point => Rect
Rect  - Size  => Rect
Rect  - Rect  => Rect
Rect  + Point => Rect
Rect  + Size  => Rect
Rect  + Rect  => Rect
  * 加法满足交换律
  * 运算不可以移项
  * 与Rect有交的运算都产生Rect

转载于:https://www.cnblogs.com/mr-totoro/archive/2012/07/13/5785763.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值