More Direct2D work.

This commit is contained in:
Pietro Gagliardi 2015-10-07 12:34:53 -04:00
parent a7d8a87540
commit d8715e6928
3 changed files with 10 additions and 4 deletions

View File

@ -225,9 +225,14 @@ void uiDrawPathCloseFigure(uiDrawPath *p)
p->inFigure = FALSE;
}
void uiDrawPathAddRectangle(uiDrawPath *p, double x0, double y0, double xxxxTODOxxxx, double xxxTODOxxxxxxxxxx)
void uiDrawPathAddRectangle(uiDrawPath *p, double x, double y, double width, double height)
{
// TODO
// this is the same algorithm used by cairo and Core Graphics, according to their documentations
uiDrawPathNewFigure(p, x, y);
uiDrawPathLineTo(p, x + width, y);
uiDrawPathLineTo(p, x + width, y + height);
uiDrawPathLineTo(p, x, y + height);
uiDrawPathCloseFigure(p);
}
void uiDrawPathEnd(uiDrawPath *p)

View File

@ -58,9 +58,9 @@ static void handlerDraw(uiAreaHandler *a, uiArea *area, uiAreaDrawParams *p)
brush.B = 0;
brush.A = 0.5;
path = uiDrawNewPath(uiDrawFillModeWinding);
//TODO uiDrawRectangle(path, 120, 80, 50, 50);
uiDrawPathAddRectangle(path, 120, 80, 50, 50);
uiDrawPathEnd(path);
// uiDrawFill(p->Context, path, &brush);
uiDrawFill(p->Context, path, &brush);
uiDrawFreePath(path);
brush.A = 1;

View File

@ -132,6 +132,7 @@ void uiDrawPathBezierTo(uiDrawPath *, double, double, double, double, double, do
// TODO quadratic bezier
void uiDrawPathCloseFigure(uiDrawPath *);
// TODO effect of these when a figure is already started
void uiDrawPathAddRectangle(uiDrawPath *, double, double, double, double);
void uiDrawPathEnd(uiDrawPath *);