--- /dev/null
+/*******************************************************************************\r
+ * Copyright (c) 2007, 2011 Association for Decentralized Information Management in\r
+ * Industry THTH ry.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * which accompanies this distribution, and is available at\r
+ * http://www.eclipse.org/legal/epl-v10.html\r
+ *\r
+ * Contributors:\r
+ * VTT Technical Research Centre of Finland - initial API and implementation\r
+ *******************************************************************************/\r
+package org.simantics.charts.ui;\r
+\r
+import java.awt.Color;\r
+\r
+import org.eclipse.jface.resource.ImageDescriptor;\r
+import org.osgi.framework.Bundle;\r
+import org.simantics.charts.Activator;\r
+import org.simantics.utils.ui.gfx.CompositionImageDescriptor;\r
+import org.simantics.utils.ui.gfx.RGBAdjustmentImageDescriptor;\r
+\r
+public class ChartItemIcon {\r
+\r
+ public ImageDescriptor tagEmpty, tagLabel, binaryEmpty, binaryLabel;\r
+ \r
+ public ChartItemIcon() {\r
+ Bundle bundle = Activator.getDefault().getBundle();\r
+ tagEmpty = ImageDescriptor.createFromURL(bundle.getResource("icons/tag_empty.png"));\r
+ tagLabel = ImageDescriptor.createFromURL(bundle.getResource("icons/tag_label.png"));\r
+ binaryEmpty = ImageDescriptor.createFromURL(bundle.getResource("icons/binary_empty.png"));\r
+ binaryLabel = ImageDescriptor.createFromURL(bundle.getResource("icons/binary_label.png")); \r
+ }\r
+ \r
+ public ImageDescriptor createIcon( boolean analog, Color color, boolean selected )\r
+ {\r
+ ImageDescriptor _base = analog ? tagEmpty : binaryEmpty;\r
+ ImageDescriptor _label = analog ? tagLabel : binaryLabel;\r
+ \r
+ if ( selected ) _base = new RGBAdjustmentImageDescriptor(_base, 200, 200, 300);\r
+ \r
+ ImageDescriptor label = new RGBAdjustmentImageDescriptor(_label, color.getRed(), color.getGreen(), color.getBlue());\r
+ ImageDescriptor icon = CompositionImageDescriptor.compose(_base, label);\r
+ \r
+ return icon;\r
+ }\r
+ \r
+}\r