當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。