本文整理汇总了C++中Canvas::DrawTwoLinesExact方法的典型用法代码示例。如果您正苦于以下问题:C++ Canvas::DrawTwoLinesExact方法的具体用法?C++ Canvas::DrawTwoLinesExact怎么用?C++ Canvas::DrawTwoLinesExact使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Canvas
的用法示例。
在下文中一共展示了Canvas::DrawTwoLinesExact方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetMargin
void
ButtonFrameRenderer::DrawButton(Canvas &canvas, PixelRect rc,
bool focused, bool pressed) const
{
const ButtonLook::StateLook &_look = focused ? look.focused : look.standard;
canvas.DrawFilledRectangle(rc, _look.background_color);
const unsigned margin = GetMargin();
if (margin < 4) {
/* draw 1-pixel lines */
canvas.Select(pressed ? _look.dark_border_pen : _look.light_border_pen);
for (unsigned i = 0; i < margin; ++i)
canvas.DrawTwoLinesExact(rc.left + i, rc.bottom - 2 - i,
rc.left + i, rc.top + i,
rc.right - 2 - i, rc.top + i);
canvas.Select(pressed ? _look.light_border_pen : _look.dark_border_pen);
for (unsigned i = 0; i < margin; ++i)
canvas.DrawTwoLinesExact(rc.left + 1 + i, rc.bottom - 1 - i,
rc.right - 1 - i, rc.bottom - 1 - i,
rc.right - 1 - i, rc.top + 1 + i);
} else {
/* at 4 pixels or more, it's more efficient to draw a filled
polygon */
const RasterPoint p1[] = {
RasterPoint(rc.left, rc.top),
RasterPoint(rc.right, rc.top),
RasterPoint(rc.right - margin, rc.top + margin),
RasterPoint(rc.left + margin, rc.top + margin),
RasterPoint(rc.left + margin, rc.bottom - margin),
RasterPoint(rc.left, rc.bottom),
};
canvas.SelectNullPen();
canvas.Select(pressed
? _look.dark_border_brush
: _look.light_border_brush);
canvas.DrawTriangleFan(p1, ARRAY_SIZE(p1));
const RasterPoint p2[] = {
RasterPoint(rc.right, rc.bottom),
RasterPoint(rc.right, rc.top),
RasterPoint(rc.right - margin, rc.top + margin),
RasterPoint(rc.right - margin, rc.bottom - margin),
RasterPoint(rc.left + margin, rc.bottom - margin),
RasterPoint(rc.left, rc.bottom),
};
canvas.Select(pressed
? _look.light_border_brush
: _look.dark_border_brush);
canvas.DrawTriangleFan(p2, ARRAY_SIZE(p2));
}
}
示例2:
void
ButtonFrameRenderer::DrawButton(Canvas &canvas, PixelRect rc,
bool focused, bool pressed) const
{
const ButtonLook::StateLook &_look = focused ? look.focused : look.standard;
canvas.DrawFilledRectangle(rc, _look.background_color);
canvas.Select(pressed ? _look.dark_border_pen : _look.light_border_pen);
canvas.DrawTwoLinesExact(rc.left, rc.bottom - 2, rc.left, rc.top, rc.right - 2,
rc.top);
canvas.DrawTwoLinesExact(rc.left + 1, rc.bottom - 3, rc.left + 1, rc.top + 1,
rc.right - 3, rc.top + 1);
canvas.Select(pressed ? _look.light_border_pen : _look.dark_border_pen);
canvas.DrawTwoLinesExact(rc.left + 1, rc.bottom - 1, rc.right - 1, rc.bottom - 1,
rc.right - 1, rc.top + 1);
canvas.DrawTwoLinesExact(rc.left + 2, rc.bottom - 2, rc.right - 2, rc.bottom - 2,
rc.right - 2, rc.top + 2);
}