File: /home/padewitte/projets/webcomponents/myscript-js/src/common/penParameters.js
'use strict';
(function (scope) {
/**
* Parameters used for both input and output canvas draw.
*
* @class PenParameters
* @constructor
*/
function PenParameters(obj) {
this.color = 'rgba(0, 0, 0, 0.9)';
this.rectColor = 'rgba(0, 0, 0, 0.2)';
this.font = 'Times New Roman';
this.decoration = 'normal';
this.width = 4;
this.pressureType = 'SIMULATED';
this.alpha = '1.0';
if (obj) {
this.color = obj.color;
this.rectColor = obj.rectColor;
this.font = obj.font;
this.decoration = obj.decoration;
this.width = obj.width;
this.pressureType = obj.pressureType;
this.alpha = obj.alpha;
}
}
/**
* Get the color renderer parameter
*
* @method getColor
* @returns {String} The color of the ink
*/
PenParameters.prototype.getColor = function () {
return this.color;
};
/**
* Set the color renderer parameter
*
* @method setColor
* @param {String} color
*/
PenParameters.prototype.setColor = function (color) {
this.color = color;
};
/**
* Get the rect renderer parameter
*
* @method getRectColor
* @returns {String} the rectangle color
*/
PenParameters.prototype.getRectColor = function () {
return this.rectColor;
};
/**
* Set the rect renderer parameter
*
* @method setRectColor
* @param {String} rectColor
*/
PenParameters.prototype.setRectColor = function (rectColor) {
this.rectColor = rectColor;
};
/**
* Get the font renderer parameter
*
* @method getFont
* @returns {String} The font
*/
PenParameters.prototype.getFont = function () {
return this.font;
};
/**
* Set the font renderer parameter
*
* @method setFont
* @param {String} font
*/
PenParameters.prototype.setFont = function (font) {
this.font = font;
};
/**
* Get the decoration renderer parameter
*
* @method getDecoration
* @returns {String} The decoration
*/
PenParameters.prototype.getDecoration = function () {
return this.decoration;
};
/**
* Set the decoration renderer parameter
*
* @method setDecoration
* @param {String} decoration
*/
PenParameters.prototype.setDecoration = function (decoration) {
this.decoration = decoration;
};
/**
* Get the width renderer parameter
*
* @method getWidth
* @returns {Number} The ink width
*/
PenParameters.prototype.getWidth = function () {
return this.width;
};
/**
* Set the width renderer parameter
*
* @method setWidth
* @param {Number} width
*/
PenParameters.prototype.setWidth = function (width) {
this.width = width;
};
// Export
scope.PenParameters = PenParameters;
})(MyScript);