本文整理汇总了Java中org.eclipse.swt.graphics.RGB类的典型用法代码示例。如果您正苦于以下问题:Java RGB类的具体用法?Java RGB怎么用?Java RGB使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RGB类属于org.eclipse.swt.graphics包,在下文中一共展示了RGB类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: eSet
import org.eclipse.swt.graphics.RGB; //导入依赖的package包/类
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet ( int featureID, Object newValue )
{
switch ( featureID )
{
case ChartPackage.AXIS__LABEL:
setLabel ( (String)newValue );
return;
case ChartPackage.AXIS__TEXT_PADDING:
setTextPadding ( (Integer)newValue );
return;
case ChartPackage.AXIS__COLOR:
setColor ( (RGB)newValue );
return;
case ChartPackage.AXIS__LABEL_VISIBLE:
setLabelVisible ( (Boolean)newValue );
return;
case ChartPackage.AXIS__FORMAT:
setFormat ( (String)newValue );
return;
}
super.eSet ( featureID, newValue );
}
示例2: encontraPixel
import org.eclipse.swt.graphics.RGB; //导入依赖的package包/类
private RGB encontraPixel(int x, int y, int indice) {
labelPosicaoCor.setText(x + "," + y);
ImageData imageData = null;
PaletteData paletteData = null;
if (indice == 1 && imagem1 != null) {
imageData = imagem1.getImageData();
paletteData = imageData.palette;
} else if (indice == 2 && imagem2 != null) {
imageData = imagem2.getImageData();
paletteData = imageData.palette;
} else if (indice == 3 && imagem3 != null) {
imageData = imagem3.getImageData();
paletteData = imageData.palette;
}
if (paletteData != null && x > -1 && y > -1) {
int pixel = imageData.getPixel(x, y);
RGB rgb = paletteData.getRGB(pixel);
return rgb;
}
return null;
}
示例3: resetBorderColorStyle
import org.eclipse.swt.graphics.RGB; //导入依赖的package包/类
/**
* Set the border color format Node
* @param DNodeContainer currentNode
* @param Color
* @return
*/
public static boolean resetBorderColorStyle(AbstractDNode currentNode, RGB color) {
if ((currentNode != null) && (color != null)) {
Style style = getCurrentStyle(currentNode);
if (style instanceof BorderedStyle) {
BorderedStyle bStyle = (BorderedStyle) style;
RGBValues vColor = convertRGBtoRGBValues(color);
if (!isSameColor(vColor, bStyle.getBorderColor())) {
bStyle.setBorderColor(vColor);
ShapeUtil.removeCustomisation(style, new EStructuralFeature[] { DiagramPackage.Literals.BORDERED_STYLE__BORDER_COLOR });
getStyleHelper(currentNode).refreshStyle(style);
return true;
}
}
}
return false;
}
示例4: allocateColorWarning
import org.eclipse.swt.graphics.RGB; //导入依赖的package包/类
private void allocateColorWarning() {
if (display == null || display.isDisposed())
return;
Utils.execSWTThread(new AERunnable() {
@Override
public void runSupport() {
Color colorTables = Colors.getSystemColor(display, SWT.COLOR_LIST_BACKGROUND);
HSLColor hslBG = new HSLColor();
hslBG.initHSLbyRGB(colorTables.getRed(), colorTables.getGreen(),
colorTables.getBlue());
int lum = hslBG.getLuminence();
HSLColor hslColor = new HSLColor();
hslColor.initRGBbyHSL(25, 200, 128 + (lum < 160 ? 10 : -10));
colorWarning = new AllocateColor("warning", new RGB(hslColor.getRed(),
hslColor.getGreen(), hslColor.getBlue()), colorWarning).getColor();
}
}, false);
}
示例5: setRowColors
import org.eclipse.swt.graphics.RGB; //导入依赖的package包/类
public boolean setRowColors(RGB c[]) {
SWTAsync.assertGUI();
boolean needRefresh = false;
if (tableColors != null && tableColors.length != c.length) {
for (Color tableColor : tableColors) {
tableColor.dispose();
}
tableColors = null;
}
if (tableColors == null) {
tableColors = new Color[c.length];
}
for (int x = 0; x < tableColors.length; x++) {
if (tableColors[x] == null || !tableColors[x].getRGB().equals(c[x])) {
tableColors[x] = PaintShop.newColor(c[x]);
needRefresh = true;
}
}
return needRefresh;
}
示例6: initializeColors
import org.eclipse.swt.graphics.RGB; //导入依赖的package包/类
void initializeColors() {
Display display = Display.getDefault();
colors = new Color[] { new Color(display, new RGB(0, 0, 0)), // black
new Color(display, new RGB(128, 0, 0)), // red
new Color(display, new RGB(0, 128, 0)), // green
new Color(display, new RGB(0, 0, 128)) // blue
};
tokenColors = new int[MAXIMUM_TOKEN];
tokenColors[OTHER] = 0;
tokenColors[NUMBER] = 0;
tokenColors[WORD] = 0;
tokenColors[WHITE] = 0;
tokenColors[COMMENT] = 1;
tokenColors[STRING] = 2;
tokenColors[KEY] = 3;
}
示例7: getPreview
import org.eclipse.swt.graphics.RGB; //导入依赖的package包/类
@Override
public Image getPreview ( final int width, final int height )
{
final Point p = new Point ( width, height );
final Image img = this.previews.get ( p );
if ( img == null )
{
RGB rgb = getLineRenderer ().getLineColor ();
if ( rgb == null )
{
rgb = DEFAULT_COLOR;
}
final Color color = (Color)this.resourceManager.get ( ColorDescriptor.createFrom ( rgb ) );
final Image newImage = makePreview ( Display.getDefault (), getLineRenderer ().getLineAttributes (), color, p );
this.previews.put ( p, newImage );
return newImage;
}
return img;
}
示例8: makeColor
import org.eclipse.swt.graphics.RGB; //导入依赖的package包/类
public static RGB makeColor ( final String color )
{
if ( color == null )
{
return null;
}
if ( color.startsWith ( "#" ) )
{
if ( color.length () == 1 + 3 )
{
return makeRGB ( color.substring ( 1, 2 ) + "0", color.substring ( 2, 3 ) + "0", color.substring ( 3, 4 ) + "0" );
}
else if ( color.length () >= 1 + 6 )
{
return makeRGB ( color.substring ( 1, 3 ), color.substring ( 3, 5 ), color.substring ( 5, 7 ) );
}
}
return null;
}
示例9: getColor
import org.eclipse.swt.graphics.RGB; //导入依赖的package包/类
/**
*
* @since 3.1.1.1
*/
public static Color getColor(Device device, float[] hsb) {
if (hsb[0] < 0) {
hsb[0] = 0;
} else if (hsb[0] > 360) {
hsb[0] = 360;
}
if (hsb[1] < 0) {
hsb[1] = 0;
} else if (hsb[1] > 1) {
hsb[1] = 1;
}
if (hsb[2] < 0) {
hsb[2] = 0;
} else if (hsb[2] > 1) {
hsb[2] = 1;
}
RGB rgb = new RGB(hsb[0], hsb[1], hsb[2]);
return getColor(device, rgb.red, rgb.green, rgb.blue);
}
示例10: applyCellDefaultStyles
import org.eclipse.swt.graphics.RGB; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private RankedItem<T> applyCellDefaultStyles(final ColumnOptions<T> options, ViewerCell cell) {
final RankedItem<T> rankedItem = (RankedItem<T>) cell.getElement();
cell.setForeground(fromRegistry(options.getFontColor()));
int rowState = rowStateResolver.apply(rankedItem);
if ((rowState & RowState.SELECTED.value) != 0 && options.isEnableBackgroundSelection()) {
cell.setBackground(fromRegistry(new RGB(225,226,206)));
} else {
cell.setBackground(fromRegistry(options.getBackgroundColor()));
}
if ((rowState & RowState.CURSOR.value) != 0 && options.isEnableBackgroundSelection()) {
cell.setBackground(fromRegistry(ColorUtil.blend(cell.getBackground().getRGB(), new RGB(200,200,200))));
}
Font font = createColumnFont(options, cell);
cell.setFont(font);
return rankedItem;
}
示例11: setEdgeColorStyle
import org.eclipse.swt.graphics.RGB; //导入依赖的package包/类
/**
* Set the color format edge
* @param DEdge currentEdge
* @param color
*/
public static void setEdgeColorStyle(DEdge currentEdge, RGB color) {
if ((currentEdge != null) && (color != null)) {
EdgeStyle edgeStyle = currentEdge.getOwnedStyle();
RGBValues c = convertRGBtoRGBValues(color);
if ((edgeStyle != null) && !isSameColor(c, edgeStyle.getStrokeColor())) {
edgeStyle.setStrokeColor(c);
ShapeUtil.addCustomisation(edgeStyle, new EStructuralFeature[] { DiagramPackage.Literals.EDGE_STYLE__STROKE_COLOR });
getStyleHelper(currentEdge).refreshStyle(edgeStyle);
}
}
}
示例12: getBorderColor
import org.eclipse.swt.graphics.RGB; //导入依赖的package包/类
public RGB getBorderColor(){
if(customBorderColor==null){
return this.defaultBorderColor;
}else{
return customBorderColor;
}
}
示例13: darken
import org.eclipse.swt.graphics.RGB; //导入依赖的package包/类
/** Darkens provided color based on the provided factor. */
public static Color darken(RGB color, float factor) {
factor = (float) Math.cbrt(factor);
int dr = clamp(color.red * factor);
int dg = clamp(color.green * factor);
int db = clamp(color.blue * factor);
return ColorUtils.getColor(dr, dg, db);
}
示例14: blend
import org.eclipse.swt.graphics.RGB; //导入依赖的package包/类
/**
* Returns an RGB that lies between the given foreground and background
* colors using the given mixing factor. A <code>factor</code> of 1.0 will produce a
* color equal to <code>fg</code>, while a <code>factor</code> of 0.0 will produce one
* equal to <code>bg</code>.
* @param bg the background color
* @param fg the foreground color
* @param factor the mixing factor, must be in [0, 1]
*
* @return the interpolated color
*/
private static RGB blend(RGB bg, RGB fg, float factor) {
// copy of org.eclipse.jface.internal.text.revisions.Colors#blend(..)
Assert.isLegal(bg != null);
Assert.isLegal(fg != null);
Assert.isLegal(factor >= 0f && factor <= 1f);
float complement = 1f - factor;
return new RGB((int) (complement * bg.red + factor * fg.red),
(int) (complement * bg.green + factor * fg.green),
(int) (complement * bg.blue + factor * fg.blue));
}
示例15: getColorFromRegistry
import org.eclipse.swt.graphics.RGB; //导入依赖的package包/类
/**
* Returns Color from color registry
*
* @return
*/
public Color getColorFromRegistry(int red, int green, int blue) {
RGB colorValue = new RGB(red, green, blue);
Color color = COLOR_REGISTRY.get(colorValue.toString());
if (color == null || (color !=null && color.isDisposed())) {
COLOR_REGISTRY.put(colorValue.toString(), colorValue);
}
return COLOR_REGISTRY.get(colorValue.toString());
}