Skip to content

Instantly share code, notes, and snippets.

@jfahrenkrug
Created March 23, 2010 15:44
Show Gist options
  • Save jfahrenkrug/341309 to your computer and use it in GitHub Desktop.
Save jfahrenkrug/341309 to your computer and use it in GitHub Desktop.
- (void)scaleImage:(float)aScaleFactor
{
//see: http://maettig.com/code/css/css-transform.html
var styleObject = [imageView imageLayer]._DOMContentsElement.style;
if (CPBrowserIsEngine(CPWebKitBrowserEngine) && (typeof styleObject.WebkitTransform != "undefined"))
{
styleObject.WebkitTransform = "scale(" + aScaleFactor + ")";
[[imageView imageLayer] setNeedsDisplay];
}
else if (CPBrowserIsEngine(CPGeckoBrowserEngine) && (typeof styleObject.MozTransform != "undefined"))
{
styleObject.MozTransform = "scale(" + aScaleFactor + ")";
[[imageView imageLayer] setNeedsDisplay];
}
/*
else if (CPBrowserIsEngine(CPOperaBrowserEngine))
{
//transformName = '-o-transform';
}
*/
else
{
var myTransform = CGAffineTransformScale(CGAffineTransformMakeRotation(0), aScaleFactor, aScaleFactor);
[[imageView imageLayer] setAffineTransform:myTransform];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment