MCPcopy Create free account
hub / github.com/SimHacker/micropolis / BitmapToPoint

Function BitmapToPoint

micropolis-activity/src/tk/tkcvbmap.c:491–526  ·  view source on GitHub ↗

ARGSUSED */

(canvasPtr, itemPtr, coordPtr)

Source from the content-addressed store, hash-verified

489 * distance from the point to the bitmap.
490 *
491 * Side effects:
492 * None.
493 *
494 *--------------------------------------------------------------
495 */
496
497 /* ARGSUSED */
498static double
499BitmapToPoint(canvasPtr, itemPtr, coordPtr)
500 Tk_Canvas *canvasPtr; /* Canvas containing item. */
501 Tk_Item *itemPtr; /* Item to check against point. */
502 double *coordPtr; /* Pointer to x and y coordinates. */
503{
504 register BitmapItem *bmapPtr = (BitmapItem *) itemPtr;
505 double x1, x2, y1, y2, xDiff, yDiff;
506
507 x1 = bmapPtr->header.x1;
508 y1 = bmapPtr->header.y1;
509 x2 = bmapPtr->header.x2;
510 y2 = bmapPtr->header.y2;
511
512 /*
513 * Point is outside rectangle.
514 */
515
516 if (coordPtr[0] < x1) {
517 xDiff = x1 - coordPtr[0];
518 } else if (coordPtr[0] > x2) {
519 xDiff = coordPtr[0] - x2;
520 } else {
521 xDiff = 0;
522 }
523
524 if (coordPtr[1] < y1) {
525 yDiff = y1 - coordPtr[1];
526 } else if (coordPtr[1] > y2) {
527 yDiff = coordPtr[1] - y2;
528 } else {
529 yDiff = 0;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected