1 /* DrawOfPages: Take notes with touchscreen input. 2 * Copyright (C) 2017 Marko Semet(Marko10_000) 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <https://www.gnu.org/licenses/>. 16 */ 17 module drawofpages.draw; 18 19 private 20 { 21 import structuresd.dimension; 22 } 23 24 public alias Point2D = Point!2; 25 public alias Square = Cuboid!2; 26 public alias Circle = Sphere!2; 27 28 public struct Color { 29 float r = 0; 30 float g = 0; 31 float b = 0; 32 float a = 1; 33 34 public this(float r, float g, float b) 35 { 36 this.r = r; 37 this.g = g; 38 this.b = b; 39 this.a = 1; 40 } 41 public this(float r, float g, float b, float a) 42 { 43 this.r = r; 44 this.g = g; 45 this.b = b; 46 this.a = a; 47 } 48 49 public enum RED = Color(1, 0, 0); 50 public enum GREEN = Color(0, 1, 0); 51 public enum BLUE = Color(0, 0, 1); 52 public enum YELLOW = Color(1, 1, 0); 53 public enum ORANGE = Color(1, 0.5, 0); 54 public enum CYAN = Color(0, 1, 1); 55 public enum PURPLE = Color(1, 0, 1); 56 public enum BLACK = Color(0, 0, 0); 57 public enum GRAY = Color(0.5, 0.5, 0.5); 58 public enum WHITE = Color(1, 1, 1); 59 public enum TRANSPARENT = Color(0, 0, 0, 0); 60 } 61 62 public interface Draw 63 { 64 void drawCirc(Point2D center, float radius, Color color); 65 void drawLine(Point2D from, Point2D to, double size, Color color); 66 void drawRect(Square square, Color color); 67 void redraw(); 68 }