Ignore:
Timestamp:
2012-01-19T12:49:55+01:00 (12 years ago)
Author:
bastiK
Message:

extend image sanitize options

Location:
trunk/src/org/openstreetmap/josm/gui/mappaint
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/mappaint/AreaElemStyle.java

    r4272 r4820  
    1616import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference;
    1717import org.openstreetmap.josm.tools.CheckParameterUtil;
     18import org.openstreetmap.josm.tools.ImageProvider.SanitizeMode;
    1819import org.openstreetmap.josm.tools.Utils;
    1920
     
    4546        IconReference iconRef = c.get("fill-image", null, IconReference.class);
    4647        if (iconRef != null) {
    47             ImageIcon icon = MapPaintStyles.getIcon(iconRef, -1, -1, false);
     48            ImageIcon icon = MapPaintStyles.getIcon(iconRef, -1, -1, SanitizeMode.MAKE_BUFFEREDIMAGE);
    4849            if (icon != null) {
    49                 if (!(icon.getImage() instanceof BufferedImage)) {
    50                     icon = MapPaintStyles.getIcon(iconRef, -1, -1, true);
    51                 }
    5250                if (!(icon.getImage() instanceof BufferedImage))
    5351                    throw new RuntimeException();
  • trunk/src/org/openstreetmap/josm/gui/mappaint/LinePatternElemStyle.java

    r4272 r4820  
    2828        if (iconRef == null)
    2929            return null;
    30         ImageIcon icon = MapPaintStyles.getIcon(iconRef, -1, -1, false);
     30        ImageIcon icon = MapPaintStyles.getIcon(iconRef, -1, -1);
    3131        if (icon == null)
    3232            return null;
  • trunk/src/org/openstreetmap/josm/gui/mappaint/MapPaintStyles.java

    r4721 r4820  
    2727import org.openstreetmap.josm.io.MirroredInputStream;
    2828import org.openstreetmap.josm.tools.ImageProvider;
     29import org.openstreetmap.josm.tools.ImageProvider.SanitizeMode;
    2930
    3031/**
     
    8788    }
    8889
    89     public static ImageIcon getIcon(IconReference ref, int width, int height, boolean sanitize) {
     90    public static ImageIcon getIcon(IconReference ref, int width, int height) {
     91        return getIcon(ref, width, height, SanitizeMode.OFF);
     92    }
     93
     94    public static ImageIcon getIcon(IconReference ref, int width, int height, SanitizeMode sanitize) {
    9095        final String namespace = ref.source.getPrefName();
    9196        ImageIcon i = new ImageProvider(ref.iconName)
     
    105110    }
    106111
     112    public static ImageIcon getNoIcon_Icon(StyleSource source) {
     113        return getNoIcon_Icon(source, SanitizeMode.OFF);
     114    }
     115
    107116    /**
    108117     * No icon with the given name was found, show a dummy icon instead
     
    113122     *  can be null if the defaults are turned off by user
    114123     */
    115     public static ImageIcon getNoIcon_Icon(StyleSource source, boolean sanitize) {
     124    public static ImageIcon getNoIcon_Icon(StyleSource source, SanitizeMode sanitize) {
    116125        return new ImageProvider("misc/no_icon.png")
    117126                .setDirs(getIconSourceDirs(source))
  • trunk/src/org/openstreetmap/josm/gui/mappaint/NodeElemStyle.java

    r4415 r4820  
    150150        int height = heightF == null ? -1 : Math.round(heightF);
    151151
    152         ImageIcon icon = MapPaintStyles.getIcon(iconRef, width, height, false);
     152        ImageIcon icon = MapPaintStyles.getIcon(iconRef, width, height);
    153153        if (icon == null)
    154             return new Pair<ImageIcon, Integer>(MapPaintStyles.getNoIcon_Icon(iconRef.source, false), 255);
     154            return new Pair<ImageIcon, Integer>(MapPaintStyles.getNoIcon_Icon(iconRef.source), 255);
    155155        int iconAlpha = Math.min(255, Math.max(0, Integer.valueOf(Main.pref.getInteger("mappaint.icon-image-alpha", 255))));
    156156        Integer pAlpha = Utils.color_float2int(c.get("icon-opacity", null, float.class));
  • trunk/src/org/openstreetmap/josm/gui/mappaint/StyleSource.java

    r4272 r4820  
    7474        if (imageIcon == null) {
    7575            if (icon != null) {
    76                 imageIcon = MapPaintStyles.getIcon(new IconReference(icon, this), -1, -1, false);
     76                imageIcon = MapPaintStyles.getIcon(new IconReference(icon, this), -1, -1);
    7777            }
    7878            if (imageIcon == null) {
Note: See TracChangeset for help on using the changeset viewer.