The extent rect is correct, I've double checked that.
Looking at the docs for NSImageRep's drawAtPoint and drawInRect
methods, it looks like they only allow you to draw the whole image
rep, not a rect within the rep.
I think the problem might be that the cropping is working fine, it's
just that I'm not viewing the result correctly, if I print out the
description of the result's representations array, I get this:
NSCachedImageRep 0x1f6b30 Size={101, 120}
ColorSpace=NSCalibratedRGBColorSpace BPS=8 Pixels=101x120 Alpha=YES
So, perhaps the TIFFRepresention method of the NSImage doesn't
actually return the pixels? Perhaps?
Cheers
Dan
On 21 Apr 2008, at 13:41, Graham Cox wrote:
Hard to tell from the code posted. Maybe extent is incorrect?
You can just draw the source imageRep directly - you don't have to
wrap it in an image, and given that you just want a straight copy
it'll be simpler too. Use [imageRep drawAtPoint:...] This may not
have a bearing on your problem but the simpler the code, the easier
to debug :)
Having different colourspaces shouldn't matter - the drawing
operation will convert the image as necessary.
G.
On 21 Apr 2008, at 10:23 pm, Daniel Thorpe wrote:
Thanks Graham, I've just tried NSCompositeCopy, still doesn't work,
no change...
One thing that I've noticed though, is that the source is a
grayscale image, but the image that I'm creating is RGB. Should I
perhaps be creating a new bitmap image rep in the target (of the
same colorSpace) before calling the compositeToPoint method?
Cheers
Dan
On 21 Apr 2008, at 12:57, Graham Cox wrote:
Oops, I meant NSCompositeCopy
g.
On 21 Apr 2008, at 9:55 pm, Graham Cox wrote:
On 21 Apr 2008, at 9:43 pm, Daniel Thorpe wrote:
[source compositeToPoint:NSZeroPoint fromRect:extent
operation:NSCompositeSourceIn fraction:1.0];
Try using NSCompositeSourceCopy here instead.
G.
_______________________________________________
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:
http://lists.apple.com/mailman/options/cocoa-dev/graham.cox%40bigpond.com
This email sent to [EMAIL PROTECTED]
_______________________________________________
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [EMAIL PROTECTED]