您好,登錄后才能下訂單哦!
Drawable newDrawable = getResources().getDrawable(mImageIds[newState])
.mutate();
Drawable oldDrawable = getResources().getDrawable(mImageIds[oldState])
.mutate();
Bitmap bitmap = null;
bitmap = Bitmap.createBitmap(width, bitmapHeight,
Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
newDrawable.setBounds(0, 0, newDrawable.getIntrinsicWidth(),
newDrawable.getIntrinsicHeight());
oldDrawable.setBounds(0, oldBitmapOffset,
oldDrawable.getIntrinsicWidth(),
oldDrawable.getIntrinsicHeight() + oldBitmapOffset);
//canvas.rotate(orientation+180, width / 2, width / 2);
//canvas.translate(-oldBitmapOffset, 0);
newDrawable.draw(canvas);
oldDrawable.draw(canvas);
canvas看作畫布,Drawable看作圖畫,bitmap看作能顯示這幅畫的畫框大小
canvas旋轉平移后,坐標原點也會隨之改變。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。