//
//  ImageHelper.m
//  ipbc-Client
//
//  Created by Gerrit Linnemann on 31.10.13.
//  Copyright (c) 2013 Adawim UG (haftungsbeschränkt). All rights reserved.
//

#import "ImageHelper.h"

@implementation ImageHelper

+(NSImage*)resizeImage:(NSImage*)sourceImage size:(NSSize)size {
    NSRect targetFrame = NSMakeRect(0, 0, size.width, size.height);
    NSImage* targetImage = nil;
    NSImageRep *sourceImageRep =
    [sourceImage bestRepresentationForRect:targetFrame
                                   context:nil
                                     hints:nil];
    
    targetImage = [[NSImage alloc] initWithSize:size];
    
    [targetImage lockFocus];
    [sourceImageRep drawInRect: targetFrame];
    [targetImage unlockFocus];
    
    return targetImage;
}

@end
