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


C++ drawCircle函数代码示例

本文整理汇总了C++中drawCircle函数的典型用法代码示例。如果您正苦于以下问题:C++ drawCircle函数的具体用法?C++ drawCircle怎么用?C++ drawCircle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了drawCircle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(){
	initializePrinter();
	drawCanvas(0,0,0,255);
	int x,y;
	y = getYRes()/2;
	x = getXRes()/2;
	circle C = makeCircle(0,0,0,255,20,x,y);
	for (i=0;i<=360;i++) {
		rotateCircle(C,i,x,y);
		drawCircle(C);
	}
	printToScreen();
	finishPrinter();
}
开发者ID:GrafikaNECT,项目名称:tembakkapal-transformasi,代码行数:14,代码来源:mcircle.c

示例2: drawCircle

/*!
 * \brief drawCircle
 * \param img image data
 * \param img_width image width
 * \param img_height image height
 * \param x x coordinate
 * \param y y coordinate
 * \param radius radius of the circle
 * \param r red
 * \param g green
 * \param b blue
 * \param line_width width of the line
 */
void drawing::drawCircle(
    unsigned char* img,
    int img_width,
    int img_height,
    int x,
    int y,
    int radius,
    int r,
    int g,
    int b,
    int line_width)
{
    drawCircle(img, img_width, img_height, (float)x, (float)y, (float)radius, r, g, b, line_width);
}
开发者ID:Artens,项目名称:openanpr,代码行数:27,代码来源:drawing.cpp

示例3: cvZero

// Draw graphs      -- todo, adjust to fit in window
void Painting::drawGraph()
{
    // Paint the canvas white
    cvZero(mImage);
    cvRectangleR(mImage,cvRect(0,0,500,500),cvScalar(255,255,255), -1);

    CvFont font;
    double hScale=0.5;
    double vScale=0.5;
    int    lineWidth=1;
    cvInitFont(&font,CV_FONT_HERSHEY_SIMPLEX|CV_FONT_ITALIC, hScale,vScale,0,lineWidth);

    // Add text to canvas
    cvPutText (mImage,"Left",cvPoint(20,50), &font, cvScalar(200,0,0));
    cvPutText (mImage,"Right",cvPoint(420,50), &font, cvScalar(0,200,0));

    // Iterate the vector of data and center the selected objects
    if(mData.size())
    {
        int xScale = 200;
        int yScale = 20;
        int xOffSet = 250 - mData[mSelect].timeStamp * xScale;
        int yOffSet1 = 240 + mData[mSelect].pulsefreq * yScale;
        int yOffSet2 = 250 + mData[mSelect].blinkingfreq * yScale;
        int yOffSet3 = 260 + mData[mSelect].breathingfreq * yScale;
        int t = 1; //thick

        if(mSelect == 0)
            t = -1;

        drawCircle(mImage,cvPoint(mData[0].timeStamp * xScale + xOffSet,yOffSet1 - mData[0].pulsefreq * yScale),0,t);
        drawCircle(mImage,cvPoint(mData[0].timeStamp * xScale + xOffSet,yOffSet2 - mData[0].blinkingfreq * yScale),1,t);
        drawCircle(mImage,cvPoint(mData[0].timeStamp * xScale + xOffSet,yOffSet3 - mData[0].breathingfreq * yScale),2,t);

        for(unsigned int i = 1; i<mData.size(); i++)
        {
            int thick = 1;
            if((unsigned)mSelect == i)
                thick = -1;
            // Pulse
            drawCircle(mImage,cvPoint(mData[i].timeStamp * xScale + xOffSet, yOffSet1 - mData[i].pulsefreq * yScale),0,thick);
            cvLine(mImage,cvPoint(mData[i].timeStamp * xScale + xOffSet, yOffSet1 - mData[i].pulsefreq * yScale),
                   cvPoint(mData[i-1].timeStamp * xScale + xOffSet, yOffSet1 - mData[i-1].pulsefreq * yScale),cvScalar(0,0,255));
            // Blinking
            drawCircle(mImage,cvPoint(mData[i].timeStamp * xScale + xOffSet, yOffSet2 - mData[i].blinkingfreq * yScale),1,thick);
            cvLine(mImage,cvPoint(mData[i].timeStamp * xScale + xOffSet, yOffSet2 - mData[i].blinkingfreq * yScale),
                   cvPoint(mData[i-1].timeStamp * xScale + xOffSet, yOffSet2 - mData[i-1].blinkingfreq * yScale),cvScalar(0,255,0));
            // Breathing
            drawCircle(mImage,cvPoint(mData[i].timeStamp * xScale + xOffSet, yOffSet3 - mData[i].breathingfreq * yScale),2,thick);
            cvLine(mImage,cvPoint(mData[i].timeStamp * xScale + xOffSet, yOffSet3 - mData[i].breathingfreq * yScale),
                   cvPoint(mData[i-1].timeStamp * xScale + xOffSet, yOffSet3 - mData[i-1].breathingfreq * yScale),cvScalar(255,0,0));
        }
    }

    cvShowImage(WindowName, mImage);

}
开发者ID:fatma-meawad,项目名称:food-recognition-project,代码行数:58,代码来源:painting.cpp

