Rotated display of bitmap images?
Rotated display of bitmap images?
- Subject: Rotated display of bitmap images?
- From: Dinu Gherman <email@hidden>
- Date: Mon, 17 Jun 2002 18:57:12 +0200 (CEST)
Hi again,
thanks Marco for this excellent classic trick! ;-) Now, I've
done a little bit more research and found mail threads about
displaying rotated image files in a view. I followed one ad-
vice saying to use drawAtPoint:fromRect:operation:fraction:
on the image, but at least in the code below everything else
(only a border) but not the image itself is rotated. And the
NSImage doc for the used method says:
[...] The composite is positioned and oriented according
to the current coordinate system. The image is rotated and
scaled as needed.
Slightly puzzled,
Dinu
#import "MyImageView.h"
@implementation MyImageView
-(void)drawRect:(NSRect)rect
{
NSPoint p = NSMakePoint(NSMinX(rect), NSMinY(rect));
NSString *imgPath = @"/Users/dinu/Desktop/foo.jpg";
NSImage *img = [[NSImage alloc] initByReferencingFile: imgPath];
[self setImageFrameStyle: NSImageFrameGrayBezel];
[self setImage: img];
[self setFrameRotation:10.0];
# draw a border
[[NSColor grayColor] set];
[NSBezierPath setDefaultLineWidth: 5];
[NSBezierPath strokeRect: rect];
[img drawAtPoint: p
fromRect: rect
operation: NSCompositeDestinationAtop
fraction: 1.0];
[super drawRect: rect];
}
@end
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.