Possibilities or unpossibilities of copy()??
in
Programming Questions
•
1 month ago
Hi !
I try to use copy() with PGraphics.
My main idea will be to share the screen displayed as a PImage
I solved it with save() and saveFrame() and after using the frame saved. But the compression destroy the quality of the image.
the best will be to store it directly in a PGraphics.
I tried to use copy in the first way :
copy(sx, sy, sw, sh, dx, dy, dw, dh)
but i can't solve the use of this copy,
i use a very simple code using PGraphics without succes
PGraphics pg; PGraphics ph; PImage img; void setup() { size(100, 100); pg = createGraphics(40, 40); ph=createGraphics(40, 40); } void draw() { pg.beginDraw(); pg.background(100); pg.stroke(255); pg.line(20, 20, mouseX, mouseY); pg.endDraw(); image(pg, 9, 30); ph.beginDraw(); ph.copy(9, 30, 40, 40, 51, 30, 40, 40); ph.endDraw(); image(ph, 51, 30); }
the second pgraphics doesnt appeears so i conclude the copy() method is inefficient.
Could you give me some hints to understand how use copy() in a efficient way to store the screen in a PGraphics?
Thx in advance
Sacha
1