Lines Matching refs:arcPtr

101 			    ArcItem *arcPtr));
129 static void ComputeArcOutline _ANSI_ARGS_((ArcItem *arcPtr));
209 ArcItem *arcPtr = (ArcItem *) itemPtr;
234 arcPtr->start = 0;
235 arcPtr->extent = 90;
236 arcPtr->outlinePtr = NULL;
237 arcPtr->numOutlinePoints = 0;
238 arcPtr->width = 1;
239 arcPtr->outlineColor = NULL;
240 arcPtr->fillColor = NULL;
241 arcPtr->fillStipple = None;
242 arcPtr->outlineStipple = None;
243 arcPtr->style = pieSliceUid;
244 arcPtr->outlineGC = None;
245 arcPtr->fillGC = None;
251 if ((Tk_CanvasGetCoord(interp, canvas, argv[0], &arcPtr->bbox[0]) != TCL_OK)
253 &arcPtr->bbox[1]) != TCL_OK)
255 &arcPtr->bbox[2]) != TCL_OK)
257 &arcPtr->bbox[3]) != TCL_OK)) {
298 ArcItem *arcPtr = (ArcItem *) itemPtr;
303 Tcl_PrintDouble(interp, arcPtr->bbox[0], c0);
304 Tcl_PrintDouble(interp, arcPtr->bbox[1], c1);
305 Tcl_PrintDouble(interp, arcPtr->bbox[2], c2);
306 Tcl_PrintDouble(interp, arcPtr->bbox[3], c3);
311 &arcPtr->bbox[0]) != TCL_OK)
313 &arcPtr->bbox[1]) != TCL_OK)
315 &arcPtr->bbox[2]) != TCL_OK)
317 &arcPtr->bbox[3]) != TCL_OK)) {
320 ComputeArcBbox(canvas, arcPtr);
359 ArcItem *arcPtr = (ArcItem *) itemPtr;
368 (char *) arcPtr, flags) != TCL_OK) {
377 i = arcPtr->start/360.0;
378 arcPtr->start -= i*360.0;
379 if (arcPtr->start < 0) {
380 arcPtr->start += 360.0;
382 i = arcPtr->extent/360.0;
383 arcPtr->extent -= i*360.0;
385 if ((arcPtr->style != arcUid) && (arcPtr->style != chordUid)
386 && (arcPtr->style != pieSliceUid)) {
388 arcPtr->style, "\": must be arc, chord, or pieslice",
390 arcPtr->style = pieSliceUid;
394 if (arcPtr->width < 0) {
395 arcPtr->width = 1;
397 if (arcPtr->outlineColor == NULL) {
400 gcValues.foreground = arcPtr->outlineColor->pixel;
402 gcValues.line_width = arcPtr->width;
404 if (arcPtr->outlineStipple != None) {
405 gcValues.stipple = arcPtr->outlineStipple;
411 if (arcPtr->outlineGC != None) {
412 Tk_FreeGC(Tk_Display(tkwin), arcPtr->outlineGC);
414 arcPtr->outlineGC = newGC;
416 if ((arcPtr->fillColor == NULL) || (arcPtr->style == arcUid)) {
419 gcValues.foreground = arcPtr->fillColor->pixel;
420 if (arcPtr->style == chordUid) {
426 if (arcPtr->fillStipple != None) {
427 gcValues.stipple = arcPtr->fillStipple;
433 if (arcPtr->fillGC != None) {
434 Tk_FreeGC(Tk_Display(tkwin), arcPtr->fillGC);
436 arcPtr->fillGC = newGC;
438 ComputeArcBbox(canvas, arcPtr);
467 ArcItem *arcPtr = (ArcItem *) itemPtr;
469 if (arcPtr->numOutlinePoints != 0) {
470 ckfree((char *) arcPtr->outlinePtr);
472 if (arcPtr->outlineColor != NULL) {
473 Tk_FreeColor(arcPtr->outlineColor);
475 if (arcPtr->fillColor != NULL) {
476 Tk_FreeColor(arcPtr->fillColor);
478 if (arcPtr->fillStipple != None) {
479 Tk_FreeBitmap(display, arcPtr->fillStipple);
481 if (arcPtr->outlineStipple != None) {
482 Tk_FreeBitmap(display, arcPtr->outlineStipple);
484 if (arcPtr->outlineGC != None) {
485 Tk_FreeGC(display, arcPtr->outlineGC);
487 if (arcPtr->fillGC != None) {
488 Tk_FreeGC(display, arcPtr->fillGC);
513 ComputeArcBbox(canvas, arcPtr)
515 ArcItem *arcPtr; /* Item whose bbox is to be
524 if (arcPtr->bbox[1] > arcPtr->bbox[3]) {
526 tmp = arcPtr->bbox[3];
527 arcPtr->bbox[3] = arcPtr->bbox[1];
528 arcPtr->bbox[1] = tmp;
530 if (arcPtr->bbox[0] > arcPtr->bbox[2]) {
532 tmp = arcPtr->bbox[2];
533 arcPtr->bbox[2] = arcPtr->bbox[0];
534 arcPtr->bbox[0] = tmp;
537 ComputeArcOutline(arcPtr);
546 arcPtr->header.x1 = arcPtr->header.x2 = arcPtr->center1[0];
547 arcPtr->header.y1 = arcPtr->header.y2 = arcPtr->center1[1];
548 TkIncludePoint((Tk_Item *) arcPtr, arcPtr->center2);
549 center[0] = (arcPtr->bbox[0] + arcPtr->bbox[2])/2;
550 center[1] = (arcPtr->bbox[1] + arcPtr->bbox[3])/2;
551 if (arcPtr->style != arcUid) {
552 TkIncludePoint((Tk_Item *) arcPtr, center);
555 tmp = -arcPtr->start;
559 if ((tmp < arcPtr->extent) || ((tmp-360) > arcPtr->extent)) {
560 point[0] = arcPtr->bbox[2];
562 TkIncludePoint((Tk_Item *) arcPtr, point);
564 tmp = 90.0 - arcPtr->start;
568 if ((tmp < arcPtr->extent) || ((tmp-360) > arcPtr->extent)) {
570 point[1] = arcPtr->bbox[1];
571 TkIncludePoint((Tk_Item *) arcPtr, point);
573 tmp = 180.0 - arcPtr->start;
577 if ((tmp < arcPtr->extent) || ((tmp-360) > arcPtr->extent)) {
578 point[0] = arcPtr->bbox[0];
580 TkIncludePoint((Tk_Item *) arcPtr, point);
582 tmp = 270.0 - arcPtr->start;
586 if ((tmp < arcPtr->extent) || ((tmp-360) > arcPtr->extent)) {
588 point[1] = arcPtr->bbox[3];
589 TkIncludePoint((Tk_Item *) arcPtr, point);
597 if (arcPtr->outlineColor == NULL) {
600 tmp = (arcPtr->width + 1)/2 + 1;
602 arcPtr->header.x1 -= tmp;
603 arcPtr->header.y1 -= tmp;
604 arcPtr->header.x2 += tmp;
605 arcPtr->header.y2 += tmp;
637 ArcItem *arcPtr = (ArcItem *) itemPtr;
646 Tk_CanvasDrawableCoords(canvas, arcPtr->bbox[0], arcPtr->bbox[1],
648 Tk_CanvasDrawableCoords(canvas, arcPtr->bbox[2], arcPtr->bbox[3],
656 start = (64*arcPtr->start) + 0.5;
657 extent = (64*arcPtr->extent) + 0.5;
665 if ((arcPtr->fillGC != None) && (extent != 0)) {
666 if (arcPtr->fillStipple != None) {
667 Tk_CanvasSetStippleOrigin(canvas, arcPtr->fillGC);
669 XFillArc(display, drawable, arcPtr->fillGC, x1, y1, (unsigned) (x2-x1),
671 if (arcPtr->fillStipple != None) {
672 XSetTSOrigin(display, arcPtr->fillGC, 0, 0);
675 if (arcPtr->outlineGC != None) {
676 if (arcPtr->outlineStipple != None) {
677 Tk_CanvasSetStippleOrigin(canvas, arcPtr->outlineGC);
680 XDrawArc(display, drawable, arcPtr->outlineGC, x1, y1,
690 if (arcPtr->width <= 2) {
691 Tk_CanvasDrawableCoords(canvas, arcPtr->center1[0],
692 arcPtr->center1[1], &x1, &y1);
693 Tk_CanvasDrawableCoords(canvas, arcPtr->center2[0],
694 arcPtr->center2[1], &x2, &y2);
696 if (arcPtr->style == chordUid) {
697 XDrawLine(display, drawable, arcPtr->outlineGC,
699 } else if (arcPtr->style == pieSliceUid) {
703 (arcPtr->bbox[0] + arcPtr->bbox[2])/2.0,
704 (arcPtr->bbox[1] + arcPtr->bbox[3])/2.0, &cx, &cy);
705 XDrawLine(display, drawable, arcPtr->outlineGC,
707 XDrawLine(display, drawable, arcPtr->outlineGC,
711 if (arcPtr->style == chordUid) {
712 TkFillPolygon(canvas, arcPtr->outlinePtr, CHORD_OUTLINE_PTS,
713 display, drawable, arcPtr->outlineGC, None);
714 } else if (arcPtr->style == pieSliceUid) {
715 TkFillPolygon(canvas, arcPtr->outlinePtr, PIE_OUTLINE1_PTS,
716 display, drawable, arcPtr->outlineGC, None);
717 TkFillPolygon(canvas, arcPtr->outlinePtr + 2*PIE_OUTLINE1_PTS,
718 PIE_OUTLINE2_PTS, display, drawable, arcPtr->outlineGC,
722 if (arcPtr->outlineStipple != None) {
723 XSetTSOrigin(display, arcPtr->outlineGC, 0, 0);
759 ArcItem *arcPtr = (ArcItem *) itemPtr;
764 if ((arcPtr->fillGC != None) || (arcPtr->outlineGC == None)) {
777 vertex[0] = (arcPtr->bbox[0] + arcPtr->bbox[2])/2.0;
778 vertex[1] = (arcPtr->bbox[1] + arcPtr->bbox[3])/2.0;
779 t1 = (pointPtr[1] - vertex[1])/(arcPtr->bbox[3] - arcPtr->bbox[1]);
780 t2 = (pointPtr[0] - vertex[0])/(arcPtr->bbox[2] - arcPtr->bbox[0]);
786 diff = pointAngle - arcPtr->start;
791 angleInRange = (diff <= arcPtr->extent) ||
792 ((arcPtr->extent < 0) && ((diff - 360.0) >= arcPtr->extent));
799 if (arcPtr->style == arcUid) {
801 return TkOvalToPoint(arcPtr->bbox, (double) arcPtr->width,
804 dist = hypot(pointPtr[0] - arcPtr->center1[0],
805 pointPtr[1] - arcPtr->center1[1]);
806 newDist = hypot(pointPtr[0] - arcPtr->center2[0],
807 pointPtr[1] - arcPtr->center2[1]);
814 if ((arcPtr->fillGC != None) || (arcPtr->outlineGC == None)) {
819 if (arcPtr->outlineGC == None) {
822 width = arcPtr->width;
825 if (arcPtr->style == pieSliceUid) {
827 dist = TkPolygonToPoint(arcPtr->outlinePtr, PIE_OUTLINE1_PTS,
829 newDist = TkPolygonToPoint(arcPtr->outlinePtr + 2*PIE_OUTLINE1_PTS,
832 dist = TkLineToPoint(vertex, arcPtr->center1, pointPtr);
833 newDist = TkLineToPoint(vertex, arcPtr->center2, pointPtr);
839 newDist = TkOvalToPoint(arcPtr->bbox, width, filled, pointPtr);
857 dist = TkPolygonToPoint(arcPtr->outlinePtr, CHORD_OUTLINE_PTS,
860 dist = TkLineToPoint(arcPtr->center1, arcPtr->center2, pointPtr);
864 poly[2] = arcPtr->center1[0];
865 poly[3] = arcPtr->center1[1];
866 poly[4] = arcPtr->center2[0];
867 poly[5] = arcPtr->center2[1];
870 if ((arcPtr->extent < -180.0) || (arcPtr->extent > 180.0)
872 newDist = TkOvalToPoint(arcPtr->bbox, width, filled, pointPtr);
878 if ((arcPtr->extent < -180.0) || (arcPtr->extent > 180.0)) {
917 ArcItem *arcPtr = (ArcItem *) itemPtr;
932 if ((arcPtr->fillGC != None) || (arcPtr->outlineGC == None)) {
937 if (arcPtr->outlineGC == None) {
940 width = arcPtr->width;
948 center[0] = (arcPtr->bbox[0] + arcPtr->bbox[2])/2.0;
949 center[1] = (arcPtr->bbox[1] + arcPtr->bbox[3])/2.0;
954 rx = arcPtr->bbox[2] - center[0] + width/2.0;
955 ry = arcPtr->bbox[3] - center[1] + width/2.0;
973 angle = -arcPtr->start*(PI/180.0);
976 angle += -arcPtr->extent*(PI/180.0);
982 if ((arcPtr->style == pieSliceUid) && (arcPtr->extent < 180.0)) {
989 tmp = -arcPtr->start;
993 if ((tmp < arcPtr->extent) || ((tmp-360) > arcPtr->extent)) {
999 tmp = 90.0 - arcPtr->start;
1003 if ((tmp < arcPtr->extent) || ((tmp-360) > arcPtr->extent)) {
1009 tmp = 180.0 - arcPtr->start;
1013 if ((tmp < arcPtr->extent) || ((tmp-360) > arcPtr->extent)) {
1019 tmp = 270.0 - arcPtr->start;
1023 if ((tmp < arcPtr->extent) || ((tmp-360) > arcPtr->extent)) {
1057 if (arcPtr->style == pieSliceUid) {
1059 if (TkPolygonToArea(arcPtr->outlinePtr, PIE_OUTLINE1_PTS,
1063 if (TkPolygonToArea(arcPtr->outlinePtr + 2*PIE_OUTLINE1_PTS,
1068 if ((TkLineToArea(center, arcPtr->center1, rectPtr) != -1) ||
1069 (TkLineToArea(center, arcPtr->center2, rectPtr) != -1)) {
1073 } else if (arcPtr->style == chordUid) {
1075 if (TkPolygonToArea(arcPtr->outlinePtr, CHORD_OUTLINE_PTS,
1080 if (TkLineToArea(arcPtr->center1, arcPtr->center2,
1093 if (HorizLineToArc(tRect[0], tRect[2], tRect[1], rx, ry, arcPtr->start,
1094 arcPtr->extent)
1096 arcPtr->start, arcPtr->extent)
1098 arcPtr->start, arcPtr->extent)
1100 arcPtr->start, arcPtr->extent)) {
1106 if (HorizLineToArc(tRect[0], tRect[2], tRect[1], rx, ry, arcPtr->start,
1107 arcPtr->extent)
1109 arcPtr->start, arcPtr->extent)
1111 arcPtr->start, arcPtr->extent)
1113 arcPtr->start, arcPtr->extent)) {
1161 ArcItem *arcPtr = (ArcItem *) itemPtr;
1163 arcPtr->bbox[0] = originX + scaleX*(arcPtr->bbox[0] - originX);
1164 arcPtr->bbox[1] = originY + scaleY*(arcPtr->bbox[1] - originY);
1165 arcPtr->bbox[2] = originX + scaleX*(arcPtr->bbox[2] - originX);
1166 arcPtr->bbox[3] = originY + scaleY*(arcPtr->bbox[3] - originY);
1167 ComputeArcBbox(canvas, arcPtr);
1196 ArcItem *arcPtr = (ArcItem *) itemPtr;
1198 arcPtr->bbox[0] += deltaX;
1199 arcPtr->bbox[1] += deltaY;
1200 arcPtr->bbox[2] += deltaX;
1201 arcPtr->bbox[3] += deltaY;
1202 ComputeArcBbox(canvas, arcPtr);
1221 * The information at arcPtr->outlinePtr gets modified, and
1222 * storage for arcPtr->outlinePtr may be allocated or freed.
1228 ComputeArcOutline(arcPtr)
1229 ArcItem *arcPtr; /* Information about arc. */
1241 if (arcPtr->numOutlinePoints == 0) {
1242 arcPtr->outlinePtr = (double *) ckalloc((unsigned)
1244 arcPtr->numOutlinePoints = 22;
1246 outlinePtr = arcPtr->outlinePtr;
1270 boxWidth = arcPtr->bbox[2] - arcPtr->bbox[0];
1271 boxHeight = arcPtr->bbox[3] - arcPtr->bbox[1];
1272 angle = -arcPtr->start*PI/180.0;
1275 angle -= arcPtr->extent*PI/180.0;
1278 vertex[0] = (arcPtr->bbox[0] + arcPtr->bbox[2])/2.0;
1279 vertex[1] = (arcPtr->bbox[1] + arcPtr->bbox[3])/2.0;
1280 arcPtr->center1[0] = vertex[0] + cos1*boxWidth/2.0;
1281 arcPtr->center1[1] = vertex[1] + sin1*boxHeight/2.0;
1282 arcPtr->center2[0] = vertex[0] + cos2*boxWidth/2.0;
1283 arcPtr->center2[1] = vertex[1] + sin2*boxHeight/2.0;
1298 * realize that the slope of the line from arcPtr->center1 to corner1
1299 * is (boxWidth*sin1)/(boxHeight*cos1), and similarly for arcPtr->center2
1304 halfWidth = arcPtr->width/2.0;
1310 corner1[0] = arcPtr->center1[0] + cos(angle)*halfWidth;
1311 corner1[1] = arcPtr->center1[1] + sin(angle)*halfWidth;
1317 corner2[0] = arcPtr->center2[0] + cos(angle)*halfWidth;
1318 corner2[1] = arcPtr->center2[1] + sin(angle)*halfWidth;
1327 if (arcPtr->style == chordUid) {
1330 TkGetButtPoints(arcPtr->center2, arcPtr->center1,
1331 (double) arcPtr->width, 0, outlinePtr+10, outlinePtr+2);
1332 outlinePtr[4] = arcPtr->center2[0] + outlinePtr[2]
1333 - arcPtr->center1[0];
1334 outlinePtr[5] = arcPtr->center2[1] + outlinePtr[3]
1335 - arcPtr->center1[1];
1338 outlinePtr[8] = arcPtr->center2[0] + outlinePtr[10]
1339 - arcPtr->center1[0];
1340 outlinePtr[9] = arcPtr->center2[1] + outlinePtr[11]
1341 - arcPtr->center1[1];
1342 } else if (arcPtr->style == pieSliceUid) {
1346 * where the center of the oval is X, arcPtr->center1 is at Y, and
1358 TkGetButtPoints(arcPtr->center1, vertex, (double) arcPtr->width, 0,
1360 outlinePtr[4] = arcPtr->center1[0] + outlinePtr[2] - vertex[0];
1361 outlinePtr[5] = arcPtr->center1[1] + outlinePtr[3] - vertex[1];
1364 outlinePtr[8] = arcPtr->center1[0] + outlinePtr[0] - vertex[0];
1365 outlinePtr[9] = arcPtr->center1[1] + outlinePtr[1] - vertex[1];
1381 * arcPtr->center2, and Z is corner2. The extra jog out to the left
1387 TkGetButtPoints(arcPtr->center2, vertex, (double) arcPtr->width, 0,
1389 if ((arcPtr->extent > 180) ||
1390 ((arcPtr->extent < 0) && (arcPtr->extent > -180))) {
1397 outlinePtr[18] = arcPtr->center2[0] + outlinePtr[16] - vertex[0];
1398 outlinePtr[19] = arcPtr->center2[1] + outlinePtr[17] - vertex[1];
1401 outlinePtr[22] = arcPtr->center2[0] + outlinePtr[12] - vertex[0];
1402 outlinePtr[23] = arcPtr->center2[1] + outlinePtr[13] - vertex[1];
1619 ArcItem *arcPtr = (ArcItem *) itemPtr;
1623 y1 = Tk_CanvasPsY(canvas, arcPtr->bbox[1]);
1624 y2 = Tk_CanvasPsY(canvas, arcPtr->bbox[3]);
1625 ang1 = arcPtr->start;
1626 ang2 = ang1 + arcPtr->extent;
1629 ang2 = arcPtr->start;
1637 if (arcPtr->fillGC != None) {
1639 (arcPtr->bbox[0] + arcPtr->bbox[2])/2, (y1 + y2)/2,
1640 (arcPtr->bbox[2] - arcPtr->bbox[0])/2, (y1 - y2)/2);
1642 if (arcPtr->style == chordUid) {
1651 if (Tk_CanvasPsColor(interp, canvas, arcPtr->fillColor) != TCL_OK) {
1654 if (arcPtr->fillStipple != None) {
1656 if (Tk_CanvasPsStipple(interp, canvas, arcPtr->fillStipple)
1660 if (arcPtr->outlineGC != None) {
1672 if (arcPtr->outlineGC != None) {
1674 (arcPtr->bbox[0] + arcPtr->bbox[2])/2, (y1 + y2)/2,
1675 (arcPtr->bbox[2] - arcPtr->bbox[0])/2, (y1 - y2)/2);
1679 sprintf(buffer, "%d setlinewidth\n0 setlinecap\n", arcPtr->width);
1681 if (Tk_CanvasPsColor(interp, canvas, arcPtr->outlineColor)
1685 if (arcPtr->outlineStipple != None) {
1688 arcPtr->outlineStipple) != TCL_OK) {
1694 if (arcPtr->style != arcUid) {
1696 if (arcPtr->style == chordUid) {
1697 Tk_CanvasPsPath(interp, canvas, arcPtr->outlinePtr,
1700 Tk_CanvasPsPath(interp, canvas, arcPtr->outlinePtr,
1702 if (Tk_CanvasPsColor(interp, canvas, arcPtr->outlineColor)
1706 if (arcPtr->outlineStipple != None) {
1709 arcPtr->outlineStipple) != TCL_OK) {
1717 arcPtr->outlinePtr + 2*PIE_OUTLINE1_PTS,
1720 if (Tk_CanvasPsColor(interp, canvas, arcPtr->outlineColor)
1724 if (arcPtr->outlineStipple != None) {
1727 arcPtr->outlineStipple) != TCL_OK) {