[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Best way to draw image in menu title?
From: |
Vaisburd, Haim |
Subject: |
RE: Best way to draw image in menu title? |
Date: |
Thu, 4 Sep 2003 12:58:49 -0700 |
Adam Fedor <fedor@doc.com> wrote:
> Most likely if you just want to read an image from the disk and display
> it in a view, you use NSImage (which encapuslates NSBitmapImageRep and
> other representations). See
>
> -[NSImage compositeToPoint:operation:]
> to do this.
My humble experience shows that
-[NSImage compositeToPoint:operation:]
does not respect scaling and rotation of the affine transformation
(which is applied to the drawing context, if I get it right).
It respects only translation.
If you want to scale the image, you need NSImageRep:
NSAffineTransform * transform = ...; // get the transform somehow
[transform concat];
// Get NSImageRep of image
NSImageRep * rep = [image bestRepresentationForDevice: nil];
[rep drawAtPoint: NSZeroPoint];
Tima.