Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.RGB


  public static int withoutAlpha(int c){
    return c & 0xffffff;
  }

  public static RGB toRGB(int c) {
    return new RGB(getRed(c), getGreen(c), getBlue(c));
  }
View Full Code Here


                cmodel.getPixelSize(), palette);
            for (int y = 0; y < data.height; y++) {
                for (int x = 0; x < data.width; x++) {
                    int rgb = image.getRGB(x, y);
                    int pixel = palette.getPixel(
                        new RGB((rgb >> 16) & 0xFF, (rgb >> 8) & 0xFF, rgb & 0xFF));
                    data.setPixel(x, y, pixel);
                    if (cmodel.hasAlpha()) data.setAlpha(x, y, (rgb >> 24) & 0xFF);
                }
            }
            return data;

        } else if (image.getColorModel() instanceof IndexColorModel) {
            IndexColorModel cmodel = (IndexColorModel)image.getColorModel();
            int size = cmodel.getMapSize();
            byte[] reds = new byte[size];
            byte[] greens = new byte[size];
            byte[] blues = new byte[size];
            cmodel.getReds(reds);
            cmodel.getGreens(greens);
            cmodel.getBlues(blues);
            RGB[] rgbs = new RGB[size];
            for (int ii = 0; ii < rgbs.length; ii++) {
                rgbs[ii] = new RGB(reds[ii] & 0xFF, greens[ii] & 0xFF, blues[ii] & 0xFF);
            }
            PaletteData palette = new PaletteData(rgbs);
            ImageData data = new ImageData(
                image.getWidth(), image.getHeight(), cmodel.getPixelSize(), palette);
            data.transparentPixel = cmodel.getTransparentPixel();
View Full Code Here

  public RubyStepSyntaxHighlighter() {

    // -- the colors to use --
    Display display = Display.getDefault();
    colors = new Color[] {
        new Color(display, new RGB(0, 0, 0)),     // black
        new Color(display, new RGB(63, 127, 95)),   // Greenish
        new Color(display, new RGB(0, 0, 192)),   // Blue
        new Color(display, new RGB(127, 0, 85)),   // -- not used --
        new Color(display, new RGB(255, 102, 0)),   // Orange 
        new Color(display, new RGB(225, 0, 0)),   // Red
        new Color(display, new RGB(0, 128, 0)),   // Green
        new Color(display, new RGB(128, 128, 128))   // Gray
    };
   
    styles = new StyleRange[] {
      new StyleRange(0, 0, null, null, SWT.NORMAL),
      new StyleRange(0, 0, colors[COLOR_RED], null, SWT.NORMAL),
View Full Code Here

  private Pattern pErrorChar = Pattern.compile("^(\\s+)\\^", Pattern.MULTILINE);
 
  public RubyStepParseErrorHelper(RubyVersion version){
   
    Display display = Display.getDefault();
    errorLineColor = new Color(display, new RGB(255,220,220));
    container = RubyStepFactory.createScriptingContainer(false, version);

    // do not litter the console with potential parse errors
    container.setError(new PrintStream(new NullOutputStream()));
    container.setOutput(new PrintStream(new NullOutputStream()));
View Full Code Here

       
        @Override
        public String isValid(Object value) {
            Control cn = editor.getControl();
            TableViewer tw = tableViewer;
            Color red = new Color(Display.getCurrent(), new RGB(255, 100, 100));
            cn.setBackground(red);
            return null;
        }
View Full Code Here

    acceptor.acceptDefaultHighlighting(REGEX_ID, "Regular expression", regexTextStyle());   
  }
 
  public TextStyle regexTextStyle() {
    TextStyle textStyle = defaultTextStyle().copy();
    textStyle.setColor(new RGB(42, 0, 255));
    return textStyle;
  }
View Full Code Here

  /**
   * @param store
   */
  public static void initHtmlEditorPrefStore(IPreferenceStore store) {
    PreferenceConverter.setDefault(store, ACTION_COLOR, new RGB(255, 0, 192));
    PreferenceConverter.setDefault(store, DEFAULT_COLOR, new RGB(0, 0, 0));
    PreferenceConverter.setDefault(store, DOCTYPE_COLOR, new RGB(127, 127, 127));
    PreferenceConverter.setDefault(store, EXPR_COLOR, new RGB(255, 144, 0));
    PreferenceConverter.setDefault(store, HTML_COLOR, new RGB(0, 0, 0));
    PreferenceConverter.setDefault(store, KEYWORD_COLOR, new RGB(0, 0, 0));
    PreferenceConverter.setDefault(store, SKIPPED_COLOR, new RGB(90, 90, 90));
    PreferenceConverter.setDefault(store, HTML_TAG_COLOR, new RGB(129, 0, 153));
    PreferenceConverter.setDefault(store, STRING_COLOR, new RGB(5, 152, 220));
    PreferenceConverter.setDefault(store, JAVA_LINE_COLOR, new RGB(33, 33, 180));
    store.setDefault(MISSING_ACTION, "error");
    store.setDefault(SOFT_TABS, false);
    store.setDefault(SOFT_TABS_WIDTH, 4);
  }
View Full Code Here

  /**
   * @param store
   */
  public static void initRoutePrefStore(IPreferenceStore store) {
    PreferenceConverter.setDefault(store, ACTION_COLOR, new RGB(200, 0, 0));
    PreferenceConverter.setDefault(store, KEYWORD_COLOR, new RGB(0, 200, 0));
    PreferenceConverter.setDefault(store, URL_COLOR, new RGB(0, 0, 200));
    PreferenceConverter.setDefault(store, COMMENT_COLOR, new RGB(90, 90, 90));
    PreferenceConverter.setDefault(store, DEFAULT_COLOR, new RGB(0, 0, 0));
    store.setDefault(MISSING_ROUTE, "error");
    store.setDefault(SOFT_TABS, false);
    store.setDefault(SOFT_TABS_WIDTH, 4);
  }
View Full Code Here

  /**
   * @param store
   */
  public static void initConfPrefStore(IPreferenceStore store) {
    PreferenceConverter.setDefault(store, COMMENT_COLOR, new RGB(90, 90, 90));
    PreferenceConverter.setDefault(store, KEY_COLOR, new RGB(150, 0, 0));
    PreferenceConverter.setDefault(store, DEFAULT_COLOR, new RGB(0, 0, 0));
    store.setDefault(SOFT_TABS, false);
    store.setDefault(SOFT_TABS_WIDTH, 4);
  }
View Full Code Here

    acceptor.acceptDefaultHighlighting(INVALID_TOKEN_ID, "Invalid Symbol", errorTextStyle());
  }
 
  public TextStyle optionTextStyle() {
    TextStyle textStyle = defaultTextStyle().copy();
    textStyle.setColor(new RGB(125, 125, 125));
    return textStyle;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.swt.graphics.RGB

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.