Pergunta

Estou desenhando um bitmap como ..

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

Agora, como definir anti-aliasing antes de G.Drawline ()?

Foi útil?

Solução

Para uso do modo antialiasing Public void setDrawingStyle (int stytyle, boolean ON)

Para uso de linhas

graphics.setDrawingStyle(Graphics.DRAWSTYLE_AALINES, true);
graphics.drawLine(x1, y1, x2, y2);
graphics.setDrawingStyle(Graphics.DRAWSTYLE_AALINES, false);

Para uso de poligons

graphics.setDrawingStyle(Graphics.DRAWSTYLE_AAPOLYGONS, true);
graphics.drawRect(x, y, width, height);
graphics.setDrawingStyle(Graphics.DRAWSTYLE_AAPOLYGONS, false);
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top