本文整理汇总了C++中rect::topleft方法的典型用法代码示例。如果您正苦于以下问题:C++ rect::topleft方法的具体用法?C++ rect::topleft怎么用?C++ rect::topleft使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rect
的用法示例。
在下文中一共展示了rect::topleft方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
void ExtObject::Draw()
{
const point hotspot(info.HotSpotX, info.HotSpotY);
const rect r = cr::rect_xywh(info.x, info.y, info.w, info.h);
const rect r2 = cr::rect_xywh(info.x + 0.5f, info.y + 0.5f, info.w - 1.0f, info.h - 1.0f);
const cr::color& c = info.pInfo->filter;
quad q ((r2 - hotspot).rotate_to_quad(cr::to_radians(info.angle), r2.topleft()));
if (!transparent)
renderer->Fill(r, cr_colors.fill * c, info.angle, hotspot);
// Draw
if (smoothLines) {
renderer->SmoothLine(q.tr, q.tl, cr_colors.c1 * c, 1.0);
renderer->SmoothLine(q.tl, q.bl, cr_colors.c1 * c, 1.0);
renderer->SmoothLine(q.bl, q.br, cr_colors.c2 * c, 1.0);
renderer->SmoothLine(q.br, q.tr, cr_colors.c2 * c, 1.0);
}
else {
renderer->Line(q.tr, q.tl, cr_colors.c1 * c);
renderer->Line(q.tl, q.bl, cr_colors.c1 * c);
renderer->Line(q.bl, q.br, cr_colors.c2 * c);
renderer->Line(q.br, q.tr, cr_colors.c2 * c);
}
}
示例2: q
void CDX9Renderer::FillGradient(const rect& r, cr_float angle, point hotspot, const color& c1, const color& c2, gradient_direction dir)
{
quad q((r - hotspot).rotate_to_quad(angle, r.topleft()));
SetTexture(NULL);
color vs[4];
switch (dir) {
case dir_up:
SetVertices(vs, c2, c2, c1, c1);
Quad(r, vs);
break;
case dir_down:
SetVertices(vs, c1, c1, c2, c2);
Quad(r, vs);
break;
case dir_left:
SetVertices(vs, c2, c1, c2, c1);
Quad(r, vs);
break;
case dir_right:
SetVertices(vs, c1, c2, c1, c2);
Quad(r, vs);
break;
}
}
示例3:
void CDX9Renderer::Box(const rect& r, const color& c)
{
// No support for textured lines
SetTexture(NULL);
BeginBatch(batch_linestrip);
CBatch_Draw* draw_op = reinterpret_cast<CBatch_Draw*>(batch.back());
D3DCOLOR color = c.getD3DCOLOR();
// 4 vertices and use 5th index to repeat first vertex closing the strip as a box
AddVertex(color, r.topleft(), 0.0f, 0.0f);
AddVertex(color, r.topright(), 0.0f, 0.0f);
AddVertex(color, r.bottomright(), 0.0f, 0.0f);
AddVertex(color, r.bottomleft(), 0.0f, 0.0f);
unsigned short index = draw_op->vertex_count;
AddIndex(index);
AddIndex(index + 1);
AddIndex(index + 2);
AddIndex(index + 3);
AddIndex(index);
draw_op->vertex_count += 4;
draw_op->index_count += 5;
}