• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Rotated display of bitmap images?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Rotated display of bitmap images?
      • From: Andreas Mayer <email@hidden>
  • Prev by Date: Re: deleting outline rows using a delegate
  • Next by Date: Re: [OT] Icons
  • Previous by thread: Re: Unwanted transparency in custom view
  • Next by thread: Re: Rotated display of bitmap images?
  • Index(es):
    • Date
    • Thread