• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: Adding text to NSImage using lockFocus/unlockFocus not working
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Adding text to NSImage using lockFocus/unlockFocus not working


  • Subject: RE: Adding text to NSImage using lockFocus/unlockFocus not working
  • From: "Ashish Tiwari" <email@hidden>
  • Date: Wed, 25 Feb 2009 13:28:34 +0530

I am sorry for typo, actually only images are shown *without titles. I want
to see image as well as their title.
Mean while I added your imageAttributes in IKBrowserItem.m with no luck.

I put various NSLog and looked in console to find out that
imageTitle, imageSubtitle, imageAttributes are not getting called. Just
imageUID, imageRepresentation and imageRepresentationType methods are being
called.
Is this correct behavior.

Ashish

-----Original Message-----
From: Graham Cox


On 25/02/2009, at 4:04 PM, email@hidden wrote:

>
> Hi Graham,
>
> I tried what you have suggested still only images are shown with
> titles.


I'm not clear what the problem is - what did you expect to see?

> - (NSString*)	imageSubtitle
> {
> 	NSDictionary* attribs = [image imageAttributes];
>
> 	int w, h;
>
> 	w = [[attribs objectForKey:@"PixelWidth"] intValue];
> 	h = [[attribs objectForKey:@"PixelHeight"] intValue];
>
> return [NSString stringWithFormat:@"%d x %d", w, h];
> }


This won't work - NSImage doesn't have a method called -
imageAttributes. In my code the attributes are retrieved using [self
imageAttributes], and that method looks like this:

- (NSDictionary*)	imageAttributes
{
	// returns the image's attributes dictionary using CGImageSource to

read the file's header. This is fast as the image
	// itself isn't loaded.

	NSURL*		  url = [NSURL fileURLWithPath:mPath];
	CGImageSourceRef  srcRef = CGImageSourceCreateWithURL((CFURLRef)
url,
NULL );
	NSDictionary*	  imgProps = (NSDictionary*)
CGImageSourceCopyPropertiesAtIndex( srcRef, 0, NULL);

	CFRelease(srcRef);

	//NSLog(@"attributes for '%@': %@", mPath, imgProps );

	return [imgProps autorelease];
}


I suspect your method is asserting when it's called due to the
unimplemented method and that is stopping the browser view working
properly. Check your console output.



--Graham



_______________________________________________

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

References: 
 >Adding text to NSImage using lockFocus/unlockFocus not working (From: "Ashish Tiwari" <email@hidden>)
 >Re: Adding text to NSImage using lockFocus/unlockFocus not working (From: Graham Cox <email@hidden>)
 >Re: Adding text to NSImage using lockFocus/unlockFocus not working (From: email@hidden)
 >Re: Adding text to NSImage using lockFocus/unlockFocus not working (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: NSWindowController, bindings and Garbage Collection
  • Next by Date: {Solved]: Adding text to NSImage using lockFocus/unlockFocus not working
  • Previous by thread: Re: Adding text to NSImage using lockFocus/unlockFocus not working
  • Next by thread: Re: Adding text to NSImage using lockFocus/unlockFocus not working
  • Index(es):
    • Date
    • Thread