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();
}
Example #2
0
/*!
 * \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);
}
Example #3
0
/*!
 * \brief drawSpot
 * \param img
 * \param img_width
 * \param img_height
 * \param x
 * \param y
 * \param radius
 * \param r
 * \param g
 * \param b
 */
void drawing::drawSpot(
    unsigned char* img,
    int img_width,
    int img_height,
    int x,
    int y,
    int radius,
    int r,
    int g,
    int b)
{
    for (int rr = 1; rr <= radius; rr++)
        drawCircle(img, img_width, img_height, x, y, rr, r, g, b, 1);
}
// 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);

}
Example #5
0
// ---
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 ();
	}
}
Example #6
0
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);
}
Example #7
0
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);
    }
}
Example #8
0
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;
    }
  }
}
Example #9
0
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);
}
Example #10
0
//---------------------------------------------------------------------
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);
}
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;
}
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 );
  }
}
Example #13
0
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();
                }
        }
}
Example #14
0
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++);
        }
    
}
Example #15
0
void Joystick::draw()
{
    if (_simpleDrawEnabled) {
        CC_NODE_DRAW_SETUP();
        switch (_state) {
            case jsTouched:
                drawCircle();
                break;
            case jsTouchMoved:
                drawArrow();
                break;
            default:
                break;
        }
    }
}
Example #16
0
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;
	}
	
}
Example #17
0
File: main.cpp Project: ptrsz/graf1
// Rajzolas, ha az alkalmazas ablak ervenytelenne valik, akkor ez a fuggveny hivodik meg
void onDisplay( ) {
    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);		// torlesi szin beallitasa
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // kepernyo torles
    if (contpoints.amount != 0) {
            glColor3f(1.0f, 1.0f, 1.0f);
            for (int i = 0; i < contpoints.amount; i++) {
                drawFilledCircle(contpoints.points[i].x,contpoints.points[i].y,0.04f);
                drawCircle(contpoints.points[i].x,contpoints.points[i].y,0.04f);
                
            }
        drawCatmullRom(contpoints);
    }
   
    glutSwapBuffers();     				// Buffercsere: rajzolas vege
    
}
    virtual void onDrawContent(SkCanvas* canvas) {
        drawSomething(canvas);

        SkPicture* pict = new SkPicture;
        SkAutoUnref aur(pict);

        drawSomething(pict->beginRecording(100, 100));
        pict->endRecording();

        canvas->save();
        canvas->translate(SkIntToScalar(300), SkIntToScalar(50));
        canvas->scale(-SK_Scalar1, -SK_Scalar1);
        canvas->translate(-SkIntToScalar(100), -SkIntToScalar(50));
        canvas->drawPicture(*pict);
        canvas->restore();

        canvas->save();
        canvas->translate(SkIntToScalar(200), SkIntToScalar(150));
        canvas->scale(SK_Scalar1, -SK_Scalar1);
        canvas->translate(0, -SkIntToScalar(50));
        canvas->drawPicture(*pict);
        canvas->restore();

        canvas->save();
        canvas->translate(SkIntToScalar(100), SkIntToScalar(100));
        canvas->scale(-SK_Scalar1, SK_Scalar1);
        canvas->translate(-SkIntToScalar(100), 0);
        canvas->drawPicture(*pict);
        canvas->restore();

#ifdef SK_DEVELOPER
        if (false) {
            SkDebugfDumper dumper;
            SkDumpCanvas dumpCanvas(&dumper);
            dumpCanvas.drawPicture(*pict);
        }
#endif

        // test that we can re-record a subpicture, and see the results

        SkMWCRandom rand(SampleCode::GetAnimTime());
        canvas->translate(SkIntToScalar(10), SkIntToScalar(250));
        drawCircle(fSubPicture->beginRecording(50, 50), 25,
                   rand.nextU() | 0xFF000000);
        canvas->drawPicture(*fPicture);
        delayInval(500);
    }
