org.eclipse.swt.graphics.RGB.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(105)

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

RGB.<init>介绍

[英]Constructs an instance of this class with the given hue, saturation, and brightness.
[中]使用给定的色调、饱和度和亮度构造此类的实例。

代码示例

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

public PaletteData getPaletteData() {
 switch ( getDepth() ) {
  case 1:
   palette = new PaletteData( new RGB[] { new RGB( 0, 0, 0 ), new RGB( 255, 255, 255 ) } );
   break;
  default:
   palette = new PaletteData( 0, 0, 0 );
   palette.isDirect = true;
   break;
 }
 return palette;
}

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

void initializeColors() {
 Display display = Display.getDefault();
 colors = new Color[] { new Color( display, new RGB( 0, 0, 0 ) ), // black
  new Color( display, new RGB( 63, 127, 95 ) ), // red
  new Color( display, new RGB( 0, 0, 192 ) ), // green
  new Color( display, new RGB( 127, 0, 85 ) ), // blue
  new Color( display, new RGB( 255, 102, 0 ) ) // Kettle Functions / Orange
 };
 tokenColors = new int[MAXIMUM_TOKEN];
 tokenColors[WORD] = 0;
 tokenColors[WHITE] = 0;
 tokenColors[KEY] = 3;
 tokenColors[COMMENT] = 1;
 tokenColors[STRING] = 2;
 tokenColors[OTHER] = 0;
 tokenColors[NUMBER] = 0;
 tokenColors[FUNCTIONS] = 4;
}

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

void initializeColors() {
 Display display = Display.getDefault();
 colors = new Color[] { new Color( display, new RGB( 0, 0, 0 ) ), // black
  new Color( display, new RGB( 255, 0, 0 ) ), // red
  new Color( display, new RGB( 63, 127, 95 ) ), // green
  new Color( display, new RGB( 0, 0, 255 ) ), // blue
  new Color( display, new RGB( 255, 0, 255 ) ) // SQL Functions / Rose
 };
 tokenColors = new int[MAXIMUM_TOKEN];
 tokenColors[WORD] = 0;
 tokenColors[WHITE] = 0;
 tokenColors[KEY] = 3;
 tokenColors[COMMENT] = 2;
 tokenColors[STRING] = 1;
 tokenColors[OTHER] = 0;
 tokenColors[NUMBER] = 0;
 tokenColors[VALUESNAME] = 4;
}

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

void initializeColors() {
 Display display = Display.getDefault();
 colors = new Color[] { new Color( display, new RGB( 0, 0, 0 ) ), // black
  new Color( display, new RGB( 255, 0, 0 ) ), // red
  new Color( display, new RGB( 63, 127, 95 ) ), // green
  new Color( display, new RGB( 0, 0, 255 ) ), // blue
  new Color( display, new RGB( 255, 0, 255 ) ) // SQL Functions / Rose
 };
 tokenColors = new int[MAXIMUM_TOKEN];
 tokenColors[WORD] = 0;
 tokenColors[WHITE] = 0;
 tokenColors[KEY] = 3;
 tokenColors[COMMENT] = 2;
 tokenColors[STRING] = 1;
 tokenColors[OTHER] = 0;
 tokenColors[NUMBER] = 0;
 tokenColors[FUNCTIONS] = 4;
}

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

public Color getColor( int red, int green, int blue ) {
 RGB rgb = new RGB( red, green, blue );
 Color color = colorMap.get( rgb );
 if ( color == null ) {
  color = new Color( display, rgb );
  colorMap.put( rgb, color );
 }
 return color;
}

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

private Color getColor( int r, int g, int b ) {
 Color color = new Color( PropsUI.getDisplay(), new RGB( r, g, b ) );
 int index = colors.indexOf( color );
 if ( index < 0 ) {
  colors.add( color );
 } else {
  color.dispose();
  color = colors.get( index );
 }
 return color;
}

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

private Color getColor( int r, int g, int b ) {
 Color color = new Color( PropsUI.getDisplay(), new RGB( r, g, b ) );
 int index = colors.indexOf( color );
 if ( index < 0 ) {
  colors.add( color );
 } else {
  color.dispose();
  color = colors.get( index );
 }
 return color;
}

代码示例来源:origin: caoxinyu/RedisClient

/**
 * Returns a {@link Color} given its red, green and blue component values.
 * 
 * @param r
 *            the red component of the color
 * @param g
 *            the green component of the color
 * @param b
 *            the blue component of the color
 * @return the {@link Color} matching the given red, green and blue component values
 */
