@Property(description = "Merge mode", editorClass = ModeEditor.class)
private Mode mode = Mode.HORIZONTAL;
@Override
protected void performImageTransformation(WFImage pImg) {
SimpleImage img = (SimpleImage) pImg;
int width1 = pImg.getImageWidth();
int height1 = pImg.getImageHeight();
int width2 = image2.getImage().getImageWidth();
int height2 = image2.getImage().getImageHeight();
int bgWidth, bgHeight;
if (this.mode == Mode.HORIZONTAL) {
bgWidth = width1 + width2;
bgHeight = (height1 > height2) ? height1 : height2;
}
else {
bgWidth = (width1 > width2) ? width1 : width2;
bgHeight = height1 + height2;
}
SimpleImage bgImg = new SimpleImage(bgWidth, bgHeight);
if (this.mode == Mode.HORIZONTAL) {
{
ComposeTransformer cT = new ComposeTransformer();
cT.setForegroundImage(img);
cT.setHAlign(ComposeTransformer.HAlignment.OFF);
cT.setLeft(0);
cT.setVAlign(ComposeTransformer.VAlignment.CENTRE);
cT.transformImage(bgImg);
}
{
ComposeTransformer cT = new ComposeTransformer();
cT.setForegroundImage(image2.getImage());
cT.setHAlign(ComposeTransformer.HAlignment.OFF);
cT.setLeft(width1);
cT.setVAlign(ComposeTransformer.VAlignment.CENTRE);
cT.transformImage(bgImg);
}
}
else {
{
ComposeTransformer cT = new ComposeTransformer();
cT.setForegroundImage(img);
cT.setHAlign(ComposeTransformer.HAlignment.CENTRE);
cT.setVAlign(ComposeTransformer.VAlignment.OFF);
cT.setTop(0);
cT.transformImage(bgImg);
}
{
ComposeTransformer cT = new ComposeTransformer();
cT.setForegroundImage(image2.getImage());
cT.setHAlign(ComposeTransformer.HAlignment.CENTRE);
cT.setVAlign(ComposeTransformer.VAlignment.OFF);
cT.setTop(height1);
cT.transformImage(bgImg);
}
}
img.setBufferedImage(bgImg.getBufferedImg(), bgWidth, bgHeight);
}