Open KevinWorkman opened 6 years ago
I think that this feature should be present . The reason why it is setting a single transparent pixel is the current set method checks whether the third parameter imgOrCol is an p5.Image instance or a color value. In case it is neither if them, it sets the value of the pixel mentioned as [0, 0, 0, 0]. We can check its implementation here .
We can check if the imgOrCol parameter is p5.Image instance or p5.Graphics instance, then we can set the pixels of one p5.Graphics instance from another.
Also , if we pass a image as the third parameter set(x, y, image) the image fills the entire canvas from x, y onwards. Is this the intended behavior ?
Should we pass the height and width here
as
this.drawingContext.drawImage(imgOrCol.canvas, x, y, imgOrCol.width, imgOrCol.height);
Would love your suggestions , Thank you!
Nature of issue?
Most appropriate sub-area of p5.js?
createGraphics()
set()
Which platform were you using when you encountered this?
Details about the bug:
From this Stack Overflow question.
It appears that the
set()
function does not work withP5.Graphics
values. Is this expected?I would expect this to create a graphics that contains a red rectangle, and then draw a blue rectangle to that first graphics. Instead, only a single pixel is set, and it's set to transparent?