示例4: drawCircle

// ---
void QGAMES::Screen::drawCircle (const QGAMES::Position& p, const QGAMES::Vector& o, 
	QGAMES::bdata a1, QGAMES::bdata a2, const QGAMES::Color& c, bool f)
{
	// Calculates the real position at the screen
	// It would depend on the scale, and where the visual position f the screen is fixed.
	QGAMES::Position nP = p.projectOver (_position, _orientation);
	QGAMES::bdata x = nP.posX () - _position.posX ();
	QGAMES::bdata y = nP.posY () - _position.posY ();
	QGAMES::bdata a1D = a1; QGAMES::bdata a2D = a2;

	// It is too mcuh difficult to verify whether
	// the final eelipse fits or not the window...

	// Scale the objects...if any
	if ((int) _scale._value != 1) // To speed the code up in normal situations...
	{
		x = _scale.effectToX (x);
		y = _scale.effectToY (y);
		if (_scale._scaleByAlgorithm)
		{
			a1D = a1 * _scale._value; // axis 1 and axis 2 have to be scaled also...
			a2D = a2 * _scale._value;
		}
	}

	// Draw the objects...
	if ((int) _scale._value == 1)
		drawCircle ((int) x, (int) y, (int) a1D, (int) a2D, c, f);
	else
	{
		if (!_scale._scaleByAlgorithm)
			activeScale ();
		drawCircle ((int) x, (int) y, (int) a1D, (int) a2D, c, f);
		if (!_scale._scaleByAlgorithm)
			desactiveScale ();
	}
}
开发者ID:Commnets,项目名称:QGAMES,代码行数:38,代码来源:screen.cpp

示例5: Garmata

void Garmata()
{
		//jadro
    glColor3f(0.0, 0.0, 0.0);                     
    drawCircle( gfPyshkaX, gfPyshkaY, 14,60);
    glEnd();
		//kinec garmatu
    glColor3f(0.0, 0.0, 0.0);                     
    drawCircle( -70+gfPyshkaX1, 44+gfPyshkaY1, 14,60);
    glEnd();         
        //Garmata zamalovka
    glBegin(GL_QUADS);                     
        glColor3f(1.0, 1.0, 1.0);
        glVertex2i(-70+gfPyshkaX1, 30+gfPyshkaY1);
        glColor3f(1.0, 1.0, 1.0);
        glVertex2i(200+gfPyshkaX1, 30+gfPyshkaY1);
        glColor3f(1.0, 1.0, 1.0);
        glVertex2i(200+gfPyshkaX1, 58+gfPyshkaY1);
        glColor3f(1.0, 1.0, 1.0);
        glVertex2i(-70+gfPyshkaX1, 58+gfPyshkaY1);
    glEnd();
        //Garmata
    glBegin(GL_LINE_LOOP);                     
        glColor3f(0.0, 0.0, 0.0);
        glVertex2i(-70+gfPyshkaX1, 30+gfPyshkaY1);
        glColor3f(0.0, 0.0, 0.0);
        glVertex2i(200+gfPyshkaX1, 30+gfPyshkaY1);
        glColor3f(0.0, 0.0, 0.0);
        glVertex2i(200+gfPyshkaX1, 58+gfPyshkaY1);
        glColor3f(0.0, 0.0, 0.0);
        glVertex2i(-70+gfPyshkaX1, 58+gfPyshkaY1);
    glEnd();
		//koleso vid pushki 
    glColor3f(0.0, 0.0, 0.0);                     
    drawCircle(0+gfPyshkaX1, 0+gfPyshkaY1, 30,60);
}
开发者ID:PLuSS-ksa,项目名称:PLuSS,代码行数:36,代码来源:Vidformatovano.cpp

示例6: color565

