Ejemplo n.º 1
0
void join_subimages(subimage_t * srcsiarray, pngimage_t * destimg, int slices, int pixelborder)
{
  int xstart, i, j, imgno, wreal, bbnum;
  xstart = 0;

  for(imgno=0; imgno<slices; imgno++)
  {
    wreal = srcsiarray[imgno].w - ( ((imgno==0)||(imgno==slices-1)) ? pixelborder : 2*pixelborder );
//printf("imgno=%d di %d - w=%d h=%d\n", imgno, slices, srcsiarray[imgno].w, srcsiarray[imgno].h);
    for(i=0; i<srcsiarray[imgno].h; i++)
    {
      for(j=0; j<wreal; j++)
      {
         int r, g, b;
         subimage_getpixel(&srcsiarray[imgno], j + ( imgno!=0 ? pixelborder : 0 ), i, &r, &g, &b);
         imageSetPixel(destimg, xstart+j, i, r, g, b);
      }
    }
    //draw bboxes
    for(bbnum=0; bbnum<srcsiarray[imgno].Nbbox; bbnum++)
    {
       int realxupleft, realyupleft, width, height;
       width = srcsiarray[imgno].bboxData[bbnum*4+2];
       height = srcsiarray[imgno].bboxData[bbnum*4+3];
       realxupleft = srcsiarray[imgno].bboxData[bbnum*4+0] - (imgno!=0 ? pixelborder : 0) + xstart;
       realyupleft = srcsiarray[imgno].bboxData[bbnum*4+1];
       draw_bbox(destimg, realxupleft, realyupleft, width, height);
    }

    xstart += wreal;
  }

}
Ejemplo n.º 2
0
/* calcula uma linha da imagem a cada camada de idle */
int idle_cb(void)
{
	int x;
	/* Faz uma linha de pixels por vez */
	if (yc<height) {
		IupGLMakeCurrent(canvas);
		glBegin(GL_POINTS);
		for( x = 0; x < width; ++x ) {
			Color pixel;
			Vector ray;				

			ray = camGetRay( camera, x, yc );
			pixel = rayTrace( scene, eye, ray, 0 );

			imageSetPixel( image, x, yc, pixel );
			glColor3f((float)pixel.red,(float)pixel.green,(float)pixel.blue);
			glVertex2i(x,yc);

		}
		glEnd();
		glFlush();
		IupGLSwapBuffers(canvas);  /* change the back buffer with the front buffer */
		yc++;
	}
	else {
		IupSetFunction (IUP_IDLE_ACTION, (Icallback) NULL); /* a imagem ja' esta' completa */
		finish_time = clock();
		duration = (double)(finish_time - start_time)/CLOCKS_PER_SEC;
		IupSetfAttribute(label, "TITLE", "tempo=%.3lf s", duration);
	}

	return IUP_DEFAULT;
}
Ejemplo n.º 3
0
void draw_HVline(pngimage_t * dstsi, int x1, int y1, int x2, int y2)
{ // x1<x2 e y1<y2
   int i;


   if(y1==y2)
   { // horizontal line
      for(i=x1; i<=x2; i++)
      {
         imageSetPixel(dstsi, i, y1, 255, 0, 0);
      }
   }
   else
   { //vertical line
      for(i=y1; i<=y2; i++)
      {
         imageSetPixel(dstsi, x1, i, 255, 0, 0);
      }
      
   }
}
Ejemplo n.º 4
0
/* calcula uma linha da imagem a cada camada de idle */
int idle_cb(void)
{
	int x;
	double ray[VECTOR];
	float pixel[COLOR];

  /* Faz uma linha de pixels por vez */
  if (yc < height) {

    IupGLMakeCurrent(canvas);
    glBegin(GL_POINTS);
    {
      for (x = 0; x < width; ++x) {

        camGetRay(camera, x, yc, ray);
        rayTrace(scene, eye, ray, 0, pixel);

        imageSetPixel(image, x, yc, pixel);
        glColor3f((float) pixel[RED], (float) pixel[GREEN], (float) pixel[BLUE]);
        glVertex2i(x, yc);

      }
    }
    glEnd();

    glFlush();

    IupGLSwapBuffers(canvas);
    
    yc++;
  } else {

		IupSetFunction (IUP_IDLE_ACTION, (Icallback) NULL); /* a imagem ja' esta' completa */
		finish_time = clock();
		duration = (double)(finish_time - start_time)/CLOCKS_PER_SEC;
		IupSetfAttribute(label, "TITLE", "tempo=%.3lf s", duration);

		glFlush();
	}


	return IUP_DEFAULT;
}