NSImage and NSAffineTransform Trouble!
NSImage and NSAffineTransform Trouble!
- Subject: NSImage and NSAffineTransform Trouble!
- From: John Devor <email@hidden>
- Date: Fri, 25 Jul 2003 22:07:05 -0400
Hi,
Basically, here's my problem: in the following code, I'm trying to get
one image rotated 3 times (not including the image's original
orientation) and set it in the frames of 4 NSImageViews. But, nothing
seems to be rotating. The images will draw fine (in the four corners),
but the NSAffineTransform isn't working properly. If anyone could help
I'd be most grateful.
BTW, if you can't tell from the code, I'm trying to create a window
with rounded corners (like the finder's volume up/down). If something
like this already exists, please point me in the right direction.
Thanks.
Anyways, here's the code:
- (void)drawRect:(NSRect)rect {
int i = 1;
if ((isGray) && (!isLocked)) {
// create the corners
while ( i <= 4) { // four corners...
NSAffineTransform *transform = [NSAffineTransform
transform];
NSRect imageRect;
float degrees = 0;
[transform rotateByDegrees:degrees];
[transform concat];
switch (i) {
case 1:
imageRect = [tLeft frame]; // tLeft, tRight, bLeft,
and bRight are ImageViews set in IB
break;
case 2:
imageRect = [tRight frame];
break;
case 3:
imageRect = [bRight frame];
break;
case 4:
imageRect = [bLeft frame];
break;
}
[[NSImage imageNamed:@"RoundedCorner"] drawInRect:imageRect
fromRect:NSZeroRect operation:NSCompositeCopy fraction:.5];
degrees = degrees + 90;
i++;
}
// create the rest of the background (removed for now)
//[[NSColor colorWithCalibratedWhite:0.3 alpha:0.2] set];
//NSRectFill(rect);
}
}
_______________________________________________
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.