From 5dcffcc537f3b6a71bac72b10189481f724b74f2 Mon Sep 17 00:00:00 2001 From: Emux Date: Tue, 28 Feb 2017 20:37:40 +0200 Subject: [PATCH] Graphics API: draw circle Desktop implementation --- vtm-desktop/src/org/oscim/awt/AwtCanvas.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/vtm-desktop/src/org/oscim/awt/AwtCanvas.java b/vtm-desktop/src/org/oscim/awt/AwtCanvas.java index 33f50215..6c3abb3a 100644 --- a/vtm-desktop/src/org/oscim/awt/AwtCanvas.java +++ b/vtm-desktop/src/org/oscim/awt/AwtCanvas.java @@ -1,7 +1,7 @@ /* * Copyright 2010, 2011, 2012, 2013 mapsforge.org * Copyright 2013 Hannes Janetzek - * Copyright 2016 devemux86 + * Copyright 2016-2017 devemux86 * Copyright 2017 nebular * * This file is part of the OpenScienceMap project (http://www.opensciencemap.org). @@ -132,7 +132,21 @@ public class AwtCanvas implements Canvas { @Override public void drawCircle(float x, float y, float radius, Paint paint) { - // TODO + AwtPaint awtPaint = (AwtPaint) paint; + this.canvas.setColor(awtPaint.color); + if (awtPaint.stroke != null) + this.canvas.setStroke(awtPaint.stroke); + float doubleRadius = radius * 2; + + Paint.Style style = paint.getStyle(); + switch (style) { + case FILL: + this.canvas.fillOval((int) (x - radius), (int) (y - radius), (int) doubleRadius, (int) doubleRadius); + break; + case STROKE: + this.canvas.drawOval((int) (x - radius), (int) (y - radius), (int) doubleRadius, (int) doubleRadius); + break; + } } @Override