29 #include YFM_YSLib_Core_YGDIBase
30 #include YFM_YSLib_Core_YCoreUtilities
40 std::numeric_limits<SDst>::lowest());
47 RectContainsRaw(
const Rect&
r,
int px,
int py)
ynothrow
49 YAssert(
r.Width > 0,
"Invalid width found."),
50 YAssert(
r.Height > 0,
"Invalid height found.");
52 return IsInInterval<int>(px -
r.X,
r.Width)
53 && IsInInterval<int>(py -
r.Y,
r.Height);
58 return RectContainsRaw(
r, pt.X, pt.Y);
62 RectContainsStrictRaw(
const Rect&
r,
int px,
int py)
ynothrow
64 YAssert(
r.Width > 1,
"Invalid width found."),
65 YAssert(
r.Height > 1,
"Invalid height found.");
66 return IsInOpenInterval<int>(px -
r.X,
r.Width - 1)
67 && IsInOpenInterval<int>(py -
r.Y,
r.Height - 1);
72 return RectContainsStrictRaw(
r, pt.X, pt.Y);
82 return !IsUnstrictlyEmpty() && RectContainsRaw(*
this, px, py);
87 return !IsUnstrictlyEmpty() && RectContainsRaw(*
this,
r.GetPoint())
88 && RectContainsRaw(*
this,
r.GetPoint() +
r.GetSize() -
Vec(1, 1));
94 return Width > 1 && Height > 1 && RectContainsStrictRaw(*
this, px, py);
99 return Width > 1 && Height > 1 && !
r.IsUnstrictlyEmpty()
100 && RectContainsStrictRaw(*
this,
r.GetPoint())
101 && RectContainsStrictRaw(*
this,
r.GetPoint() +
r.GetSize() -
Vec(1, 1));
108 y1(max(
Y,
r.Y)), y2(min(
Y + Height,
r.Y +
r.Height));
110 return *
this = x2 < x1 || y2 < y1 ?
Rect() : Rect(x1, y1, x2 - x1, y2 - y1);
121 const SPos mx(min(
X,
r.X)), my(min(
Y,
r.Y));
123 return *
this =
Rect(mx, my, max(
X +
Width,
r.X +
r.Width) - mx,
124 max(
Y + Height,
r.Y +
r.Height) - my);
143 Graphics::operator[](
size_t r)
const ynothrow
146 YAssert(
r < sGraphics.Height,
"Access out of range.");
147 return pBuffer +
r * sGraphics.Width;
156 throw std::out_of_range(
"Access out of range.");
158 return pBuffer +
r * sGraphics.Width;
bool ContainsStrict(int px, int py) const ynothrow
判断点 (px, py) 是否在矩形内。
static const Rect Invalid
无效对象。
static const Graphics Invalid
无效图形接口上下文。
std::runtime_error GeneralEvent
一般运行时异常事件类。
#define YB_UNLIKELY(expr)
分支预测提示。
GBinaryGroup< SPos > Point
屏幕二维点(直角坐标表示)。
static const Size Invalid
无效对象。
#define ynothrow
YSLib 无异常抛出保证:若支持 noexcept 关键字, 指定特定的 noexcept 异常规范。
bool Contains(int px, int py) const ynothrow
判断点 (px, py) 是否在矩形内或边上。
#define ythrow(...)
YSLib 动态异常规范:根据是否使用异常规范宏指定或忽略动态异常规范。
Rect & operator|=(const Rect &) ynothrow
求与另一个屏幕标准矩形的并。
#define YAssertNonnull(_expr)
Rect operator&(const Rect &a, const Rect &b) ynothrow
if(YB_UNLIKELY(r >=sGraphics.Height)) throw std return pBuffer r *sGraphics Width
Rect operator|(const Rect &a, const Rect &b) ynothrow
GBinaryGroup< SPos > Vec
屏幕二维向量(直角坐标表示)。
#define YAssert(_expr, _msg)