Esempio n. 1
0
/*!
  Display the gray level image \e I (8bits).

  \warning Display has to be initialized.

  \warning Suppress the overlay drawing.

  \param I : Image to display.

  \sa init(), closeDisplay()
*/
void vpDisplayGTK::displayImage(const vpImage<unsigned char> &I)
{

  if (displayHasBeenInitialized)
  {
    /* Copie de l'image dans le pixmap fond */
    gdk_draw_gray_image(background,
                        gc, 0, 0, (gint)width, (gint)height,
                        GDK_RGB_DITHER_NONE,
                        I.bitmap,
                        (gint)width);

    /* Le pixmap background devient le fond de la zone de dessin */
    gdk_window_set_back_pixmap(widget->window, background, FALSE);

    /* Affichage */
    //gdk_window_clear(GTK_WINDOW(widget));
    //gdk_flush();
  }
  else
  {
    vpERROR_TRACE("GTK not initialized " ) ;
    throw(vpDisplayException(vpDisplayException::notInitializedError,
                             "GTK not initialized")) ;
  }
}
Esempio n. 2
0
/*!
  Display a selection of the gray level image \e I (8bits).

  \warning Display has to be initialized.

  \warning Suppress the overlay drawing in the region of interest.

  \param I : Image to display.
  
  \param iP : Top left corner of the region of interest
  
  \param w : Width of the region of interest
  
  \param h : Height of the region of interest

  \sa init(), closeDisplay()
*/
void vpDisplayGTK::displayImageROI ( const vpImage<unsigned char> &I,const vpImagePoint &iP, const unsigned int w, const unsigned int h )
{
  if (displayHasBeenInitialized)
  {
    vpImage<unsigned char> Itemp;
    vpImageTools::crop(I,(unsigned int)iP.get_i(),(unsigned int)iP.get_j(), h, w,Itemp);
    /* Copie de l'image dans le pixmap fond */
    gdk_draw_gray_image(background,
                        gc, (gint)iP.get_u(), (gint)iP.get_v(), (gint)w, (gint)h,
                        GDK_RGB_DITHER_NONE,
                        I.bitmap,
                        (gint)w);

    /* Le pixmap background devient le fond de la zone de dessin */
    gdk_window_set_back_pixmap(widget->window, background, FALSE);

    /* Affichage */
    //gdk_window_clear(GTK_WINDOW(widget));
    //gdk_flush();
  }
  else
  {
    vpERROR_TRACE("GTK not initialized " ) ;
    throw(vpDisplayException(vpDisplayException::notInitializedError,
                             "GTK not initialized")) ;
  }
}
Esempio n. 3
0
void draw_fp_image()
{
	guchar *pixels;
	int rowstride;

	image = gdk_pixbuf_new_from_data(raw_data, GDK_COLORSPACE_RGB, FALSE, 8, ImageSize.nWidth, ImageSize.nHeight, ImageSize.nWidth*1, NULL, NULL );

	if (!image) 
	{
		if (gtk_debug) g_print( "ERROR: cannot load image into buffer.\n" );
		return;
	}
       
	rowstride = gdk_pixbuf_get_rowstride (image);
	pixels = gdk_pixbuf_get_pixels (image);

	gdk_draw_gray_image( back_buffer,
				      da->style->black_gc,
				      0, 0,
				      ImageSize.nWidth, ImageSize.nHeight,
				      GDK_RGB_DITHER_NORMAL,
				      pixels, rowstride);

	// drawing pixmap to screen 
	gdk_draw_pixmap(
			da->window,
			da->style->black_gc,
			back_buffer,
			0,0, 0,0, -1,-1
	);
}
Esempio n. 4
0
gboolean gui_draw_small(void)
{ 
	if(clipW && clipH)
	{
		 gdk_draw_rectangle(smallDisplay->window,
				 				smallDisplay->style->fg_gc[GTK_STATE_NORMAL],
				 				1, // Filled
		                        0,                          // X
		                        0,                          // y
		                        clipW,
		                        clipH);
		
	
	}
 if(sw && sh && sdata)
 {
    gdk_draw_gray_image(smallDisplay->window, smallDisplay->style->fg_gc[GTK_STATE_NORMAL],
                        1,                          // X
                        1,                          // y
                        sw*2+1,                          //width
                        sh*2+1,                          //h*2, // heigth
                        GDK_RGB_DITHER_NONE,
                        sdata, // buffer
                        sw*2+2 );
 }
    return true;
}
Esempio n. 5
0
gint area_expose_event (GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
	view_struct *vs;
	vs = (view_struct *) data;
  	if (event->count > 0) {
    		return(TRUE);
  	}
	if (GTK_IS_DRAWING_AREA(vs->area)) {
		if (vs->if_rgb) {
			gdk_draw_rgb_image(vs->area->window,
				vs->area->style->fg_gc[GTK_WIDGET_STATE (vs->area)],
				0,0,vs->width, 
				vs->height,
				GDK_RGB_DITHER_NONE,
				vs->buf8,
				3*vs->width);
		}
		else {
			gdk_draw_gray_image(vs->area->window, 
				vs->area->style->black_gc,
				0, 0, vs->width, 
				vs->height, 
				GDK_RGB_DITHER_NONE, 
				vs->buf8,
				vs->width);
		}
	}
	return TRUE;
}
Esempio n. 6
0
gboolean gui_draw_small(void)
{ 
 if(sw && sh && sdata)
    gdk_draw_gray_image(smallDisplay->window, smallDisplay->style->fg_gc[GTK_STATE_NORMAL],
                        0,                          // X
                        0,                          // y
                        sw*2+2,                          //width
                        sh*2+2,                          //h*2, // heigth
                        GDK_RGB_DITHER_NONE,
                        sdata, // buffer
                        sw*2+2 );
    return true;
}
Esempio n. 7
0
/**
    \fn     glyphDraw
    \brief  display glyph
*/
gboolean glyphDraw( void )
{
    if(!currentGlyph) return true;
    gdk_draw_gray_image(WID(drawingarea1)->window, WID(drawingarea1)->style->fg_gc[GTK_STATE_SELECTED /*GTK_STATE_NORMAL*/],
                        2,                          // X
                        2,                          // y
                        currentGlyph->width,                          //width
                        currentGlyph->height,                          //h*2, // heigth
                        GDK_RGB_DITHER_NONE,
                        currentGlyph->data, // buffer
                        currentGlyph->width );
    return true;
}
Esempio n. 8
0
// Appellée lorsque la zone d'écriture a besoin d'être redessinée
gboolean zone_dessin_rafraichir(GtkWidget *drawing, GdkEventExpose *e, gpointer data)
{
	
  if(!ptr_draw_area->buffer.mat)
    return FALSE;
	
  gdk_draw_gray_image(drawing->window, drawing->style->fg_gc[GTK_WIDGET_STATE(drawing)],
		      0,0,
		      ptr_draw_area->buffer.width, ptr_draw_area->buffer.height, 
		      GDK_RGB_DITHER_MAX, 
		      ptr_draw_area->buffer.mat, 
		      ptr_draw_area->buffer.width);
       
  return TRUE;
}
Esempio n. 9
0
/*
 * paint screen from cache
 */
