I want to skew (correct me if this is not the right word) bitmap so that it looks like depth. A good way to visualize what I'm asking for is how Star Wars credits are angled to show depth.
I tried the following:
canvas.getMatrix().postSkew(kx,ky,px,py);
and
canvas.skew(sx,sy);
But I did not have much success. The above methods always convert the bitmap image to parallelogram. Is there a way to convert a bitmap to a trapezoid?
Here is a snippet of code that I took from the examples that Romain pointed out to me.
canvas.rotate(-mOrientation[0] + mHeading, mCenterX, mCenterY); camera.save(); if (mReverse) { camera.translate(0.0f, 0.0f, mDepthZ * interpolatedTime); } else { camera.translate(0.0f, 0.0f, mDepthZ * (1.0f - interpolatedTime)); } camera.rotateX(mOrientation[1]); camera.applyToCanvas(canvas); canvas.drawPath(mPath, mPaint); canvas.drawCircle(mCenterX, mCenterY, mRadius - 37, mPaint); camera.restore();
android bitmap canvas
mdupls
source share