void DeviceAddScreen::render()
{
    uint16_t schcolor = color565(142,35,35);
    fillScreen(BLACK);
    makeRectangle(15,15, 200,280, BLACK, 5);
    drawPgmString(210,50 , PSTR("ADD ADAPTERS"), schcolor, BLACK, 2);
    drawPgmString(180,50, PSTR("While this screen is open, devices will"), WHITE, BLACK, 1);
    drawPgmString(170,50, PSTR("synchronize with the basestation. Press"), WHITE, BLACK, 1);
    drawPgmString(160,50, PSTR("and hold HOME or BACK to exit."), WHITE, BLACK, 1);

    drawCircle(100, 100, 30, WHITE);
    drawCircle(100, 220, 30, WHITE);
    drawHorizontalLine(100, 130, 60, WHITE, 1);
    // 100, 190 is point of arrow
    for(int8_t i=0; i < 8; i++) {
        drawPixel(100-i, 190-i, WHITE);
        drawPixel(100+i, 190-i, WHITE);
    }

    for(int8_t i=0; i < 8; i++) {
        drawPixel(100-i, 130+i, WHITE);
        drawPixel(100+i, 130+i, WHITE);
    }
}
开发者ID:unregistered,项目名称:lg-activate,代码行数:24,代码来源:lgui.c

示例7: drawLine

void drawLine(int x2, int y2, int x1, int y1){
  int dx = x1 - x2;
  int dy = y1 - y2;

  int t_max = abs(dx);
  if (abs(dy) > abs(dx))
    t_max = abs(dy);

  if (t_max == 0){
    drawCircle(x1, y1);
  }
  else{
    double ddx = double(dx)/double(t_max);
    double ddy = double(dy)/double(t_max);
    
    double x=x2;
    double y=y2;
    for(int t=0;t<=t_max;++t){
      drawCircle((int)round(x),(int)round(y));
      x += ddx;
      y += ddy;
    }
  }
}
开发者ID:opiette,项目名称:wxsand,代码行数:24,代码来源:Canvas.cpp

示例8: clear_to_color

void CustomCircle::takePoint(Point p)
{
    p2.x = p.x;
    p2.y = p.y;

    if (!On)
    {
        On = true;
        p1.x = p.x;
        p1.y = p.y;
    }

    clear_to_color(bmp, TRANSPARENT);
    drawCircle(bmp, p1, pointDistance(p1, p2), GREEN);
}
开发者ID:leomarques,项目名称:Dickbox,代码行数:15,代码来源:CustomCircle.cpp

示例9: update

//---------------------------------------------------------------------
void TitleDraw::update()
{
    //---- main content
    int state = title_state->getNowState();
    if (state == TitleState::STATE_CIRCLE) { drawCircle(); }
    if (state == TitleState::STATE_TITLE) { drawTitle(); }

    //---- fadeout/fadein
    SetDrawBlendMode(DX_BLENDMODE_ALPHA, title_state->getAlpha());
    DrawBox(0, 0,
        SystemData::getInstance()->getWindowWidth(),
        SystemData::getInstance()->getWindowHeight(),
        GetColor(0, 0, 0), TRUE);
    SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 0);
}
开发者ID:tapi-soft,项目名称:poseine,代码行数:16,代码来源:TitleDraw.cpp

示例10: main

int main( void )
{
    GLFWwindow *window;
    
    // Initialize the library
    if ( !glfwInit( ) )
    {
        return -1;
    }
    
    // Create a windowed mode window and its OpenGL context
    window = glfwCreateWindow( SCREEN_WIDTH, SCREEN_HEIGHT, "Hello World", NULL, NULL );
    
    if ( !window )
    {
        glfwTerminate( );
        return -1;
    }
    
    // Make the window's context current
    glfwMakeContextCurrent( window );
    
    glViewport( 0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT ); // specifies the part of the window to which OpenGL will draw (in pixels), convert from normalised to pixels
    glMatrixMode( GL_PROJECTION ); // projection matrix defines the properties of the camera that views the objects in the world coordinate frame. Here you typically set the zoom factor, aspect ratio and the near and far clipping planes
    glLoadIdentity( ); // replace the current matrix with the identity matrix and starts us a fresh because matrix transforms such as glOrpho and glRotate cumulate, basically puts us at (0, 0, 0)
    glOrtho( 0, SCREEN_WIDTH, 0, SCREEN_HEIGHT, 0, 1 ); // essentially set coordinate system
    glMatrixMode( GL_MODELVIEW ); // (default matrix mode) modelview matrix defines how your objects are transformed (meaning translation, rotation and scaling) in your world
    glLoadIdentity( ); // same as above comment
    
    // Loop until the user closes the window
    while ( !glfwWindowShouldClose( window ) )
    {
        glClear( GL_COLOR_BUFFER_BIT );

        // render OpenGL here
        drawCircle( SCREEN_WIDTH / 2, SCREEN_HEIGHT / 2, 0, 120, 10 );
        
        // Swap front and back buffers
        glfwSwapBuffers( window );
        
        // Poll for and process events
        glfwPollEvents( );
    }
    
    glfwTerminate( );
    
    return 0;
}
开发者ID:Ajloun-National-University,项目名称:OpenGL-Tutorials,代码行数:48,代码来源:main.cpp

