public void setProducers(List<Object> producers) {
this.producers = producers;
}
private BufferedImage crateImage(String str) {
Builder captcha = new Captcha.Builder(width, height);
if (this.wordRenderer == null) {
captcha.addText(new CapTextProducer(str));
} else {
captcha.addText(new CapTextProducer(str), this.wordRenderer);
}
if (producers != null && !producers.isEmpty()) {
for (Object producer : producers) {
if (producer instanceof BackgroundProducer) {
captcha.addBackground((BackgroundProducer) producer);
} else if (producer instanceof GimpyRenderer) {
captcha.gimp((GimpyRenderer) producer);
} else if (producer instanceof NoiseProducer) {
captcha.addNoise((NoiseProducer) producer);
}
}
}
if (isBorder()) {
captcha.addBorder();
}
return captcha.build().getImage();
}