Re: Cursor zone
Re: Cursor zone
- Subject: Re: Cursor zone
- From: Bertrand Mansion <email@hidden>
- Date: Sun, 17 Feb 2002 12:49:18 +0100
FROM: Bhaller
DATE: 2002-02-16 20:00
>
[A side note: if people asking questions are going to cross-post between
>
cocoa-dev and macosx-dev, I think they should do it with an explicit
>
cross-post by addressing a single message to both lists. Separate posts
>
to each list means that the person answering the question has to then
>
post a reply separately to each list, which is annoying, and means that
>
followup discussion is split on the two lists. That said, I personally
>
think it would be nice if question posters just chose one list or the
>
other; I suspect the reader list for the two is close to identical, so
>
cross-posting just wastes everybody's time. I wonder whether we, the
>
cocoa developer community, should be making noise about combining these
>
lists, in fact; do they serve any distinct function apart? Anyhow, on
>
to the thread at hand...]
Dear Ben,
I totally agree with your statement. As you might know, I maintain a
searchable archive for both mailing-lists (can be found at
http://cocoa.mamasam.com ). Having people doing cross-posting means they are
filling my HD and the search-engine with two times the same message which I
would also like to avoid in the future. So, +1 for a merge.
But the reason I did cross-posts is because nobody replied to my first post
on COCOADEV list (and this is not the first time it happens, and if you look
at the rate of answered questions in general, it is very low anyway). So I
thought people could be nicier on MACOSXDEV list and answer my question.
>
> I am trying to set a sensitive zone to change the image of my cursor. I
>
> can do it easily if I use a NSRect and [self addCursorRect:myRect
>
> cursor:myCursor];
>
> But is it possible to make a cursor zone a different shape ?
>
> For instance, I have a circle in my view and when the arrow cursor
>
> moves over this circle, I would like it to change to another cursor
>
> image. What is the best solution for that ?
>
I believe there is API to do this in CoreGraphics, from what I recall,
>
but it does not appear to be public. So you're out of luck. Log a bug
>
on Apple (so maybe they'll make this API public in the future), and then
>
you have a few choices:
Could you tell me where I can find more info on this (in headers ?).
>
o Add multiple tracking rects that more or less "scan convert" your
>
circle into a set of rectangular areas.
I have done that but it takes ages to draw. The picture is here and 3
seconds later, the sensitive rects appear. It looks to me like the Cursor
Rect stuff in COCOA is not very well designed.
Actually, it might be because I just want the borders of the circle to be
sensitive. To make that, I scan every points in my NSBitmapImageRep and
determine if they are white or black. If they are white, I check if there is
a black point in the 8 pixels around. At the end, it makes many rects and
they overlap sometimes. Could it be the reason of the time it takes to draw?
>
o Use a single rect and live with it.
Not possible :(
>
o Try to use [NSCursor pushCursor] / [NSCursor popCursor], and struggle
>
with the various issues raised earlier on the list about the problems
>
with this approach and its basic lack of support in the Kit.
I will have a look at that too.
>
Of the three, I'd recommend choice #1; you may not need to use very
>
many rectangles to give the user the feel that the circle is the "live"
>
area, depending on how big the circle is. I'd just write a utility
>
method (perhaps a category, to harken to other current threads ;->) that
>
does this for you in a general way.
Do you think Cursor Rects are CPU consumming ? Am I limited in the number of
rects I can use ? I have made tests with a big image full of circles : I get
the spinning cursor for ages and my app is stuck.
Anyway, thanks for your reply, I was getting afraid that I was the only one
in the world with cursor problems... :-)
Bertrand Mansion
Mamasam
_______________________________________________
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.