示例11: Q_FOREACH

void QgsPointDisplacementRenderer::drawGroup( QPointF centerPoint, QgsRenderContext& context, const ClusteredGroup& group )
{

  //calculate max diagonal size from all symbols in group
  double diagonal = 0;

  Q_FOREACH ( const GroupedFeature& feature, group )
  {
    if ( QgsMarkerSymbol* symbol = feature.symbol )
    {
      diagonal = qMax( diagonal, context.convertToPainterUnits( M_SQRT2 * symbol->size(),
                       symbol->sizeUnit(), symbol->sizeMapUnitScale() ) );
    }
  }

  QgsSymbolRenderContext symbolContext( context, QgsUnitTypes::RenderMillimeters, 1.0, false );

  QList<QPointF> symbolPositions;
  QList<QPointF> labelPositions;
  double circleRadius = -1.0;
  calculateSymbolAndLabelPositions( symbolContext, centerPoint, group.size(), diagonal, symbolPositions, labelPositions, circleRadius );

  //draw circle
  if ( circleRadius > 0 )
    drawCircle( circleRadius, symbolContext, centerPoint, group.size() );

  if ( group.size() > 1 )
  {
    //draw mid point
    QgsFeature firstFeature = group.at( 0 ).feature;
    if ( mCenterSymbol )
    {
      mCenterSymbol->renderPoint( centerPoint, &firstFeature, context, -1, false );
    }
    else
    {
      context.painter()->drawRect( QRectF( centerPoint.x() - symbolContext.outputLineWidth( 1 ), centerPoint.y() - symbolContext.outputLineWidth( 1 ), symbolContext.outputLineWidth( 2 ), symbolContext.outputLineWidth( 2 ) ) );
    }
  }

  //draw symbols on the circle
  drawSymbols( group, context, symbolPositions );
  //and also the labels
  if ( mLabelIndex >= 0 )
  {
    drawLabels( centerPoint, symbolContext, labelPositions, group );
  }
}
开发者ID:wongjimsan,项目名称:QGIS,代码行数:48,代码来源:qgspointdisplacementrenderer.cpp

示例12: myMouse

extern void myMouse(int button, int state, int x, int y)
{
        if (state == GLUT_DOWN) {
                if (button == GLUT_LEFT_BUTTON) {
                        glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
                        glClear(GL_COLOR_BUFFER_BIT);
                        drawAxis();
                        glFlush();
                } else if (button == GLUT_RIGHT_BUTTON) {
                        glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
                        glClear(GL_COLOR_BUFFER_BIT);
                        drawCircle();
                        glFlush();
                }
        }
}
开发者ID:jypeitao,项目名称:opengl_learn,代码行数:16,代码来源:drawCircle.c

示例13: ofSetCircleResolution

void Particle::drawCircle(float x, float y, float diam) {
    //center circles
    
        ofSetCircleResolution(100);
        ofNoFill();
    
        ofDrawCircle(x,y,diam,diam);
    
        diam = diam*.7;
   
    
        if(diam>1){
            drawCircle(x,y,diam++);
        }
    
}
开发者ID:kimm068,项目名称:of_miyeon,代码行数:16,代码来源:Particle.cpp

示例14: CC_NODE_DRAW_SETUP

void Joystick::draw()
{
    if (_simpleDrawEnabled) {
        CC_NODE_DRAW_SETUP();
        switch (_state) {
            case jsTouched:
                drawCircle();
                break;
            case jsTouchMoved:
                drawArrow();
                break;
            default:
                break;
        }
    }
}
开发者ID:fispurring,项目名称:Erratic,代码行数:16,代码来源:Joystick.cpp

示例15: glLoadIdentity

void Enemy::render(){
	glLoadIdentity();
	glColor3f(0,1,0);
	switch(shape){
	case S_CIRCLE:
	drawCircle(x,y,size,40,2,0,fill);	
		break;
	case S_RECT:
	drawRectangle(x,y,size*2,size*2,angle,fill);
		break;
	case S_SMILEY:
	drawSmileyFace(x,y,size);	
		break;
	}
	
}
开发者ID:smrutled,项目名称:CSE-Opengl-Projects,代码行数:16,代码来源:Enemy.cpp


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