Changeset 21195
- Timestamp:
- 09/30/2007 08:15:45 PM (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Frameworks/AIUtilities Framework/Source/AIImageAdditions.h
r21148 r21195 51 51 - (NSImage *)imageByScalingForMenuItem; 52 52 - (NSImage *)imageByScalingToSize:(NSSize)size fraction:(float)delta flipImage:(BOOL)flipImage proportionally:(BOOL)proportionally allowAnimation:(BOOL)allowAnimation; 53 - (NSSize)sizeInPixels; 53 54 //+ (NSImage *)imageFromGWorld:(GWorldPtr)gWorldPtr; 54 55 - (NSRect)drawRoundedInRect:(NSRect)rect radius:(float)radius; trunk/Frameworks/AIUtilities Framework/Source/AIImageAdditions.m
r21148 r21195 407 407 } 408 408 409 - (NSSize)sizeInPixels 410 { 411 NSImageRep *rep = [self bestRepresentationForDevice:nil]; 412 return (NSSize){ [rep pixelsWide], [rep pixelsHigh] }; 413 } 414 409 415 //General purpose draw image rounded in a NSRect. 410 416 - (NSRect)drawRoundedInRect:(NSRect)rect radius:(float)radius … … 425 431 426 432 //We use our own size for drawing purposes no matter the passed size to avoid distorting the image via stretching 427 NSSize ownSize = [self size]; 433 //We use the size in pixels in order to ignore the resolution of the image. Otherwise, the image may come out larger or smaller than the target size. 434 NSSize ownSize = [self sizeInPixels]; 428 435 429 436 //If we're passed a 0,0 size, use the image's size for the area taken up by the image