Reputation: 115
As the title says I wonder how I can make my images to perspective view. Here's an image showing how they manage to do this in photoshop:
http://netlumination.com/blog/creating-perspective-and-a-mirror-image-in-photoshop
Is it possible to do something like this in android?
Upvotes: 3
Views: 3247
Reputation: 2452
This works pretty well for me, for values of rotation between 0 and 60:
Matrix imageMatrix = new Matrix();
float[] srcPoints = {
0, 0,
0, 200,
200, 200,
200, 0};
float[] destPoints = {
rotation, rotation/2f,
rotation, 200 - rotation/2f,
200 - rotation, 200,
200 - rotation, 0};
imageMatrix.setPolyToPoly(srcPoints, 0, destPoints, 0, 4);
Upvotes: 0
Reputation: 1933
Yes.
Have a look at this page http://www.inter-fuser.com/2009/12/android-reflections-with-bitmaps.html. You can then apply an AffineTransform (at least in AWT, but Android should have something similar, too) using a matrix to distort/skew the image.
Edit: see http://www.jhlabs.com/ip/filters/index.html for an implementation of a PerspectiveFilter.
Note that you could probably also use openGL to achieve a similar effect. See http://developer.android.com/reference/android/opengl/GLU.html and http://developer.android.com/reference/android/opengl/GLSurfaceView.html
Upvotes: 1