如何在 Blackberry Storm 中设置抗锯齿?
-
20-09-2019 - |
题
我正在绘制位图,例如..
bitmap[i] = new Bitmap(60, 60);
Graphics g = new Graphics(bitmap[i]);
g.setColor(Color.BLACK);
g.drawLine(....);
现在如何在 g.drawLine() 之前设置抗锯齿功能?
解决方案
用于抗锯齿模式使用 公共无效setDrawingStyle(int drawStyle,布尔值)
对于线路使用
graphics.setDrawingStyle(Graphics.DRAWSTYLE_AALINES, true);
graphics.drawLine(x1, y1, x2, y2);
graphics.setDrawingStyle(Graphics.DRAWSTYLE_AALINES, false);
对于 poligons 使用
graphics.setDrawingStyle(Graphics.DRAWSTYLE_AAPOLYGONS, true);
graphics.drawRect(x, y, width, height);
graphics.setDrawingStyle(Graphics.DRAWSTYLE_AAPOLYGONS, false);
不隶属于 StackOverflow