From 9530d25ec037286cc829f0de68d0ef0dc706ffde Mon Sep 17 00:00:00 2001 From: William Joye Date: Sun, 19 Mar 2017 14:01:04 -0400 Subject: add fill support --- tkwin/tkwin32.C | 56 ++++++++++++++++++++++++-------------------------------- tkwin/tkwin32.h | 5 +++-- tkwin/win32lib.C | 44 +++++++++++++++++++++++++++++--------------- tkwin/win32lib.h | 6 +++--- 4 files changed, 59 insertions(+), 52 deletions(-) diff --git a/tkwin/tkwin32.C b/tkwin/tkwin32.C index 88f3a48..e4b4bcf 100755 --- a/tkwin/tkwin32.C +++ b/tkwin/tkwin32.C @@ -753,23 +753,21 @@ void TkWin32::drawLines(float* x, float* y, int n) SetPen(0); } -void TkWin32::drawRect(float x, float y, float w, float h) -{ - float xx[5]; - float yy[5]; - xx[0] = x; - yy[0] = y; - xx[1] = x+w; - yy[1] = y; - xx[2] = x+w; - yy[2] = y-h; - xx[3] = x; - yy[3] = y-h; - xx[4] = xx[0]; - yy[4] = yy[0]; +void TkWin32::fillPolygon(float* x, float* y, int n) +{ + int ii; + POINT *apt; + if( !(apt=(POINT *)calloc(n+1, sizeof(POINT))) ){ + return; + } + for(ii=0; iigetCanvasToPage(); - Vector ss = s*tkwin32->getPageScale(); - tkwin32->drawRect(vv1[0], vv1[1], ss[0], ss[1]); + float xx[n]; + float yy[n]; + + for(int ii=0; iigetCanvasToPage(); + xx[ii] = vv[0]; + yy[ii] = vv[1]; + } + tkwin32->fillPolygon(xx,yy,n); } */ } @@ -154,6 +160,17 @@ void win32DrawArc(Vector v, float rad, float ang1, float ang2) */ } +void win32FillArc(Vector v, float rad, float ang1, float ang2) +{ + /* + if (tkwin32) { + Vector vv = v*tkwin32->getCanvasToPage(); + float rr = rad*tkwin32->getPageScale(); + tkwin32->fillArc(vv[0], vv[1], rr, ang1, ang2); + } + */ +} + void win32DrawCurve(Vector v0, Vector t0, Vector t1, Vector v1) { /* @@ -168,22 +185,19 @@ void win32DrawCurve(Vector v0, Vector t0, Vector t1, Vector v1) */ } -void win32FillPolygon(Vector* v, int n) +void win32FillCurve(Vector v0, Vector t0, Vector t1, Vector v1) { /* if (tkwin32) { - float xx[n]; - float yy[n]; - - for(int ii=0; iigetCanvasToPage(); - xx[ii] = vv[0]; - yy[ii] = vv[1]; - } - tkwin32->fillPolygon(xx,yy,n); + Vector vv0 = v0*tkwin32->getCanvasToPage(); + Vector tt0 = t0*tkwin32->getCanvasToPage(); + Vector tt1 = t1*tkwin32->getCanvasToPage(); + Vector vv1 = v1*tkwin32->getCanvasToPage(); + tkwin32->fillCurve(vv0[0], vv0[1], tt0[0], tt0[1], + tt1[0], tt1[1], vv1[0], vv1[1]); } */ -} +} void win32BitmapCreate(void* img, int width, int height, const Vector& v, const Vector& s) diff --git a/tkwin/win32lib.h b/tkwin/win32lib.h index 1374442..d950498 100755 --- a/tkwin/win32lib.h +++ b/tkwin/win32lib.h @@ -24,11 +24,11 @@ void win32Clip(Vector, Vector); void win32DrawText(Vector, float, const char*); void win32DrawLine(Vector, Vector); void win32DrawLines(Vector*, int); -void win32DrawRect(Vector, Vector); +void win32FillPolygon(Vector*, int); void win32DrawArc(Vector, float, float, float); +void win32FillArc(Vector, float, float, float); void win32DrawCurve(Vector, Vector, Vector, Vector); - -void win32FillPolygon(Vector*, int); +void win32FillCurve(Vector, Vector, Vector, Vector); void win32BitmapCreate(void*, int, int, const Vector&, const Vector&); -- cgit v0.12