Fixed up the examples.

This commit is contained in:
Pietro Gagliardi 2015-10-11 21:31:23 -04:00
parent e51fd6e494
commit d789d37ef6
1 changed files with 28 additions and 30 deletions

View File

@ -566,7 +566,7 @@ static void drawD2DPathGeometries(uiAreaDrawParams *p)
uiDrawPathNewFigureWithArc(sun, uiDrawPathNewFigureWithArc(sun,
(440.0 - 270.0) / 2 + 270.0, 255, (440.0 - 270.0) / 2 + 270.0, 255,
85, 85,
0, M_PI, M_PI, M_PI,
0); 0);
uiDrawPathCloseFigure(sun); uiDrawPathCloseFigure(sun);
uiDrawPathEnd(sun); uiDrawPathEnd(sun);
@ -894,8 +894,8 @@ static void drawCSArc(uiAreaDrawParams *p)
uiDrawPathNewFigureWithArc(path, uiDrawPathNewFigureWithArc(path,
xc, yc, xc, yc,
radius, radius,
angle2, angle1,
M_PI - angle1, angle2 - angle1,
0); 0);
uiDrawPathEnd(path); uiDrawPathEnd(path);
uiDrawStroke(p->Context, path, &source, &sp); uiDrawStroke(p->Context, path, &source, &sp);
@ -918,7 +918,7 @@ static void drawCSArc(uiAreaDrawParams *p)
uiDrawPathNewFigureWithArc(path, uiDrawPathNewFigureWithArc(path,
xc, yc, xc, yc,
radius, radius,
(M_PI - angle1) + angle2, 0, angle1, 0,
0); 0);
uiDrawPathLineTo(path, xc, yc); uiDrawPathLineTo(path, xc, yc);
uiDrawPathNewFigureWithArc(path, uiDrawPathNewFigureWithArc(path,
@ -955,9 +955,9 @@ static void drawCSArcNegative(uiAreaDrawParams *p)
uiDrawPathNewFigureWithArc(path, uiDrawPathNewFigureWithArc(path,
xc, yc, xc, yc,
radius, radius,
-angle1, angle1,
angle1 + angle2, angle2 - angle1,
0); 1);
uiDrawPathEnd(path); uiDrawPathEnd(path);
uiDrawStroke(p->Context, path, &source, &sp); uiDrawStroke(p->Context, path, &source, &sp);
uiDrawFreePath(path); uiDrawFreePath(path);
@ -979,7 +979,7 @@ static void drawCSArcNegative(uiAreaDrawParams *p)
uiDrawPathNewFigureWithArc(path, uiDrawPathNewFigureWithArc(path,
xc, yc, xc, yc,
radius, radius,
(M_PI - angle1) + angle2, 0, angle1, 0,
0); 0);
uiDrawPathLineTo(path, xc, yc); uiDrawPathLineTo(path, xc, yc);
uiDrawPathNewFigureWithArc(path, uiDrawPathNewFigureWithArc(path,
@ -1169,8 +1169,8 @@ static void drawCSFillStyle(uiAreaDrawParams *p)
uiDrawPathNewFigureWithArc(path, uiDrawPathNewFigureWithArc(path,
192, 64, 192, 64,
40, 40,
0, 2*M_PI, 0, -2*M_PI,
0); 1);
uiDrawPathEnd(path); uiDrawPathEnd(path);
crsourcergba(&source, 0, 0.7, 0, 1); crsourcergba(&source, 0, 0.7, 0, 1);
@ -1194,8 +1194,8 @@ static void drawCSFillStyle(uiAreaDrawParams *p)
uiDrawPathNewFigureWithArc(path, uiDrawPathNewFigureWithArc(path,
192, 64, 192, 64,
40, 40,
0, 2*M_PI, 0, -2*M_PI,
0); 1);
uiDrawPathEnd(path); uiDrawPathEnd(path);
crsourcergba(&source, 0, 0, 0.9, 1); crsourcergba(&source, 0, 0, 0.9, 1);
@ -1264,33 +1264,31 @@ static void drawCSRoundRect(uiAreaDrawParams *p)
path = uiDrawNewPath(uiDrawFillModeWinding); path = uiDrawNewPath(uiDrawFillModeWinding);
// this example differs because of counterclockwise arcs
// the original went clockwise; we must go counterclockwise
// top right corner // top right corner
uiDrawPathNewFigureWithArc(path, uiDrawPathArcTo(path,
x + width - radius, y + radius, x + width - radius, y + radius,
radius, radius,
0 * degrees, 90 * degrees, -90 * degrees, M_PI / 2,
0);
// top left corner
uiDrawPathArcTo(path,
x + radius, y + radius,
radius,
90 * degrees, 90 * degrees,
0);
// bottom left corner
uiDrawPathArcTo(path,
x + radius, y + height - radius,
radius,
180 * degrees, 90 * degrees,
0); 0);
// bottom right corner // bottom right corner
uiDrawPathArcTo(path, uiDrawPathArcTo(path,
x + width - radius, y + height - radius, x + width - radius, y + height - radius,
radius, radius,
270 * degrees, 90 * degrees, 0 * degrees, M_PI / 2,
0); 0);
// bottom left corner
uiDrawPathArcTo(path,
x + radius, y + height - radius,
radius,
90 * degrees, M_PI / 2,
0);
// top left corner
uiDrawPathArcTo(path,
x + radius, y + radius,
radius,
180 * degrees, M_PI / 2,
0);
uiDrawPathCloseFigure(path); uiDrawPathCloseFigure(path);
uiDrawPathEnd(path); uiDrawPathEnd(path);