本文整理汇总了C++中ofImage::setAnchorPercent方法的典型用法代码示例。如果您正苦于以下问题:C++ ofImage::setAnchorPercent方法的具体用法?C++ ofImage::setAnchorPercent怎么用?C++ ofImage::setAnchorPercent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofImage
的用法示例。
在下文中一共展示了ofImage::setAnchorPercent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
//--------------------------------------------------------------
void testApp::draw(){
img.draw(imgPos.x, imgPos.y, w,h);
img.setAnchorPercent(0.5, 0.5);
}
示例2: setup
//--------------------------------------------------------------
void testApp::setup(){
vidGrabber.setVerbose(true);
vidGrabber.initGrabber(640, 480);
colorImg.allocate(vidGrabber.getWidth(), vidGrabber.getHeight());
greyImage.allocate(vidGrabber.getWidth(), vidGrabber.getHeight());
greyImageSmall.allocate(120, 90);
haarFinder.setup("haarcascade_frontalface_alt2.xml");
img.loadImage("stevejobs.png");
img.setAnchorPercent(0.5, 0.5);
ofEnableAlphaBlending();
}
示例3: setup
//--------------------------------------------------------------
void testApp::setup(){
site.loadImage("site.png");
site.setAnchorPercent(0.5, 0.5);
// zg.load("patches/mouth1.pd", 0, 2, 44100, 256);
ofSetVerticalSync(true);
ofSetFrameRate(60.f);
play = false;
WIDTH = 320;
HEIGHT = 240;
useLiveVideo = false;
int sourceWidth = 320;
int sourceHeight = 240;
vidGrabber.setVerbose(true);
sourceWidth = WIDTH;
sourceHeight = HEIGHT;
vidGrabber.initGrabber(WIDTH, HEIGHT);
/*
vidPlayer.loadMovie("mouth0.mov");
vidPlayer.play();
vidPlayer.setLoopState(OF_LOOP_NORMAL);
sourceWidth = vidPlayer.width;
sourceHeight = vidPlayer.height;
*/
colorImg.allocate(sourceWidth, sourceHeight);
bigGrayImage.allocate(sourceWidth, sourceHeight);
grayImage.allocate(WIDTH, HEIGHT);
grayBg.allocate(WIDTH, HEIGHT);
grayDiff.allocate(WIDTH, HEIGHT);
mouths.setup();
threshold = 80;
gui.addButton("rewind", rewind);
gui.addButton("pause", paused);
gui.addButton("play", play);
gui.addToggle("Use Camera", useLiveVideo);
gui.addContent("Source Image", colorImg);
gui.loadFromXML();
gui.setAutoSave(true);
ofSoundStreamSetup(2,0,this, 44100,256, 1);
}
示例4: draw
/*
Draw area with image
*/
void CenterContainer::draw(ofImage img_){
ofPushStyle();
if(ofGetElapsedTimeMillis() - clickTime < 1000){
float difr = 255-color.r;
float difg = 255-color.g;
float difb = 255-color.b;
float newr = ofMap(ofGetElapsedTimeMillis() - clickTime, 0, 1000, 0, difr);
float newg = ofMap(ofGetElapsedTimeMillis() - clickTime, 0, 1000, 0, difg);
float newb = ofMap(ofGetElapsedTimeMillis() - clickTime, 0, 1000, 0, difb);
path.setColor(ofColor(ofClamp(255-newr, 0, 255),ofClamp(255-newg, 0, 255),ofClamp(255-newb, 0, 255),color.a));//white to color
}else {
path.setColor(color);
}
path.draw();
LineSegment line1 = LineSegment(nw,se);
LineSegment line2 = LineSegment(ne,sw);
ofVec2f intersection;
line1.Intersect(line2, intersection);
if(ofGetElapsedTimeMillis() - clickTime < 1000){
float difr = 255-color.r;
float difg = 255-color.g;
float difb = 255-color.b;
float newr = ofMap(ofGetElapsedTimeMillis() - clickTime, 0, 1000, 0, difr);
float newg = ofMap(ofGetElapsedTimeMillis() - clickTime, 0, 1000, 0, difg);
float newb = ofMap(ofGetElapsedTimeMillis() - clickTime, 0, 1000, 0, difb);
ofSetColor(ofColor(ofClamp(color.r+newr, 0, 255), ofClamp(color.g+newg, 0, 255),ofClamp(color.b+newb, 0, 255),color.a));
//color to white
}else {
ofSetColor(ofColor::white,color.a);
}
img_.setAnchorPercent(0.5, 0.5);
img_.draw(intersection.x, intersection.y,30,30);
ofPopStyle();
}