summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Joye <wjoye@cfa.harvard.edu>2017-03-19 18:01:04 (GMT)
committerWilliam Joye <wjoye@cfa.harvard.edu>2017-03-19 18:01:04 (GMT)
commit9530d25ec037286cc829f0de68d0ef0dc706ffde (patch)
treecd6f07cf46e73e32f366276c30acc52095e3f025
parent2b15e1aff433a1013cc13107556eb6a897bfb744 (diff)
downloadblt-9530d25ec037286cc829f0de68d0ef0dc706ffde.zip
blt-9530d25ec037286cc829f0de68d0ef0dc706ffde.tar.gz
blt-9530d25ec037286cc829f0de68d0ef0dc706ffde.tar.bz2
add fill support
-rwxr-xr-xtkwin/tkwin32.C56
-rwxr-xr-xtkwin/tkwin32.h5
-rwxr-xr-xtkwin/win32lib.C44
-rwxr-xr-xtkwin/win32lib.h6
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; ii<n; ii++){
+ apt[ii].x = (int)x[ii];
+ apt[ii].y = (int)y[ii];
+ }
SetPen(1);
- TkWin32::drawLines(xx, yy, 5);
+ Polygon(pd.hDC, apt, n);
SetPen(0);
+ free(apt);
}
void TkWin32::drawArc(float x, float y, float rad, float ang1, float ang2)
@@ -788,10 +786,14 @@ void TkWin32::drawArc(float x, float y, float rad, float ang1, float ang2)
SetPen(0);
}
+void TkWin32::fillArc(float x, float y, float rad, float ang1, float ang2)
+{
+}
+
void TkWin32::drawCurve(float x0, float y0,
- float u0, float v0,
- float u1, float v1,
- float x1, float y1)
+ float u0, float v0,
+ float u1, float v1,
+ float x1, float y1)
{
POINT apt[4];
apt[0].x = (int)x0;
@@ -807,21 +809,11 @@ void TkWin32::drawCurve(float x0, float y0,
SetPen(0);
}
-void TkWin32::fillPolygon(float* x, float* y, int n)
+void TkWin32::fillCurve(float x0, float y0,
+ float u0, float v0,
+ float u1, float v1,
+ float x1, float y1)
{
- int ii;
- POINT *apt;
- if( !(apt=(POINT *)calloc(n+1, sizeof(POINT))) ){
- return;
- }
- for(ii=0; ii<n; ii++){
- apt[ii].x = (int)x[ii];
- apt[ii].y = (int)y[ii];
- }
- SetPen(1);
- Polygon(pd.hDC, apt, n);
- SetPen(0);
- free(apt);
}
void TkWin32::bitmapCreate(void* data, int width, int height,
diff --git a/tkwin/tkwin32.h b/tkwin/tkwin32.h
index 48748ca..7577b2a 100755
--- a/tkwin/tkwin32.h
+++ b/tkwin/tkwin32.h
@@ -122,10 +122,11 @@ class TkWin32 {
void drawText(float, float, float, const char*);
void drawLines(float*, float*, int);
- void drawRect(float, float, float, float);
+ void fillPolygon(float*, float*, int);
void drawArc(float, float, float, float, float);
+ void fillArc(float, float, float, float, float);
void drawCurve(float, float, float, float, float, float, float, float);
- void fillPolygon(float*, float*, int);
+ void fillCurve(float, float, float, float, float, float, float, float);
void bitmapCreate(void*, int, int, float, float, float, float);
*/
diff --git a/tkwin/win32lib.C b/tkwin/win32lib.C
index e30386d..0e55117 100755
--- a/tkwin/win32lib.C
+++ b/tkwin/win32lib.C
@@ -132,13 +132,19 @@ void win32DrawLines(Vector* v, int n)
*/
}
-void win32DrawRect(Vector v, Vector s)
+void win32FillPolygon(Vector* v, int n)
{
/*
if (tkwin32) {
- Vector vv1 = v*tkwin32->getCanvasToPage();
- 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; ii<n; ii++) {
+ Vector vv = v[ii]*tkwin32->getCanvasToPage();
+ 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; ii<n; ii++) {
- Vector vv = v[ii]*tkwin32->getCanvasToPage();
- 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&);