synchronized (semaphore) {
if (!pic.getErasePatch().isEmpty()) {
Bitmap trgBitmapPatched = new Bitmap(trgBitmapUnpatched);
int col = trgPal.getIndexOfMostTransparentPaletteEntry();
for (ErasePatch ep : pic.getErasePatch()) {
trgBitmapPatched.fillRectangularWithColorIndex(ep.x, ep.y, ep.width, ep.height, (byte)col);
}
return trgBitmapPatched.getImage(trgPal.getColorModel());
} else {
return trgBitmapUnpatched.getImage(trgPal.getColorModel());
}