Graphics API: draw line using floats
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
* Copyright 2017 nebular
|
* Copyright 2017 nebular
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
@@ -68,7 +68,7 @@ public class AndroidCanvas implements Canvas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawLine(int x1, int y1, int x2, int y2, Paint paint) {
|
public void drawLine(float x1, float y1, float x2, float y2, Paint paint) {
|
||||||
canvas.drawLine(x1, y1, x2, y2, ((AndroidPaint) paint).mPaint);
|
canvas.drawLine(x1, y1, x2, y2, ((AndroidPaint) paint).mPaint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -150,12 +150,12 @@ public class AwtCanvas implements Canvas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawLine(int x1, int y1, int x2, int y2, Paint paint) {
|
public void drawLine(float x1, float y1, float x2, float y2, Paint paint) {
|
||||||
AwtPaint awtPaint = (AwtPaint) paint;
|
AwtPaint awtPaint = (AwtPaint) paint;
|
||||||
this.canvas.setColor(awtPaint.color);
|
this.canvas.setColor(awtPaint.color);
|
||||||
if (awtPaint.stroke != null)
|
if (awtPaint.stroke != null)
|
||||||
this.canvas.setStroke(awtPaint.stroke);
|
this.canvas.setStroke(awtPaint.stroke);
|
||||||
this.canvas.drawLine(x1, y1, x2, y2);
|
this.canvas.drawLine((int) x1, (int) y1, (int) x2, (int) y2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2016 Longri
|
* Copyright 2016 Longri
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
* Copyright 2017 nebular
|
* Copyright 2017 nebular
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify it under the
|
* This program is free software: you can redistribute it and/or modify it under the
|
||||||
@@ -98,8 +98,7 @@ public class IosCanvas implements Canvas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawLine(int x1, int y1, int x2, int y2, Paint paint) {
|
public void drawLine(float x1, float y1, float x2, float y2, Paint paint) {
|
||||||
|
|
||||||
//flip Y-axis
|
//flip Y-axis
|
||||||
y1 = (int) (this.cgBitmapContext.getHeight() - y1);
|
y1 = (int) (this.cgBitmapContext.getHeight() - y1);
|
||||||
y2 = (int) (this.cgBitmapContext.getHeight() - y2);
|
y2 = (int) (this.cgBitmapContext.getHeight() - y2);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
* Copyright 2017 nebular
|
* Copyright 2017 nebular
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
@@ -101,7 +101,7 @@ public class GwtCanvas implements org.oscim.backend.canvas.Canvas {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawLine(int x1, int y1, int x2, int y2, Paint paint) {
|
public void drawLine(float x1, float y1, float x2, float y2, Paint paint) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
* Copyright 2017 nebular
|
* Copyright 2017 nebular
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
@@ -45,7 +45,7 @@ public interface Canvas {
|
|||||||
|
|
||||||
void drawCircle(float x, float y, float radius, Paint paint);
|
void drawCircle(float x, float y, float radius, Paint paint);
|
||||||
|
|
||||||
void drawLine(int x1, int y1, int x2, int y2, Paint paint);
|
void drawLine(float x1, float y1, float x2, float y2, Paint paint);
|
||||||
|
|
||||||
void fillColor(int color);
|
void fillColor(int color);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user