/**
 * ---- p5.js drawing utility ------------------------------------------------
 */ 0 ; param renderer param x param y param red param green param blue param pixelDensity export function setPixel ( renderer , x , y , red , green , blue , alpha , pixelDensity ? ) { const g = renderer as p5 ; const d = pixelDensity || g . pixelDensity ( ) ; const graphicsPixels = g . pixels ; for ( let i = 0 ; i < d ; i += 1 ) { for ( let j = 0 ; j < d ; j += 1 ) { const idx = 4 * ( ( y * d + j ) * g . width * d + ( x * d + i ) ) ; graphicsPixels [ idx ] = red ; graphicsPixels [ idx + 1 ] = green ; graphicsPixels [ idx + 2 ] = blue ; graphicsPixels [ idx + 3 ] = alpha ; } } } param p param drawCallback export function createPixels ( p , drawCallback ) { p . push ( ) ; drawCallback ( p ) ; p . pop ( ) ; p . loadPixels ( ) ; return p . pixels ; }