IndexColorModel getColorModel(int transparentColor) {
            if (cm != null) {
                if (transparentColor != cm.getTransparentPixel()) {
                    return cm = null; // Force default ARGB color model
                }
                return cm;
            } else
                if (completed && size > 0) {
                    if (transparentColor == IMPOSSIBLE_VALUE) {
                        return cm =
                                new IndexColorModel(8, size, colors, 0, false);
                    }

                    if (transparentColor > size) {
                        size = transparentColor + 1;
                    }
                    return cm =
                            new IndexColorModel(8, size, colors, 0, false, transparentColor);
                }

            return cm = null; // Force default ARGB color model
        }