// Paint image
gc.drawImage(ctx.getImage(), 0, 0);
int numberOfMaskObjects = ctx.getSegmentationMasks().size();
- // Paint all masks skipping the enabled mask.
+ // Paint all masks and its borders skipping the enabled mask.
if(numberOfMaskObjects > 0)
{
// For drawing all the disabled masks.
gc.drawImage(maskBorderImage, 0, 0);
}
}
- }
- // Painting the enabled mask.
- if(numberOfMaskObjects > 0)
- {
- // For drawing all the previous masks.
+
+ // For drawing the enabled mask and its border..
for(SegmentationMask segmentMask : ctx.getSegmentationMasks())
{
// Blending of background pixel values while pasting the last mask only
gc.drawImage(maskImage, 0, 0);
createVisibleMaskBorder(ctx.getMask());
gc.drawImage(maskBorderImage, 0, 0);
+
}
// Very initial mask, which has not yet been turned into an object.
else
switch (mask.values[i]) {
case SegmentationMask.BACKGROUND:
alpha = enabled ? (byte) 128 : (byte) 0;
- index = 2;
+ index = 0;
break;
case SegmentationMask.FOREGROUND:
alpha = (byte) 128;
- index = 1;
+ index = (byte) ((i%3)+1);
break;
default:
alpha = 0;
maskBorderData.setPixels(0, mask.height-1, buff.length, buff, 0);
}
- // Create new mask
+ // Create new maskBorder
maskBorderImage = new Image(Display.getCurrent(), maskBorderData);
}
private static ImageData createMaskData(Rectangle bounds) {
RGB[] colors = new RGB[] {
- new RGB(128,128,128),
- //new RGB(255,255,255),
- new RGB(255,180,180),
- new RGB(0, 0, 0)
+ new RGB(0, 0, 0),
+ new RGB(255,180,180),
+ new RGB(180,255,180),
+ new RGB(180,180,255)
};
// Create 3 color indexed palette