当前位置: 首页>>代码示例>>Java>>正文


Java RGB类代码示例

本文整理汇总了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 );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:29,代码来源:AxisImpl.java

示例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;
    }
 
开发者ID:nbfontana,项目名称:pdi,代码行数:27,代码来源:Interface.java

示例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;
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:23,代码来源:ShapeUtil.java

示例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);
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:21,代码来源:Colors.java

示例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;
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:21,代码来源:EnumTable.java

示例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;
}
 
开发者ID:sergueik,项目名称:SWET,代码行数:17,代码来源:JavaLineStyler.java

示例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;

}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:21,代码来源:LineInput.java

示例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;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:21,代码来源:Helper.java

示例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);
}
 
开发者ID:BiglySoftware,项目名称:BiglyBT,代码行数:24,代码来源:ColorCache.java

示例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;
}
 
开发者ID:dakaraphi,项目名称:eclipse-plugin-commander,代码行数:19,代码来源:KaviListColumns.java

示例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);
    }
  }
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:17,代码来源:ShapeUtil.java

示例12: getBorderColor

import org.eclipse.swt.graphics.RGB; //导入依赖的package包/类
public RGB getBorderColor(){
	if(customBorderColor==null){
		return this.defaultBorderColor;
	}else{
		return customBorderColor;
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:8,代码来源:Preference.java

示例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);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:11,代码来源:ColorUtils.java

示例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,&nbsp;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));
}
 
开发者ID:sergueik,项目名称:SWET,代码行数:23,代码来源:PopupDialog.java

示例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());
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:14,代码来源:CustomColorRegistry.java


注:本文中的org.eclipse.swt.graphics.RGB类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。