如何使用 XPS 文档 API 绘制圆圈?
我使用以下代码,如果圆的起点和终点相同,则根本不绘制圆。它绘制“角度为零的弧线”..
XPS_POINT startPoint = { 500, 500};
hr = xpsFactory->CreateGeometryFigure(&startPoint, &figure);
XPS_SEGMENT_TYPE segmentTypes[1] = {
XPS_SEGMENT_TYPE_ARC_LARGE_COUNTERCLOCKWISE
};
// x - coordinate of the arc's end point.
// y - coordinate of the arc's end point.
// Length of the ellipse's radius along the x-axis.
// Length of the ellipse's radius along the y-axis.
// Rotation angle.
FLOAT segmentData[5] = {
startPoint.x, // if it is startPoint.x + 0.001, I see kind pf a circle
startPoint.y,
radius,
radius,
360
};
BOOL segmentStrokes[1] = {
TRUE// Yes, draw each of the segment arcs.
};
// Add the segment data to the figure.
hr = figure->SetSegments(
1,
5,
segmentTypes,
segmentData,
segmentStrokes);
hr = figure->SetIsClosed(TRUE);
hr = figure->SetIsFilled(TRUE);