}
}
private void addCompositeImage(Resource resource, BufferedImage image, ImageSettings imageSettings,
boolean alternate) {
CompositeBitmap compositeBitmap = CompositeBitmap.create(image, imageSettings.getBitDepth());
if (compositeBitmap.getRows() == 1) {
ImageRecord imageRecord = resource.createImageRecord(compositeBitmap.getBitmapAt(0, 0), alternate);
pluckerDocument.addRecord(imageRecord);
} else {
String[] segmentURIs = new String[compositeBitmap.getRows()];
String uri = (resource.isRedirected() ? resource.getRedirectionURI() : resource.getURI());
if (alternate) {
uri += ".alternate";
}
for (int i = 0, n = compositeBitmap.getRows(); i < n; i++) {
segmentURIs[i] = uri + "-" + (i + 1);
pluckerDocument.addRecord(new ImageRecord(segmentURIs[i], compositeBitmap.getBitmapAt(i, 0)));
}
CompositeImageRecord imageRecord = resource.createCompositeImageRecord(segmentURIs, 1, alternate);
pluckerDocument.addRecord(imageRecord);
}