Changeset 5054 in josm for trunk/src/org/openstreetmap/josm/gui/mappaint/AreaElemStyle.java
- Timestamp:
- 2012-03-08T12:11:38+01:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/mappaint/AreaElemStyle.java
r4960 r5054 5 5 6 6 import java.awt.Color; 7 import java.awt.image.BufferedImage;8 9 import javax.swing.ImageIcon;10 7 11 8 import org.openstreetmap.josm.Main; … … 27 24 */ 28 25 public Color color; 29 public MapImage <BufferedImage>fillImage;26 public MapImage fillImage; 30 27 public TextElement text; 31 28 32 protected AreaElemStyle(Cascade c, Color color, MapImage <BufferedImage>fillImage, TextElement text) {29 protected AreaElemStyle(Cascade c, Color color, MapImage fillImage, TextElement text) { 33 30 super(c, -1000f); 34 31 CheckParameterUtil.ensureParameterNotNull(color); … … 39 36 40 37 public static AreaElemStyle create(Cascade c) { 41 MapImage <BufferedImage>fillImage = null;38 MapImage fillImage = null; 42 39 Color color = null; 43 40 44 41 IconReference iconRef = c.get("fill-image", null, IconReference.class); 45 42 if (iconRef != null) { 46 ImageIcon icon = MapPaintStyles.getIcon(iconRef, -1, -1); 47 if (icon != null) { 48 if (!(icon.getImage() instanceof BufferedImage)) 49 throw new RuntimeException(); 50 fillImage = new MapImage<BufferedImage>(iconRef.iconName, iconRef.source); 51 fillImage.img = (BufferedImage) icon.getImage(); 43 fillImage = new MapImage(iconRef.iconName, iconRef.source); 44 fillImage.getImage(); 52 45 53 color = new Color(fillImage.img.getRGB(54 fillImage.img.getWidth() / 2, fillImage.img.getHeight() / 2)55 46 color = new Color(fillImage.getImage().getRGB( 47 fillImage.getWidth() / 2, fillImage.getHeight() / 2) 48 ); 56 49 57 fillImage.alpha = Math.min(255, Math.max(0, Integer.valueOf(Main.pref.getInteger("mappaint.fill-image-alpha", 255)))); 58 Integer pAlpha = Utils.color_float2int(c.get("fill-opacity", null, float.class)); 59 if (pAlpha != null) { 60 fillImage.alpha = pAlpha; 61 } 50 fillImage.alpha = Math.min(255, Math.max(0, Integer.valueOf(Main.pref.getInteger("mappaint.fill-image-alpha", 255)))); 51 Integer pAlpha = Utils.color_float2int(c.get("fill-opacity", null, float.class)); 52 if (pAlpha != null) { 53 fillImage.alpha = pAlpha; 62 54 } 63 55 } else { … … 78 70 text = TextElement.create(c, PaintColors.AREA_TEXT.get(), true); 79 71 } 80 72 81 73 if (color != null) 82 74 return new AreaElemStyle(c, color, fillImage, text);
Note:
See TracChangeset
for help on using the changeset viewer.