added desaturate effect control

This commit is contained in:
Bala Clark 2011-08-30 23:23:30 +02:00
parent 8361c754f9
commit 41626d8ab7

View file

@ -178,6 +178,8 @@ function ComicBook(id, srcs, opts) {
ComicBook.prototype.enhance.brightness({ contrast: ui.value }); ComicBook.prototype.enhance.brightness({ contrast: ui.value });
} }
})) }))
.append("<input type='checkbox' id='desaturate' />")
.append("<label for='desaturate'>Desaturate</label>")
.css({ .css({
position: "absolute", position: "absolute",
top: "40%", top: "40%",
@ -208,10 +210,19 @@ function ComicBook(id, srcs, opts) {
* TODO: center, make sure they never leave the visible portion of the screen * TODO: center, make sure they never leave the visible portion of the screen
*/ */
ComicBook.prototype.renderControls = function() { ComicBook.prototype.renderControls = function() {
$(canvas) $(canvas)
.after(this.getControl("navigation").left) .after(this.getControl("navigation").left)
.after(this.getControl("navigation").right) .after(this.getControl("navigation").right)
.after(this.getControl("image").hide()); .after(this.getControl("image").hide());
$("#desaturate").click(function(e){
if (this.checked) {
ComicBook.prototype.enhance.desaturate();
} else {
ComicBook.prototype.enhance.resaturate();
}
})
}; };
ComicBook.prototype.getControl = function(control) { ComicBook.prototype.getControl = function(control) {
@ -533,6 +544,14 @@ function ComicBook(id, srcs, opts) {
init(); init();
}, },
/**
* Undo desaturate
*/
resaturate: function() {
delete options.enhance.desaturate;
ComicBook.prototype.drawPage();
},
/** /**
* Sharpen * Sharpen
* *