org.eclipse.swt.graphics.RGB Java Examples

The following examples show how to use org.eclipse.swt.graphics.RGB. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DefaultValuesInitializer.java    From e4Preferences with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void initializeDefaultPreferences()
{
	IEclipsePreferences node = DefaultScope.INSTANCE.getNode(FrameworkUtil.getBundle(getClass()).getSymbolicName());

	if (node != null)
	{
		node.put("rootPageValue", "DEFAULT ROOT PAGE VALUE");
		node.put("page1", "DEFAULT PAGE 1 VALUE");
		node.put("page2", "DEFAULT PAGE 2 VALUE");
	
		node.put("prefCombo", "value2");
		node.put("prefColor", StringConverter.asString(new RGB(0,255,0)));
		node.putBoolean("prefBoolean",true);
		node.put("prefString","Default string value");
		
		try { node.flush();  }  catch (BackingStoreException e) { }
	}		
	
	
	
}
 
Example #2
Source File: ColorUtils.java    From saros with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Scales a color's lightness; the higher the ratio the lighter the color
 *
 * @param rgb that defines the color
 * @param scale non-negative whereas 0 results in zero lightness = black color
 * @return the scaled RGB
 * @see <a href="http://en.wikipedia.org/wiki/HSL_and_HSV">HSL and HSV</a>
 */
public static RGB scaleColorBy(RGB rgb, float scale) {
  if (scale < 0) throw new IllegalArgumentException();

  /*
   * Convert to HLS; HLS and HSL are synonym
   */
  float[] hls =
      ColorSpaceConversion.RGBtoHLS(
          (float) rgb.red / 255, (float) rgb.green / 255, (float) rgb.blue / 255);

  /*
   * Scale the lightness
   */
  hls[1] *= scale;

  /*
   * Convert back from HLS to RGB
   */
  float[] scaledRGB = ColorSpaceConversion.HLStoRGB(hls[0], hls[1], hls[2]);

  return new RGB(
      Math.round(scaledRGB[0] * 255),
      Math.round(scaledRGB[1] * 255),
      Math.round(scaledRGB[2] * 255));
}
 
Example #3
Source File: AutoStartup.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void earlyStartup() {
	GamaPreferences.Modeling.EDITOR_BASE_FONT.init(() -> getDefaultFontData()).onChange(font -> {
		try {
			final FontData newValue = new FontData(font.getName(), font.getSize(), font.getStyle());
			setValue(EditorsPlugin.getDefault().getPreferenceStore(), TEXT_FONT, newValue);
		} catch (final Exception e) {}
	});
	GamaPreferences.Modeling.EDITOR_BACKGROUND_COLOR.init(() -> getDefaultBackground()).onChange(c -> {
		final RGB rgb = new RGB(c.getRed(), c.getGreen(), c.getBlue());
		PreferenceConverter.setValue(EditorsPlugin.getDefault().getPreferenceStore(),
				AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND, rgb);
		GamaPreferences.Modeling.OPERATORS_MENU_SORT
				.onChange(newValue -> OperatorsReferenceMenu.byName = newValue.equals("Name"));
	});
	GamlRuntimeModule.staticInitialize();
	GamlEditorBindings.install();
	GamlReferenceSearch.install();
}
 
Example #4
Source File: ResourceHelper.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
public static Color getColor(String rgbString) {
	if (!JFaceResources.getColorRegistry().hasValueFor(rgbString)) {
		if (rgbString.startsWith("#")) {
			// decode hex to rgb
			Integer intval = Integer.decode(rgbString);
	        int i = intval.intValue();
	        RGB rgb = new RGB((i >> 16) & 0xFF, (i >> 8) & 0xFF, i & 0xFF);
	        JFaceResources.getColorRegistry().put(rgbString, rgb);
		} else {
			// rgb string in format rgb(r, g, b)
			String rgbValues = rgbString.substring(rgbString.indexOf('(') + 1, rgbString.lastIndexOf(')'));
			String[] values = rgbValues.split(",");
			try {
				int red = Integer.valueOf(values[0].trim());
				int green = Integer.valueOf(values[1].trim());
				int blue = Integer.valueOf(values[2].trim());
				
				JFaceResources.getColorRegistry().put(rgbString, new RGB(red, green, blue));
			} catch (NumberFormatException e) {
				e.printStackTrace();
			}
		}
	}
	return JFaceResources.getColorRegistry().get(rgbString);
}
 
