Mapsforge themes compatibility improvements #388 #100

This commit is contained in:
Emux
2017-09-02 18:36:49 +03:00
parent b695d43fee
commit f4f8eb8d1c
20 changed files with 276 additions and 229 deletions

View File

@@ -186,6 +186,16 @@ public class AwtCanvas implements Canvas {
fillRectangle(0, 0, getWidth(), getHeight(), color);
}
@Override
public void fillRectangle(float x, float y, float width, float height, int color) {
java.awt.Color awtColor = color == Color.TRANSPARENT ? TRANSPARENT : new java.awt.Color(color);
Composite originalComposite = this.canvas.getComposite();
this.canvas.setComposite(AlphaComposite.getInstance(color == Color.TRANSPARENT ? AlphaComposite.CLEAR : AlphaComposite.SRC_OVER));
this.canvas.setColor(awtColor);
this.canvas.fillRect((int) x, (int) y, (int) width, (int) height);
this.canvas.setComposite(originalComposite);
}
@Override
public int getHeight() {
return this.bitmap != null ? this.bitmap.getHeight() : 0;
@@ -195,14 +205,4 @@ public class AwtCanvas implements Canvas {
public int getWidth() {
return this.bitmap != null ? this.bitmap.getWidth() : 0;
}
@Override
public void fillRectangle(int x, int y, int width, int height, int color) {
java.awt.Color awtColor = color == Color.TRANSPARENT ? TRANSPARENT : new java.awt.Color(color);
Composite originalComposite = this.canvas.getComposite();
this.canvas.setComposite(AlphaComposite.getInstance(color == Color.TRANSPARENT ? AlphaComposite.CLEAR : AlphaComposite.SRC_OVER));
this.canvas.setColor(awtColor);
this.canvas.fillRect(x, y, width, height);
this.canvas.setComposite(originalComposite);
}
}