Graphics API: draw circle (#295)
This commit is contained in:
parent
a6ecab334c
commit
67afa0b7ab
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2017 nebular
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -61,6 +62,11 @@ public class AndroidCanvas implements Canvas {
|
||||
canvas.drawBitmap(((AndroidBitmap) bitmap).mBitmap, x, y, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawCircle(float x, float y, float radius, Paint paint) {
|
||||
canvas.drawCircle(x, y, radius, ((AndroidPaint) paint).mPaint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawLine(int x1, int y1, int x2, int y2, Paint paint) {
|
||||
canvas.drawLine(x1, y1, x2, y2, ((AndroidPaint) paint).mPaint);
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2017 nebular
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -139,6 +140,16 @@ class AndroidPaint implements Paint {
|
||||
return mPaint.getStrokeWidth();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Style getStyle() {
|
||||
switch (mPaint.getStyle()) {
|
||||
case STROKE:
|
||||
return Style.STROKE;
|
||||
default:
|
||||
return Style.FILL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTextHeight(String text) {
|
||||
mPaint.getTextBounds(text, 0, text.length(), rect);
|
||||
|
@ -2,6 +2,7 @@
|
||||
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2017 nebular
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -129,6 +130,11 @@ public class AwtCanvas implements Canvas {
|
||||
this.canvas.drawImage(((AwtBitmap) bitmap).bitmap, (int) x, (int) y, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawCircle(float x, float y, float radius, Paint paint) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawLine(int x1, int y1, int x2, int y2, Paint paint) {
|
||||
AwtPaint awtPaint = (AwtPaint) paint;
|
||||
|
@ -2,6 +2,7 @@
|
||||
* Copyright 2010, 2011, 2012, 2013 mapsforge.org
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2017 nebular
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -217,6 +218,11 @@ public class AwtPaint implements Paint {
|
||||
return strokeWidth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Style getStyle() {
|
||||
return style;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTextHeight(String text) {
|
||||
Graphics2D graphics2d = bufferedImage.createGraphics();
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2016 Longri
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2017 nebular
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
@ -91,6 +92,11 @@ public class IosCanvas implements Canvas {
|
||||
this.cgBitmapContext.restoreGState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawCircle(float x, float y, float radius, Paint paint) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawLine(int x1, int y1, int x2, int y2, Paint paint) {
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2016 Longri
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2017 nebular
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
@ -342,6 +343,11 @@ public class IosPaint implements Paint {
|
||||
return strokeWidth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Style getStyle() {
|
||||
return style;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTextHeight(String text) {
|
||||
return this.fontHeight;
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2017 nebular
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -94,6 +95,11 @@ public class GwtCanvas implements org.oscim.backend.canvas.Canvas {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawCircle(float x, float y, float radius, Paint paint) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawLine(int x1, int y1, int x2, int y2, Paint paint) {
|
||||
// TODO
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2017 nebular
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -36,6 +37,8 @@ public class GwtPaint implements Paint {
|
||||
//String font = "12px sans-serif";
|
||||
String font = "13px Helvetica";
|
||||
|
||||
Style style;
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return 0;
|
||||
@ -69,7 +72,7 @@ public class GwtPaint implements Paint {
|
||||
|
||||
@Override
|
||||
public void setStyle(Style style) {
|
||||
// TODO
|
||||
this.style = style;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -129,6 +132,11 @@ public class GwtPaint implements Paint {
|
||||
return strokeWidth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Style getStyle() {
|
||||
return style;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTextHeight(String text) {
|
||||
// TODO
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2017 nebular
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -42,6 +43,8 @@ public interface Canvas {
|
||||
*/
|
||||
void drawBitmap(Bitmap bitmap, float x, float y);
|
||||
|
||||
void drawCircle(float x, float y, float radius, Paint paint);
|
||||
|
||||
void drawLine(int x1, int y1, int x2, int y2, Paint paint);
|
||||
|
||||
void fillColor(int color);
|
||||
|
@ -2,6 +2,7 @@
|
||||
* Copyright 2010, 2011, 2012 mapsforge.org
|
||||
* Copyright 2013 Hannes Janetzek
|
||||
* Copyright 2016 devemux86
|
||||
* Copyright 2017 nebular
|
||||
*
|
||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||
*
|
||||
@ -73,6 +74,8 @@ public interface Paint {
|
||||
|
||||
float getStrokeWidth();
|
||||
|
||||
Style getStyle();
|
||||
|
||||
float getTextHeight(String text);
|
||||
|
||||
float getTextWidth(String text);
|
||||
|
Loading…
x
Reference in New Issue
Block a user