Example #5
Source File: UIUtil.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public static Color createColor( IPreferenceStore store, String key,
		Display display )
{
	RGB rgb = null;
	if ( store.contains( key ) )
	{
		if ( store.isDefault( key ) )
		{
			rgb = PreferenceConverter.getDefaultColor( store, key );
		}
		else
		{
			rgb = PreferenceConverter.getColor( store, key );
		}
		if ( rgb != null )
		{
			return new Color( display, rgb );
		}
	}
	return null;
}
 
Example #6
Source File: CustomReceiveTask2EditPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public Object getPreferredValue(EStructuralFeature feature) {
       Object preferenceStore = getDiagramPreferencesHint().getPreferenceStore();
       if (preferenceStore instanceof IPreferenceStore) {
           if (feature == NotationPackage.eINSTANCE.getLineStyle_LineColor()) {
               
               return FigureUtilities.RGBToInteger(new RGB(44,109,163));
               
           } else if (feature == NotationPackage.eINSTANCE
               .getFontStyle_FontColor()) {
               
               return FigureUtilities.RGBToInteger(PreferenceConverter
                   .getColor((IPreferenceStore) preferenceStore,
                       IPreferenceConstants.PREF_FONT_COLOR));
               
           } else if (feature == NotationPackage.eINSTANCE
               .getFillStyle_FillColor()) {
               
               return FigureUtilities.RGBToInteger(new RGB(184,185,218));
               
           }
       }

       return getStructuralFeatureValue(feature);
   }
 
Example #7
Source File: ThemeGetTextAttribute.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private RGBa merge(RGBa top, RGBa bottom, RGB defaultParent)
{
	if (top == null && bottom == null)
	{
		return new RGBa(defaultParent);
	}
	if (top == null) // for some reason there is no top.
	{
		return bottom;
	}
	if (top.isFullyOpaque()) // top has no transparency, just return it
	{
		return top;
	}
	if (bottom == null) // there is no parent, merge onto default FG/BG for theme
	{
		return new RGBa(Theme.alphaBlend(defaultParent, top.toRGB(), top.getAlpha()));
	}
	return new RGBa(Theme.alphaBlend(bottom.toRGB(), top.toRGB(), top.getAlpha()));
}
 
Example #8
Source File: SetCheckPoint2.java    From AndroidRobot with Apache License 2.0 6 votes vote down vote up
public ImageData getImageData(BufferedImage bufferedImage) {
    DirectColorModel colorModel = (DirectColorModel) bufferedImage.getColorModel();
    PaletteData palette = new PaletteData(colorModel.getRedMask(), colorModel.getGreenMask(),
        colorModel.getBlueMask());
    ImageData data = new ImageData(bufferedImage.getWidth(), bufferedImage.getHeight(),
        colorModel.getPixelSize(), palette);
    WritableRaster raster = bufferedImage.getRaster();
    int[] pixelArray = new int[3];
    for (int y = 0; y < data.height; y++) {
        for (int x = 0; x < data.width; x++) {
            raster.getPixel(x, y, pixelArray);
            int pixel = palette.getPixel(new RGB(pixelArray[0], pixelArray[1], pixelArray[2]));
            data.setPixel(x, y, pixel);
        }
    }
    return data;
}
 
