How to draw a bitmap to another, but into a given quadrilateral (not necessary a rectangle)?

后端 未结 3 490
小鲜肉
小鲜肉 2020-12-22 04:25

Suppose I have 2 bitmaps. One is smallBitmap, and one is largeBitmap.

I want to draw the entire smallBitmap into largeBitmap, but only to a part of largeBitmap, and

3条回答
  •  [愿得一人]
    2020-12-22 05:02

    to skew a bitmap,probably Matrix can be handy.

       /*use values accordingly*/
       Matrix matrix = new Matrix();
       matrix.postScale(curScale, curScale);  
       matrix.postRotate(curRotate);
       matrix.postSkew(curSkewX, curSkewY);
    
       Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bmpWidth, bmpHeight, matrix, true);
       myImageView.setImageBitmap(resizedBitmap);
    

提交回复
热议问题