Render themes: line texture improvements, #1005 (#1006)

This commit is contained in:
Emux 2023-01-10 14:40:01 +02:00 committed by GitHub
parent 88d8a7ed8a
commit c36d62e0d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 8 deletions

View File

@ -612,11 +612,11 @@ public class XmlThemeBuilder extends DefaultHandler {
if (b.dashArray != null) {
// Stroke dash array
if (b.dashArray.length == 2) {
if (b.dashArray.length == 1) {
b.randomOffset = false;
b.stipple = b.dashArray[0] < 1 ? 1 : (int) b.dashArray[0];
if (mTheme.isMapsforgeTheme())
b.stipple *= 8;
b.stipple *= Parameters.MAPSFORGE_DASH_FACTOR;
b.stippleWidth = 1;
b.stippleColor = Color.TRANSPARENT;
b.dashArray = null;
@ -634,7 +634,7 @@ public class XmlThemeBuilder extends DefaultHandler {
if (f < 1)
f = 1;
if (mTheme.isMapsforgeTheme())
f *= 8;
f *= Parameters.MAPSFORGE_DASH_FACTOR;
width += f;
}
Bitmap bitmap = CanvasAdapter.newBitmap(width, height, 0);
@ -646,7 +646,7 @@ public class XmlThemeBuilder extends DefaultHandler {
if (f < 1)
f = 1;
if (mTheme.isMapsforgeTheme())
f *= 8;
f *= Parameters.MAPSFORGE_DASH_FACTOR;
canvas.fillRectangle(x, 0, f, height, transparent ? Color.TRANSPARENT : Color.WHITE);
x += f;
transparent = !transparent;

View File

@ -632,11 +632,11 @@ public class XmlThemeBuilder {
if (b.dashArray != null) {
// Stroke dash array
if (b.dashArray.length == 2) {
if (b.dashArray.length == 1) {
b.randomOffset = false;
b.stipple = b.dashArray[0] < 1 ? 1 : (int) b.dashArray[0];
if (mTheme.isMapsforgeTheme())
b.stipple *= 8;
b.stipple *= Parameters.MAPSFORGE_DASH_FACTOR;
b.stippleWidth = 1;
b.stippleColor = Color.TRANSPARENT;
b.dashArray = null;
@ -654,7 +654,7 @@ public class XmlThemeBuilder {
if (f < 1)
f = 1;
if (mTheme.isMapsforgeTheme())
f *= 8;
f *= Parameters.MAPSFORGE_DASH_FACTOR;
width += f;
}
Bitmap bitmap = CanvasAdapter.newBitmap(width, height, 0);
@ -666,7 +666,7 @@ public class XmlThemeBuilder {
if (f < 1)
f = 1;
if (mTheme.isMapsforgeTheme())
f *= 8;
f *= Parameters.MAPSFORGE_DASH_FACTOR;
canvas.fillRectangle(x, 0, f, height, transparent ? Color.TRANSPARENT : Color.WHITE);
x += f;
transparent = !transparent;

View File

@ -48,6 +48,11 @@ public final class Parameters {
*/
public static boolean MAP_EVENT_LAYER2 = false;
/**
* Dash factor for Mapsforge themes.
*/
public static float MAPSFORGE_DASH_FACTOR = 1;
/**
* If true the markers are sorted in y-axis.
*/