Limit on CGImageDestination?
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