Skip to content

Instantly share code, notes, and snippets.

@ofTheo
Created December 9, 2012 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ofTheo/4245137 to your computer and use it in GitHub Desktop.
Save ofTheo/4245137 to your computer and use it in GitHub Desktop.
OF iOS image picker from library example
#include "testApp.h"
ofxiPhoneImagePicker camera;
ofImage photo;
//--------------------------------------------------------------
void testApp::setup(){
ofBackground(0);
}
//--------------------------------------------------------------
void testApp::update(){
if(camera.imageUpdated){
photo.setFromPixels(camera.pixels, camera.width, camera.height, OF_IMAGE_COLOR_ALPHA);
camera.imageUpdated = false;
camera.close();
}
}
//--------------------------------------------------------------
void testApp::draw(){
ofDrawBitmapString("touch the screen to open the library", 10, 20);
photo.draw(0,0);
}
//--------------------------------------------------------------
void testApp::exit() {
}
//--------------------------------------------------------------
void testApp::touchDown(ofTouchEventArgs & touch){
if(touch.id == 0){
camera.openLibrary();
}
}
//--------------------------------------------------------------
void testApp::touchMoved(ofTouchEventArgs & touch){
}
//--------------------------------------------------------------
void testApp::touchUp(ofTouchEventArgs & touch){
}
//--------------------------------------------------------------
void testApp::touchDoubleTap(ofTouchEventArgs & touch){
}
//--------------------------------------------------------------
void testApp::touchCancelled(ofTouchEventArgs & touch){
}
//--------------------------------------------------------------
void testApp::lostFocus() {
}
//--------------------------------------------------------------
void testApp::gotFocus() {
}
//--------------------------------------------------------------
void testApp::gotMemoryWarning() {
}
//--------------------------------------------------------------
void testApp::deviceOrientationChanged(int newOrientation){
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment