[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: point-in-pict-p
In article <95Jan26.095955est.144280@explorer.dgp.toronto.edu>,
markt@dgp.toronto.edu (Mark A. Tapia) wrote:
|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)))
Nah, that's the easy part. The question remains: How do I test that a
PICT is going to actively CHANGE a given pixel color. eg, #_FrameRect
does *NOT* alter the pixels in the interior of the given rectangle. I
want a hit test that only includes those pixels QuickDraw has actually
*altered*.
--
--
--
-- "TANSTAAFL" Rich lynch@ils.nwu.edu