this.height) { this.stretchHeight = this.measureHeight(); }
}
if (this.stretchWidth == null) {
this.stretchWidth = this.width;
if (this.measureWidth() > this.width) { this.stretchWidth = this.measureWidth(); }
}
// define box for gradient
this.beginPath();
this.rect(0, 0, this.stretchWidth, this.stretchHeight);
this.closePath();
// create gradient color
var g;
if (this.gradientType == 'linear') {
if (this.gradientOrientation == 'vertical') {
g = this.createLinearGradient(0,0,0,this.stretchHeight);
}
if (this.gradientOrientation == 'horizontal') {
g = this.createLinearGradient(0,this.stretchHeight,this.stretchWidth,this.stretchHeight);
}
if (this.gradientOrientation == 'diagonalleft') {
g = this.createLinearGradient(0,0,this.stretchWidth,this.stretchHeight);
}
if (this.gradientOrientation == 'diagonalright') {
g = this.createLinearGradient(this.stretchWidth,0,0,this.stretchHeight);
}
}
if (this.gradientType == 'radial') {
g = this.createRadialGradient(0-(this.stretchWidth*.5),-(this.stretchHeight*.5),0,this.stretchWidth*1.5,this.stretchHeight*1.5,0);
}
if ((g != null) && (this.colorFrom != null)) {
this.globalAlpha = 1;
g.addColorStop(0, this.colorFrom);
g.addColorStop(1, this.colorTo != null ? this.colorTo : this.colorFrom);
this.fillStyle = g;
this.fill();
}
if ((this.borderSize > 0) || (this.borderSizeTop > 0)) {
if (this.borderColorTop == null) {
this.borderColorTop = this.borderColor;
}
// create top border
this.beginPath();
var borderWidth = this.borderSizeTop ? this.borderSizeTop : this.borderSize;
var borderOffset = borderWidth - 1;
this.moveTo(borderOffset,borderOffset);
this.lineTo(this.stretchWidth,borderOffset);
this.strokeStyle = this.borderColorTop;
this.lineWidth = borderWidth;
this.stroke();
this.closePath();
}
if ((this.borderSize > 0) || (this.borderSizeBottom > 0)) {
if (this.borderColorBottom == null) {
this.borderColorBottom = this.borderColor;
}
// create bottom border
this.beginPath();
var borderWidth = this.borderSizeBottom ? this.borderSizeBottom : this.borderSize;
var borderOffset = borderWidth - 1;
this.moveTo(borderOffset,this.stretchHeight-1);
this.lineTo(this.stretchWidth,this.stretchHeight-1);
this.strokeStyle = this.borderColorBottom;
this.lineWidth = borderWidth;
this.stroke();
this.closePath();
}
if ((this.borderSize > 0) || (this.borderSizeLeft > 0)) {
if (this.borderColorLeft == null) {
this.borderColorLeft= this.borderColor;
}
// create left border
this.beginPath();
var borderWidth = this.borderSizeLeft ? this.borderSizeLeft : this.borderSize;
var borderOffset = borderWidth - 1;
this.moveTo(borderOffset,borderOffset);
this.lineTo(borderOffset,this.stretchHeight-borderOffset);
this.strokeStyle = this.borderColorLeft;
this.lineWidth = borderWidth;
this.stroke();
this.closePath();
}
if ((this.borderSize > 0) || (this.borderSizeRight > 0)) {
if (this.borderColorRight == null) {
this.borderColorRight= this.borderColor;
}
// create right border
this.beginPath();
var borderWidth = this.borderSizeRight ? this.borderSizeRight : this.borderSize;
var borderOffset = borderWidth - 1;
this.moveTo(this.stretchWidth-1,borderOffset);
this.lineTo(this.stretchWidth-1,this.stretchHeight-1);
this.strokeStyle = this.borderColorRight;
this.lineWidth = borderWidth;
this.stroke();
this.closePath();
}
]]>