Tell me how you can make a partial redraw canvas. When the invalidate () method is called, the entire canvas will be redrawn, but how to make exactly the drawing to the existing one?
I need to repaint some hexagons on the drawn hexagonal grid, and I would not like to draw the whole grid again.
for (Hexagon hexagon: hexagonalGrid.getHexagons()) drawPoly(canvas, convertToPointsArr(hexagon.getPoints(), array), "#FF5346", Style.STROKE); private void drawPoly(Canvas canvas, int[] array, String color, Style style) { Paint p = new Paint(); p.setColor(Color.parseColor(color)); p.setStyle(style); if (width > 15) p.setStrokeWidth(2); else if (width > 30) p.setStrokeWidth(1); else p.setStrokeWidth(5); Path polyPath = new Path(); polyPath.moveTo(array[0], array[1]); for (int i = 0; i < 12; i = i + 2) polyPath.lineTo(array[i], array[i + 1]); polyPath.lineTo(array[0], array[1]); canvas.drawPath(polyPath, p); }