当前位置: 首页>>代码示例>>Java>>正文


Java Bitmap.getScaledHeight方法代码示例

本文整理汇总了Java中android.graphics.Bitmap.getScaledHeight方法的典型用法代码示例。如果您正苦于以下问题:Java Bitmap.getScaledHeight方法的具体用法?Java Bitmap.getScaledHeight怎么用?Java Bitmap.getScaledHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.Bitmap的用法示例。


在下文中一共展示了Bitmap.getScaledHeight方法的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);
}
 
开发者ID:MobClub,项目名称:BBSSDK-for-Android,代码行数:23,代码来源:SelectableRoundedImageView.java

示例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);
}
 
开发者ID:PacktPublishing,项目名称:Expert-Android-Programming,代码行数:23,代码来源:SelectableRoundedImageView.java

示例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);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:SelectableRoundedImageView.java

示例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);
}
 
开发者ID:sciage,项目名称:FinalProject,代码行数:14,代码来源:RoundedImageView.java


注:本文中的android.graphics.Bitmap.getScaledHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。