如何在Blackberry Storm中设置抗锯齿功能?

时间:2009-08-29 04:15:02

标签: user-interface graphics blackberry blackberry-storm rim-4.7

我正在绘制像...这样的位图。

bitmap[i] = new Bitmap(60, 60);  
Graphics g = new Graphics(bitmap[i]);
g.setColor(Color.BLACK);
g.drawLine(....);

现在如何在g.drawLine()之前设置Anti-Aliasing?

1 个答案:

答案 0 :(得分:3)

对于抗锯齿模式,请使用public void setDrawingStyle(int drawStyle, boolean on)

对于线路使用

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);