Example #19
0
void displayCircle(void){

	const float CX = 80.;
	const float CY = 60.;
	const float R = 30;
	// Clear all pixels with the specified clear color
	glClear(GL_COLOR_BUFFER_BIT);

	// draw the four points in four colors
	glBegin(GL_LINE_STRIP);
		glColor3f(0., 1., 0.);
		drawCircle(CX, CY, R, 100);
	glEnd();

	// start flushing OpenGL calls to to display buffer
	glFlush();
}
Example #20
0
static void suspensionDraw(Suspension* s)
{
	Chassis* c = s->chassis;
	const vec3* x = &c->pose.v[0].v3;
	const vec3* y = &c->pose.v[1].v3;
	const vec3* z = &c->pose.v[2].v3;
	const vec3* chassisPos = &c->pose.v[3].v3;

	float cx = chassisPos->x;
	float cy = chassisPos->y;
	float cz = chassisPos->z;

	Wheel* w = s->wheel;
	float wx = w->pos.x;
	float wy = w->pos.y;
	float wz = w->pos.z;

	vec3 point;
	vec3mtx43mulvec3(&point, &c->pose, &s->offset);

	glColor4f(1,1,1,1);
	drawCircle(point.x, point.y, 0.05f);
	vec3 a, b;
	vecaddscale(&a, &point, &w->wheelAxis, -0.13f);
	vecaddscale(&b, &point, &w->wheelAxis, +0.13f);
	glBegin(GL_LINES);
	glVertex3f(a.x, a.y, 0.f);
	glVertex3f(b.x, b.y, 0.f);
	glEnd();

	vec3 forwards = {w->wheelAxis.y, -w->wheelAxis.x, 0.f};
	vecaddscale(&a, &point, &forwards, -0.34f);
	vecaddscale(&b, &point, &forwards, +0.34f);
	glBegin(GL_LINES);
	glVertex3f(a.x, a.y, 0.f);
	glVertex3f(b.x, b.y, 0.f);
	glEnd();

	vec3 wheelVel;
	vecaddscale(&wheelVel, &w->pos, &w->vel, subDt);
	glColor4f(0,0,1,1);
	glBegin(GL_LINES);
	glVertex3f(wx, wy, 0.f);
	glVertex3f(wheelVel.x, wheelVel.y, 0.f);
	glEnd();
}
Example #21
0
// will be called with next end as the last begin
// match == on begin only, otherwise get double markings
void drawKeepEupEScreen(void)
{
   DEBUGBOX("drawKeepEupEScreen","");
   clearScreen();
   drawRectangleSafe(14,24,50,50);
   DEBUGBOX("drawKeepEupEScreen","b4rect");
   // messes up &WinDrawLineF ptr setup somewhere here
   drawRectangle(14,24,50,50,&WinDrawLineF);

   DEBUGBOX("drawKeepEupEScreen","");
   drawTriangle(90,34,70,&WinDrawLineF);
   DEBUGBOX("drawKeepEupEScreen","");
   drawDiamond(14,90,60,&WinDrawLineF);
   DEBUGBOX("drawKeepEupEScreen","");
   drawCircle(90+27,90+27,27+27,&WinDrawLineF);
   DEBUGBOX("drawKeepEupEScreen","");
}
void ControlFlowView::draw()
	{
	glColor4f( 0.2, 0.2, 0.2, 0.5 );
	drawCircle( 0.99, outline );

	Color::palette["code"].scaleValue( 0.75 ).set();
	drawArcBetween( 0, 1 );
	drawArcBetween( 0, 2 );
	drawArcBetween( 0, 3 );

	Color::palette["code"].scaleValue( 0.5 ).set();
	drawCirclesOnArc( code, radius, 0.5 / (code + 1), 1 - 0.5 / (code + 1), outline );

	// begin/end boundary
	glColor3f( 0, 0, 0 );
	drawLine( 0, 0.6, 0.8 );
	}
