]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.g2d/src/org/simantics/g2d/image/DefaultImages.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / image / DefaultImages.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 /*\r
13  *\r
14  * @author Toni Kalajainen\r
15  */\r
16 package org.simantics.g2d.image;\r
17 \r
18 import org.simantics.utils.datastructures.cache.IFactory;\r
19 \r
20 \r
21 /**\r
22  * This class contains some built-in images.\r
23  * \r
24  * Usage example.\r
25  * \r
26  *  Image x = DefaultImages.UNKNOWN.get();\r
27  *  x.paint();\r
28  *  ...\r
29  *  x = null;\r
30  *\r
31  * @author Toni Kalajainen <toni.kalajainen@vtt.fi>\r
32  */\r
33 public class DefaultImages {    \r
34         \r
35         public static final IFactory<Image> UNKNOWN2 = get("unknown.png");\r
36         public static final IFactory<Image> SVG = get("svg.png");\r
37     public static final IFactory<Image> ERROR_DECORATOR = get("error.svg");\r
38     public static final IFactory<Image> WARNING_DECORATOR = get("warningDecorator.png");\r
39         public static final IFactory<Image> COMPOSITION = get("composition.png");\r
40         public static final IFactory<Image> UNKNOWN = get("unknownDocument.svg");\r
41         public static final IFactory<Image> WHEEL =  get("wheel2.svg"); \r
42         public static final IFactory<Image> GRAB = get("grab.png");\r
43         public static final IFactory<Image> GRAB32 = get("grab32.png");\r
44         public static final IFactory<Image> HAND = get("hand.png");\r
45         public static final IFactory<Image> HAND32 = get("hand32.png");\r
46         public static final IFactory<Image> HOURGLASS = get("hourglass.svg");\r
47 \r
48         private static IFactory<Image> get(String filename) {\r
49                 return \r
50                         ProviderUtils.reference(\r
51                         ProviderUtils.cache(\r
52                         ProviderUtils.rasterize(\r
53                         ProviderUtils.at(\r
54                                 DefaultImages.class.getResource(filename)\r
55                         ))));           \r
56         }\r
57         \r
58 }\r