Changeset 8324 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2015-05-04T23:24:14+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/ImageProvider.java
r8323 r8324 52 52 import javax.imageio.metadata.IIOMetadata; 53 53 import javax.imageio.stream.ImageInputStream; 54 import javax.swing.Icon;55 54 import javax.swing.ImageIcon; 56 55 import javax.xml.bind.DatatypeConverter; … … 1144 1143 return Toolkit.getDefaultToolkit().createCustomCursor(img.getImage(), 1145 1144 "crosshair".equals(name) ? new Point(10, 10) : new Point(3, 2), "Cursor"); 1146 }1147 1148 /**1149 * Decorate one icon with an overlay icon.1150 *1151 * @param ground the base image1152 * @param overlay the overlay image (can be smaller than the base image)1153 * @param pos position of the overlay image inside the base image (positioned1154 * in one of the corners)1155 * @return an icon that represent the overlay of the two given icons. The second icon is layed1156 * on the first relative to the given position.1157 * FIXME: This function does not fit into the ImageProvider concept as public function!1158 * Overlay should be handled like all the other functions only settings arguments and1159 * overlay must be transparent in the background.1160 * Also scaling is not cared about with current implementation.1161 * @deprecated this method will be refactored1162 */1163 @Deprecated1164 public static ImageIcon overlay(Icon ground, Icon overlay, OverlayPosition pos) {1165 int w = ground.getIconWidth();1166 int h = ground.getIconHeight();1167 int wo = overlay.getIconWidth();1168 int ho = overlay.getIconHeight();1169 BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);1170 Graphics g = img.createGraphics();1171 ground.paintIcon(null, g, 0, 0);1172 int x = 0, y = 0;1173 switch (pos) {1174 case NORTHWEST:1175 x = 0;1176 y = 0;1177 break;1178 case NORTHEAST:1179 x = w - wo;1180 y = 0;1181 break;1182 case SOUTHWEST:1183 x = 0;1184 y = h - ho;1185 break;1186 case SOUTHEAST:1187 x = w - wo;1188 y = h - ho;1189 break;1190 }1191 overlay.paintIcon(null, g, x, y);1192 return new ImageIcon(img);1193 1145 } 1194 1146
Note:
See TracChangeset
for help on using the changeset viewer.