super(canvas);
this.layerId = layerId;
bounds = b;
layerAlpha = 1.0f;
visible = true;
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
int w = Math.max((int) b.width, 1);
int h = Math.max((int) b.height, 1);
if (ge.isHeadlessInstance()) {
img = new BufferedImage(w, h,
layerId.equals("backing") ? BufferedImage.TYPE_INT_RGB
: BufferedImage.TYPE_INT_ARGB);
} else {
GraphicsConfiguration gc = ge.getDefaultScreenDevice()
.getDefaultConfiguration();
// int imageType = layerId.equals("backing") && false ? BufferedImage.TYPE_INT_RGB : BufferedImage.TYPE_INT_ARGB;
// img = new BufferedImage((int)b.width, (int)b.height, imageType);
img = gc.createCompatibleImage(w, h,
layerId.equals("backing") ? Transparency.OPAQUE