|
From: <kr_...@us...> - 2003-02-03 16:53:45
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32
In directory sc8-pr-cvs1:/tmp/cvs-serv13436/port/src/cbits/Win32
Modified Files:
Canvas.c
Log Message:
The implementation of Canvas are changed for better performance. setPenColor, setPenBackColor, setPenHatchStyle and all other setPen* functions are replaced with single function which changes all attributes of Canvas in single step.
Index: Canvas.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Canvas.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Canvas.c 30 Jan 2003 20:43:25 -0000 1.5
--- Canvas.c 3 Feb 2003 16:53:41 -0000 1.6
***************
*** 53,63 ****
\*------------------------------------*/
- #define DRAWING 0
- #define UNDRAWING 1
- #define FILLING 2
- #define ERASING 4
-
- static void SetLineStyle(int lineStyle, int stylesCount, unsigned char *stylesPtr, CanvasHandle canvas);
-
void osInitCanvas (int size, int function,
unsigned int pcolor,
--- 53,56 ----
***************
*** 78,99 ****
RECT clipRect;
- canvas->penSize = size;
- canvas->joinStyle = joinStyle;
- canvas->capStyle = capStyle;
- canvas->lineStyle = 0;
canvas->stylesCount = 0;
canvas->stylesPtr = NULL;
! canvas->penColor = pcolor;
! canvas->backColor = bcolor;
! canvas->lastActivity = FILLING;
! canvas->theNormalPen = NULL;
! canvas->theBackPen = NULL;
! canvas->theBackBrush = NULL;
! canvas->theNormalBrush = NULL;
canvas->theFont = NULL;
- canvas->hatchStyle = hatchStyle;
- canvas->patBmp = patBmp;
-
- SetLineStyle(lineStyle,stylesCount,stylesPtr,canvas);
SaveDC(canvas->hDC);
--- 71,79 ----
RECT clipRect;
canvas->stylesCount = 0;
canvas->stylesPtr = NULL;
! canvas->thePen = NULL;
! canvas->theBrush = NULL;
canvas->theFont = NULL;
SaveDC(canvas->hDC);
***************
*** 130,150 ****
SetTextAlign (canvas->hDC, TA_LEFT | TA_BASELINE);
SetStretchBltMode (canvas->hDC,COLORONCOLOR);
- SelectObject (canvas->hDC, GetStockObject (NULL_PEN));
! osSetBackColor (canvas->backColor, canvas);
! osSetPenColor (canvas->penColor, canvas);
! osSetFont (font, canvas);
! osSetPenFunction(function, canvas);
if (canvas->bInvalidated)
{
SetBkMode(canvas->hDC, OPAQUE);
! SetBkColor (canvas->hDC, canvas->penColor);
SelectObject (canvas->hDC, GetStockObject (NULL_PEN));
! SelectObject(canvas->hDC, canvas->theBackBrush);
Rectangle(canvas->hDC, clipRect.left, clipRect.top, clipRect.right+1, clipRect.bottom+1);
- }
! osSetBkDrawMode(bkMode, canvas);
} /* osInitCanvas */
--- 110,138 ----
SetTextAlign (canvas->hDC, TA_LEFT | TA_BASELINE);
SetStretchBltMode (canvas->hDC,COLORONCOLOR);
! osChangeCanvasPen(size,function,pcolor,bcolor,joinStyle,capStyle,lineStyle,stylesCount,stylesPtr,bkMode,hatchStyle,patBmp,font,canvas);
if (canvas->bInvalidated)
{
+ HBRUSH hb;
+ LOGBRUSH lb;
+
+ lb.lbColor = bcolor;
+ SetupLogBrush(&lb, FALSE, hatchStyle, patBmp);
+ hb = CreateBrushIndirect(&lb);
+
SetBkMode(canvas->hDC, OPAQUE);
! SetBkColor (canvas->hDC, pcolor);
SelectObject (canvas->hDC, GetStockObject (NULL_PEN));
! SelectObject (canvas->hDC, hb);
!
Rectangle(canvas->hDC, clipRect.left, clipRect.top, clipRect.right+1, clipRect.bottom+1);
! SelectObject (canvas->hDC, canvas->theBrush);
! SelectObject (canvas->hDC, canvas->thePen);
! if (!bkMode) SetBkMode(canvas->hDC, TRANSPARENT);
!
! DeleteObject(hb);
! }
} /* osInitCanvas */
***************
*** 177,186 ****
RestoreDC (canvas->hDC, -1);
! SetLineStyle(0,0,NULL,canvas);
! DeleteObject (canvas->theNormalPen);
! DeleteObject (canvas->theBackPen);
! DeleteObject (canvas->theNormalBrush);
! DeleteObject (canvas->theBackBrush);
} /* osDoneCanvas */
--- 165,173 ----
RestoreDC (canvas->hDC, -1);
! if (canvas->stylesPtr)
! free(canvas->stylesPtr);
! DeleteObject (canvas->thePen);
! DeleteObject (canvas->theBrush);
} /* osDoneCanvas */
***************
*** 214,337 ****
} /* osDeletePolygon */
-
- static void StartDrawing (CanvasHandle canvas)
- {
- switch (canvas->lastActivity)
- {
- case UNDRAWING:
- SelectObject (canvas->hDC, canvas->theNormalPen);
- SetTextColor(canvas->hDC, canvas->penColor);
- break;
- case FILLING:
- SelectObject (canvas->hDC, canvas->theNormalPen);
- SetTextColor(canvas->hDC, canvas->penColor);
- SelectObject (canvas->hDC, GetStockObject (NULL_BRUSH));
- break;
- case ERASING:
- SelectObject (canvas->hDC, canvas->theNormalPen);
- SetTextColor(canvas->hDC, canvas->penColor);
- SelectObject (canvas->hDC, GetStockObject (NULL_BRUSH));
- break;
- }
- canvas->lastActivity = DRAWING;
- } /* StartDrawing */
-
- static void StartFilling (CanvasHandle canvas)
- {
- switch (canvas->lastActivity)
- {
- case DRAWING:
- SelectObject (canvas->hDC, GetStockObject (NULL_PEN));
- SelectObject (canvas->hDC, canvas->theNormalBrush);
- break;
- case UNDRAWING:
- SelectObject (canvas->hDC, GetStockObject (NULL_PEN));
- SelectObject (canvas->hDC, canvas->theNormalBrush);
- break;
- case ERASING:
- SelectObject (canvas->hDC, canvas->theNormalBrush);
- break;
- }
- canvas->lastActivity = FILLING;
- } /* StartFilling */
-
- static void StartErasing (CanvasHandle canvas)
- {
- switch (canvas->lastActivity)
- {
- case UNDRAWING:
- SelectObject (canvas->hDC, GetStockObject (NULL_PEN));
- SelectObject (canvas->hDC, canvas->theBackBrush);
- break;
- case DRAWING:
- SelectObject (canvas->hDC, GetStockObject (NULL_PEN));
- SelectObject (canvas->hDC, canvas->theBackBrush);
- break;
- case FILLING:
- SelectObject (canvas->hDC, canvas->theBackBrush);
- break;
- }
- canvas->lastActivity = ERASING;
- } /* StartErasing */
-
-
- static void StartUndrawing (CanvasHandle canvas)
- {
- switch (canvas->lastActivity)
- {
- case DRAWING:
- SelectObject (canvas->hDC, canvas->theBackPen);
- SetTextColor (canvas->hDC, canvas->backColor);
- break;
- case FILLING:
- SelectObject (canvas->hDC, canvas->theBackPen);
- SetTextColor (canvas->hDC, canvas->backColor);
- SelectObject (canvas->hDC, GetStockObject (NULL_BRUSH));
- break;
- case ERASING:
- SelectObject (canvas->hDC, canvas->theBackPen);
- SetTextColor (canvas->hDC, canvas->backColor);
- SelectObject (canvas->hDC, GetStockObject (NULL_BRUSH));
- break;
- }
- canvas->lastActivity = UNDRAWING;
- } /* StartUndrawing */
-
- static int GetPenStyle(CanvasHandle canvas)
- {
- DWORD style;
-
- //if (canvas->penSize == 1 && canvas->lineStyle != PS_USERSTYLE)
- //style = PS_COSMETIC;
- //else
- style = PS_GEOMETRIC;
-
- switch (canvas->lineStyle)
- {
- case 0: style |= (canvas->penSize == 1) ? PS_SOLID : PS_INSIDEFRAME; break;
- case 1: style |= PS_DASH; break;
- case 2: style |= PS_DOT; break;
- case 3: style |= PS_DASHDOT; break;
- case 4: style |= PS_DASHDOTDOT; break;
- case 5: style |= PS_USERSTYLE; break;
- }
-
- switch (canvas->joinStyle)
- {
- case 0: style |= PS_JOIN_BEVEL; break;
- case 1: style |= PS_JOIN_MITER; break;
- case 2: style |= PS_JOIN_ROUND; break;
- }
-
- switch (canvas->capStyle)
- {
- case 0: style |= PS_ENDCAP_ROUND; break;
- case 1: style |= PS_ENDCAP_SQUARE; break;
- case 2: style |= PS_ENDCAP_FLAT; break;
- }
-
- return style;
- }
-
void SetupLogBrush(LOGBRUSH *plb, BOOL bSetSolid, int hatchStyle, BitmapHandle patBmp)
{
--- 201,204 ----
***************
*** 373,450 ****
}
- static void ChangeTheNormalPen (CanvasHandle canvas)
- {
- HPEN hp;
- LOGBRUSH lb;
-
- lb.lbColor = canvas->penColor;
- SetupLogBrush(&lb, canvas->penSize == 1, canvas->hatchStyle, canvas->patBmp);
- hp = ExtCreatePen (GetPenStyle(canvas), canvas->penSize, &lb, canvas->stylesCount, canvas->stylesPtr);
-
- if (canvas->lastActivity == DRAWING)
- SelectObject (canvas->hDC, hp);
- if (canvas->theNormalPen)
- DeleteObject (canvas->theNormalPen);
! canvas->theNormalPen = hp;
! } /* ChangeTheNormalPen */
! static void ChangeTheBackPen (CanvasHandle canvas)
{
HPEN hp;
- LOGBRUSH lb;
-
- lb.lbColor = canvas->backColor;
- SetupLogBrush(&lb, canvas->penSize == 1, canvas->hatchStyle, canvas->patBmp);
- hp = ExtCreatePen (GetPenStyle(canvas), canvas->penSize, &lb, canvas->stylesCount, canvas->stylesPtr);
-
- if (canvas->lastActivity == UNDRAWING)
- SelectObject (canvas->hDC, hp);
- if (canvas->theBackPen)
- DeleteObject (canvas->theBackPen);
-
- canvas->theBackPen = hp;
- } /* ChangeTheBackPen */
-
- static void ChangeTheNormalBrush (CanvasHandle canvas)
- {
HBRUSH hb;
LOGBRUSH lb;
!
! lb.lbColor = canvas->penColor;
! SetupLogBrush(&lb, FALSE, canvas->hatchStyle, canvas->patBmp);
! hb = CreateBrushIndirect(&lb);
!
! if (canvas->lastActivity == FILLING)
! SelectObject (canvas->hDC, hb);
! if (canvas->theNormalBrush)
! DeleteObject (canvas->theNormalBrush);
!
! canvas->theNormalBrush = hb;
! } /* ChangeTheNormalBrush */
!
! static void ChangeTheBackBrush (CanvasHandle canvas)
! {
! HBRUSH hb;
! LOGBRUSH lb;
!
! lb.lbColor = canvas->backColor;
! SetupLogBrush(&lb, FALSE, canvas->hatchStyle, canvas->patBmp);
! hb = CreateBrushIndirect(&lb);
!
! if (canvas->lastActivity == ERASING)
! SelectObject (canvas->hDC, hb);
! if (canvas->theBackBrush)
! DeleteObject (canvas->theBackBrush);
!
! canvas->theBackBrush = hb;
! } /* ChangeTheBackBrush */
!
! static void SetLineStyle(int lineStyle, int stylesCount, unsigned char *stylesPtr, CanvasHandle canvas)
! {
int i;
- canvas->lineStyle = lineStyle;
-
if (canvas->stylesPtr)
free(canvas->stylesPtr);
--- 240,269 ----
}
! /*------------------------------------*\
! | Interface functions |
! \*------------------------------------*/
! void osChangeCanvasPen(int size, int function,
! unsigned int pcolor,
! unsigned int bcolor,
! int joinStyle,
! int capStyle,
! int lineStyle,
! int stylesCount,
! unsigned char *stylesPtr,
! BOOL bkMode,
! int hatchStyle,
! BitmapHandle patBmp,
! FontHandle font,
! CanvasHandle canvas
! )
{
HPEN hp;
HBRUSH hb;
LOGBRUSH lb;
! DWORD penstyle;
int i;
if (canvas->stylesPtr)
free(canvas->stylesPtr);
***************
*** 465,541 ****
canvas->stylesPtr = NULL;
}
- }
-
- /*------------------------------------*\
- | Interface functions |
- \*------------------------------------*/
-
- void osSetPenSize (int size, CanvasHandle canvas)
- {
- canvas->penSize = size;
- ChangeTheNormalPen (canvas);
- ChangeTheBackPen (canvas);
- } /* osSetPenSize */
-
- void osSetPenColor (unsigned int color, CanvasHandle canvas)
- {
- canvas->penColor = color;
-
- ChangeTheNormalPen (canvas);
- ChangeTheNormalBrush (canvas);
-
- if (canvas->lastActivity == DRAWING)
- SetTextColor(canvas->hDC, canvas->penColor);
- } /* osSetPenColor */
-
- void osSetBackColor (unsigned int color, CanvasHandle canvas)
- {
- canvas->backColor = color;
! ChangeTheBackPen (canvas);
! ChangeTheBackBrush (canvas);
! SetBkColor (canvas->hDC, canvas->backColor);
! if (canvas->lastActivity == UNDRAWING)
! SetTextColor(canvas->hDC, canvas->backColor);
! } /* osSetBackColor */
! void osSetPenJoinStyle(int joinStyle, CanvasHandle canvas)
! {
! canvas->joinStyle = joinStyle;
! ChangeTheNormalPen(canvas);
! ChangeTheBackPen(canvas);
! } /* osSetPenJoinStyle */
! void osSetPenCapStyle(int capStyle, CanvasHandle canvas)
! {
! canvas->capStyle = capStyle;
! ChangeTheNormalPen(canvas);
! ChangeTheBackPen(canvas);
! } /* osSetPenCapStyle */
! void osSetPenLineStyle(int lineStyle, int stylesCount, unsigned char *stylesPtr, CanvasHandle canvas)
! {
! if (canvas->stylesPtr)
! free(canvas->stylesPtr);
! SetLineStyle(lineStyle,stylesCount,stylesPtr,canvas);
! ChangeTheNormalPen(canvas);
! ChangeTheBackPen(canvas);
! } /* osSetPenLineStyle */
! void osSetPenHatchStyle(int hatchStyle, BitmapHandle patBmp, CanvasHandle canvas)
! {
! canvas->hatchStyle = hatchStyle;
! canvas->patBmp = patBmp;
! ChangeTheNormalPen(canvas);
! ChangeTheNormalBrush(canvas);
! ChangeTheBackPen(canvas);
! ChangeTheBackBrush(canvas);
! } /* osSetPenHatchStyle */
- void osSetPenFunction(int function, CanvasHandle canvas)
- {
switch (function)
{
--- 284,335 ----
canvas->stylesPtr = NULL;
}
! //if (penSize == 1 && lineStyle != PS_USERSTYLE)
! //penstyle = PS_COSMETIC;
! //else
! penstyle = PS_GEOMETRIC;
! switch (lineStyle)
! {
! case 0: penstyle |= (size == 1) ? PS_SOLID : PS_INSIDEFRAME; break;
! case 1: penstyle |= PS_DASH; break;
! case 2: penstyle |= PS_DOT; break;
! case 3: penstyle |= PS_DASHDOT; break;
! case 4: penstyle |= PS_DASHDOTDOT; break;
! case 5: penstyle |= PS_USERSTYLE; break;
! }
! switch (joinStyle)
! {
! case 0: penstyle |= PS_JOIN_BEVEL; break;
! case 1: penstyle |= PS_JOIN_MITER; break;
! case 2: penstyle |= PS_JOIN_ROUND; break;
! }
! switch (capStyle)
! {
! case 0: penstyle |= PS_ENDCAP_ROUND; break;
! case 1: penstyle |= PS_ENDCAP_SQUARE; break;
! case 2: penstyle |= PS_ENDCAP_FLAT; break;
! }
! lb.lbColor = pcolor;
! SetupLogBrush(&lb, size == 1, hatchStyle, patBmp);
! hp = ExtCreatePen (penstyle, size, &lb, canvas->stylesCount, canvas->stylesPtr);
! SelectObject (canvas->hDC, hp);
! if (canvas->thePen)
! DeleteObject (canvas->thePen);
! canvas->thePen = hp;
! lb.lbColor = pcolor;
! SetupLogBrush(&lb, FALSE, hatchStyle, patBmp);
! hb = CreateBrushIndirect(&lb);
! SelectObject (canvas->hDC, hb);
! if (canvas->theBrush)
! DeleteObject(canvas->theBrush);
! canvas->theBrush = hb;
switch (function)
{
***************
*** 544,553 ****
case 2: SetROP2 (canvas->hDC, R2_XORPEN); break;
}
- } /* osSetPenFunction */
! void osSetBkDrawMode(BOOL mode, CanvasHandle canvas)
! {
! SetBkMode(canvas->hDC, mode ? OPAQUE : TRANSPARENT);
! }
void osRotateCanvas(double angle, CanvasHandle canvas)
--- 338,347 ----
case 2: SetROP2 (canvas->hDC, R2_XORPEN); break;
}
! SetTextColor(canvas->hDC, pcolor);
! SetBkColor(canvas->hDC, bcolor);
!
! SetBkMode(canvas->hDC, bkMode ? OPAQUE : TRANSPARENT);
! };
void osRotateCanvas(double angle, CanvasHandle canvas)
***************
*** 599,620 ****
void osDrawPoint (int x, int y, CanvasHandle canvas)
{
! SetPixelV (canvas->hDC, x, y, canvas->penColor); // (for printing)
} /* osDrawPoint */
- void osUndrawPoint (int x, int y, CanvasHandle canvas)
- {
- SetPixelV (canvas->hDC, x, y, canvas->backColor); // (for printing)
- } /* osUndrawPoint */
-
void osDrawLine (int startx, int starty, int endx, int endy, CanvasHandle canvas)
{
- StartDrawing (canvas);
- MoveToEx (canvas->hDC, startx, starty, NULL);
- LineTo (canvas->hDC, endx, endy);
- } /* osDrawLine */
-
- void osUndrawLine (int startx, int starty, int endx, int endy, CanvasHandle canvas)
- {
- StartUndrawing(canvas);
MoveToEx (canvas->hDC, startx, starty, NULL);
LineTo (canvas->hDC, endx, endy);
--- 393,401 ----
void osDrawPoint (int x, int y, CanvasHandle canvas)
{
! SetPixelV (canvas->hDC, x, y, GetTextColor(canvas->hDC));
} /* osDrawPoint */
void osDrawLine (int startx, int starty, int endx, int endy, CanvasHandle canvas)
{
MoveToEx (canvas->hDC, startx, starty, NULL);
LineTo (canvas->hDC, endx, endy);
***************
*** 623,675 ****
void osDrawChar (int x, int y, char c, CanvasHandle canvas)
{
- StartDrawing (canvas);
TextOut (canvas->hDC, x, y, &c, 1);
} /* osDrawChar */
- void osUndrawChar (int x, int y, char c, CanvasHandle canvas)
- {
- StartUndrawing(canvas);
- TextOut (canvas->hDC, x, y, &c, 1);
- } /* osEraseChar */
-
void osDrawString (int x, int y, char *string, CanvasHandle canvas)
{
- StartDrawing (canvas);
TextOut (canvas->hDC, x, y, string, strlen(string));
} /* osDrawString */
- void osUndrawString (int x, int y, char *string, CanvasHandle canvas)
- {
- StartUndrawing(canvas);
- TextOut (canvas->hDC, x, y, string, strlen(string));
- } /* osEraseString */
-
-
void osDrawRect(int left, int top, int right, int bot, CanvasHandle canvas)
{
! StartDrawing (canvas);
! Rectangle (canvas->hDC, left, top, right, bot);
} /* osDrawRect */
- void osUndrawRect(int left, int top, int right, int bot, CanvasHandle canvas)
- {
- StartUndrawing (canvas);
- Rectangle (canvas->hDC, left, top, right, bot);
- } /* osUndrawRect */
-
void osFillRect(int left, int top, int right, int bot, CanvasHandle canvas)
{
! StartFilling (canvas);
! Rectangle (canvas->hDC, left, top, right + 1, bot + 1);
} /* osFillRect */
- void osEraseRect(int left, int top, int right, int bot, CanvasHandle canvas)
- {
- StartErasing (canvas);
- Rectangle (canvas->hDC, left, top, right + 1, bot + 1);
- } /* osEraseRect */
-
! static void winDrawCurve(BOOL fill, int x0, int y0, int x1, int y1, float from, float to, BOOL clockwise,CanvasHandle canvas)
{
float rx,ry;
--- 404,431 ----
void osDrawChar (int x, int y, char c, CanvasHandle canvas)
{
TextOut (canvas->hDC, x, y, &c, 1);
} /* osDrawChar */
void osDrawString (int x, int y, char *string, CanvasHandle canvas)
{
TextOut (canvas->hDC, x, y, string, strlen(string));
} /* osDrawString */
void osDrawRect(int left, int top, int right, int bot, CanvasHandle canvas)
{
! SelectObject (canvas->hDC, GetStockObject (NULL_BRUSH));
! Rectangle (canvas->hDC, left, top, right+1, bot+1);
! SelectObject (canvas->hDC, canvas->theBrush);
} /* osDrawRect */
void osFillRect(int left, int top, int right, int bot, CanvasHandle canvas)
{
! SelectObject (canvas->hDC, GetStockObject (NULL_PEN));
! Rectangle(canvas->hDC, left, top, right+2, bot+2);
! SelectObject (canvas->hDC, canvas->thePen);
} /* osFillRect */
! static void osDrawFillCurve(BOOL fill, int x0, int y0, int x1, int y1, float from, float to, BOOL clockwise,CanvasHandle canvas)
{
float rx,ry;
***************
*** 677,686 ****
int fx,fy;
int tx,ty;
!
rx = abs(x1-x0)/2;
ry = abs(y1-y0)/2;
cx = x0 + rx;
cy = y0 + ry;
!
fx = floor(cx + cos(from)*rx);
fy = floor(cy - sin(from)*ry);
--- 433,442 ----
int fx,fy;
int tx,ty;
!
rx = abs(x1-x0)/2;
ry = abs(y1-y0)/2;
cx = x0 + rx;
cy = y0 + ry;
!
fx = floor(cx + cos(from)*rx);
fy = floor(cy - sin(from)*ry);
***************
*** 688,722 ****
ty = floor(cy - sin(to)*ry);
! if (fill) {
! if (clockwise) Pie (canvas->hDC, x0, y0, x1, y1, tx, ty, fx, fy );
! else Pie (canvas->hDC, x0, y0, x1, y1, fx, fy, tx, ty );
! }
! else {
! if (clockwise) Arc (canvas->hDC, x0, y0, x1, y1, tx, ty, fx, fy );
! else Arc (canvas->hDC, x0, y0, x1, y1, fx, fy, tx, ty );
! }
} /* osDrawCurve */
void osDrawCurve (int x0, int y0, int x1, int y1, float from, float to, BOOL clockwise,CanvasHandle canvas)
{
! StartDrawing(canvas);
! winDrawCurve(FALSE,x0,y0,x1,y1,from,to,clockwise,canvas);
} /* osDrawCurve */
- void osUndrawCurve (int x0, int y0, int x1, int y1, float from, float to, BOOL clockwise,CanvasHandle canvas)
- {
- StartUndrawing(canvas);
- winDrawCurve(FALSE,x0,y0,x1,y1,from,to,clockwise,canvas);
- } /* osUndrawCurve */
-
void osDrawOval (int left, int top, int right, int bot, CanvasHandle canvas)
{
- StartDrawing (canvas);
- Arc (canvas->hDC, left, top, right, bot, 0, 0, 0, 0);
- } /* osDrawOval */
-
- void osUndrawOval (int left, int top, int right, int bot, CanvasHandle canvas)
- {
- StartUndrawing (canvas);
Arc (canvas->hDC, left, top, right, bot, 0, 0, 0, 0);
} /* osDrawOval */
--- 444,470 ----
ty = floor(cy - sin(to)*ry);
! if (fill)
! {
! if (clockwise)
! Pie (canvas->hDC, x0, y0, x1, y1, tx, ty, fx, fy);
! else
! Pie (canvas->hDC, x0, y0, x1, y1, fx, fy, tx, ty);
! }
! else
! {
! if (clockwise)
! Arc (canvas->hDC, x0, y0, x1, y1, tx, ty, fx, fy);
! else
! Arc (canvas->hDC, x0, y0, x1, y1, fx, fy, tx, ty);
! }
} /* osDrawCurve */
void osDrawCurve (int x0, int y0, int x1, int y1, float from, float to, BOOL clockwise,CanvasHandle canvas)
{
! osDrawFillCurve(FALSE,x0,y0,x1,y1,from,to,clockwise,canvas);
} /* osDrawCurve */
void osDrawOval (int left, int top, int right, int bot, CanvasHandle canvas)
{
Arc (canvas->hDC, left, top, right, bot, 0, 0, 0, 0);
} /* osDrawOval */
***************
*** 724,759 ****
void osFillOval (int left, int top, int right, int bot, CanvasHandle canvas)
{
- StartFilling (canvas);
Ellipse (canvas->hDC, left, top, right + 1, bot + 1);
} /* osFillOval */
- void osEraseOval (int left, int top, int right, int bot, CanvasHandle canvas)
- {
- StartErasing (canvas);
- Ellipse (canvas->hDC, left, top, right + 1, bot + 1);
- } /* osEraseOval */
-
-
void osFillCurve(int x0, int y0, int x1, int y1, float from, float to, BOOL clockwise,CanvasHandle canvas)
{
! StartFilling (canvas);
! winDrawCurve(TRUE,x0,y0,x1,y1,from,to,clockwise,canvas);
} /* osFillCurve */
- void osEraseCurve (int x0, int y0, int x1, int y1, float from, float to, BOOL clockwise,CanvasHandle canvas)
- {
- StartErasing (canvas);
- winDrawCurve(TRUE,x0,y0,x1,y1,from,to,clockwise,canvas);
- } /* osEraseCurve */
-
void osDrawPolyline (PolygonHandle arr, CanvasHandle canvas)
{
- StartDrawing (canvas);
- Polyline (canvas->hDC, arr->data, arr->count);
- } /* osDrawPolygon */
-
- void osUndrawPolyline (PolygonHandle arr, CanvasHandle canvas)
- {
- StartUndrawing (canvas);
Polyline (canvas->hDC, arr->data, arr->count);
} /* osDrawPolygon */
--- 472,485 ----
void osFillOval (int left, int top, int right, int bot, CanvasHandle canvas)
{
Ellipse (canvas->hDC, left, top, right + 1, bot + 1);
} /* osFillOval */
void osFillCurve(int x0, int y0, int x1, int y1, float from, float to, BOOL clockwise,CanvasHandle canvas)
{
! osDrawFillCurve(TRUE,x0,y0,x1,y1,from,to,clockwise,canvas);
} /* osFillCurve */
void osDrawPolyline (PolygonHandle arr, CanvasHandle canvas)
{
Polyline (canvas->hDC, arr->data, arr->count);
} /* osDrawPolygon */
***************
*** 761,771 ****
void osDrawPolygon (PolygonHandle arr, CanvasHandle canvas)
{
- StartDrawing (canvas);
- Polygon (canvas->hDC, arr->data, arr->count);
- } /* osDrawPolygon */
-
- void osUndrawPolygon (PolygonHandle arr, CanvasHandle canvas)
- {
- StartUndrawing (canvas);
Polygon (canvas->hDC, arr->data, arr->count);
} /* osDrawPolygon */
--- 487,490 ----
***************
*** 773,785 ****
void osFillPolygon (PolygonHandle arr, CanvasHandle canvas)
{
- StartFilling (canvas);
Polygon (canvas->hDC, arr->data, arr->count);
} /* osFillPolygon */
-
- void osErasePolygon (PolygonHandle arr, CanvasHandle canvas)
- {
- StartErasing (canvas);
- Polygon (canvas->hDC, arr->data, arr->count);
- } /* osErasePolygon */
/* PA: two new routines that temporarily create and destroy a DISPLAY CanvasHandle.
--- 492,497 ----
|