本文整理汇总了C++中nsIRenderingContext::FillPolygon方法的典型用法代码示例。如果您正苦于以下问题:C++ nsIRenderingContext::FillPolygon方法的具体用法?C++ nsIRenderingContext::FillPolygon怎么用?C++ nsIRenderingContext::FillPolygon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsIRenderingContext
的用法示例。
在下文中一共展示了nsIRenderingContext::FillPolygon方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paintCenter
static void
PaintCheckMark(nsIRenderingContext& aRenderingContext,
const nsRect& aRect)
{
// Points come from the coordinates on a 7X7 unit box centered at 0,0
const PRInt32 checkPolygonX[] = { -3, -1, 3, 3, -1, -3 };
const PRInt32 checkPolygonY[] = { -1, 1, -3, -1, 3, 1 };
const PRInt32 checkNumPoints = sizeof(checkPolygonX) / sizeof(PRInt32);
const PRInt32 checkSize = 9; // This is value is determined by adding 2
// units to pad the 7x7 unit checkmark
// Scale the checkmark based on the smallest dimension
nscoord paintScale = PR_MIN(aRect.width, aRect.height) / checkSize;
nsPoint paintCenter(aRect.x + aRect.width / 2,
aRect.y + aRect.height / 2);
nsPoint paintPolygon[checkNumPoints];
// Convert checkmark for screen rendering
for (PRInt32 polyIndex = 0; polyIndex < checkNumPoints; polyIndex++) {
paintPolygon[polyIndex] = paintCenter +
nsPoint(checkPolygonX[polyIndex] * paintScale,
checkPolygonY[polyIndex] * paintScale);
}
aRenderingContext.FillPolygon(paintPolygon, checkNumPoints);
}