本文整理汇总了Java中android.graphics.Bitmap.getScaledWidth方法的典型用法代码示例。如果您正苦于以下问题:Java Bitmap.getScaledWidth方法的具体用法?Java Bitmap.getScaledWidth怎么用?Java Bitmap.getScaledWidth使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.Bitmap
的用法示例。
在下文中一共展示了Bitmap.getScaledWidth方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SelectableRoundedCornerDrawable
import android.graphics.Bitmap; //导入方法依赖的package包/类
public SelectableRoundedCornerDrawable(Bitmap bitmap, Resources r) {
mbBitmap = bitmap;
mmBitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
if (bitmap != null) {
mmBitmapWidth = bitmap.getScaledWidth(r.getDisplayMetrics());
mmBitmapHeight = bitmap.getScaledHeight(r.getDisplayMetrics());
} else {
mmBitmapWidth = mmBitmapHeight = -1;
}
mmBitmapRect.set(0, 0, mmBitmapWidth, mmBitmapHeight);
mmBitmapPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mmBitmapPaint.setStyle(Paint.Style.FILL);
mmBitmapPaint.setShader(mmBitmapShader);
mmBorderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mmBorderPaint.setStyle(Paint.Style.STROKE);
mmBorderPaint.setColor(mmBorderColor.getColorForState(getState(), DEFAULT_BORDER_COLOR));
mmBorderPaint.setStrokeWidth(mmBorderWidth);
}
示例2: SelectableRoundedCornerDrawable
import android.graphics.Bitmap; //导入方法依赖的package包/类
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);
}
示例3: SelectableRoundedCornerDrawable
import android.graphics.Bitmap; //导入方法依赖的package包/类
public SelectableRoundedCornerDrawable(Bitmap bitmap, Resources r) {
this.mBitmap = bitmap;
this.mBitmapShader = new BitmapShader(bitmap, TileMode.CLAMP, TileMode.CLAMP);
if (bitmap != null) {
this.mBitmapWidth = bitmap.getScaledWidth(r.getDisplayMetrics());
this.mBitmapHeight = bitmap.getScaledHeight(r.getDisplayMetrics());
} else {
this.mBitmapHeight = -1;
this.mBitmapWidth = -1;
}
this.mBitmapRect.set(0.0f, 0.0f, (float) this.mBitmapWidth, (float) this.mBitmapHeight);
this.mBitmapPaint = new Paint(1);
this.mBitmapPaint.setStyle(Style.FILL);
this.mBitmapPaint.setShader(this.mBitmapShader);
this.mBorderPaint = new Paint(1);
this.mBorderPaint.setStyle(Style.STROKE);
this.mBorderPaint.setColor(this.mBorderColor.getColorForState(getState(), -16777216));
this.mBorderPaint.setStrokeWidth(this.mBorderWidth);
}
示例4: RoundedCornerDrawable
import android.graphics.Bitmap; //导入方法依赖的package包/类
RoundedCornerDrawable(Bitmap bitmap, Resources r) {
mBitmap = bitmap;
mBitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
mBitmapWidth = bitmap.getScaledWidth(r.getDisplayMetrics());
mBitmapHeight = bitmap.getScaledHeight(r.getDisplayMetrics());
mBitmapRect.set(0, 0, mBitmapWidth, mBitmapHeight);
mBitmapPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mBitmapPaint.setStyle(Paint.Style.FILL);
mBitmapPaint.setShader(mBitmapShader);
}