[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools] Re: Trying to make a simple image....


There is an easier way to get the pixel value for a direct palette:

        PaletteData palette = new PaletteData(0xFF, 0xFF00, 0xFF0000);
        RGB rgb = display.getSystemColor(SWT.COLOR_YELLOW).getRGB();
       int
pixel = palette.getPixel(rgb);

This method can also be used when you define your own palette as in the second example I posted above:

        RGB red = new RGB(255, 0, 0);
     RGB green =
new RGB(0, 255, 0);
     RGB blue =
new RGB(0, 0, 255);
     PaletteData palette =
new PaletteData(new RGB[]{red, green, blue});
        int pixel = palette.getPixel(red);