Example #9
Source File: DefaultGridLookPainter.java    From nebula with Eclipse Public License 2.0 6 votes vote down vote up
private void paintCell(GC gc, RGB background, Rectangle bounds,
		boolean topOpen, boolean bottomOpen) {
	// Compute effective cell rectangle
	int x = bounds.x - border.getLeft() - cellPadding.x;
	int y = bounds.y - border.getTop(topOpen)
			- (topOpen ? 0 : cellPadding.y);
	int width = bounds.width + border.getWidth() + cellPadding.x
			+ cellPadding.width;
	int height = bounds.height + border.getHeight(topOpen, bottomOpen)
			+ (bottomOpen ? 0 : cellPadding.y + cellPadding.height);

	// Paint background
	Color backgroundColor = resources.getColor(background);
	if (backgroundColor != null) {
		Color oldBackground = gc.getBackground();
		gc.setBackground(backgroundColor);
		gc.fillRectangle(x, y, width, height);
		gc.setBackground(oldBackground);
	}

	// Paint border
	border.paint(gc, x, y, width, height, topOpen, bottomOpen);
}
 
Example #10
Source File: AbstractSegmentStoreDensityViewer.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Get the color for a series
 *
 * @param name
 *            the series name
 * @return The color in RGB
 * @since 4.1
 */
public RGB getColorForItem(String name) {
    if (fSegmentStoreProviders.size() == 1) {
        return BAR_COLOR;
    }
    Set<String> keys = fSegmentStoreProviders.keySet();
    int i = 0;
    for (String key : keys) {
        if (key.equals(name)) {
            break;
        }
        i++;
    }
    float pos = (float) i / keys.size();
    int index = Math.max((int) (PALETTE.getNbColors() * pos), 0) % PALETTE.getNbColors();
    return Objects.requireNonNull(RGBAUtil.fromRGBAColor(PALETTE.get().get(index)).rgb);
}
 
Example #11
Source File: EditorConfigColorManager.java    From editorconfig-eclipse with Apache License 2.0 5 votes vote down vote up
@Override
public Color getColor(String key) {

	if (key == null)
		return null;

	RGB rgb = fKeyTable.get(key);
	return getColor(rgb);
}
 
Example #12
Source File: TSPreferenceInitializer.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void initializeDefaultPreferences() {
	// 设置 colors 首选项页的初始值
	IPreferenceStore store = Activator.getDefault().getPreferenceStore();
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TAG_FG_COLOR, new RGB(234, 234, 234));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TAG_BG_COLOR, new RGB(223, 112, 0));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.WRONG_TAG_COLOR, new RGB(255, 0, 0));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.DIFFERENCE_FG_COLOR, new RGB(255, 0, 0));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.DIFFERENCE_BG_COLOR, new RGB(244, 244, 159));

	PreferenceConverter.setDefault(store, IColorPreferenceConstant.PT_COLOR, new RGB(255, 0, 0));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.QT_COLOR, new RGB(255, 204, 204));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.MT_COLOR, new RGB(171, 217, 198));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH101_COLOR, new RGB(255, 255, 204));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH100_COLOR, new RGB(37, 168, 204));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH90_COLOR, new RGB(79, 185, 214));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH80_COLOR, new RGB(114, 199, 222));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH70_COLOR, new RGB(155, 215, 231));
	PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH0_COLOR, new RGB(198, 240, 251));

	PreferenceConverter.setDefault(store, IColorPreferenceConstant.HIGHLIGHTED_TERM_COLOR, new RGB(170, 255, 85));

	// 设置 net.heartsome.cat.common.core 插件中的语言代码初始值
	IPreferenceStore corePreferenceStore = new ScopedPreferenceStore(ConfigurationScope.INSTANCE, CoreActivator
			.getDefault().getBundle().getSymbolicName());
	corePreferenceStore.setDefault(IPreferenceConstants.LANGUAGECODE, LocaleService.getLanguageConfigAsString());

	// 设置选择路径对话框的初始值
	PlatformUI.getPreferenceStore()
			.setDefault(IPreferenceConstants.LAST_DIRECTORY, System.getProperty("user.home"));
	
	ColorConfigLoader.init();
}
 
