什麼是轉換()功能在rectf。 roundOut(Rect dest)函數的確切功能是什麼。有沒有人可以用這個例子說明這個函數是如何工作的?什麼是Rectf roundout(Rect dest)功能?
0
A
回答
1
public void roundOut (Rect dst)
Added in API level 1
四捨五入「了」這個矩形,選擇 頂部的地板和左,右側和底部的上限設置DST整數矩形。
public static double floor (double d)
在API級別1
返回最積極的(最接近 正無窮大)的整數值小於或等於自變量的雙轉換。
特殊情況是:
floor(+0.0) = +0.0 floor(-0.0) = -0.0 floor(+infinity) = +infinity floor(-infinity) = -infinity floor(NaN) = NaN
public static double ceil (double d) 在API級別1
返回最負(最接近 負無窮大)的整數值大於或等於的雙變換到 的說法。
特殊情況是:
ceil(+0.0) = +0.0 ceil(-0.0) = -0.0 ceil((anything in range (-1,0)) = -0.0 ceil(+infinity) = +infinity ceil(-infinity) = -infinity ceil(NaN) = NaN
RectF rectF = new RectF(0.0f, 0.0f, 10.5f, 20.f);
Rect rect = new Rect();
rectF.roundOut(rect);// Now rect will contains these values Rect(0, 0, 11, 20)
//What happens inside roundOut function
Math.floor(0.0f);//Results 0
Math.floor(0.0f);//Results 0
Math.ceil(10.5f);//Results 10
Math.ceil(20.f);//Results 20
0
一個我發現同時搜索使用的是拉平(矩形)用於從RectF轉換爲矩形,使用。
rectF.roundOut(rect);
來源 - What is the best way to convert from a RectF to a Rect in Android?
1
rountRect
會給你一個Rect
對象。
所以
Rect rect = new Rect();
rectFObj.roundout(rect);
現在RECT包含RectF對象的所有值,但他們現在四捨五入意味着1.1變爲1
相關問題
- 1. 將Rect轉換爲RectF
- 2. Android SDK中的Rect和RectF
- 3. 在Android中將RectF轉換爲Rect的最佳方式是什麼?
- 4. 什麼是「Rect」類?
- 5. 如何將背景位圖設置爲rect或rectF?
- 6. 什麼是免費功能?
- 7. getEvdoDbm()的功能是什麼?
- 8. bios的功能是什麼?
- 9. bootstrap.cache.php的功能是什麼?
- 10. 「(ClassName *)」的功能是什麼
- 11. 什麼是Y功能?
- 12. !DOCTYPE的功能是什麼?
- 13. 什麼是OracleXEUniv.exe功能?
- 14. sudo的功能是什麼?
- 15. 什麼是阻塞功能?
- 16. 什麼是「頁面功能」?
- 17. I()的功能是什麼?
- 18. forkN的功能是什麼?
- 19. Python:什麼是`is`功能?
- 20. SOCK_STREAM的功能是什麼?
- 21. 是什麼功能NHibernate
- 22. BDD,什麼是功能?
- 23. 什麼是蹦牀功能?
- 24. 什麼是這個功能
- 25. 什麼是警報功能?
- 26. 什麼是asp.net vNext功能?
- 27. Android:ContentResolver.update()的功能是什麼?
- 28. 什麼是功能測試?
- 29. SetDefaultItem的功能是什麼?
- 30. Silverlight的功能是什麼?
將你的建議實現上述功能的示例代碼? – Strawberry
編輯答案。 – Triode
'rectF.roundOut(new Rect(0,0,30,35));'在此之後,rectf將如何改變? – Strawberry