2 * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach
3 * <jaroslav.tulach@apidesign.org>
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.
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
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.
18 package net.java.html.canvas;
20 import java.util.HashMap;
21 import java.util.Objects;
27 public class LinearGradient extends Style {
29 HashMap<Double,String> stops;
31 double x0, y0, x1, y1;
33 LinearGradient( double x0, double y0, double x1, double y1) {
42 void addColorStop(double position, String color){
43 if (stops == null) stops = new HashMap<>();
44 stops.put(position, color);
47 public HashMap<Double, String> getStops() {
51 public void setStops(HashMap<Double, String> stops) {
55 public double getX0() {
59 public void setX0(double x0) {
63 public double getY0() {
67 public void setY0(double y0) {
71 public double getX1() {
75 public void setX1(double x1) {
79 public double getY1() {
83 public void setY1(double y1) {
88 public int hashCode() {
90 hash = 29 * hash + Objects.hashCode(this.stops);
91 hash = 29 * hash + (int) (Double.doubleToLongBits(this.x0) ^ (Double.doubleToLongBits(this.x0) >>> 32));
92 hash = 29 * hash + (int) (Double.doubleToLongBits(this.y0) ^ (Double.doubleToLongBits(this.y0) >>> 32));
93 hash = 29 * hash + (int) (Double.doubleToLongBits(this.x1) ^ (Double.doubleToLongBits(this.x1) >>> 32));
94 hash = 29 * hash + (int) (Double.doubleToLongBits(this.y1) ^ (Double.doubleToLongBits(this.y1) >>> 32));
99 public boolean equals(Object obj) {
103 if (getClass() != obj.getClass()) {
106 final LinearGradient other = (LinearGradient) obj;
107 if (!Objects.equals(this.stops, other.stops)) {
110 if (Double.doubleToLongBits(this.x0) != Double.doubleToLongBits(other.x0)) {
113 if (Double.doubleToLongBits(this.y0) != Double.doubleToLongBits(other.y0)) {
116 if (Double.doubleToLongBits(this.x1) != Double.doubleToLongBits(other.x1)) {
119 if (Double.doubleToLongBits(this.y1) != Double.doubleToLongBits(other.y1)) {