private BitmapShader updateShaderMatrix(BitmapShader shader) {
float scale;
float dx = 0;
float dy = 0;
calculateBounds();
Matrix shaderMatrix = new Matrix();
shaderMatrix.set(null);
if (mBitmapWidth * mBoundsRect.height() > mBitmapHeight * mBoundsRect.width()) {
scale = mBoundsRect.height() / (float) mBitmapHeight;
dx = (mBoundsRect.width() - mBitmapWidth * scale) * 0.5f;
} else {
scale = mBoundsRect.width() / (float) mBitmapWidth;
dy = (mBoundsRect.height() - mBitmapHeight * scale) * 0.5f;
}
shaderMatrix.setScale(scale, scale);
shaderMatrix.postTranslate((int)(dx + 0.5f) + mBoundsRect.left, (int)(dy + 0.5f) + mBoundsRect.top);
shader.setLocalMatrix(shaderMatrix);
return shader;
}
CircularImageView.java 文件源码
java
阅读 32
收藏 0
点赞 0
评论 0
项目:wg_planer
作者:
评论列表
文章目录