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 int getID(Element element, BrushManager brushManager, int def) { Brush producer = brushManager.getProducerAll(element); return (producer == null) ? def : producer.getInfo().getId(); }