Example #1
0
//--------------------------------------------------------------
void Input::draw() {
  updateTextureIfNeeded();
  
  ofClear(0.f);
  ofSetColor(ofColor::white);
  
  ofTexture& input = raw();
  
  // Center images using original as anchor
  {
  ofPushMatrix();
  ofRectangle rect(0, 0, input.getWidth(), input.getHeight());
  center(rect, angle);
  applyRotation(input, angle);
  input.draw(0, 0);
  ofPopMatrix(); /* Center images */
  }
  
  // Draw bounding box for crop
  {
  ofPushMatrix();
  ofRectangle rect(x-1, y-1, w+2, h+2);
  center(rect, 0);
  ofNoFill();
  ofSetColor(ofColor::red);
  ofDrawRectangle(rect);
  ofPopMatrix();
  }
  
  gui.draw();
}
void ofxThreadedImage::update(){

	if(imageLoaded){
		updateTextureIfNeeded();
	}

	if(pendingNotification){
		ofxThreadedImageEvent event;
		event.image = this;
		if(problemLoading){
			event.loaded = false;
			imageLoaded = false;
		}
		ofNotifyEvent( imageReadyEvent, event, this );
		pendingNotification = false;
	}
}
void ofxThreadedImage::draw(float _x, float _y, float _w, float _h, bool fadeInOnLoad){

	if(imageLoaded){
		updateTextureIfNeeded();
	}

	if (imageLoaded && fadeInOnLoad && alpha < 1.0f){
		if (whatToDo == LOAD_HTTP || whatToDo == LOAD){
			alpha += alphaRiseSpeed;
			if(alpha > 1.0) alpha = 1.0;
		}

		ofPushStyle();
			ofSetColor(255,255,255, 255 * alpha);
			ofImage::draw(_x, _y, _w, _h);
        ofPopStyle();

	}else{
		if(tex.bAllocated()){
			ofImage::draw(_x, _y, _w, _h);
		}
	}
}
Example #4
0
//--------------------------------------------------------------
ofPixels& Input::processed() {
  updateTextureIfNeeded();
  return result;
}