本文整理了Java中org.eclipse.swt.graphics.RGB
类的一些代码示例,展示了RGB
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RGB
类的具体详情如下:
包路径:org.eclipse.swt.graphics.RGB
类名称:RGB
[英]Instances of this class are descriptions of colors in terms of the primary additive color model (red, green and blue). A color may be described in terms of the relative intensities of these three primary colors. The brightness of each color is specified by a value in the range 0 to 255, where 0 indicates no color (blackness) and 255 indicates maximum intensity.
The hashCode() method in this class uses the values of the public fields to compute the hash value. When storing instances of the class in hashed collections, do not modify these fields after the object has been inserted.
Application code does not need to explicitly release the resources managed by each instance when those instances are no longer required, and thus no dispose()
method is provided.
[中]此类的实例是根据主添加颜色模型(红色、绿色和蓝色)对颜色的描述。颜色可以用这三种原色的相对强度来描述。每种颜色的亮度由0到255之间的值指定,其中0表示无颜色(黑色),255表示最大强度。
此类中的hashCode()方法使用公共字段的值来计算哈希值。在散列集合中存储类的实例时,不要在插入对象后修改这些字段。
当不再需要每个实例时,应用程序代码不需要显式释放这些实例管理的资源,因此不提供dispose()
方法。
代码示例来源: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: org.microemu/microemu-javase-swt
public RGB filterRGB (int x, int y, RGB rgb)
{
int Y = (int)(Yr * rgb.red + Yg * rgb.green + Yb * rgb.blue) % 256;
if (Y > 255) {
Y = 255;
}
return new RGB(
(int) (Rr * Y) + foregroundColor.getRed(),
(int) (Rg * Y) + foregroundColor.getGreen(),
(int) (Rb * Y) + foregroundColor.getBlue());
}
代码示例来源: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: 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.ui.cheatsheets
private void computeReverseVideoColors(Display display) {
Color background = toolkit.getColors().getBackground();
RGB white = new RGB(255, 255, 255);
// Create new colors, they will get disposed
RGB rgb = background.getRGB();
activeColor = new Color(display, rgb );
rgb = FormColors.blend(rgb, white, 85);
inactiveColor1 = new Color(display, rgb);
rgb = FormColors.blend(rgb, white, 85);
inactiveColor2 = new Color(display, rgb );
introColor = new Color(display, rgb );
}
代码示例来源: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: BiglySoftware/BiglyBT
private boolean setForeground(final RGB rgb) {
Color colorFG = getForeground();
boolean changed = colorFG == null || colorFG.isDisposed()
|| !colorFG.getRGB().equals(rgb);
if (changed) {
Utils.execSWTThread(new AERunnable() {
@Override
public void runSupport() {
setForeground(ColorCache.getColor(Display.getCurrent(), rgb));
}
});
}
return changed;
}
代码示例来源:origin: ajermakovics/eclipse-instasearch
public ResultLabelProvider(ResultContentProvider contentProvider) {
Color searchColor = JFaceResources.getColorRegistry().get(ECLIPSE_SEARCH_UI_MATCH_HIGHLIGHT);
JFaceResources.getColorRegistry().put(HIGHLIGHT_COLOR_NAME, (searchColor!=null?searchColor.getRGB():new RGB(206, 204, 247)));
this.labelProvider = new WorkbenchLabelProvider();
this.highlightStyle = StyledString.createColorRegistryStyler(null, HIGHLIGHT_COLOR_NAME);
this.contentProvider = contentProvider;
this.matchImage = InstaSearchUI.getSharedImage(IMG_OBJ_TEXT_SEARCH_LINE);
imageRegistry.put(DOWN_ARROW_IMG_KEY, InstaSearchPlugin.getImageDescriptor(DOWN_ARROW_IMG_KEY));
this.showMatchCount = InstaSearchPlugin.getBoolPref(PreferenceConstants.P_SHOW_MATCH_COUNT);
this.showFullPath = InstaSearchPlugin.getBoolPref(PreferenceConstants.P_SHOW_FULL_PATH);
InstaSearchPlugin.addPreferenceChangeListener(this);
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86
/**
* Returns an <code>RGB</code> representing the receiver.
*
* @return the RGB for the color
*
* @exception SWTException <ul>
* <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
* </ul>
*/
public RGB getRGB () {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
return new RGB(handle & 0xFF, (handle & 0xFF00) >> 8, (handle & 0xFF0000) >> 16);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
@Override
public RGB createColor() {
RGB rgb = ColorUtil.getColorValue(color);
float scale = Float.parseFloat(scaleFactor);
float[] hsb = rgb.getHSB();
float b = hsb[2] * scale;
if (b < 0)
b = 0;
if (b > 1)
b = 1;
return new RGB(hsb[0], hsb[1], b);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.compare
private void checkForColorUpdate(Display display) {
if (fIsUsingSystemBackground) {
RGB bg= display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB();
if (!bg.equals(getBackground(display))) {
updateColors(display);
}
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.compare
public boolean setColor(RGB color) {
RGB oldColor= fIndicatorColor;
fIndicatorColor= color;
if (color == null)
return oldColor != null;
if (oldColor != null)
return !color.equals(oldColor);
return true;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.forms
@Override
public int hashCode() {
int hash = 0;
for (RGB fRGB : fRGBs)
hash = hash * 7 + fRGB.hashCode();
hash = hash * 7 + fLength;
return hash;
}
}
代码示例来源: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: org.eclipse.swt.cocoa.macosx/x86_64
/**
* Returns an <code>RGB</code> representing the receiver.
*
* @return the RGB for the color
*
* @exception SWTException <ul>
* <li>ERROR_GRAPHIC_DISPOSED - if the receiver has been disposed</li>
* </ul>
*/
public RGB getRGB () {
if (isDisposed()) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
return new RGB(getRed(), getGreen(), getBlue());
}
代码示例来源: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: BiglySoftware/BiglyBT
private boolean setForeground(final RGB rgb) {
Color colorFG = getForegroundSWT();
boolean changed = colorFG == null || colorFG.isDisposed()
|| !colorFG.getRGB().equals(rgb);
if (changed) {
Utils.execSWTThread(new SWTRunnable() {
@Override
public void runWithDisplay(Display display) {
setForeground(ColorCache.getColor(Display.getCurrent(), rgb));
}
});
}
return changed;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
@Override
public boolean equals(Object obj) {
if (obj instanceof RGBColorDescriptor) {
RGBColorDescriptor other = (RGBColorDescriptor) obj;
return other.color.equals(color) && other.originalColor == originalColor;
}
return false;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.forms
@Override
public int hashCode() {
int hash = 0;
for (RGB fRGB : fRGBs)
hash = hash * 7 + fRGB.hashCode();
hash = hash * 7 + fLength;
return hash;
}
}
内容来源于网络,如有侵权,请联系作者删除!