protected void apply(
      ElementArea area,
      BufferedImage image,
      IntUnaryOperator convertor,
      BrushManager manager,
      int x,
      int y) {

    final int imgWidth = image.getWidth();
    final int imgHeight = image.getHeight();

    final int areaWidth = area.getWidth();
    final int areaHeight = area.getHeight();

    Inserter<?> inserter = area.getInserter();
    inserter.setEraseTemperature(false);

    for (int cX = x; cX < (x + imgWidth) && cX < areaWidth; cX++) {
      for (int cY = y; cY < (y + imgHeight) && cY < areaHeight; cY++) {

        if (cX < 0 || cY < 0) continue;

        final int id = ~image.getRGB(cX - x, cY - y);
        final Brush brush = manager.getBrush(convertor.applyAsInt(id));

        if (brush != null) {
          inserter.apply(cX, cY, brush);
        }
      }
    }
  }
  protected BufferedImage createImage(ElementArea area, BrushManager bm) {
    BufferedImage bufferedImage =
        new BufferedImage(area.getWidth(), area.getHeight(), BufferedImage.TYPE_INT_ARGB);

    area.forEach(
        (element, x, y) -> {
          int id = getID(element, bm, defaultBrushID);
          bufferedImage.setRGB(x, y, ~id);
        });

    return bufferedImage;
  }