export default function SetPixel (context, x, y, red = 0, green = 0, blue = 0, alpha = 255) { const imageData = GetImageData(context, x, y, 1, 1); if (SetPixelData(imageData, 0, 0, red, green, blue, alpha)) { PutImageData(context, imageData, x, y); } return context; }
loadComplete (file) { const ctx = GetContext(this.canvas); ctx.drawImage(file.data, 0, 0); const imageData = GetImageData(ctx, 0, 0, 256, 256); Emboss(imageData); PutImageData(ctx, imageData, 256, 0); }
loadComplete (file) { // Draw the image const ctx = GetContext(this.canvas); ctx.drawImage(file.data, 0, 0); const imageData = GetImageData(ctx); FlipHorizontal(imageData); ctx.clearRect(0, 0, 320, 200); PutImageData(ctx, imageData); }
loadComplete (file) { // Draw the image const ctx = GetContext(this.canvas); ctx.drawImage(file.data, 0, 0); const imageData = GetImageData(ctx); // Process(imageData, this.greyScale); Process(imageData, this.greyScale, 0, 0, 160, 200); // Process(imageData, this.greyScale, 60, 0, 160, 200); // Process(imageData, this.greyScale, 160, 0, 160, 200); // Process(imageData, this.greyScale, 200, 100, 160, 200); ctx.putImageData(imageData, 0, 0); }
loadComplete (file) { // Draw the image const ctx = GetContext(this.canvas); ctx.drawImage(file.data, 0, 0); const imageData = GetImageData(ctx); // Scan from Top to Bottom (Left to Right) console.log(GetFirstPixel(imageData, 0)); // 9x23 // Scan from Bottom to Top (Right to Left) console.log(GetFirstPixel(imageData, 1)); // 180x176 // Scan from Left to Right console.log(GetFirstPixel(imageData, 2)); // 9x23 // Scan from Right to Left console.log(GetFirstPixel(imageData, 3)); // 310x23 }