Changeset 5375

Show
Ignore:
Timestamp:
03/13/08 18:22:29 (7 months ago)
Author:
morris
Message:

Add -imageBySuperimposingImage:

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • WiredAdditions/trunk/NSImage-WIAdditions.h

    r4438 r5375  
    3636- (NSImage *)mirroredImage; 
    3737- (NSImage *)scaledImageWithSize:(NSSize)size; 
     38- (NSImage *)imageBySuperimposingImage:(NSImage *)image; 
    3839 
    3940- (NSImage *)imageWithAffineTransform:(NSAffineTransform *)transform action:(SEL)action; 
  • WiredAdditions/trunk/NSImage-WIAdditions.m

    r4798 r5375  
    212212 
    213213 
     214- (NSImage *)imageBySuperimposingImage:(NSImage *)image { 
     215        NSImage                 *newImage; 
     216        NSSize                  size; 
     217 
     218        size = [self size]; 
     219        [image setSize:size]; 
     220         
     221        newImage = [[NSImage alloc] initWithSize:size]; 
     222        [newImage lockFocus]; 
     223 
     224        [self drawAtPoint:NSZeroPoint 
     225                         fromRect:NSMakeRect(0.0, 0.0, size.width, size.height) 
     226                        operation:NSCompositeSourceOver 
     227                         fraction:1.0]; 
     228 
     229        [image drawAtPoint:NSZeroPoint 
     230                         fromRect:NSMakeRect(0.0, 0.0, size.width, size.height) 
     231                        operation:NSCompositeSourceOver 
     232                         fraction:1.0]; 
     233 
     234        [newImage unlockFocus]; 
     235 
     236        return [newImage autorelease]; 
     237} 
     238 
     239 
     240 
    214241#pragma mark - 
    215242