2

我正在绘制一个位图,例如..

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

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

4

1 回答 1

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);
于 2009-08-30T06:53:29.067 回答