Re: How do I get the hot spot from a .cur file in objective c on MAC Cocoa?
Re: How do I get the hot spot from a .cur file in objective c on MAC Cocoa?
- Subject: Re: How do I get the hot spot from a .cur file in objective c on MAC Cocoa?
- From: "Stephen J. Butler" <email@hidden>
- Date: Sun, 01 Apr 2012 00:34:48 -0500
Wikipedia says that cur/ico files have a very simple format:
http://en.wikipedia.org/wiki/ICO_(file_format)
Part of the ICONDIRENTRY structure is the hotspot information. Should
be pretty easy to write a basic parser.
On Sun, Mar 25, 2012 at 4:25 AM, Oshrat Fahima <email@hidden> wrote:
> Hi
> In our plug-ins we are using cursors kept in a *.CUR file.
> In windows there's no problem to identify the hot spot from the *.CUR file (because it's a WIN file, LoadCursor already knows where is the hot spot automatically).
> But in MAC Cocoa, we've encountered a problem when we create a new NSCursor object in which we must transfer the hot spot to it by calculating it and maintaining it hard coded
> (we prefer not to do that).
> Are you familiar with a method that can help retrieve the hot spot from a given *.CUR file?
> That way we can create the NSCursor directly using this point rather than calculating it ourselves.
>
> Here's a sample of our code.
> Thanks a lot for your time and knowledge
> Oshrat
>
>
> NewCursor(const resContainerRef, const short cursorID, const WTPoint2s hotSpotPoint)
> {
> WTCursorHandle retVal = 0;
>
> NSCursor* crsr = 0;
> wvFM::WCStPath imgPath;
> WTResType resType = "Crsr";
> wvRM::GetPathToActualFile (resContainerRef, resType, cursorID, imgPath);
>
> NSString* imgPathAsNSString = 0;
> imgPathAsNSString = [NSString stringWithFormat:@"%s", imgPath.GetNativePathString().c_str()];
>
> NSImage * img = [[NSImage alloc] :imgPathAsNSString];
> crsr = [[NSCursor alloc]initWithImage:img hotSpot:NSMakePoint(hotSpotPoint.m_x,hotSpotPoint.m_y)];
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden