summaryrefslogtreecommitdiff
path: root/menuApp/src/ofApp.cpp
diff options
context:
space:
mode:
authortim <tim@eclectronics.org>2017-06-12 23:17:46 +0100
committertim <tim@eclectronics.org>2017-06-12 23:17:46 +0100
commitfd37c61cd45c1c7a4786b12db8140680772cb1be (patch)
treee7e036a11de58289c152139a464c8fbf1d9ee431 /menuApp/src/ofApp.cpp
parentb2e4d58259d8e4ca744d40ad53bb3ca5e3d0ed3d (diff)
possible grabbing fix by rotation
Diffstat (limited to 'menuApp/src/ofApp.cpp')
-rw-r--r--menuApp/src/ofApp.cpp22
1 files changed, 20 insertions, 2 deletions
diff --git a/menuApp/src/ofApp.cpp b/menuApp/src/ofApp.cpp
index ce141de..81350ac 100644
--- a/menuApp/src/ofApp.cpp
+++ b/menuApp/src/ofApp.cpp
@@ -186,6 +186,14 @@ void ofApp::draw(){
loadInstagramFeed();
}
+ofPushMatrix();
+
+ if(ROTATION>0){
+ ofTranslate(540*FACTOR,960*FACTOR);
+ ofRotate(-ROTATION);
+ ofTranslate(-120*FACTOR,-540*FACTOR);
+ }
+
ofPushMatrix(); //Store the coordinate system nexessary for some reason
background.draw(0,0,1080*FACTOR,1920*FACTOR); //ofGetWidth(),ofGetHeight());
ofPopMatrix(); //Restore the coordinate system
@@ -242,7 +250,17 @@ ofPopMatrix(); //Restore the coordinate system
//hence the "primed" mechanism
if (primed){
ofImage img;
- img.grabScreen(0, 0,1080*FACTOR,1920*FACTOR);
+ //float rotation=ofDegToRad(ROTATION);
+ //int width=(1920*FACTOR*sin(rotation))+(1080*FACTOR*cos(rotation));
+ //int height=(1920*FACTOR*cos(rotation))+(1080*FACTOR*sin(rotation));
+ img.grabScreen(0, 0,1920*FACTOR,1920*FACTOR);
+ if(ROTATION>0){
+ img.rotate90(1);
+ img.crop(860*FACTOR,0,1080*FACTOR,1920*FACTOR);
+ }
+ else {
+ img.crop(0,0,1080*FACTOR,1920*FACTOR);
+ }
img.save(SCREENGRABFILEPATH);
primed=false;
}
@@ -252,7 +270,7 @@ ofPopMatrix(); //Restore the coordinate system
isGrabbed=true;
}
-
+ofPopMatrix();
}