public static Color getColor(int r, int g, int b) {
  return getColor(new RGB(r, g, b));
}
/**

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

public RGB getBackgroundRGB() {
 int r = Const.toInt( properties.getProperty( STRING_BACKGROUND_COLOR_R ), ConstUI.COLOR_BACKGROUND_RED ); // Defaut:
 int g = Const.toInt( properties.getProperty( STRING_BACKGROUND_COLOR_G ), ConstUI.COLOR_BACKGROUND_GREEN );
 int b = Const.toInt( properties.getProperty( STRING_BACKGROUND_COLOR_B ), ConstUI.COLOR_BACKGROUND_BLUE );
 return new RGB( r, g, b );
}

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

public RGB getTabColorRGB() {
 int r = Const.toInt( properties.getProperty( STRING_TAB_COLOR_R ), ConstUI.COLOR_TAB_RED ); // default White
 int g = Const.toInt( properties.getProperty( STRING_TAB_COLOR_G ), ConstUI.COLOR_TAB_GREEN );
 int b = Const.toInt( properties.getProperty( STRING_TAB_COLOR_B ), ConstUI.COLOR_TAB_BLUE );
 return new RGB( r, g, b );
}

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

public RGB getGraphColorRGB() {
 int r = Const.toInt( properties.getProperty( STRING_GRAPH_COLOR_R ), ConstUI.COLOR_GRAPH_RED ); // default White
 int g = Const.toInt( properties.getProperty( STRING_GRAPH_COLOR_G ), ConstUI.COLOR_GRAPH_GREEN );
 int b = Const.toInt( properties.getProperty( STRING_GRAPH_COLOR_B ), ConstUI.COLOR_GRAPH_BLUE );
 return new RGB( r, g, b );
}

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

/**
  * Converts BufferedImage to SWT/Image with alpha channel.
  */
 protected Image swing2swt( Device device, BufferedImage img ) {
  PaletteData palette = new PaletteData( 0xFF0000, 0xFF00, 0xFF );
  ImageData data = new ImageData( img.getWidth(), img.getHeight(), 32, palette );
  for ( int y = 0; y < data.height; y++ ) {
   for ( int x = 0; x < data.width; x++ ) {
    int rgba = img.getRGB( x, y );
    int rgb = palette.getPixel( new RGB( ( rgba >> 16 ) & 0xFF, ( rgba >> 8 ) & 0xFF, rgba & 0xFF ) );
    int a = ( rgba >> 24 ) & 0xFF;
    data.setPixel( x, y, rgb );
    data.setAlpha( x, y, a );
   }
  }
  return new Image( device, data );
 }
}

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

public void widgetSelected( SelectionEvent arg0 ) {
  tabColor.dispose();
  tabColorRGB = new RGB( ConstUI.COLOR_TAB_RED, ConstUI.COLOR_TAB_GREEN, ConstUI.COLOR_TAB_BLUE );
  tabColor = new Color( display, tabColorRGB );
  wTabColor.setBackground( tabColor );
  wTabColor.redraw();
 }
} );

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

public void widgetSelected( SelectionEvent arg0 ) {
  background.dispose();
  backgroundRGB =
   new RGB( ConstUI.COLOR_BACKGROUND_RED, ConstUI.COLOR_BACKGROUND_GREEN, ConstUI.COLOR_BACKGROUND_BLUE );
  background = new Color( display, backgroundRGB );
  wBGColor.setBackground( background );
  wBGColor.redraw();
 }
} );

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

public void widgetSelected( SelectionEvent arg0 ) {
  graphColor.dispose();
  graphColorRGB = new RGB( ConstUI.COLOR_GRAPH_RED, ConstUI.COLOR_GRAPH_GREEN, ConstUI.COLOR_GRAPH_BLUE );
  graphColor = new Color( display, graphColorRGB );
  wGrColor.setBackground( graphColor );
  wGrColor.redraw();
 }
} );

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

wFontItalic.setSelection( notePadMeta.isFontItalic() );
fontColor =
 new Color( shell.getDisplay(), new RGB(
  notePadMeta.getFontColorRed(), notePadMeta.getFontColorGreen(), notePadMeta.getFontColorBlue() ) );
bgColor =
 new Color( shell.getDisplay(), new RGB( notePadMeta.getBackGroundColorRed(), notePadMeta
  .getBackGroundColorGreen(), notePadMeta.getBackGroundColorBlue() ) );
borderColor =
 new Color( shell.getDisplay(), new RGB( notePadMeta.getBorderColorRed(), notePadMeta
  .getBorderColorGreen(), notePadMeta.getBorderColorBlue() ) );
wDrawShadow.setSelection( notePadMeta.isDrawShadow() );
fontColor =
 new Color(
  shell.getDisplay(), new RGB(
   NotePadMeta.COLOR_RGB_BLACK_RED, NotePadMeta.COLOR_RGB_BLACK_GREEN,
   NotePadMeta.COLOR_RGB_BLACK_BLUE ) );
bgColor =
 new Color( shell.getDisplay(), new RGB(
  NotePadMeta.COLOR_RGB_DEFAULT_BG_RED, NotePadMeta.COLOR_RGB_DEFAULT_BG_GREEN,
  NotePadMeta.COLOR_RGB_DEFAULT_BG_BLUE ) );
borderColor =
 new Color( shell.getDisplay(), new RGB(
  NotePadMeta.COLOR_RGB_DEFAULT_BORDER_RED, NotePadMeta.COLOR_RGB_DEFAULT_BORDER_GREEN,
  NotePadMeta.COLOR_RGB_DEFAULT_BORDER_BLUE ) );

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

for ( int x = 0; x < data.width; x++ ) {
  raster.getPixel( x, y, pixelArray );
  int pixel = palette.getPixel( new RGB( pixelArray[0], pixelArray[1], pixelArray[2] ) );
  data.setPixel( x, y, pixel );
  data.setAlpha( x, y, pixelArray[3] );
RGB[] rgbs = new RGB[size];
for ( int i = 0; i < rgbs.length; i++ ) {
 rgbs[i] = new RGB( reds[i] & 0xFF, greens[i] & 0xFF, blues[i] & 0xFF );

代码示例来源:origin: stackoverflow.com

folder.setSelectionBackground(new Color[]{new Color(display, new RGB(242, 244, 247)), new Color(display, new RGB(157, 167, 195))}, new int[]{100}, true);

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

ImageUtil.makeImageTransparent( display, loadAsResource( display, BasePropertyHandler
  .getProperty( "Banner_bg_image" ), 0 ), // , "ui/images/bg_banner.png"
 new RGB( 255, 255, 255 ) );

代码示例来源: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);

相关文章