From 4fe292708215d10e64caf87973880e14bb8f6c58 Mon Sep 17 00:00:00 2001 From: William Joye Date: Thu, 30 Mar 2017 16:57:10 -0400 Subject: fixed windows fill region issues --- tksao/frame/baseellipse.C | 17 ++++++----- tksao/frame/baseellipse.h | 4 +-- tksao/frame/box.C | 1 + tksao/frame/circle.C | 15 ++------- tksao/frame/circle.h | 3 +- tksao/frame/ellipse.C | 15 ++------- tksao/frame/ellipse.h | 3 +- tkwin/tkwin32.h | 14 +++++---- tkwin/win32lib.C | 77 ++++++++++++++++++++++++++++++++--------------- tkwin/win32lib.h | 9 ++++-- 10 files changed, 87 insertions(+), 71 deletions(-) diff --git a/tksao/frame/baseellipse.C b/tksao/frame/baseellipse.C index 842707a..8a7436b 100644 --- a/tksao/frame/baseellipse.C +++ b/tksao/frame/baseellipse.C @@ -692,7 +692,7 @@ void BaseEllipse::renderWIN32() { if (isRound && isScale && isOrient && parent->isAzElZero()) renderWIN32Circle(); else - renderWIN32EllipseCurve(); + renderWIN32Ellipse(); } void BaseEllipse::renderWIN32Circle() @@ -717,17 +717,18 @@ void BaseEllipse::renderWIN32Circle() if (a2<=a1) a2 += M_TWOPI; - renderWIN32CircleDraw(cc, l, a1, a2); + win32Arc(cc, l, a1, a2); + + renderWIN32Draw(); } } -void BaseEllipse::renderWIN32CircleDraw(Vector& cc, double l, - float a1, float a2) +void BaseEllipse::renderWIN32Draw() { - win32DrawArc(cc, l, a1, a2); + win32Stroke(); } -void BaseEllipse::renderWIN32EllipseCurve() +void BaseEllipse::renderWIN32Ellipse() { renderWIN32GC(); @@ -754,6 +755,8 @@ void BaseEllipse::renderWIN32EllipseCurve() if (s1&&s2) s1=s2=0; + + renderWIN32Draw(); } } } @@ -802,7 +805,7 @@ void BaseEllipse::renderWIN32EllipseArc(double a1, double a2, Vector& rr) Vector xx2 = fwdMap(x2*FlipY(),Coord::CANVAS); Vector tt1 = fwdMap(t1*FlipY(),Coord::CANVAS); - win32DrawCurve(tt0, xx1, xx2, tt1); + win32Curve(tt0, xx1, xx2, tt1); } void BaseEllipse::renderWIN32Include() diff --git a/tksao/frame/baseellipse.h b/tksao/frame/baseellipse.h index cdeb12c..778e46c 100644 --- a/tksao/frame/baseellipse.h +++ b/tksao/frame/baseellipse.h @@ -43,7 +43,7 @@ class BaseEllipse : public BaseMarker { #ifdef __WIN32 void renderWIN32Circle(); - void renderWIN32EllipseCurve(); + void renderWIN32Ellipse(); void renderWIN32EllipsePrep(double, double, double, double, Vector&); void renderWIN32EllipseArc(double, double, Vector&); void renderWIN32Include(); @@ -66,7 +66,7 @@ class BaseEllipse : public BaseMarker { #endif #ifdef __WIN32 void renderWIN32(); - virtual void renderWIN32CircleDraw(Vector&, double, float, float); + virtual void renderWIN32Draw(); #endif virtual void updateHandles(); diff --git a/tksao/frame/box.C b/tksao/frame/box.C index 43e1898..9d4a410 100644 --- a/tksao/frame/box.C +++ b/tksao/frame/box.C @@ -75,6 +75,7 @@ void Box::renderMACOSXDraw(Vector* vv) #ifdef __WIN32 void Box::renderWIN32Draw(Vector* vv) +{ if (fill_) win32FillPolygon(vv, numPoints_); else diff --git a/tksao/frame/circle.C b/tksao/frame/circle.C index e643e47..a4b2aca 100644 --- a/tksao/frame/circle.C +++ b/tksao/frame/circle.C @@ -97,21 +97,12 @@ void Circle::renderMACOSXDraw() #endif #ifdef __WIN32 -void Circle::renderWIN32CircleDraw(Vector& cc, double l, float a1, float a2) +void Circle::renderWIN32Draw() { if (fill_) - win32FillArc(cc, l, a1, a2); + win32Fill(); else - win32DrawArc(cc, l, a1, a2); -} - -void Circle::renderWIN32EllipseArcDraw(Vector& tt0, Vector& xx1, - Vector& xx2, Vector& tt1) -{ - if (fill_) - win32FillCurve(tt0, xx1, xx2, tt1); - else - win32DrawCurve(tt0, xx1, xx2, tt1); + win32Stroke(); } #endif diff --git a/tksao/frame/circle.h b/tksao/frame/circle.h index 6e50a06..9ebce28 100644 --- a/tksao/frame/circle.h +++ b/tksao/frame/circle.h @@ -22,8 +22,7 @@ class Circle : public BaseEllipse { #endif #ifdef __WIN32 - void renderWIN32CircleDraw(Vector&, double, float, float); - void renderWIN32EllipseArcDraw(Vector&, Vector&, Vector&, Vector&); + void renderWIN32Draw(); #endif void listNonCel(FitsImage*, ostream&, Coord::CoordSystem); diff --git a/tksao/frame/ellipse.C b/tksao/frame/ellipse.C index c07513a..8d9b1af 100644 --- a/tksao/frame/ellipse.C +++ b/tksao/frame/ellipse.C @@ -85,21 +85,12 @@ void Ellipse::renderMACOSXDraw() #endif #ifdef __WIN32 -void Ellipse::renderWIN32CircleDraw(Vector& cc, double l, float a1, float a2) +void Ellipse::renderWIN32Draw() { if (fill_) - win32FillArc(cc, l, a1, a2); + win32Fill(); else - win32DrawArc(cc, l, a1, a2); -} - -void Ellipse::renderWIN32EllipseArcDraw(Vector& tt0, Vector& xx1, - Vector& xx2, Vector& tt1) -{ - if (fill_) - win32FillCurve(tt0, xx1, xx2, tt1); - else - win32drawCurve(tt0, xx1, xx2, tt1); + win32Stroke(); } #endif diff --git a/tksao/frame/ellipse.h b/tksao/frame/ellipse.h index 43460f2..fde2c0d 100644 --- a/tksao/frame/ellipse.h +++ b/tksao/frame/ellipse.h @@ -22,8 +22,7 @@ class Ellipse : public BaseEllipse { #endif #ifdef __WIN32 - void renderWIN32CircleDraw(Vector&, double, float, float); - void renderWIN32EllipseArcDraw(Vector&, Vector&, Vector&, Vector&); + void renderWIN32Draw(); #endif void listNonCel(FitsImage*, ostream&, Coord::CoordSystem); diff --git a/tkwin/tkwin32.h b/tkwin/tkwin32.h index 7577b2a..c043c35 100755 --- a/tkwin/tkwin32.h +++ b/tkwin/tkwin32.h @@ -110,26 +110,28 @@ class TkWin32 { double getPageScale() {return pageScale;} const Matrix& getCanvasToPage() {return canvasToPage;} - + */ void begin(); void end(); - void color(int red, int green, int blue); + void color(int, int, int); void width(float); void dash(float*,int); void font(Tk_Font); void clip(float, float, float, float); + void newpath(); + void stroke(); + void fill(); + void arc(float, float, float, float, float); + void curve(float, float, float, float, float, float, float, float); + void drawText(float, float, float, const char*); void drawLines(float*, float*, int); 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 fillCurve(float, float, float, float, float, float, float, float); void bitmapCreate(void*, int, int, float, float, float, float); - */ }; extern TkWin32* tkwin32; diff --git a/tkwin/win32lib.C b/tkwin/win32lib.C index 0e55117..5ba7360 100755 --- a/tkwin/win32lib.C +++ b/tkwin/win32lib.C @@ -85,6 +85,58 @@ void win32Clip(Vector v, Vector s) */ } +void win32NewPath() +{ + /* + if (tkwin32) { + tkwin32->newpath(); + } + */ +} + +void win32Stroke() +{ + /* + if (tkwin32) { + tkwin32->stroke(); + } + */ +} + +void win32Fill() +{ + /* + if (tkwin32) { + tkwin32->fill(); + } + */ +} + +void win32Arc(Vector v, float rad, float ang1, float ang2) +{ + /* + if (tkwin32) { + Vector vv = v*tkwin32->getCanvasToPage(); + tkwin32->arc(vv[0], vv[1], rad, ang1, ang2); + } + */ +} + +void win32Curve(Vector v0, Vector t0, Vector t1, Vector v1) +{ + /* + if (tkwin32) { + Vector vv0 = v0*tkwin32->getCanvasToPage(); + Vector tt0 = t0*tkwin32->getCanvasToPage(); + Vector tt1 = t1*tkwin32->getCanvasToPage(); + Vector vv1 = v1*tkwin32->getCanvasToPage(); + + tkwin32->curve(vv0[0], vv0[1], tt0[0], tt0[1], + tt1[0], tt1[1], vv1[0], vv1[1]); + } + */ +} + void win32DrawText(Vector v, float ang, const char* text) { /* @@ -160,17 +212,6 @@ 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) { /* @@ -185,20 +226,6 @@ void win32DrawCurve(Vector v0, Vector t0, Vector t1, Vector v1) */ } -void win32FillCurve(Vector v0, Vector t0, Vector t1, Vector v1) -{ - /* - if (tkwin32) { - 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 d950498..f28375a 100755 --- a/tkwin/win32lib.h +++ b/tkwin/win32lib.h @@ -21,14 +21,17 @@ void win32Dash(float*,int); void win32Font(Tk_Font); void win32Clip(Vector, Vector); +void win32NewPath(); +void win32Stroke(); +void win32Fill(); +void win32Arc(Vector, float, float, float); +void win32Curve(Vector, Vector, Vector, Vector); + void win32DrawText(Vector, float, const char*); void win32DrawLine(Vector, Vector); void win32DrawLines(Vector*, int); void win32FillPolygon(Vector*, int); void win32DrawArc(Vector, float, float, float); -void win32FillArc(Vector, float, float, float); -void win32DrawCurve(Vector, Vector, Vector, Vector); -void win32FillCurve(Vector, Vector, Vector, Vector); void win32BitmapCreate(void*, int, int, const Vector&, const Vector&); -- cgit v0.12