Domanda

I m disegno in una bitmap come ..

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

Ora come impostare Anti-Aliasing prima di g.drawLine ()?

È stato utile?

Soluzione

Per l'uso in modalità antialiasing setDrawingStyle public void (int DrawStyle, boolean on)

Per le linee usano

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

Per usare poligoni

graphics.setDrawingStyle(Graphics.DRAWSTYLE_AAPOLYGONS, true);
graphics.drawRect(x, y, width, height);
graphics.setDrawingStyle(Graphics.DRAWSTYLE_AAPOLYGONS, false);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top