Example #23
0
void flashShape(int shape, WinDrawLine_fn WinDrawLine)
{
   switch(shape){
   case 0:
      drawRectangle(14+5,24+5,50-10,50-10,WinDrawLine);
      break;
   case 1:
      drawTriangle(90+5+5,34+5,70-10-10,WinDrawLine);
      break;
   case 2:
      drawDiamond(14+5,90+5,60-10, WinDrawLine);
      break;
   case 3:
      drawCircle(90+27,90+27,27+27-10,WinDrawLine);
      break;
   }
}
Example #24
0
void drawcg()
{
	glMatrixMode (GL_PROJECTION);
	glLoadIdentity();
	glOrtho(0, IMG_WIDTH, 0, IMG_HEIGHT, -1.0, 1.0);

	list<blobseq*>::iterator lblob = m_tracker.lblobseqref.begin();
	for (;lblob!=m_tracker.lblobseqref.end();++lblob)
	{
		if ((*lblob)->overlap==0)
		{
				continue;
		}
						
		glEnable (GL_DEPTH_TEST);

		CvMat* hmt = cvCloneMat((*lblob)->homography);
		cvmSet(hmt,2, 0, cvmGet(hmt,2,0)/IMG_SCALE);
		cvmSet(hmt,2, 1, cvmGet(hmt,2,1)/IMG_SCALE);
		cvmSet(hmt,2, 2, cvmGet(hmt,2,2)/IMG_SCALE);
			
		setviewfromhomography(hmt);
		
		glMatrixMode(GL_PROJECTION);
		glLoadMatrixd(projection);
		glMultMatrixd(view);

		glPushMatrix();			
		//draw labels
		for (unsigned i=0;i<(*lblob)->labels.size();i++)
		{
			glPushMatrix();
			drawCircle((float)((*lblob)->labels[i].x/IMG_SCALE), (float)((*lblob)->labels[i].y/IMG_SCALE), 3.0, 20);
			drawText((float)((*lblob)->labels[i].x/IMG_SCALE), (float)((*lblob)->labels[i].y/IMG_SCALE-10), 0, (*lblob)->labels[i].name, 7, !m_rotated, m_rotated, 1, 1, 0.0);
			glPopMatrix();	
		}
		drawText((float)((*lblob)->bound.x+(*lblob)->bound.width/2),(float)((*lblob)->bound.y+(*lblob)->bound.height/2), 0.0, (*lblob)->name, 20.0, true);

		glPopMatrix();
		glDisable(GL_DEPTH_TEST);
		cvReleaseMat(&hmt);
		(*lblob)->overlap=0;
	}
	
}
Example #25
0
void drawShapes (Shape shapes[], int count) {
    void drawCircle(ShapeRect bounds, ShapeColor fillColor);
    void drawRectangle(ShapeRect bounds, ShapeColor fillColor);
    void drawEgg(ShapeRect bounds, ShapeColor fillColor);
    for (int i = 0; i < count; i++) {
        switch (shapes[i].type) {
            case kCircle:
                drawCircle(shapes[i].bounds, shapes[i].fillColor);
                break;
            case kRectangle:
                drawRectangle(shapes[i].bounds, shapes[i].fillColor);
                break;
            case kEgg:
                drawEgg(shapes[i].bounds, shapes[i].fillColor);
                break;
        }
    }
}
Example #26
0
void circleGeo(){
    int userChoise = 0;
    int flag = 1;
    char didExit = 'a';

    while(flag){
        int width = 0;
        system("cls");

        setConsoleColor(FOREGROUND_BLUE | FOREGROUND_INTENSITY);

        printf ("########################################\n");
        printf ("####        Welcome on circle        ###\n");
        printf ("########################################\n");
        printf ("\n");
        fflush(stdout);

        printf ("########################################\n");
        printf ("# To draw a circle                     #\n");
        printf ("# 1 : select radius                    #\n");
        printf ("# 3 : repeat                           #\n");
        printf ("########################################\n");
        printf ("\n");
        fflush(stdout);

        /* Restore original attributes */
        setConsoleColor(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);

        while(width < 3){
            printf ("Enter radius > 2 :");
            width = mathInputInt();
        }

        drawCircle(width);

        printf ("Do you want to exit? (q) :");
        didExit = needToExit();
        if(didExit == 'q'){
            geoHomeDisplay();
            userChoise = userInputInt(3);
            geoHomeUse(userChoise);
        }
    }
}
Example #27
0
void display(void)
{
  int i, j;
  Obj *o;

  glClear (GL_COLOR_BUFFER_BIT);

  for (i=0; i<objsNum; i++) 
  {
    o = &objLst[i];
    glColor3f(o->r, o->g, o->b);
    glMatrixMode(GL_MODELVIEW);

    glPushMatrix();
    glTranslatef(o->tx, o->ty, 0.0);
    glRotatef(o->rotAng, 0.0, 0.0, 1.0);
    glScalef(o->sx, o->sy, 1.0);
    switch(o->type){
      case RECTOBJ:
        if (o->fillFlag) glBegin(GL_POLYGON);
        else glBegin(GL_LINE_LOOP);

        for (j = 0; j < o->ptsNum; j++) glVertex3f ((float)o->pts[j].x, (float)o->pts[j].y, 0.0);

      break;
      case PLINE:
        glBegin(GL_LINE_STRIP);
        for (j = 0; j < o->ptsNum; j++) glVertex3f ((float)o->pts[j].x, (float)o->pts[j].y, 0.0);
      break;

      case PGON:
        glBegin(GL_POLYGON);
        for (j = 0; j < o->ptsNum; j++) glVertex3f ((float)o->pts[j].x, (float)o->pts[j].y, 0.0);
      break;
      case CIRC:
        drawCircle(o->pts[0].y, o->pts[0].y, o->param, o->fillFlag);
      break;
    }
    glEnd();
    glPopMatrix();
  }

  glFlush();
}
Example #28
0
void analogClockDraw(){
	volatile unsigned long delay;
  volatile unsigned long elapsed = 0;
	int x_s, y_s, x_m, y_m, x_h, y_h;

	DisableInterrupts();

	// disable SysTick during setup
  NVIC_ST_CTRL_R = 0;                   // disable SysTick during setup
  NVIC_ST_RELOAD_R = NVIC_ST_RELOAD_M;  // maximum reload value
  NVIC_ST_CURRENT_R = 0;                // any write to current clears it
                                        // enable SysTick with core clock
  NVIC_ST_CTRL_R = NVIC_ST_CTRL_ENABLE+NVIC_ST_CTRL_CLK_SRC;
	delay = NVIC_ST_CURRENT_R ;
	
	 x_s = (int)(coslut[seconds]*secondRadius + 64);
	 y_s = (int)(sinlut[seconds]*secondRadius + 48);
	 x_m = (int)(coslut[minutes]*miniteRadius + 64);
	 y_m = (int)(sinlut[minutes]*miniteRadius + 48);
	 x_h = (int)(coslut[hours*5 + minutes/12]*hourRadius + 64);
	 y_h = (int)(sinlut[hours*5 + minutes/12]*hourRadius + 48);
		
	RIT128x96x4_ClearImage();
	drawCircle(64, 48, 45);
	

	//draws clock hands
	RIT128x96x4_Line(64, 48, x_s, y_s, color);
	RIT128x96x4_Line(64, 48, x_m, y_m, color);
	RIT128x96x4_Line(64, 48, x_h, y_h, color);
	RIT128x96x4_ShowImage();
	RIT128x96x4StringDraw((hours24>=12)?"PM":"AM", 110, 80, color);
	RIT128x96x4StringDraw("Alarm", 0, 76, color);
	RIT128x96x4StringDraw((alarmActive)?"On":"Off", 0, 85, color);

	RIT128x96x4StringDraw("12", 58, 5, color);
	RIT128x96x4StringDraw("3", 100, 48, color);
	RIT128x96x4StringDraw("9", 23, 48, color);
	RIT128x96x4StringDraw("6", 62, 80, color);
	elapsed = 1;
	elapsed = NVIC_ST_CURRENT_R - delay;
	delay = 0;
	EnableInterrupts();
}
void ofApp::drawLine(float length, float theta, int dir, int num){
    float r = ofRandomuf();
    ofSetColor(0,0,0,150);
    ofFill();
    ofDrawLine(0, 0, 0, -length);
    ofTranslate(0, -length);
    
    if(r>0.9){
        drawCircle(5);
    }
    
     if(num<mazeSize){
         
        r = ofRandomuf();
         if(r > 0.5){
             dir = 1;
         }else{
             dir = -1;
         }
         
         r = ofRandomuf();
         if(r > 0 && r < 0.4){
             ofPushMatrix();
             ofRotate(theta);
             drawLine(length, 0, dir, num + 1);
             ofPopMatrix();
         }else if(r > 0.4 && r < 0.90){
             ofPushMatrix();
             ofRotate(theta);
             drawLine(length, 90 * dir, dir,num + 1);
             ofPopMatrix();
         }else{
             ofPushMatrix();
             ofRotate(theta);
             drawLine(length, 90 * dir, dir,num + 1);
             ofPopMatrix();
             ofPushMatrix();
             ofRotate(-theta);
             drawLine(length, 90 * dir, dir,num + 1);
             ofPopMatrix();
         }
     }
}
Example #30
0
void drawShapes(Shape** shapes, int n){
  for (int i=0; i<n; ++i){
    struct Shape* s = shapes[i];
    switch (s->type_){
    case Shape::square:
      drawSquare((struct Square*)s);
      break;
    case Shape::circle:
      drawCircle((struct Circle*)s);
      break;
    case Shape::rhomb:
      drawRhomb((struct Rhomb*)s);
      break;
    default:
      assert(0);
      std::exit(0);
    }
  }
}