[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: point-in-pict-p
- To: lynch@ils.nwu.edu
- Subject: Re: point-in-pict-p
- From: "Mark A. Tapia" <markt@dgp.toronto.edu>
- Date: Thu, 26 Jan 1995 09:59:46 -0500
- Cc: info-mcl@digitool.com
- Sender: owner-info-mcl@digitool.com
On Thu Jan 26, Richard Lynch asks:
Given a pict that was formed with, say:
(* ...code to generate a picture and store it in pict *)
I need a function that will return non-NIL for those pixels actually
covered by the rectangle, but NIL for those points inside the rectangle.
ie, (point-in-pict-p pict #@(12 12)) --> T [or any non-NIL]
(point-in-pict-p pict #@(24 24)) --> NIL
Is there some easy way to do this?
Here's the function point-in-pict-p. Obviously, the function can be
protected by checking to see whether the picture is really a picture.
Here's the code that does what you want, I haven't tested it.
mark
(unless (fboundp 'ccl::valid-picture)
(defun ccl::valid-picture (the-picture)
(and (macptrp the-picture) (handlep the-picture) the-picture))
(export 'ccl::valid-picture :ccl))
(defun point-in-picture-p (picture h &optional v)
(when (valid-picture picture)
(rlet ((r :rect :topLeft (rref picture :picture.picframe.TopLeft)
:bottomRight (rref picture :picture.picframe.BottomRight)))
(point-in-rect-p r point)))