Tool plugin architecture with eraser/pen/paintbucket tools.

This commit is contained in:
Vince
2012-08-31 10:45:07 +02:00
parent 70ad2760df
commit ca04f8db4d
20 changed files with 614 additions and 85 deletions

View File

@ -0,0 +1,41 @@
/*
* @provide pskl.drawingtools.SimplePen
*
* @require pskl.utils
*/
(function() {
var ns = $.namespace("pskl.drawingtools");
ns.SimplePen = function() {
this.toolId = "tool-pen"
};
pskl.utils.inherit(ns.SimplePen, ns.BaseTool);
/**
* @override
*/
ns.SimplePen.prototype.applyToolOnFrameAt = function(col, row, frame, color) {
var color = pskl.utils.normalizeColor(color);
if (color != frame[col][row]) {
frame[col][row] = color;
}
};
/**
* @override
*/
ns.SimplePen.prototype.applyToolOnCanvasAt = function(col, row, canvas, frame, color, dpi) {
this.drawPixelInCanvas(col, row, canvas, color, dpi);
};
/**
* @override
*/
ns.SimplePen.prototype.releaseToolAt = function() {
// Do nothing
console.log('SimplePen release');
};
})();