本文整理了Java中android.graphics.Bitmap.getScaledHeight()
方法的一些代码示例,展示了Bitmap.getScaledHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Bitmap.getScaledHeight()
方法的具体详情如下:
包路径:android.graphics.Bitmap
类名称:Bitmap
方法名:getScaledHeight
暂无
代码示例来源:origin: guolindev/giffun
GlideBitmapDrawable(Resources res, BitmapState state) {
if (state == null) {
throw new NullPointerException("BitmapState must not be null");
}
this.state = state;
final int targetDensity;
if (res != null) {
final int density = res.getDisplayMetrics().densityDpi;
targetDensity = density == 0 ? DisplayMetrics.DENSITY_DEFAULT : density;
state.targetDensity = targetDensity;
} else {
targetDensity = state.targetDensity;
}
width = state.bitmap.getScaledWidth(targetDensity);
height = state.bitmap.getScaledHeight(targetDensity);
}
代码示例来源:origin: stackoverflow.com
int xdpi, ydpi;
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
Bitmap bmp = BitmapFactory.decodeResources(getResources(), R.drawable.my_bitmap);
xdpi = bmp.getScaledWidth(metrics);
ydpi = bmp.getScaledHeight(metrics);
代码示例来源:origin: kingargyle/adt-leanback-support
private void computeBitmapSize() {
mBitmapWidth = mBitmap.getScaledWidth(mTargetDensity);
mBitmapHeight = mBitmap.getScaledHeight(mTargetDensity);
}
代码示例来源:origin: sealtalk/sealtalk-android
public SelectableRoundedCornerDrawable(Bitmap bitmap, Resources r) {
mBitmap = bitmap;
mBitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
if (bitmap != null) {
mBitmapWidth = bitmap.getScaledWidth(r.getDisplayMetrics());
mBitmapHeight = bitmap.getScaledHeight(r.getDisplayMetrics());
} else {
mBitmapWidth = mBitmapHeight = -1;
}
mBitmapRect.set(0, 0, mBitmapWidth, mBitmapHeight);
mBitmapPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mBitmapPaint.setStyle(Paint.Style.FILL);
mBitmapPaint.setShader(mBitmapShader);
mBorderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mBorderPaint.setStyle(Paint.Style.STROKE);
mBorderPaint.setColor(mBorderColor.getColorForState(getState(), DEFAULT_BORDER_COLOR));
mBorderPaint.setStrokeWidth(mBorderWidth);
}
代码示例来源:origin: GuoFeilong/BehivorDemo
public SelectableRoundedCornerDrawable(Bitmap bitmap, Resources r) {
mBitmap = bitmap;
mBitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
if (bitmap != null) {
mBitmapWidth = bitmap.getScaledWidth(r.getDisplayMetrics());
mBitmapHeight = bitmap.getScaledHeight(r.getDisplayMetrics());
} else {
mBitmapWidth = mBitmapHeight = -1;
}
mBitmapRect.set(0, 0, mBitmapWidth, mBitmapHeight);
mBitmapPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mBitmapPaint.setStyle(Paint.Style.FILL);
mBitmapPaint.setShader(mBitmapShader);
mBorderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mBorderPaint.setStyle(Paint.Style.STROKE);
mBorderPaint.setColor(mBorderColor.getColorForState(getState(), DEFAULT_BORDER_COLOR));
mBorderPaint.setStrokeWidth(mBorderWidth);
}
代码示例来源:origin: THEONE10211024/ApiDemos
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
final DisplayMetrics metrics = getResources().getDisplayMetrics();
setMeasuredDimension(
mBitmap.getScaledWidth(metrics),
mBitmap.getScaledHeight(metrics));
}
代码示例来源:origin: stackoverflow.com
playLeft = (this.getWidth()-bmpPlay.getScaledWidth(canvas))/2;
playRight = playLeft + bmpPlay.getScaledWidth(canvas);
playTop = (this.getHeight()-bmpPlay.getScaledHeight(canvas))/2;
playBottom = playTop+bmpPlay.getScaledHeight(canvas);
代码示例来源:origin: qiubiteme/android_api_demos
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
final DisplayMetrics metrics = getResources().getDisplayMetrics();
setMeasuredDimension(
mBitmap.getScaledWidth(metrics),
mBitmap.getScaledHeight(metrics));
}
代码示例来源:origin: stackoverflow.com
playLeft = (this.getWidth()-bmpPlay.getScaledWidth(canvas))/2;
playRight = playLeft + bmpPlay.getScaledWidth(canvas);
playTop = (this.getHeight()-bmpPlay.getScaledHeight(canvas))/2;
playBottom = playTop+bmpPlay.getScaledHeight(canvas);
代码示例来源:origin: kalaspuffar/secure-quick-reliable-login
int bitmapHeight = bitmap.getScaledHeight(canvas);
内容来源于网络,如有侵权,请联系作者删除!