javaquery/canvas/src/main/java/net/java/html/canvas/LinearGradient.java
author Anton Epple <toni.epple@eppleton.de>
Thu, 23 May 2013 09:47:20 +0200
branchcanvas
changeset 1132 368626597f1a
parent 1131 dec5f4e7d031
child 1141 69c81bdaf193
permissions -rw-r--r--
Limited extensibility of Style and it's three allowed subclasses
     1 /**
     2  * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach
     3  * <jaroslav.tulach@apidesign.org>
     4  *
     5  * This program is free software: you can redistribute it and/or modify it under
     6  * the terms of the GNU General Public License as published by the Free Software
     7  * Foundation, version 2 of the License.
     8  *
     9  * This program is distributed in the hope that it will be useful, but WITHOUT
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    11  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    12  * details.
    13  *
    14  * You should have received a copy of the GNU General Public License along with
    15  * this program. Look for COPYING file in the top folder. If not, see
    16  * http://opensource.org/licenses/GPL-2.0.
    17  */
    18 package net.java.html.canvas;
    19 
    20 import java.util.HashMap;
    21 
    22 /**
    23  *
    24  * @author antonepple
    25  */
    26 public class LinearGradient extends Style {
    27 
    28     HashMap<Double,String> stops;
    29     
    30     double x0, y0, x1, y1;
    31 
    32     LinearGradient( double x0, double y0, double x1, double y1) {
    33         this.x0 = x0;
    34         this.y0 = y0;
    35         this.x1 = x1;
    36         this.y1 = y1;
    37     }
    38 
    39     
    40     
    41     void addColorStop(double position, String color){
    42         if (stops == null) stops = new HashMap<>();
    43         stops.put(position, color);
    44     }
    45 
    46     public HashMap<Double, String> getStops() {
    47         return stops;
    48     }
    49 
    50     public void setStops(HashMap<Double, String> stops) {
    51         this.stops = stops;
    52     }
    53 
    54     public double getX0() {
    55         return x0;
    56     }
    57 
    58     public void setX0(double x0) {
    59         this.x0 = x0;
    60     }
    61 
    62     public double getY0() {
    63         return y0;
    64     }
    65 
    66     public void setY0(double y0) {
    67         this.y0 = y0;
    68     }
    69 
    70     public double getX1() {
    71         return x1;
    72     }
    73 
    74     public void setX1(double x1) {
    75         this.x1 = x1;
    76     }
    77 
    78     public double getY1() {
    79         return y1;
    80     }
    81 
    82     public void setY1(double y1) {
    83         this.y1 = y1;
    84     }
    85     
    86 }