1

How can I draw a circle with XPS document API?

I use following code, bit the circle is not drawn at all if start point and end point of circle is same. It draws "the arc of angle zero instead"..

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);
Zheden
  • 583
  • 2
  • 11
  • 36
  • 1
    Isn't the first value in figure->SetrSegments the number of segments? I'm not sure, but is the arc considered a single segment or should you provide the number of line sgments which form an approximation of the arc? – Bob__ Jul 06 '16 at 16:16

0 Answers0