Mercurial > dwindows
comparison os2/dw.c @ 1285:2c04a56eaf63
Switched to using arcparams and GpiFullArc on OS/2 to draw the ellipse.
Now that I understand how it works from info here:
http://cyberkinetica.homeunix.net/os2tk45/gpi4/158_L5_DefininganEllipse.html
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 31 Oct 2011 08:49:57 +0000 |
parents | 4f0f816f1e76 |
children | 6a5df80cfb43 |
comparison
equal
deleted
inserted
replaced
1284:8cb3650eb242 | 1285:2c04a56eaf63 |
---|---|
8701 return; | 8701 return; |
8702 | 8702 |
8703 /* For a filled arc we need to start an area */ | 8703 /* For a filled arc we need to start an area */ |
8704 if(flags & DW_DRAW_FILL) | 8704 if(flags & DW_DRAW_FILL) |
8705 GpiBeginArea(hps, 0L); | 8705 GpiBeginArea(hps, 0L); |
8706 /* Setup the arc info on the presentation space */ | |
8707 GpiSetArcParams(hps, &ap); | |
8708 | 8706 |
8709 /* Handle full circle/ellipse */ | 8707 /* Handle full circle/ellipse */ |
8710 if(flags & DW_DRAW_FULL) | 8708 if(flags & DW_DRAW_FULL) |
8711 { | 8709 { |
8712 int xmid = ((x2 - x1)/2) + x1; | 8710 pts[0].x = xorigin; |
8713 int ymid = ((y2 - y1)/2) + y1; | 8711 pts[0].y = thisheight - yorigin - 1; |
8714 | |
8715 /* Draw one half... */ | |
8716 pts[0].x = x1; | |
8717 pts[0].y = thisheight - ymid - 1; | |
8718 GpiMove(hps, pts); | 8712 GpiMove(hps, pts); |
8719 pts[0].x = xmid; | 8713 ap.lP = (x2 - x1)/2; |
8720 pts[0].y = thisheight - y1 - 1; | 8714 ap.lQ = (y2 - y1)/2; |
8721 pts[1].x = x2; | 8715 /* Setup the arc info on the presentation space */ |
8722 pts[1].y = thisheight - ymid - 1; | 8716 GpiSetArcParams(hps, &ap); |
8723 GpiPointArc(hps, pts); | 8717 GpiFullArc(hps, DRO_OUTLINE, MAKEFIXED(1, 1)); |
8724 /* ... then continue to draw the other half */ | 8718 } |
8725 GpiMove(hps, &pts[1]); | |
8726 pts[0].x = xmid; | |
8727 pts[0].y = thisheight - y2 - 1; | |
8728 pts[1].x = x1; | |
8729 pts[1].y = thisheight - ymid - 1; | |
8730 GpiPointArc(hps, pts); | |
8731 } | |
8732 else | 8719 else |
8733 { | 8720 { |
8721 /* Setup the default arc info on the presentation space */ | |
8722 GpiSetArcParams(hps, &ap); | |
8734 pts[0].x = x1; | 8723 pts[0].x = x1; |
8735 pts[0].y = thisheight - y1 - 1; | 8724 pts[0].y = thisheight - y1 - 1; |
8736 /* Move to the initial position */ | 8725 /* Move to the initial position */ |
8737 GpiMove(hps, pts); | 8726 GpiMove(hps, pts); |
8738 /* Calculate the midpoint */ | 8727 /* Calculate the midpoint */ |