Commit 3b854ef8 authored by Matija Obreza's avatar Matija Obreza

Tile colors with alpha

parent 9624b929
......@@ -187,6 +187,9 @@ public class MappingServiceImpl implements MappingService {
// bi.setRGB(i, 255, Color.red.getRGB());
// }
Color color = new Color(Color.yellow.getRed(), Color.yellow.getGreen(), Color.yellow.getBlue(), 170) ;
final int colorWithAlpha = color.getRGB();
filterService.listGeoTile(true, jsonTree, null, zoom, xtile, ytile, new RowCallbackHandler() {
@Override
public void processRow(ResultSet rs) throws SQLException {
......@@ -202,7 +205,7 @@ public class MappingServiceImpl implements MappingService {
for (int i = -pixelSize / 2; i <= pixelSize / 2; i++) {
for (int j = -pixelSize / 2; j <= pixelSize / 2; j++) {
if (longitude + i >= 0 && latitude + j >= 0 && longitude + i < 256 && latitude + j < 256) {
bi.setRGB(longitude + i, latitude + j, Color.yellow.getRGB());
bi.setRGB(longitude + i, latitude + j, colorWithAlpha);
}
}
}
......
......@@ -367,8 +367,16 @@ public class ExplorerController extends BaseController {
if (newColor.equals(Color.yellow)) {
return imageBytes;
}
final MapColorsFilter mcf = new MapColorsFilter(Color.yellow.getRGB(), newColor.getRGB());
Color origColor = new Color(Color.yellow.getRed(), Color.yellow.getGreen(), Color.yellow.getBlue(), 170) ;
final int originalColor = origColor.getRGB();
Color alphaColor = new Color(newColor.getRed(), newColor.getGreen(), newColor.getBlue(), 170);
final int updatedColor = alphaColor.getRGB();
final MapColorsFilter mcf = new MapColorsFilter(originalColor, updatedColor);
final ByteArrayInputStream bios = new ByteArrayInputStream(imageBytes);
final BufferedImage image = mcf.filter(ImageIO.read(bios), null);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment