cocoaTouch/otherSrc/UIImageScale.m
author smxx
Fri, 16 Apr 2010 12:38:31 +0000 (2010-04-16)
changeset 3344 b18a166e6ca4
parent 3325 652a8ebdf667
permissions -rw-r--r--
Frontend: * Added missing default binds for alternative camera movement (Numpad 2, 4, 6 and 8) * Added new hedgehog structure to teams and added loading/saving of basic stats * Added loading/saving of local achievements to teams (wip; might change/get dropped)
//
//  UIImageScale.m
//  HedgewarsMobile
//
//  Created by Vittorio on 08/04/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "UIImageScale.h"


@implementation UIImage (scale)
 
-(UIImage*)scaleToSize:(CGSize)size
{
  // Create a bitmap graphics context
  // This will also set it as the current context
  UIGraphicsBeginImageContext(size);
 
  // Draw the scaled image in the current context
  [self drawInRect:CGRectMake(0, 0, size.width, size.height)];
 
  // Create a new image from current context
  UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext();
 
  // Pop the current context from the stack
  UIGraphicsEndImageContext();
 
  // Return our new scaled image
  return scaledImage;
}
 
@end