void paint_from_gray_cache(GtkWidget *widget, struct map_cache *cache, GdkRectangle *area)
{
	unsigned char *dat;
	if (!area_in_cache(area, cache)) {
		err_printf("paint_from_cache: oops - area not in cache\n");
		d3_printf("area is %d by %d starting at %d,%d\n",
			  area->width, area->height, area->x, area->y);
		d3_printf("cache is %d by %d starting at %d,%d\n",
			  cache->w, cache->h, cache->x, cache->y);
//		return;
	}
	dat = cache->dat + area->x - cache->x
		+ (area->y - cache->y) * cache->w;
	gdk_draw_gray_image (widget->window, widget->style->fg_gc[GTK_STATE_NORMAL],
			     area->x, area->y, area->width, area->height,
			     GDK_RGB_DITHER_MAX, dat, cache->w);
}
Esempio n. 10
0
//*****************************************************************************************
gboolean gui_draw( void )
{
static int lastx=0,lasty=0;
    if(lastx!=redraw_x || lasty!=redraw_y)
        gtk_widget_set_usize(mainDisplay, redraw_x, redraw_y);
    lastx=redraw_x;
    lasty=redraw_y;
    
    gdk_draw_gray_image(mainDisplay->window, mainDisplay->style->fg_gc[GTK_STATE_NORMAL],
                        0,                          // X
                        0,                          // y
                        redraw_x,                          //width
                        redraw_y,                          //h*2, // heigth
                        GDK_RGB_DITHER_NONE,
                        workArea, // buffer
                        redraw_x );
    return true;
}
Esempio n. 11
0
// affichage de l image drawing_area
void OnExpose(GtkWidget* widget, gpointer data) {
  (void) data;
  if (cur_image == NULL) {
    gtk_widget_set_size_request (widget, 0, 0);
    gdk_draw_rectangle(pDA->window,
        pDA->style->white_gc,
        TRUE,
        0, 0,
        pDA->allocation.width,
        pDA->allocation.height);
  } else {
    gtk_widget_set_size_request (widget, cur_image->w, cur_image->h);
    gdk_draw_gray_image (pDA->window,
        pDA->style->white_gc,
        0, 0,
        cur_image->w, cur_image->h,
        GDK_RGB_DITHER_NORMAL,
        cur_image->buff,
        cur_image->w);
  }
}
Esempio n. 12
0
//图像显示
gboolean preview_display2( GtkWidget *widget, GdkEventExpose *event,gpointer data )
{

    int i=1;

    if(g_tFrameHead[i].uiMediaType==CAMERA_MEDIA_TYPE_MONO8){
        gdk_draw_gray_image(widget->window,widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
                            g_W_H_INFO[i].xOffsetFOV,g_W_H_INFO[i].yOffsetFOV,
                            g_W_H_INFO[i].sensor_width,g_W_H_INFO[i].sensor_height,
                            GDK_RGB_DITHER_NORMAL,(guchar *)g_readBuf[i],g_W_H_INFO[i].sensor_width);
    }
    else{
        //显示图像
        gdk_draw_rgb_image(widget->window,widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
                            g_W_H_INFO[i].xOffsetFOV,g_W_H_INFO[i].yOffsetFOV,
                            g_W_H_INFO[i].sensor_width,g_W_H_INFO[i].sensor_height,
                            GDK_RGB_DITHER_NORMAL,(guchar *)g_readBuf[i],g_W_H_INFO[i].sensor_width*3);
    }

	g_disply_fps[i]++;

	return TRUE;
}