From b0cedde0a9b084f91e0084267a3c790742f0d415 Mon Sep 17 00:00:00 2001 From: Alinson Xavier Date: Fri, 12 Apr 2019 05:17:31 -0500 Subject: [PATCH] Partial kotlin implementation of IosCanvas --- .../org/isoron/platform/gui/IosCanvas.kt | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 core/src/iosMain/kotlin/org/isoron/platform/gui/IosCanvas.kt diff --git a/core/src/iosMain/kotlin/org/isoron/platform/gui/IosCanvas.kt b/core/src/iosMain/kotlin/org/isoron/platform/gui/IosCanvas.kt new file mode 100644 index 000000000..170589c31 --- /dev/null +++ b/core/src/iosMain/kotlin/org/isoron/platform/gui/IosCanvas.kt @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2016-2019 Álinson Santos Xavier + * + * This file is part of Loop Habit Tracker. + * + * Loop Habit Tracker is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. + * + * Loop Habit Tracker is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +package org.isoron.platform.gui + +import platform.CoreGraphics.* +import platform.UIKit.* + +val Color.uicolor: UIColor + get() = UIColor.colorWithRed(this.red, this.green, this.blue, this.alpha) + +val Color.cgcolor: CGColorRef? + get() = uicolor.CGColor + +class IosCanvas() : Canvas { + val ctx = UIGraphicsGetCurrentContext() + var textColor = UIColor.blackColor + + override fun setColor(color: Color) { + CGContextSetStrokeColorWithColor(ctx, color.cgcolor) + CGContextSetFillColorWithColor(ctx, color.cgcolor) + textColor = color.uicolor + } + + override fun drawLine(x1: Double, y1: Double, x2: Double, y2: Double) { + } + + override fun drawText(text: String, x: Double, y: Double) { + } + + override fun fillRect(x: Double, y: Double, width: Double, height: Double) { + } + + override fun drawRect(x: Double, y: Double, width: Double, height: Double) { + } + + override fun getHeight(): Double { + return 0.0 + } + + override fun getWidth(): Double { + return 0.0 + } + + override fun setFont(font: Font) { + } + + override fun setFontSize(size: Double) { + } + + override fun setStrokeWidth(size: Double) { + } + + override fun fillArc(centerX: Double, + centerY: Double, + radius: Double, + startAngle: Double, + swipeAngle: Double) { + } + + override fun fillCircle(centerX: Double, centerY: Double, radius: Double) { + } + + override fun setTextAlign(align: TextAlign) { + } +} \ No newline at end of file