views:

90

answers:

1

Since I cannot pre-render all the images in PNGs and real-time image transformation functions are required, namely:

  • skew
  • perspective

(like the transform action found in Photoshop)

Which API (CoreAnimation? OpenGL ES?) should I look into? Even better, is there any sample code around? Thanks!

+1  A: 

For skew/shear you can use:

CGAffineTransform CGAffineTransformMakeShear( CGFloat inX , CGFloat inY ) {
    return CGAffineTransformMake( 1 , inY , inX , 1 , 0 , 0 );
}

For perspective, a 2D affine transform is insufficient. You can apply a 3D affine transform to a layer and get the results that perspective is trying to emulate.

myView.layer.transform = CATransform3DMakeRotation( ... );
drawnonward