我是靠谱客的博主 无语宝马,最近开发中收集的这篇文章主要介绍android 图片3d,android图片3D倾斜。如图,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

Bitmap    bit=Reflect3DImage.skewImage(bit, 50);

package com.maxway.util;

import android.graphics.Bitmap;

import android.graphics.Bitmap.Config;

import android.graphics.Camera;

import android.graphics.Canvas;

import android.graphics.LinearGradient;

import android.graphics.Matrix;

import android.graphics.Paint;

import android.graphics.PorterDuff;

import android.graphics.PorterDuff.Mode;

import android.graphics.PorterDuffXfermode;

import android.graphics.Shader;

import android.graphics.Shader.TileMode;

public class Reflect3DImage

{

public static Bitmap createReflectedImage(Bitmap paramBitmap, int paramInt)

{

int i = paramBitmap.getWidth();

int j = paramBitmap.getHeight();

Matrix localMatrix = new Matrix();

localMatrix.preScale(1.0F, -1.0F);

Bitmap localBitmap1 = Bitmap.createBitmap(paramBitmap, 0, j - paramInt, i, paramInt, localMatrix, false);

Bitmap localBitmap2 = Bitmap.createBitmap(i, j + paramInt, Bitmap.Config.ARGB_8888);

Canvas localCanvas = new Canvas(localBitmap2);

Paint localPaint1 = new Paint();

localCanvas.drawBitmap(paramBitmap, 0.0F, 0.0F, localPaint1);

localCanvas.drawBitmap(localBitmap1, 0.0F, j, localPaint1);

Paint localPaint2 = new Paint();

localPaint2.setShader(new LinearGradient(0.0F, paramBitmap.getHeight(), 0.0F, localBitmap2.getHeight(), 1895825407, 16777215, Shader.TileMode.MIRROR));

localPaint2.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));

localCanvas.drawRect(0.0F, j, i, localBitmap2.getHeight(), localPaint2);

localBitmap1.recycle();

return localBitmap2;

}

public static Bitmap skewImage(Bitmap paramBitmap, int paramInt)

{

Bitmap localBitmap1 = createReflectedImage(paramBitmap, paramInt);

Camera localCamera = new Camera();

localCamera.save();

Matrix localMatrix = new Matrix();

localCamera.rotateY(15.0F);

localCamera.getMatrix(localMatrix);

localCamera.restore();

localMatrix.preTranslate(-localBitmap1.getWidth() >> 1, -localBitmap1.getHeight() >> 1);

Bitmap localBitmap2 = Bitmap.createBitmap(localBitmap1, 0, 0, localBitmap1.getWidth(), localBitmap1.getHeight(), localMatrix, true);

Bitmap localBitmap3 = Bitmap.createBitmap(localBitmap2.getWidth(), localBitmap2.getHeight(), Bitmap.Config.ARGB_8888);

Canvas localCanvas = new Canvas(localBitmap3);

Paint localPaint = new Paint();

localPaint.setAntiAlias(true);

localPaint.setFilterBitmap(true);

localCanvas.drawBitmap(localBitmap2, 0.0F, 0.0F, localPaint);

localBitmap2.recycle();

return localBitmap3;

}

}

最后

以上就是无语宝马为你收集整理的android 图片3d,android图片3D倾斜。如图的全部内容,希望文章能够帮你解决android 图片3d,android图片3D倾斜。如图所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(78)

评论列表共有 0 条评论

立即
投稿
返回
顶部