function start() {
//alert("Baah");
var myImg = $("img").prop("src");
var myDistance = 50;
console.log(myImg);
var f = function(myImg) {
//do something with returned image
};
var c = comicify(myImg, myDistance, f);
};
function comicify(img, dist, outf) {
var t = this;
t.srcimg = img;
t.distance = dist;
t.outfun = outf;
t.container = $("
"); //$("#resultHolder");
t.process();
}
comicify.prototype = {
draw: function(container) {
var t = this;
t.container = container;
var input = $('').val(t.distance).change(function() {
t.distance = this.value;
if ('' != t.srcimg[0].src) {
t.process();
}
});
container.append($('
').text("Directions:").append(
$('
')
.append($('
').text("Set the distance to distance (manitude between color vecotrs) that defines a single (new) color"))
.append($('
').text("Paste an image to the page"))
.append($('
').text("Wait -- you're processing an image in Javascript..."))
));
container.append($('
').append($('').text("Distance:").width("400px")).append(input))
t.srcimg = $('');
t.srcimg.load(function() {
t.process()
});
container.on('paste', function(evt) {
return (t.handlePaste(evt));
});
},
handlePaste: function(evt) {
var t = this;
var items = evt.originalEvent.clipboardData.items,
paste;
for (var i in items) {
if ('file' == items[i].kind) {
var fr = new FileReader();
console.log("Going");
fr.onload = function(revt) {
t.srcimg[0].src = revt.target.result;
}
fr.readAsDataURL(items[i].getAsFile());
}
}
},
process: function() {
var t = this;
var canvas = $('
The Ultimate Keto Meal Plan The keto diet bucks the trend when it comes to diets and there is even reason to suggest it works better too. << Click here to watch the video >>
Comments
Post a Comment