MagnifierView.java 文件源码

java
阅读 37 收藏 0 点赞 0 评论 0

项目:AndroidDigIn 作者:
public MagnifierView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        bitmap = ((BitmapDrawable) getResources().getDrawable(R.drawable.pic)).getBitmap();
        scaledBitmap = Bitmap.createScaledBitmap(bitmap, bitmap.getWidth() * FACTOR, bitmap.getHeight() * FACTOR,
                true);
//        bitmap.recycle();
        mBitmapShader = new BitmapShader(scaledBitmap,
                Shader.TileMode.CLAMP,
                Shader.TileMode.CLAMP);
        mShapeDrawable = new ShapeDrawable(new OvalShape());
        mShapeDrawable.setBounds(0, 0, WIDTH, WIDTH);
        mShapeDrawable.getPaint().setShader(mBitmapShader);
        mMatrix = new Matrix();
        mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
        mPaint.setColor(Color.RED);
        mPaint.setStyle(Paint.Style.STROKE);
        mPaint.setStrokeWidth(3);
    }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号