org.eclipse.swt.graphics.Color.getRGB()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(7.3k)|赞(0)|评价(0)|浏览(147)

本文整理了Java中org.eclipse.swt.graphics.Color.getRGB()方法的一些代码示例,展示了Color.getRGB()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Color.getRGB()方法的具体详情如下:
包路径:org.eclipse.swt.graphics.Color
类名称:Color
方法名:getRGB

Color.getRGB介绍

[英]Returns an RGB representing the receiver.
[中]

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  ColorDialog cd = new ColorDialog( shell );
  cd.setText( BaseMessages.getString( PKG, "NotePadDialog.Font.Color.Dialog.Label" ) );
  cd.setRGB( wBorderColor.getBackground().getRGB() );
  RGB newColor = cd.open();
  if ( newColor == null ) {
   return;
  }
  borderColor.dispose();
  borderColor = new Color( shell.getDisplay(), newColor );
  wBorderColor.setBackground( borderColor );
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  ColorDialog cd = new ColorDialog( shell );
  cd.setText( BaseMessages.getString( PKG, "NotePadDialog.Font.Color.Dialog.Label" ) );
  cd.setRGB( wFontColor.getBackground().getRGB() );
  RGB newColor = cd.open();
  if ( newColor == null ) {
   return;
  }
  fontColor.dispose();
  fontColor = new Color( shell.getDisplay(), newColor );
  wFontColor.setBackground( fontColor );
  refreshTextNote();
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent e ) {
  ColorDialog cd = new ColorDialog( shell );
  cd.setText( BaseMessages.getString( PKG, "NotePadDialog.Font.Color.Dialog.Label" ) );
  cd.setRGB( wBackGroundColor.getBackground().getRGB() );
  RGB newColor = cd.open();
  if ( newColor == null ) {
   return;
  }
  bgColor.dispose();
  bgColor = new Color( shell.getDisplay(), newColor );
  wBackGroundColor.setBackground( bgColor );
  refreshTextNote();
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void getData() {
 fixedFontData = props.getFixedFont();
 fixedFont = new Font( display, fixedFontData );
 graphFontData = props.getGraphFont();
 graphFont = new Font( display, graphFontData );
 noteFontData = props.getNoteFont();
 noteFont = new Font( display, noteFontData );
 backgroundRGB = props.getBackgroundRGB();
 if ( backgroundRGB == null ) {
  backgroundRGB = display.getSystemColor( SWT.COLOR_WIDGET_BACKGROUND ).getRGB();
 }
 background = new Color( display, backgroundRGB );
 graphColorRGB = props.getGraphColorRGB();
 graphColor = new Color( display, graphColorRGB );
 tabColorRGB = props.getTabColorRGB();
 tabColor = new Color( display, tabColorRGB );
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.forms

AbstractImageDescriptor(Color[] colors, int length) {
  fRGBs = new RGB[colors.length];
  for (int i = 0; i < colors.length; i++) {
    Color color = colors[i];
    fRGBs[i] = color == null ? null : color.getRGB();
  }
  fLength = length;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.forms

AbstractImageDescriptor(Color[] colors, int length) {
  fRGBs = new RGB[colors.length];
  for (int i = 0; i < colors.length; i++) {
    Color color = colors[i];
    fRGBs[i] = color == null ? null : color.getRGB();
  }
  fLength = length;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

/**
 * Creates a new RGBColorDescriptor that describes an existing color.
 *
 * @since 3.1
 *
 * @param originalColor a color to describe
 */
public RGBColorDescriptor(Color originalColor) {
  this(originalColor.getRGB());
  this.originalColor = originalColor;
}

代码示例来源:origin: de.dentrassi.eclipse.neoscada.utils/org.eclipse.scada.ui.databinding

@Override
public Object convert ( final Object fromObject )
{
  return ( (Color)fromObject ).getRGB ();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface

/**
 * Creates a new RGBColorDescriptor that describes an existing color.
 *
 * @since 3.1
 *
 * @param originalColor a color to describe
 */
public RGBColorDescriptor(Color originalColor) {
  this(originalColor.getRGB());
  this.originalColor = originalColor;
}

代码示例来源:origin: org.eclipse.mylyn.wikitext/ui

public void startDocument() throws SAXException {
  ElementState elementState = state.push(new ElementState(null, "<document>", new FontState(), getOffset())); //$NON-NLS-1$
  elementState.fontState.foreground = defaultForeground == null ? null : defaultForeground.getRGB();
  elementState.fontState.background = defaultBackground == null ? null : defaultBackground.getRGB();
}

代码示例来源:origin: BiglySoftware/BiglyBT

@Override
  public void runSupport() {
    if (!colorDefault.isDisposed())
      AllocateColor.this.rgbDefault = colorDefault.getRGB();
    else
      AllocateColor.this.rgbDefault = new RGB(0, 0, 0);
  }
}, false);

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.forms

/**
 * Returns the RGB value of the system color represented by the code
 * argument, as defined in <code>SWT</code> class.
 *
 * @param code
 *            the system color constant as defined in <code>SWT</code>
 *            class.
 * @return the RGB value of the system color
 */
public RGB getSystemColor(int code) {
  return getDisplay().getSystemColor(code).getRGB();
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

private void initializeDefaultColors() {
   // TODO This is temporary.
   // These should be initialized by the workbench theme, but not yet.
   // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=133731
   Display display = Display.getCurrent();
   colorRegistry.put(JFacePreferences.CONTENT_ASSIST_BACKGROUND_COLOR,
       display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB());
   colorRegistry.put(JFacePreferences.CONTENT_ASSIST_FOREGROUND_COLOR,
       display.getSystemColor(SWT.COLOR_LIST_FOREGROUND).getRGB());
 }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.views.properties.tabbed

public void setWidgetNormalShadowColor(Color color) {
  widgetNormalShadow = color;
  RGB white = Display.getCurrent().getSystemColor(SWT.COLOR_WHITE).getRGB();
  navigationElementShadowStroke = factory.getColors().createColor("TabbedPropertyList.shadowStroke", //$NON-NLS-1$
      FormColors.blend(white, widgetNormalShadow.getRGB(), 55));
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

private void putColor(String property, RGB setting) {
  Color oldColor = fColorTable.get(property);
  if (oldColor != null) {
    if (oldColor.getRGB().equals(setting))
      return;
    oldColor.dispose();
  }
  fColorTable.put(property, new Color(Display.getCurrent(), setting));
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.jface.text

private void setStatusLabelColors(Color foreground, Color background) {
  if (foreground == null || background == null) return;
  if (fStatusLabelForeground != null) {
    fStatusLabelForeground.dispose();
  }
  fStatusLabelForeground = new Color(fStatusLabel.getDisplay(), Colors.blend(background.getRGB(), foreground.getRGB(), 0.56f));
  fStatusLabel.setForeground(fStatusLabelForeground);
  fStatusLabel.setBackground(background);
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
protected void setForeground(Color color) {
  getControl().setForeground(color);
  fForegroundColorRGB= color.getRGB();
  refresh();
}

代码示例来源:origin: com.github.rinde/rinsim-pdptw

static Image createNewTransparentImg(Display d, int w, int h) {
 final Color bg = d.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
 final PaletteData palette = new PaletteData(new RGB[] {bg.getRGB()});
 final ImageData sourceData = new ImageData(w, h, 1, palette);
 if (IS_MAC_OR_WINDOWS) {
  sourceData.transparentPixel = 0;
 }
 return new Image(d, sourceData);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.forms

private void createTwistieColors() {
  RGB rgb = getColor(IFormColors.TITLE).getRGB();
  RGB white = getSystemColor(SWT.COLOR_WHITE);
  createColor(TB_TOGGLE, rgb);
  rgb = blend(rgb, white, 60);
  createColor(TB_TOGGLE_HOVER, rgb);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.forms

/**
 * Allocates colors for the following keys: BORDER, SEPARATOR and
 * TITLE. Subclasses can override to allocate these colors differently.
 */
protected void initializeColorTable() {
  createTitleColor();
  createColor(IFormColors.SEPARATOR, getColor(IFormColors.TITLE).getRGB());
  RGB black = getSystemColor(SWT.COLOR_BLACK);
  RGB borderRGB = getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT);
  createColor(IFormColors.BORDER, blend(borderRGB, black, 80));
}

相关文章