-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTransform.pde
More file actions
48 lines (43 loc) · 942 Bytes
/
Copy pathTransform.pde
File metadata and controls
48 lines (43 loc) · 942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
PGraphics drawFlipVertically(PImage img) {
PGraphics g = createGraphics(img.width, img.height);
g.beginDraw();
g.push();
g.scale(1,-1);
g.translate(0,-img.height);
g.image(img,0,0);
g.pop();
g.endDraw();
return g;
}
PGraphics drawFlipHorizontally(PImage img) {
PGraphics g = createGraphics(img.width, img.height);
g.beginDraw();
g.push();
g.scale(-1,1);
g.translate(-img.width,0);
g.image(img,0,0);
g.pop();
g.endDraw();
return g;
}
PGraphics drawRotate90Degrees(PImage img) {
PGraphics g = createGraphics(img.width, img.height);
g.beginDraw();
g.push();
g.rotate(radians(90));
g.translate(0,-img.height);
g.image(img,0,0);
g.pop();
g.endDraw();
return g;
}
PGraphics drawToFit(PImage img, float w, float h) {
PGraphics g = createGraphics(int(w),int(h));
g.beginDraw();
g.push();
g.scale(img.width/h,img.height/w);
g.image(img,0,0);
g.pop();
g.endDraw();
return g;
}