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