Changeset 11954 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2017-04-19T00:27:28+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/ImageWarp.java
r11915 r11954 168 168 for (int i = 0; i < imgTarget.getWidth(); i++) { 169 169 Point2D srcCoord = invTransform.transform(new Point2D.Double(i, j)); 170 if ( isInside(srcCoord, srcRect, interpolation.getMargin())) {170 if (srcRect.contains(srcCoord)) { 171 171 int rgba; 172 172 switch (interpolation) { … … 203 203 } 204 204 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 214 205 private static int getColor(int x, int y, BufferedImage img) { 215 206 // 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)); 225 210 } 226 211 }
Note:
See TracChangeset
for help on using the changeset viewer.