Example #13
Source File: CoverageInformationItem.java    From tlaplus with MIT License 5 votes vote down vote up
Color colorItem(TreeSet<Long> counts, final Representation rep) {
	int hue = ModuleCoverageInformation.getHue(rep.getValue(this, Grouping.INDIVIDUAL), counts);
	String key = Integer.toString(hue);
	if (!JFaceResources.getColorRegistry().hasValueFor(key)) {
		JFaceResources.getColorRegistry().put(key, new RGB(hue, .25f, 1f));
	}
	final Color color = JFaceResources.getColorRegistry().get(key);

	Color[] colors = new Color[2];
	colors[Grouping.INDIVIDUAL.ordinal()] = color;
	colors[Grouping.COMBINED.ordinal()] = color;
	representations.put(rep, colors);
	
	if (hasSiblings()) {
		// Aggregated color (might be identical to color).
		hue = ModuleCoverageInformation.getHue(rep.getValue(this, Grouping.COMBINED), counts);
		key = Integer.toString(hue);
		if (!JFaceResources.getColorRegistry().hasValueFor(key)) {
			JFaceResources.getColorRegistry().put(key, new RGB(hue, .25f, 1f));
		}
		Color aggregate = JFaceResources.getColorRegistry().get(key);

		colors = new Color[2];
		colors[Grouping.INDIVIDUAL.ordinal()] = color;
		colors[Grouping.COMBINED.ordinal()] = aggregate;
		representations.put(rep, colors);
		return aggregate;
	}
	
	return color;
}
 
Example #14
Source File: BackgroundPrintTest.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
public void testEquals() {
	Print background = new BackgroundPrint(new PrintStub(0), new RGB(0, 0,
			0));
	assertEquals(background, new BackgroundPrint(new PrintStub(0), new RGB(
			0, 0, 0)));
	assertFalse(background.equals(new BackgroundPrint(new PrintStub(1),
			new RGB(0, 0, 0))));
	assertFalse(background.equals(new BackgroundPrint(new PrintStub(0),
			new RGB(1, 1, 1))));
}
 
Example #15
Source File: XkcdColorPicker.java    From gradle-and-eclipse-rcp with Apache License 2.0 5 votes vote down vote up
public XkcdColorPicker(Composite parent, RGB initRGB) {
	super(new Composite(parent, SWT.NONE));
	RGB initYCbCr = ColorPicker.toYCbCr(initRGB);

	// create a scale and bind it to an RxBox<Integer>
	RxBox<Integer> luminance = RxBox.of(initYCbCr.red);

	// colorpanel in the center
	ColorPicker cbcrPanel = new ColorPicker(wrapped);
	Rx.subscribe(luminance, cbcrPanel::setY);

	// controls at the right
	Composite rightCmp = new Composite(wrapped, SWT.NONE);

	// scale below
	Scale scale = new Scale(wrapped, SWT.HORIZONTAL);
	scale.setMinimum(0);
	scale.setMaximum(255);
	Rx.subscribe(luminance, scale::setSelection);
	scale.addListener(SWT.Selection, e -> {
		luminance.set(scale.getSelection());
	});

	Layouts.setGrid(wrapped).numColumns(2);
	Layouts.setGridData(cbcrPanel).grabAll();
	Layouts.setGridData(rightCmp).grabVertical().verticalSpan(2);
	Layouts.setGridData(scale).grabHorizontal();

	// populate the bottom
	Layouts.setGrid(rightCmp).margin(0);
	XkcdColors.Lookup xkcdLookup = new XkcdColors.Lookup(rightCmp);

	Group hoverGrp = new Group(rightCmp, SWT.SHADOW_ETCHED_IN);
	hoverGrp.setText("Hover");
	createGroup(hoverGrp, cbcrPanel.rxMouseMove(), xkcdLookup);

	Group clickGrp = new Group(rightCmp, SWT.SHADOW_ETCHED_IN);
	clickGrp.setText("Click");
	createGroup(clickGrp, cbcrPanel.rxMouseDown(), xkcdLookup);
}
 
Example #16
Source File: ThermometerFigure.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * @param fillColor the fillColor to set
 */
public void setFillColor(Color fillColor) {
	if(this.fillColor != null && this.fillColor.equals(fillColor))
		return;
	this.fillColor = fillColor;		
	int blue = 255 - fillColor.getBlue();
	int green = 255 - fillColor.getGreen();
	int red = fillColor.getRed();
	this.contrastFillColor = XYGraphMediaFactory.getInstance().getColor(
			new RGB(red, green, blue));
	repaint();
}
 
