Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!ucla-cs!zen!ucbvax!dewey.soe.berkeley.edu!oster From: oster@dewey.soe.berkeley.edu (David Phillip Oster) Newsgroups: comp.windows.x Subject: Re: Widget tracking Message-ID: <20907@ucbvax.BERKELEY.EDU> Date: Tue, 22-Sep-87 17:45:48 EDT Article-I.D.: ucbvax.20907 Posted: Tue Sep 22 17:45:48 1987 Date-Received: Thu, 24-Sep-87 07:12:37 EDT References: <870922-063108-11818@Xerox> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster) Organization: School of Education, UC-Berkeley Lines: 29 The way the problem of non-square buttons is solved on the Macintosh is two-fold. First, there is a collection of subroutines for manipulating arbitrary sets of polygons (drawing them, rescaling them, checking if a point is inside, doing union, intersection, set difference.) The internal representation is a Ycoordinate sorted list of Xcoordinate sorted list of pixels that are inside the set of polygons. However, some shapes (like those of icons) are too jagged for this representation to be efficient. In these cases, a bit map (called a "mask") is used to give the shape of the object against the icon. Now, suppose you want to see if a mouse coordinate point is inside one of these little monsters. 1.) check to see if the point is inside the bounding rectangle. 2.) if it is, check to see if it is inside the actual object. In the case of the set of polygons, the way you do this is obvious given the internal representation. In the case of a bitmap, you just translate the point into the local coordiantes of the bitmap, and see if that bit is on. In either case, if the mouse point is in the widget, you consume the mouse point. If it is not in this widget, you pass the point on to any object that may be under you. --- David Phillip Oster --My Good News: "I'm a perfectionist." Arpa: oster@dewey.soe.berkeley.edu --My Bad News: "I don't charge by the hour." Uucp: {uwvax,decvax,ihnp4}!ucbvax!oster%dewey.soe.berkeley.edu