Re: RgnHandle replacement?
Re: RgnHandle replacement?
- Subject: Re: RgnHandle replacement?
- From: Jonathan Wight <email@hidden>
- Date: Wed, 06 Nov 2002 23:49:51 -0600
On 11/06/2002 23:29, "Scott Anguish" <email@hidden> wrote:
>
On Wednesday, November 6, 2002, at 06:43 PM, Jonathan Wight wrote:
>
>
> In my cocoa NSView subclass I have a bunch of icons and want to allow
>
> the
>
> user to select them with a selection marquee. I've the core of this
>
> working
>
> but to test if the icons are selected by the marquee I'm using
>
> NSIntersectsRect to see if the marquee rectangle is intersecting the
>
> icon's
>
> bounds rect.
>
>
>
>
You'd want to create an NSImage with the icon in it (oh, you probably
>
already have that then right?), and then test the hit point to see if
>
it has a pixel or not...
>
>
Here is someone doing something similar, and a thread where it was
>
discussed
>
>
http://cocoa.mamasam.com/COCOADEV/2001/09/2/13509.php
>
>
(look at both JCR's response, and Ken Dyke's)
>
>
getting the color of a specific pixel is a pretty common operation,
>
but it's dependent on the format of the underlying graphic at this
>
point.. the bit level and format... you could simplify this if your
>
image is always the same depth..
>
>
it'd be better if it was part of the API though.
Hi Scott,
Maybe I didn't describe the problem well enough. I've already got code to
hit test individual pixels within my icons (I'm using NSReadPixel on the
icon's image instead of using pointer math), but now I want to find out what
icons are selected when the users drags a selection marquee around zero or
more icons.
Basically I'm creating an NSView that works just like a finder icon window.
The user can individually select icons by clicking on them one at at time
(which I've coded and works fine). The user can also drag a selection
marquee around zero or more icons to select them (coded, but I'm having a
problem getting exact selection as described above).
Anyway - if a picture is worth a thousand words then a sample app must be
worth a couple of million:
http://puck.homeip.net/~schwa/Finderish.tar.gz
(124KB).
Jon.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.