/**
* <!-- 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 );
}
java类org.eclipse.swt.graphics.RGB的实例源码
AxisImpl.java 文件源码
项目:neoscada
阅读 29
收藏 0
点赞 0
评论 0
Interface.java 文件源码
项目:pdi
阅读 25
收藏 0
点赞 0
评论 0
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;
}
ShapeUtil.java 文件源码
项目:time4sys
阅读 27
收藏 0
点赞 0
评论 0
/**
* 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;
}
Colors.java 文件源码
项目:BiglyBT
阅读 27
收藏 0
点赞 0
评论 0
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);
}
EnumTable.java 文件源码
项目:openaudible
阅读 30
收藏 0
点赞 0
评论 0
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;
}
JavaLineStyler.java 文件源码
项目:SWET
阅读 27
收藏 0
点赞 0
评论 0
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;
}
LineInput.java 文件源码
项目:neoscada
阅读 26
收藏 0
点赞 0
评论 0
@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;
}
Helper.java 文件源码
项目:neoscada
阅读 36
收藏 0
点赞 0
评论 0
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;
}
ColorCache.java 文件源码
项目:BiglyBT
阅读 26
收藏 0
点赞 0
评论 0
/**
*
* @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);
}
KaviListColumns.java 文件源码
项目:eclipse-plugin-commander
阅读 28
收藏 0
点赞 0
评论 0
@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;
}
ShapeUtil.java 文件源码
项目:time4sys
阅读 26
收藏 0
点赞 0
评论 0
/**
* 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);
}
}
}
Preference.java 文件源码
项目:bdf2
阅读 40
收藏 0
点赞 0
评论 0
public RGB getBorderColor(){
if(customBorderColor==null){
return this.defaultBorderColor;
}else{
return customBorderColor;
}
}
ColorUtils.java 文件源码
项目:n4js
阅读 29
收藏 0
点赞 0
评论 0
/** 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);
}
PopupDialog.java 文件源码
项目:SWET
阅读 58
收藏 0
点赞 0
评论 0
/**
* 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));
}
CustomColorRegistry.java 文件源码
项目:Hydrograph
阅读 27
收藏 0
点赞 0
评论 0
/**
* 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());
}
ConfigReader.java 文件源码
项目:tap17-muggl-javaee
阅读 30
收藏 0
点赞 0
评论 0
/**
* Generate a new color entry for the configuration file. It will save values for
* red, green and blue.
* @param name The name of the setting to store.
* @param rgb The SWT RGB object to save.
* @param rgbDefault The default RGB values.
* @return The entry as a String.
*/
private static String generateNewEntry(String name, RGB rgb, RGB rgbDefault) {
return "\t<setting name=\"" + name + "\" type=\"rgb\">"+LINE_SEPARATOR
+ "\t\t<value name=\"red\">" + rgb.red + "</value>"+LINE_SEPARATOR
+ "\t\t<value name=\"green\">" + rgb.green + "</value>"+LINE_SEPARATOR
+ "\t\t<value name=\"blue\">" + rgb.blue + "</value>"+LINE_SEPARATOR
+ "\t\t<value name=\"default red\">" + rgbDefault.red + "</value>"+LINE_SEPARATOR
+ "\t\t<value name=\"default green\">" + rgbDefault.green + "</value>"+LINE_SEPARATOR
+ "\t\t<value name=\"default blue\">" + rgbDefault.blue + "</value>"+LINE_SEPARATOR
+ "\t</setting>"+LINE_SEPARATOR;
}
ColorUtil.java 文件源码
项目:eclipse-batch-editor
阅读 30
收藏 0
点赞 0
评论 0
public static String convertToHexColor(RGB rgb) {
if (rgb == null) {
return null;
}
String hex = String.format("#%02x%02x%02x", rgb.red, rgb.green, rgb.blue);
return hex;
}
BatchSourceViewerConfiguration.java 文件源码
项目:eclipse-batch-editor
阅读 30
收藏 0
点赞 0
评论 0
private void addPresentation(PresentationReconciler reconciler, String id, RGB rgb, int style) {
TextAttribute textAttribute = new TextAttribute(colorManager.getColor(rgb),
defaultTextAttribute.getBackground(), style);
PresentationSupport presentation = new PresentationSupport(textAttribute);
reconciler.setDamager(presentation, id);
reconciler.setRepairer(presentation, id);
}
BatchSourceViewerConfiguration.java 文件源码
项目:eclipse-batch-editor
阅读 41
收藏 0
点赞 0
评论 0
public void updateTextScannerDefaultColorToken() {
if (gradleScanner == null) {
return;
}
RGB color = getPreferences().getColor(COLOR_NORMAL_TEXT);
gradleScanner.setDefaultReturnToken(createColorToken(color));
}
Preference.java 文件源码
项目:bdf2
阅读 27
收藏 0
点赞 0
评论 0
public RGB getBackgroundColor(){
if(customBackgroundColor==null){
return this.defaultBackgroundColor;
}else{
return customBackgroundColor;
}
}
BehaviorScenarioServices.java 文件源码
项目:time4sys
阅读 29
收藏 0
点赞 0
评论 0
public void customizeStepColor(DDiagramElement functionNode, RGBValues color) {
// Change color border style
RGB rgbColor = new RGB(color.getRed(), color.getGreen(), color.getBlue());
if (functionNode instanceof AbstractDNode) {
ShapeUtil.setBorderColorStyle(((AbstractDNode) functionNode), rgbColor);
}
}
EditingPane.java 文件源码
项目:pmTrans
阅读 22
收藏 0
点赞 0
评论 0
public void changeFontColor() {
ColorDialog cd = new ColorDialog(getShell());
cd.setRGB(text.getBackground().getRGB());
cd.setText("Choose a color");
RGB newColor = cd.open();
if (newColor != null)
Config.getInstance().setValue(Config.FONT_COLOR,
new Color(Display.getCurrent(), newColor));
updateFont();
}
Config.java 文件源码
项目:pmTrans
阅读 29
收藏 0
点赞 0
评论 0
public Color getColor(String prop) {
String color = getString(prop);
if (color.isEmpty())
return Display.getCurrent().getSystemColor(SWT.COLOR_WHITE);
String rgb[] = color.split(";");
return new Color(Display.getCurrent(), new RGB(
Integer.parseInt(rgb[0]), Integer.parseInt(rgb[1]),
Integer.parseInt(rgb[2])));
}
SWTGraphics.java 文件源码
项目:neoscada
阅读 30
收藏 0
点赞 0
评论 0
@Override
public void setBackground ( final RGB color )
{
if ( color != null )
{
this.gc.setBackground ( (Color)this.resourceManager.get ( ColorDescriptor.createFrom ( color ) ) );
}
else
{
this.gc.setBackground ( this.gc.getDevice ().getSystemColor ( SWT.COLOR_WIDGET_BACKGROUND ) );
}
}
LegendRenderer.java 文件源码
项目:neoscada
阅读 34
收藏 0
点赞 0
评论 0
private void renderData ( final Graphics g, final Rectangle chartRect, final DataSet data )
{
// reset clipping
g.setClipping ( null );
int y = chartRect.y + this.margin;
int x = chartRect.x + this.margin;
g.setAntialias ( true );
g.setForeground ( this.foregroundColor );
g.setBackground ( this.backgroundColor );
// draw the frame
g.fillRoundRectangle ( x, y, data.width + this.padding * 2, data.height + this.padding * 2, 10, 10 );
g.drawRoundRectangle ( x, y, data.width + this.padding * 2, data.height + this.padding * 2, 10, 10 );
x += this.padding;
y += this.padding;
g.setForeground ( new RGB ( 0, 0, 0 ) );
for ( final Data d : data.allData )
{
renderDataEntry ( g, data, d, x, y );
y += Math.max ( d.getHeight (), this.previewSize ) + this.textPadding;
}
}
ShapeUtil.java 文件源码
项目:time4sys
阅读 25
收藏 0
点赞 0
评论 0
/**
* Convert a RGB value to RGBValues
* @param RGB color
* @return RGBValues
*/
public static RGBValues convertRGBtoRGBValues(RGB color) {
if (color == null) {
return null;
}
RGBValues newValuesContent = RGBValues.create(color.red, color.green, color.blue);
return newValuesContent;
}
LineInput.java 文件源码
项目:neoscada
阅读 28
收藏 0
点赞 0
评论 0
@Override
public void setLineColor ( final RGB rgb )
{
this.lineColor = rgb;
getLineRenderer ().setLineColor ( rgb );
fireUpdatePreviews ();
firePropertyChange ( PROP_COLOR, null, rgb );
}
ItemObserver.java 文件源码
项目:neoscada
阅读 23
收藏 0
点赞 0
评论 0
public void update ( final DataItemValue value )
{
this.ruler.setVisible ( false );
if ( value != null )
{
final Variant levelValue = value.getAttributes ().get ( this.prefix + ".preset" ); //$NON-NLS-1$
if ( levelValue != null )
{
this.ruler.setPosition ( levelValue.asDouble ( null ) );
this.ruler.setVisible ( true );
}
final boolean active = value.getAttributeAsBoolean ( this.prefix + ".active" ); //$NON-NLS-1$
final boolean unsafe = value.getAttributeAsBoolean ( this.prefix + ".unsafe" ); //$NON-NLS-1$
final boolean error = value.getAttributeAsBoolean ( this.prefix + ".error" ); //$NON-NLS-1$
final boolean alarm = value.getAttributeAsBoolean ( this.prefix + ".alarm" ); //$NON-NLS-1$
if ( !active )
{
this.ruler.setColor ( new RGB ( 128, 128, 128 ) );
}
else if ( unsafe )
{
this.ruler.setColor ( new RGB ( 255, 0, 255 ) );
}
else if ( error || alarm )
{
this.ruler.setColor ( new RGB ( 255, 0, 0 ) );
}
else
{
this.ruler.setColor ( new RGB ( 0, 255, 0 ) );
}
}
}
ChartViewer.java 文件源码
项目:neoscada
阅读 25
收藏 0
点赞 0
评论 0
protected void updateState ()
{
final org.eclipse.scada.chart.XAxis x;
x = getTimeRulerViewer ();
// update mouse controllers
if ( this.mouseHover != null )
{
this.mouseHover.dispose ();
this.mouseHover = null;
}
if ( isHoverable () )
{
this.mouseHover = new MouseHover ( this.manager );
this.mouseHover.setVisible ( true );
}
// update current time tracker
if ( this.timeRuler == null && this.showTimeRuler && x != null )
{
this.timeRuler = new CurrentTimeRuler ( x );
this.timeRuler.setColor ( new RGB ( 0, 0, 255 ) );
this.manager.addRenderer ( this.timeRuler, 100 );
}
else if ( this.timeRuler != null && !this.showTimeRuler || x == null )
{
disposeTimeRuler ();
}
}
ShapeUtil.java 文件源码
项目:time4sys
阅读 26
收藏 0
点赞 0
评论 0
/**
* Set the color format edge
* @param DEdge currentEdge
* @param color
*/
public static void resetEdgeColorStyle(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.removeCustomisation(edgeStyle, new EStructuralFeature[] { DiagramPackage.Literals.EDGE_STYLE__STROKE_COLOR });
getStyleHelper(currentEdge).refreshStyle(edgeStyle);
}
}
}