mirror of
https://github.com/lospec/pixel-editor.git
synced 2023-08-10 21:12:51 +03:00
Commit before dropping the fill tool idea and reverting to the first lasso version
This commit is contained in:
14
js/Util.js
14
js/Util.js
@ -1,6 +1,20 @@
|
||||
// Acts as a public static class
|
||||
class Util {
|
||||
|
||||
/** Colors a pixel in an image data
|
||||
*
|
||||
* @param {*} tempImage The imagedata to paint
|
||||
* @param {*} pixelPos Index of the pixel
|
||||
* @param {*} fillColor Color to use to paint
|
||||
*/
|
||||
static colorPixel(tempImage, pixelPos, fillColor) {
|
||||
//console.log('colorPixel:',pixelPos);
|
||||
tempImage.data[pixelPos] = fillColor.r;
|
||||
tempImage.data[pixelPos + 1] = fillColor.g;
|
||||
tempImage.data[pixelPos + 2] = fillColor.b;
|
||||
tempImage.data[pixelPos + 3] = 255;
|
||||
}
|
||||
|
||||
/** Tells if a pixel is empty (has alpha = 0)
|
||||
*
|
||||
* @param {*} pixel
|
||||
|
Reference in New Issue
Block a user