android中matrix的单位,Android中canvas和matrix之间的关系是什么?
我讀了這個畫布概述:
The Canvas class holds the “draw” calls. To draw something, you need 4
basic components: A Bitmap to hold the pixels, a Canvas to host the
draw calls (writing into the bitmap), a drawing primitive (e.g. Rect,
Path, text, Bitmap), and a paint (to describe the colors and styles
for the drawing).
任何人都可以更清楚地解釋畫布嗎?
我對畫布和矩陣之間的關系感到困惑.畫布是否從矩陣中獲取變換?
我想知道下面的功能是否會影響畫布?
canvas.drawBitmap(bitmap, matrix, paint);
換句話說,畫布矩陣是否與位圖矩陣不同?
我問這個,因為當我使用canvas.drawBitmap然后使用canvas.concat()然后繪制任何對象時,此對象在畫布上進行相同的轉換,所以我認為畫布和位圖具有相同的矩陣!
解決方法:
它們是不同的.當使用畫布繪制提供矩陣的位圖時,在內部,提供的矩陣連接到當前畫布矩陣.
換句話說,調用canvas.drawBitmap(rectBitmap,matrix,paint);具有相同的效果:
canvas.save();
canvas.concat(matrix);
canvas.drawBitmap(rectBitmap, 0, 0, paint);
canvas.restore();
這解釋了為什么你的對象正在進行相同的轉換,因為你正在調用canvas.concat(matrix);然后繪制對象.
標簽:android,bitmap,canvas,matrix,concat
來源: https://codeday.me/bug/20190609/1206444.html
總結
以上是生活随笔為你收集整理的android中matrix的单位,Android中canvas和matrix之间的关系是什么?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 威联通装linux百度网盘,威联通NAS
- 下一篇: android studio常用适配器,