1.1 --- a/javaquery/canvas/src/main/java/net/java/html/canvas/LinearGradient.java Mon May 27 10:04:39 2013 +0200
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,125 +0,0 @@
1.4 -/**
1.5 - * Back 2 Browser Bytecode Translator Copyright (C) 2012 Jaroslav Tulach
1.6 - * <jaroslav.tulach@apidesign.org>
1.7 - *
1.8 - * This program is free software: you can redistribute it and/or modify it under
1.9 - * the terms of the GNU General Public License as published by the Free Software
1.10 - * Foundation, version 2 of the License.
1.11 - *
1.12 - * This program is distributed in the hope that it will be useful, but WITHOUT
1.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1.14 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
1.15 - * details.
1.16 - *
1.17 - * You should have received a copy of the GNU General Public License along with
1.18 - * this program. Look for COPYING file in the top folder. If not, see
1.19 - * http://opensource.org/licenses/GPL-2.0.
1.20 - */
1.21 -package net.java.html.canvas;
1.22 -
1.23 -import java.util.HashMap;
1.24 -import java.util.Objects;
1.25 -
1.26 -/**
1.27 - *
1.28 - * @author antonepple
1.29 - */
1.30 -public class LinearGradient extends Style {
1.31 -
1.32 - HashMap<Double,String> stops;
1.33 -
1.34 - double x0, y0, x1, y1;
1.35 -
1.36 - LinearGradient( double x0, double y0, double x1, double y1) {
1.37 - this.x0 = x0;
1.38 - this.y0 = y0;
1.39 - this.x1 = x1;
1.40 - this.y1 = y1;
1.41 - }
1.42 -
1.43 -
1.44 -
1.45 - void addColorStop(double position, String color){
1.46 - if (stops == null) stops = new HashMap<>();
1.47 - stops.put(position, color);
1.48 - }
1.49 -
1.50 - public HashMap<Double, String> getStops() {
1.51 - return stops;
1.52 - }
1.53 -
1.54 - public void setStops(HashMap<Double, String> stops) {
1.55 - this.stops = stops;
1.56 - }
1.57 -
1.58 - public double getX0() {
1.59 - return x0;
1.60 - }
1.61 -
1.62 - public void setX0(double x0) {
1.63 - this.x0 = x0;
1.64 - }
1.65 -
1.66 - public double getY0() {
1.67 - return y0;
1.68 - }
1.69 -
1.70 - public void setY0(double y0) {
1.71 - this.y0 = y0;
1.72 - }
1.73 -
1.74 - public double getX1() {
1.75 - return x1;
1.76 - }
1.77 -
1.78 - public void setX1(double x1) {
1.79 - this.x1 = x1;
1.80 - }
1.81 -
1.82 - public double getY1() {
1.83 - return y1;
1.84 - }
1.85 -
1.86 - public void setY1(double y1) {
1.87 - this.y1 = y1;
1.88 - }
1.89 -
1.90 - @Override
1.91 - public int hashCode() {
1.92 - int hash = 7;
1.93 - hash = 29 * hash + Objects.hashCode(this.stops);
1.94 - hash = 29 * hash + (int) (Double.doubleToLongBits(this.x0) ^ (Double.doubleToLongBits(this.x0) >>> 32));
1.95 - hash = 29 * hash + (int) (Double.doubleToLongBits(this.y0) ^ (Double.doubleToLongBits(this.y0) >>> 32));
1.96 - hash = 29 * hash + (int) (Double.doubleToLongBits(this.x1) ^ (Double.doubleToLongBits(this.x1) >>> 32));
1.97 - hash = 29 * hash + (int) (Double.doubleToLongBits(this.y1) ^ (Double.doubleToLongBits(this.y1) >>> 32));
1.98 - return hash;
1.99 - }
1.100 -
1.101 - @Override
1.102 - public boolean equals(Object obj) {
1.103 - if (obj == null) {
1.104 - return false;
1.105 - }
1.106 - if (getClass() != obj.getClass()) {
1.107 - return false;
1.108 - }
1.109 - final LinearGradient other = (LinearGradient) obj;
1.110 - if (!Objects.equals(this.stops, other.stops)) {
1.111 - return false;
1.112 - }
1.113 - if (Double.doubleToLongBits(this.x0) != Double.doubleToLongBits(other.x0)) {
1.114 - return false;
1.115 - }
1.116 - if (Double.doubleToLongBits(this.y0) != Double.doubleToLongBits(other.y0)) {
1.117 - return false;
1.118 - }
1.119 - if (Double.doubleToLongBits(this.x1) != Double.doubleToLongBits(other.x1)) {
1.120 - return false;
1.121 - }
1.122 - if (Double.doubleToLongBits(this.y1) != Double.doubleToLongBits(other.y1)) {
1.123 - return false;
1.124 - }
1.125 - return true;
1.126 - }
1.127 -
1.128 -}