Changeset 11954 in josm


Ignore:
Timestamp:
2017-04-19T00:27:28+02:00 (3 months ago)
Author:
bastiK
Message:

see #7427 - fix seams for reprojected tiles

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/imagery/ReprojectionTile.java

    r11937 r11954  
    110110                interpolation = ImageWarp.Interpolation.BILINEAR;
    111111        }
    112         double margin = interpolation.getMargin();
    113112
    114113        Projection projCurrent = Main.getProjection();
     
    121120        ProjectionBounds pbTarget = projCurrent.getEastNorthBoundsBox(pbServer, projServer);
    122121
     122        double margin = 2;
    123123        Dimension dim = getDimension(pbMarginAndAlign(pbTarget, scaleMapView, margin), scaleMapView);
    124124        Integer scaleFix = limitScale(source.getTileSize(), Math.sqrt(dim.getWidth() * dim.getHeight()));
  • trunk/src/org/openstreetmap/josm/tools/ImageWarp.java

    r11915 r11954  
    168168            for (int i = 0; i < imgTarget.getWidth(); i++) {
    169169                Point2D srcCoord = invTransform.transform(new Point2D.Double(i, j));
    170                 if (isInside(srcCoord, srcRect, interpolation.getMargin())) {
     170                if (srcRect.contains(srcCoord)) {
    171171                    int rgba;
    172172                    switch (interpolation) {
     
    203203    }
    204204
    205     private static boolean isInside(Point2D p, Rectangle2D rect, double margin) {
    206         return isInside(p.getX(), rect.getMinX(), rect.getMaxX(), margin) &&
    207                 isInside(p.getY(), rect.getMinY(), rect.getMaxY(), margin);
    208     }
    209 
    210     private static boolean isInside(double x, double xMin, double xMax, double margin) {
    211         return x + margin >= xMin && x - margin <= xMax;
    212     }
    213 
    214205    private static int getColor(int x, int y, BufferedImage img) {
    215206        // border strategy: continue with the color of the outermost pixel,
    216         // but change alpha component to fully translucent
    217         int a = Utils.clamp(x, 0, img.getWidth() - 1);
    218         int b = Utils.clamp(y, 0, img.getHeight() - 1);
    219         int clr = img.getRGB(a, b);
    220         if (a == x && b == y)
    221             return clr;
    222         // keep color components, but set transparency to 0
    223         // (the idea is that border fades out and mixes with next tile)
    224         return clr & 0x00ffffff;
     207        return img.getRGB(
     208                Utils.clamp(x, 0, img.getWidth() - 1),
     209                Utils.clamp(y, 0, img.getHeight() - 1));
    225210    }
    226211}
Note: See TracChangeset for help on using the changeset viewer.