使用Android畫布繪製命令:Android,線寬,像素尺寸
如果我設置stroke = 0或stroke = 1並繪製水平線,則線條像素爲兩個像素高。如果我設置stroke = 2,像素也是兩個像素高但更亮。
如果我繪製單個像素,像素是一個2x2矩陣,筆畫= 0或筆畫= 1。如果筆畫= 2,我也得到一個2x2矩陣,但有更明亮的像素。
我必須做些什麼來獲得只有一個像素高的線? 我必須做些什麼才能獲得只有一個像素的像素?
注意:正在使用的設備的屏幕尺寸爲480 x 800或更大。
Paint thePaint = new Paint();
thePaint.setARGB(a, r, g, b);
thePaint.setAntiAlias(true);
thePaint.setStyle(Paint.Style.FILL);
thePaint.setStrokeWidth(0);
canvas.drawLine(x1,y1,x2,y2, thePaint);
根據文檔,strokeWidth爲0應該是1像素,不管是什麼......您能否提供一些代碼來顯示您如何創建Paint對象以及如何繪製到Canvas? – 2012-07-24 01:26:59
已添加代碼。是的,這就是文檔所說的。這不是現實。 – Xarph 2012-07-24 03:09:59