Re: Cursor
Re: Cursor
- Subject: Re: Cursor
- From: Ricky Sharp <email@hidden>
- Date: Sat, 25 Sep 2004 18:34:47 -0500
On Sep 25, 2004, at 2:24 PM, Linea Tessile Srl wrote:
I have a NSColorwell object and when I cliked on it (with an IBAction)
I would like to change the arrow cursor in a brush cursor with an
image .tiff.
Then I would like to paint the brush cursor with the color of
NSColorWell object.
Is it possible?
Alessandra,
This should be possible.
I've done some experimentation with custom cursors, and since they
simply use an NSImage, you could build an NSImage at runtime to contain
the "paint" for your brush.
Check out NSCursor's initWithImage:hotSpot: method. You can definitely
first initialize your NSImage object with a TIFF file. You could then
do some experimentation with the various compositing modes to colorize
the area you want to paint.
What I'd probably do is have three NSImages:
(1) The brush cursor itself
(2) A mask to use which represents the portion of the image you want
your "paint"
(3) A dynamically built NSImage which would simply contain the solid
color (current color from your color well)
You could composite (2) and (3) above and take that result and
composite into (1). Note that there may be a solution with less steps.
Then, to set the cursor...
Since an NSColorWell ultimately inherits from NSView, so check out
NSView's resetCursorRects method. That will allow you to specify a
custom cursor tracking rectangle for your color well. I would imagine
that you could query the state of the color well such that you'd only
show your cursor if it's clicked (selected).
Hmm...it sounds like the case though that you want the custom cursor in
say your document view itself? And not just over the color well? In
that case, you can still use resetCursorRects, but override that in
your NSWindow object (i.e. the window containing the area you want your
custom cursor to be in).
___________________________________________________________
Ricky A. Sharp mailto:email@hidden
Instant Interactive(tm) http://www.instantinteractive.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >Cursor (From: Linea Tessile Srl <email@hidden>) |