2011-03-07 00:50:44 +00:00
|
|
|
/*
|
|
|
|
* Paper.js
|
|
|
|
*
|
|
|
|
* This file is part of Paper.js, a JavaScript Vector Graphics Library,
|
|
|
|
* based on Scriptographer.org and designed to be largely API compatible.
|
2011-03-08 01:41:50 +00:00
|
|
|
* http://paperjs.org/
|
2011-03-07 00:50:44 +00:00
|
|
|
* http://scriptographer.org/
|
|
|
|
*
|
2011-03-08 01:41:50 +00:00
|
|
|
* Distributed under the MIT license. See LICENSE file for details.
|
|
|
|
*
|
2011-03-07 00:50:44 +00:00
|
|
|
* Copyright (c) 2011, Juerg Lehni & Jonathan Puckey
|
|
|
|
* http://lehni.org/ & http://jonathanpuckey.com/
|
|
|
|
*
|
2011-03-08 01:41:50 +00:00
|
|
|
* All rights reserved.
|
2011-03-07 00:50:44 +00:00
|
|
|
*/
|
|
|
|
|
2011-03-04 13:34:31 +00:00
|
|
|
var GradientStop = this.GradientStop = Base.extend({
|
2011-02-19 22:50:37 +01:00
|
|
|
beans: true,
|
|
|
|
|
|
|
|
// TODO: support midPoint? (initial tests didn't look nice)
|
|
|
|
initialize: function(color, rampPoint) {
|
2011-03-05 01:26:12 +00:00
|
|
|
this.setColor(color);
|
|
|
|
this.setRampPoint(rampPoint);
|
2011-02-19 22:50:37 +01:00
|
|
|
},
|
2011-03-03 22:45:17 +00:00
|
|
|
|
2011-02-19 22:50:37 +01:00
|
|
|
getRampPoint: function() {
|
|
|
|
return this._rampPoint;
|
|
|
|
},
|
2011-03-03 22:45:17 +00:00
|
|
|
|
2011-02-19 22:50:37 +01:00
|
|
|
setRampPoint: function(rampPoint) {
|
2011-05-18 09:38:20 +01:00
|
|
|
this._rampPoint = rampPoint || 0;
|
2011-02-19 22:50:37 +01:00
|
|
|
},
|
2011-03-03 22:45:17 +00:00
|
|
|
|
2011-02-19 22:50:37 +01:00
|
|
|
getColor: function() {
|
|
|
|
return this._color;
|
|
|
|
},
|
2011-03-03 22:45:17 +00:00
|
|
|
|
2011-03-08 17:17:36 +00:00
|
|
|
setColor: function(color) {
|
2011-02-19 22:50:37 +01:00
|
|
|
this._color = Color.read(arguments);
|
2011-05-05 20:28:28 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
equals: function(stop) {
|
|
|
|
if (stop == this) {
|
|
|
|
return true;
|
|
|
|
} else if (stop instanceof GradientStop) {
|
|
|
|
return this._color.equals(stop._color)
|
|
|
|
&& rampPoint == stop.rampPoint;
|
|
|
|
}
|
|
|
|
return false;
|
2011-02-19 22:50:37 +01:00
|
|
|
}
|
2011-03-03 16:32:55 +00:00
|
|
|
});
|