Example #17
Source File: CSSTextHoverInformationControl.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void setInput(Object input)
{
	if (input instanceof RGB)
	{
		setBackgroundColor(getColorManager().getColor((RGB) input));
	}
	else if (input instanceof String)
	{
		setInformation((String) input);
	}
}
 
Example #18
Source File: ChangeBackgroundColorAction.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
public ChangeBackgroundColorAction(IWorkbenchPart part, ERDiagram diagram) {
	super(part, Action.AS_DROP_DOWN_MENU);

	this.setId(ID);

	this.setText(ResourceString
			.getResourceString("action.title.change.background.color"));
	this.setToolTipText(ResourceString
			.getResourceString("action.title.change.background.color"));

	int[] defaultColor = diagram.getDefaultColor();

	this.rgb = new RGB(defaultColor[0], defaultColor[1], defaultColor[2]);
	this.setColorToImage();
}
 
Example #19
Source File: XYDataProviderBaseTest.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
/**
 * Verify the style of a series in the XY chart
 *
 * @param seriesName
 *            The name of the series
 * @param expectedType
 *            Expected type of the series
 * @param expectedColor
 *            Expected color of the series. If the color is arbitrary, a value
 *            of <code>null</code> will skip color check
 * @param expectedLineStyle
 *            Expected line style of the series
 * @param isArea
 *            Parameter should be true if expected series show area, false
 *            either
 */
protected void verifySeriesStyle(String seriesName, ISeries.SeriesType expectedType, @Nullable RGB expectedColor, LineStyle expectedLineStyle, boolean isArea) {
    /* Make sure the UI update is complete */
    UIThreadRunnable.syncExec(() -> {});

    ISeries<?> series = fChart.getSeriesSet().getSeries(seriesName);
    assertNotNull(series);
    assertTrue(series.isVisible());

    /* Color, type and style */
    assertEquals(expectedType, series.getType());

    if (expectedType == ISeries.SeriesType.LINE) {
        ILineSeries<?> line = (ILineSeries<?>) series;
        if (expectedColor != null) {
            assertEquals(expectedColor, line.getLineColor().getRGB());
        }
        assertEquals(expectedLineStyle, line.getLineStyle());
        assertEquals(isArea, line.isAreaEnabled());
    } else if (expectedType == ISeries.SeriesType.BAR) {
        IBarSeries<?> bar = (IBarSeries<?>) series;
        if (expectedColor != null) {
            assertEquals(expectedColor, bar.getBarColor().getRGB());
        }
        assertTrue(bar.isStackEnabled());
    }
}
 
Example #20
Source File: DEUtil.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Converts an RGB object value to an Integer value, the Integer format is
 * xRRGGBB.
 * 
 * @param rgb
 *            RGB value.
 * @return Integer value.
 */
public static int getRGBInt( RGB rgb )
{
	if ( rgb == null )
	{
		return -1;
	}

	return ( ( rgb.red & 0xff ) << 16 )
			| ( ( rgb.green & 0xff ) << 8 )
			| ( rgb.blue & 0xff );
}
 
Example #21
Source File: ChartFactoryImpl.java    From neoscada with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
@Override
public String convertToString ( EDataType eDataType, Object instanceValue )
{
    switch ( eDataType.getClassifierID () )
    {
        case ChartPackage.PROFILE_SWITCHER_TYPE:
            return convertProfileSwitcherTypeToString ( eDataType, instanceValue );
        case ChartPackage.RGB:
            return convertRGBToString ( eDataType, instanceValue );
        default:
            throw new IllegalArgumentException ( "The datatype '" + eDataType.getName () + "' is not a valid classifier" ); //$NON-NLS-1$ //$NON-NLS-2$
    }
}
 
Example #22
Source File: JavaColorManager.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void bindColor(String key, RGB rgb) {
	Object value= fKeyTable.get(key);
	if (value != null)
		throw new UnsupportedOperationException();

	fKeyTable.put(key, rgb);
}
 
