void VECTOR<TYPE>::push_back(const TYPE& element) { if(mVectorSize >= mVectorCapacity) { changeCapacity( (mVectorCapacity + mGrowthRate) ); } *mpObjPtrs[mVectorSize++] = element; }
void slitScanApp::mouseReleased(int x, int y, int button) { isDraggingLeft = false; isDraggingRight = false; isDraggingWidth = false; if(isDraggingCapacity){ changeCapacity(); isDraggingCapacity = false; } }
void VECTOR<TYPE>::push_back(const TYPE& element) { if(mVectorSize >= mVectorCapacity) { changeCapacity( (mVectorCapacity + mGrowthRate) ); } mpData[mVectorSize] = element; mVectorSize++; }
void VECTOR<TYPE>::push_front(const TYPE& element) { if(mVectorSize >= mVectorCapacity) { changeCapacity( (mVectorCapacity + mGrowthRate) ); } // Right-most item that was shifted out is retained at the last position. mpData[mVectorSize] = shiftRightFromPosition(0); // 1st element was moved to 2nd by shifting right, place new item at 1st location. mpData[0] = element; mVectorSize++; }
void VECTOR<TYPE>::push_front(const TYPE& element) { if(mVectorSize >= mVectorCapacity) { changeCapacity( (mVectorCapacity + mGrowthRate) ); } // Make room to put new item at mpData[0] by moving free right-most pointer back to 0 if( mVectorSize++ >= 1) { mpObjPtrs[0] = shiftRightFromPosition(0); } // 1st element was moved to 2nd by shifting right, place new item at 1st location. *mpObjPtrs[0] = element; }
void VECTOR<TYPE>::reserve(unsigned int size) { changeCapacity(size); }
VECTOR<TYPE>::VECTOR(int initialCapacity) { init(); changeCapacity(initialCapacity); }
void slitScanApp::setup(){ // This makes relative paths work in C++ in Xcode by changing directory to the Resources folder inside the .app bundle // this way you can include your images in the copy phase of the project and don't have to rely on a data/ folder for distribution // //TODO Need a XPlatform solution for this // #ifdef TARGET_OSX // ofDisableDataPath(); // CFBundleRef mainBundle = CFBundleGetMainBundle(); // CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle); // char path[PATH_MAX]; // CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX); // CFRelease(resourcesURL); // chdir(path); // #endif // ofSetVerticalSync(true); ofSetLogLevel(OF_LOG_VERBOSE); capacity = 20; sampleMapStrings.push_back("maps/left_to_right.png"); sampleMapStrings.push_back("maps/right_to_left.png"); sampleMapStrings.push_back("maps/up_to_down.png"); sampleMapStrings.push_back("maps/down_to_up.png"); sampleMapStrings.push_back("maps/hard_noise.png"); sampleMapStrings.push_back("maps/soft_noise.png"); sampleMapStrings.push_back("maps/random_grid.png"); sampleMapStrings.push_back("maps/video_delay.png"); for(int i = 0; i < sampleMapStrings.size(); i++){ ofImage* map = new ofImage(); map->allocate(WIDTH, HEIGHT, OF_IMAGE_GRAYSCALE); map->loadImage(sampleMapStrings[i]); sampleMaps.push_back( map ); } colorImg.allocate(WIDTH,HEIGHT, OF_IMAGE_COLOR); previewImage.allocate(WIDTH, HEIGHT, OF_IMAGE_COLOR); warpImage.allocate(WIDTH, HEIGHT, OF_IMAGE_COLOR); customMap.allocate(WIDTH, HEIGHT, OF_IMAGE_GRAYSCALE); currentSampleMapIndex = 0; isDraggingLeft = false; isDraggingRight = false; isDraggingCapacity = false; isFullScreen = false; isPaused = false; leftClamp = 0.0f; rightClamp = 1.0f; changeCapacity(); initLiveVideo(); warp.setBlending(true); warp.setDelayMap(*(sampleMaps[0])); //load buttons loadYourOwn.loadImage("images/loadyourown.png"); buttonLiveOn.loadImage("images/live_on.png"); buttonMovieOn.loadImage("images/movie_on.png"); buttonPauseOn.loadImage("images/pause_on.png"); buttonPauseOff.loadImage("images/pause_off.png"); buttonBlendingOn.loadImage("images/blending_on.png"); buttonBlendingOff.loadImage("images/blending_off.png"); buttonFullscreenOn.loadImage("images/fullscreen_on.png"); buttonFullscreenOff.loadImage("images/fullscreen_off.png"); leftHandle.loadImage("images/handle_left.png"); rightHandle.loadImage("images/handle_right.png"); frameCapacityBar.loadImage("images/capacity_full.png"); frameCapacityText.loadImage("images/frame_capacity.png"); bottomImage.loadImage("images/bottom_banner.png"); }