macOS 12.5

I create an image like:

NSImage *subImage = [ [NSImage alloc] initWithSize: subRect.size ];
[ subImage lockFocus ];
[ self.image    drawAtPoint:    NSMakePoint(0, 0)  
                                fromRect:               subRect  
                                operation:              
NSCompositingOperationCopy  
                                fraction:               1 
];    
[ subImage unlockFocus ];

My NSImageView has no problem showing subImage. So far so good.

But now I try to write it like:
NSArray *representations = subImage.representations;    //      contains 1 rep
NSBitmapImageRep *oneRep = representations.firstObject; 

The problem is: oneRep is an NSCGImageSnapshotRep, which does NOT understand 
        [ NSBitmapImageRep  representationUsingType:properties: ].
(It crashes with a message to this effect).

So: how can I provide my subImage with a nice and valid NSBitmapImageRep?

Btw.: subImage.TIFFRepresentation does work, but I am not really interested in 
Tiff.

Gerriet.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to