Example #23
Source File: SyntaxHighlighter.java    From RepDev with GNU General Public License v3.0 5 votes vote down vote up
public EStyle(RGB frgb, RGB bgrgb, int style) {
	if (frgb != null)
		fcolor = new Color(Display.getCurrent(), frgb);
	if (bgrgb != null)
		bgcolor = new Color(Display.getCurrent(), bgrgb);
	this.style = style;
}
 
Example #24
Source File: TextStylingPreference.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
public static TextStyling getFromStore(IPreferencesAccess prefsHelper, String colorKey) {
	RGB rgb = getRgb(prefsHelper, getColorKey(colorKey));
	boolean isEnabled = getBoolean(prefsHelper, getEnabledKey(colorKey));
	boolean isBold = getBoolean(prefsHelper, getBoldKey(colorKey));
	boolean isItalic = getBoolean(prefsHelper, getItalicKey(colorKey));
	boolean isStrikethrough = getBoolean(prefsHelper, getStrikethroughKey(colorKey));
	boolean isUnderline = getBoolean(prefsHelper, getUnderlineKey(colorKey));
	
	return new TextStyling(isEnabled, rgb, isBold, isItalic, isStrikethrough, isUnderline);
}
 
Example #25
Source File: ColorPicker.java    From gradle-and-eclipse-rcp with Apache License 2.0 5 votes vote down vote up
/** Converts an RGB value to YCrCb. */
public static RGB toYCbCr(double r, double g, double b) {
	int y = limitRound(0.299 * r + 0.587 * g + 0.114 * b);
	int cb = limitRound(128 - 0.168736 * r - 0.331264 * g + 0.5 * b);
	int cr = limitRound(128 + 0.5 * r - 0.418688 * g - 0.081312 * b);
	return new RGB(y, cb, cr);
}
 
Example #26
Source File: CommentScanner.java    From mat-calcite-plugin with Apache License 2.0 5 votes vote down vote up
public CommentScanner() {
	List<IRule> rules = new ArrayList<IRule>();

	Token commentToken = new Token(new TextAttribute(new Color(
			Display.getCurrent(), new RGB(63, 127, 95))));
	rules.add(new EndOfLineRule("--", commentToken));
	rules.add(new EndOfLineRule("//", commentToken));
	rules.add(new MultiLineRule("/*", "*/", commentToken));

	setRules(rules.toArray(new IRule[rules.size()]));
}
 
Example #27
Source File: ForkedColorsAndFontsPropertySection.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @see org.eclipse.jface.resource.CompositeImageDescriptor#drawCompositeImage(int,
 *      int)
 */
protected void drawCompositeImage(int width, int height) {

	// draw the thin color bar underneath
	if (rgb != null) {
		ImageData colorBar = new ImageData(width, height / 5, 1,
		
			new PaletteData(new RGB[] {rgb}));
		drawImage(colorBar, 0, height - height / 5);
		
	}
	// draw the base image
	drawImage(basicImgData, 0, 0);
}
 
Example #28
Source File: DefaultCellStyle.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * @param foregroundColor The foregroundColor to set.
 */
public void setForegroundColor(RGB foregroundColor) {
    if (isRealModification(_foregroundColor, foregroundColor)) {
        RGB oldVal = _foregroundColor;
        _foregroundColor = foregroundColor;
        firePropertyChange(FOREGROUNDCOLOR, oldVal, foregroundColor);
    }
}
 
Example #29
Source File: SeriesPageBubble.java    From slr-toolkit with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void mouseUp(MouseEvent e) {
	if(e.getSource() == labelShowColor && list_y.getItemCount() > 0 && btnRadioButtonCustom.getSelection()) {
		RGB rgb = PageSupport.openAndGetColor(this.getParent(), labelShowColor);
		int index = list_y.getSelectionIndex();
		termDataY.get(index).setRGB(rgb);
	}
}
 
Example #30
Source File: BorderToggleDescriptorProvider.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
private RGB convertToRGB( String color )
{
	int[] rgbValues = ColorUtil.getRGBs( color );
	if ( rgbValues == null )
	{
		return null;
	}
	else
	{
		return new RGB( rgbValues[0], rgbValues[1], rgbValues[2] );
	}
}