PImage and Screen drawing - reusability of code?
in
Programming Questions
•
2 years ago
I'm working on a project which draws some objects on the screen. I need to generate thumbnails of some of the objects. So, obviously I'd like to use the same code which draws the objects to draw the thumbnails. Can anyone help me figure out how to do this elegantly?
I'm aware that I can draw on a PImage pic by saying something like
pic.line(x1,y1,x2,y2);
But when I want to draw on the screen I just say
line(x1,y1,x2,y2);
Obviously I don't want to duplicate my draw routine if I don't have to. What should I do? Is there a PImage that points to the screen? If so I could always use pic.line(x1,y1,x2,y2); and occasionally allow pic = screen. If not, is there a pointer I can change to control where method calls like line(x1,y1,x2,y2); actually draw?
I'm aware that I can draw on a PImage pic by saying something like
pic.line(x1,y1,x2,y2);
But when I want to draw on the screen I just say
line(x1,y1,x2,y2);
Obviously I don't want to duplicate my draw routine if I don't have to. What should I do? Is there a PImage that points to the screen? If so I could always use pic.line(x1,y1,x2,y2); and occasionally allow pic = screen. If not, is there a pointer I can change to control where method calls like line(x1,y1,x2,y2); actually draw?
1