• 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
Limit on CGImageDestination?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Limit on CGImageDestination?


  • Subject: Limit on CGImageDestination?
  • From: John Brownie <email@hidden>
  • Date: Wed, 28 May 2014 13:25:40 +1000

I'm trying to capture the icon information for the current keyboard input source, using the following code:

IconRef keyboardIcon = TISGetInputSourceProperty(currentInputSource, kTISPropertyIconRef);
        if (keyboardIcon != NULL) {
NSImage *iconImage = [[NSImage alloc] initWithIconRef:keyboardIcon];
            NSArray *iconImageReps = [iconImage representations];
            NSInteger iconImageCount = [iconImageReps count];
            iconData = [NSMutableData data];
CGImageDestinationRef imageDestination = CGImageDestinationCreateWithData((__bridge CFMutableDataRef)iconData, kUTTypeAppleICNS, iconImageCount, nil);
            for (NSImageRep *imageRep in iconImageReps) {
                NSSize imageSize = [imageRep size];
NSRect imageRect = NSMakeRect(0, 0, imageSize.width, imageSize.height); CGImageRef imageRef = [imageRep CGImageForProposedRect:&imageRect context:nil hints:nil]; CGImageDestinationAddImage(imageDestination, imageRef, nil);
            }
            CGImageDestinationFinalize(imageDestination);
            CFRelease(imageDestination);
        }

However, I'm getting 15 images in the iconImageReps array, and CGImageDestinationCreateWithData complains that an internal routine can only handle 10 images. I suspect I haven't seen this before as this is the first time I've run the code on a retina display Mac.

Should I be trying an alternate strategy? If so, what?

John
--
John Brownie, email@hidden or email@hidden
Summer Institute of Linguistics      | Mussau-Emira language, Mussau Is.
Ukarumpa, Eastern Highlands Province | New Ireland Province
Papua New Guinea                     | Papua New Guinea
_______________________________________________

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


  • Prev by Date: Re: Black treatment showing when an iOS 7 only application is in the background
  • Next by Date: Insetting a UIWebView while a keyboard is on screen
  • Previous by thread: Re: Black treatment showing when an iOS 7 only application is in the background
  • Next by thread: Insetting a UIWebView while a keyboard is on screen
  • Index(es):
    • Date
    • Thread