- Code: Select all
public int toRGB(final int bgra) {
final int alpha = (bgra & 0xff000000) >> 24;
final int blue = (bgra & 0x00ff0000) >> 16;
final int green = (bgra & 0x0000ff00) >> 8;
final int red = (bgra & 0x000000ff);
return (red * alpha / 255) << 16 | (green * alpha / 255) << 8 | (blue * alpha / 255);
}
(Used https://stackoverflow.com/questions/204 ... lor-to-rgb which considers the white background as a factor with the transparency).
I was wondering, however, if I could disable the alpha component completely (would there be a JCEF class, or a command-line switch that could disable the alpha channel?), since my program dithers these RGB values onto an image.