Ignore:
Timestamp:
2012-02-16T20:58:54+01:00 (14 years ago)
Author:
stoecker
Message:

mv jump to action from G to key J

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r4938 r4960  
    8585    }
    8686
    87     public static enum SanitizeMode {
    88         OFF,                // never sanitize the image
    89         ALWAYS,             // always copy to a new BufferedImage
    90         MAKE_BUFFEREDIMAGE  // make sure the returned image is instance of BufferedImage
    91     }
    92 
    9387    protected Collection<String> dirs;
    9488    protected String id;
     
    10094    protected int maxWidth = -1;
    10195    protected int maxHeight = -1;
    102     protected SanitizeMode sanitize;
    10396    protected boolean optional;
    10497
     
    204197    public ImageProvider setMaxHeight(int maxHeight) {
    205198        this.maxHeight = maxHeight;
    206         return this;
    207     }
    208 
    209     /**
    210      * Set true, if the image should be repainted to a new BufferedImage in order to work around certain issues.
    211      */
    212     public ImageProvider setSanitize(SanitizeMode sanitize) {
    213         this.sanitize = sanitize;
    214199        return this;
    215200    }
     
    240225        }
    241226        if (maxWidth != -1 || maxHeight != -1)
    242             return ir.getImageIconBounded(new Dimension(maxWidth, maxHeight), sanitize);
     227            return ir.getImageIconBounded(new Dimension(maxWidth, maxHeight));
    243228        else
    244             return ir.getImageIcon(new Dimension(width, height), sanitize);
     229            return ir.getImageIcon(new Dimension(width, height));
    245230    }
    246231
     
    292277                    if (mediatype != null && mediatype.contains("image/svg+xml")) {
    293278                        URI uri = getSvgUniverse().loadSVG(new StringReader(new String(bytes)), name);
    294                         SVGDiagram svg = getSvgUniverse().getDiagram(uri);
    295                         return new ImageResource(svg);
     279                        return new ImageResource(getSvgUniverse().getDiagram(uri));
    296280                    } else {
    297                         return new ImageResource(new ImageIcon(bytes).getImage(), true);
     281                        return new ImageResource(new ImageIcon(bytes).getImage());
    298282                    }
    299283                }
     
    406390                        img = ImageIO.read(is.getFile().toURI().toURL());
    407391                    } catch (IOException e) {}
    408                     return img == null ? null : new ImageResource(img, true);
     392                    return img == null ? null : new ImageResource(img);
    409393                default:
    410394                    throw new AssertionError();
     
    475459                                img = ImageIO.read(new ByteArrayInputStream(buf));
    476460                            } catch (IOException e) {}
    477                             return img == null ? null : new ImageResource(img, false);
     461                            return img == null ? null : new ImageResource(img);
    478462                        default:
    479463                            throw new AssertionError();
     
    509493                    img = ImageIO.read(path);
    510494                } catch (IOException e) {}
    511                 return img == null ? null : new ImageResource(img, true);
     495                return img == null ? null : new ImageResource(img);
    512496            default:
    513497                throw new AssertionError();
     
    767751    }
    768752
    769     public static BufferedImage sanitize(Image img) {
    770         (new ImageIcon(img)).getImage(); // load competely
    771         int width = img.getWidth(null);
    772         int height = img.getHeight(null);
    773         BufferedImage result = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
    774         result.getGraphics().drawImage(img, 0, 0, null);
    775         return result;
    776     }
    777 
    778753    public static Image createImageFromSvg(SVGDiagram svg, Dimension dim) {
    779754        float realWidth = svg.getWidth();
Note: See TracChangeset for help on using the changeset viewer.