当前位置: 首页>>代码示例>>C++>>正文


C++ ofImage::setAnchorPercent方法代码示例

本文整理汇总了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);



}
开发者ID:BaharErtem,项目名称:Interactive_Environment,代码行数:9,代码来源:testApp.cpp

示例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();
}
开发者ID:bmwcmw,项目名称:iSteveJobs,代码行数:16,代码来源:testApp.cpp

示例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);
}
开发者ID:brolin,项目名称:openFrameworks,代码行数:49,代码来源:testApp.cpp

示例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();
    
}
开发者ID:paulobala,项目名称:tCAD,代码行数:46,代码来源:CenterContainer.cpp


注:本文中的ofImage::setAnchorPercent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。