X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.utils.ui%2Fsrc%2Forg%2Fsimantics%2Futils%2Fui%2Fgfx%2FColorImageDescriptor.java;fp=bundles%2Forg.simantics.utils.ui%2Fsrc%2Forg%2Fsimantics%2Futils%2Fui%2Fgfx%2FColorImageDescriptor.java;h=eca35f1fce9bd634689a8562344c1556488ab4f1;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hp=63c1dabe839320f07427e164b27f9de6caf3028b;hpb=24e2b34260f219f0d1644ca7a138894980e25b14;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/gfx/ColorImageDescriptor.java b/bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/gfx/ColorImageDescriptor.java index 63c1dabe8..eca35f1fc 100644 --- a/bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/gfx/ColorImageDescriptor.java +++ b/bundles/org.simantics.utils.ui/src/org/simantics/utils/ui/gfx/ColorImageDescriptor.java @@ -1,77 +1,77 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Association for Decentralized Information Management in - * Industry THTH ry. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * VTT Technical Research Centre of Finland - initial API and implementation - *******************************************************************************/ -package org.simantics.utils.ui.gfx; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.graphics.ImageData; -import org.eclipse.swt.graphics.PaletteData; - -/** - * Colored rectangle with black borders. - * - * @author toni.kalajainen - */ -public class ColorImageDescriptor extends ImageDescriptor { - static final PaletteData PALETTEDATA = new PaletteData(0x00ff0000, 0x0000ff00, 0x000000ff); - - int width; - int height; - int c; - boolean selected; - - public ColorImageDescriptor(int red, int green, int blue, int width, int height, boolean selected) - { - c = (red<<16) | (green<<8) | (blue); - this.width = width; - this.height = height; - this.selected = selected; - } - - @Override - public ImageData getImageData() { - ImageData id = new ImageData(width, height, 24, PALETTEDATA); - int cx = width / 2; - int cy = height / 2; - int dst = height * width / 23; - for (int x=0; x