Per altre informazioni scrivi a fabriziocaldarelli@negusweb.it
Ridimensionare una UIImage
Da Programmazione Software.
Vengono passati come parametri l'immagine di partenza ed il fattore di scala. L'immagine risultante è in autorelease, quindi non va rilasciata.
- (UIImage*)imageScale:(UIImage *)imageToScale factor:(CGFloat)factor;
{CGSize size = CGSizeMake( imageToScale.size.width*factor, imageToScale.size.height*factor );
// Create a bitmap graphics context// This will also set it as the current contextUIGraphicsBeginImageContext(size);
// Draw the scaled image in the current context[imageToScale drawInRect:CGRectMake(0, 0, size.width, size.height)];
// Create a new image from current contextUIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext();
// Pop the current context from the stackUIGraphicsEndImageContext();
return scaledImage;}

