Example #1
0
/* Remove a square corresponding to a removed process in the list */
void drawing_remove_square(histoDrawing_t *drawing,
        guint y,
        guint height)
{
  GdkPixmap *pixmap;

  if(unlikely((guint)drawing->height == height)) {
    //pixmap = gdk_pixmap_new(
    //    drawing->drawing_area->window,
    //    drawing->width + SAFETY,
    //    1,
    //    -1);
    pixmap = drawing->pixmap;
    drawing->height=1;
  } else {
    /* Allocate a new pixmap with new height */
     //pixmap = gdk_pixmap_new(
     //   drawing->drawing_area->window,
     //   drawing->width + SAFETY,
     //   drawing->height - height,
     //   -1);
     /* Keep the same preallocated pixmap */
    pixmap = drawing->pixmap;
   
    /* Copy the high region */
    gdk_draw_pixmap (pixmap,
      drawing->drawing_area->style->black_gc,
      drawing->pixmap,
      0, 0,
      0, 0,
      drawing->width + SAFETY, y);

    /* Copy up the bottom of the region */
    gdk_draw_pixmap (pixmap,
      drawing->drawing_area->style->black_gc,
      drawing->pixmap,
      0, y + height,
      0, y,
      drawing->width, drawing->height - y - height);

    drawing->height-=height;
  }

  //if(likely(drawing->pixmap))
  //  gdk_pixmap_unref(drawing->pixmap);

  //drawing->pixmap = pixmap;
  
  gtk_widget_set_size_request(drawing->drawing_area,
                             -1,
                             drawing->height);
  gtk_widget_queue_resize_no_redraw(drawing->drawing_area);
  /* ask for the buffer to be redrawn */
  gtk_widget_queue_draw_area ( drawing->drawing_area,
                               0, y,
                               drawing->width, MAX(drawing->height-y, 1));
}
Example #2
0
void ensure_buddy_pix (GtkWidget *window, int n) {
  int width, height;
  GdkGC *white_gc;
  int pri;
  int sec;

  if (!buddy_pix[1].pix)	/* not initialized */
    return;

  if (n < 0 || n > 9 || buddy_pix[n].pix)
    return;

  sec = ((n & 0x04) != 0)? 0x04 : 0x02;
  pri = n & ~sec;

  ensure_buddy_pix (window, pri);

  if (!pri || !sec)
    return;

  if (!GTK_WIDGET_REALIZED (window))
    gtk_widget_realize (window);

  gdk_window_get_size (buddy_pix[1].pix, &width, &height);

  buddy_pix[n].pix = gdk_pixmap_new (window->window, width, height, -1);
  buddy_pix[n].mask = gdk_pixmap_new (window->window, width, height, 1);

  white_gc = window->style->white_gc;

  if (!masks_gc) {
    masks_gc = gdk_gc_new (buddy_pix[n].mask);
    gdk_gc_set_exposures (masks_gc, FALSE);
  }

  gdk_gc_set_foreground (masks_gc, &window->style->white);

  gdk_draw_pixmap (buddy_pix[n].pix, white_gc, buddy_pix[pri].pix,
                                                   0, 0, 0, 0, width, height);
  gdk_draw_pixmap (buddy_pix[n].mask, masks_gc, buddy_pix[pri].mask,
                                                   0, 0, 0, 0, width, height);

  gdk_gc_set_clip_mask (white_gc, buddy_pix[sec].mask);
  gdk_draw_pixmap (buddy_pix[n].pix, white_gc, buddy_pix[sec].pix,
                                                   0, 0, 0, 0, width, height);
  gdk_gc_set_clip_mask (white_gc, NULL);

  gdk_gc_set_clip_mask (masks_gc, buddy_pix[sec].mask);
  gdk_draw_rectangle (buddy_pix[n].mask, masks_gc, TRUE, 0, 0, width, height);
  gdk_gc_set_clip_mask (masks_gc, NULL);
}
Example #3
0
static void
overlay_draw(struct graphics_priv *parent, struct graphics_priv *overlay, int window)
{
#if 0
	GdkPixbuf *pixbuf,*pixbuf2;
	GtkWidget *widget=parent->widget;
	guchar *pixels1, *pixels2, *p1, *p2;
	int x,y;
	int rowstride1,rowstride2;
	int n_channels1,n_channels2;

	if (! parent->drawable)
		return;

	pixbuf=gdk_pixbuf_get_from_drawable(NULL, overlay->drawable, NULL, 0, 0, 0, 0, overlay->width, overlay->height);
	pixbuf2=gdk_pixbuf_new(gdk_pixbuf_get_colorspace(pixbuf), TRUE, gdk_pixbuf_get_bits_per_sample(pixbuf), 
				gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf));

	rowstride1 = gdk_pixbuf_get_rowstride (pixbuf);
	rowstride2 = gdk_pixbuf_get_rowstride (pixbuf2);
	pixels1=gdk_pixbuf_get_pixels (pixbuf);	
	pixels2=gdk_pixbuf_get_pixels (pixbuf2);	
	n_channels1 = gdk_pixbuf_get_n_channels (pixbuf);
	n_channels2 = gdk_pixbuf_get_n_channels (pixbuf2);
	for (y = 0 ; y < overlay->height ; y++) {
		for (x = 0 ; x < overlay->width ; x++) {
			p1 = pixels1 + y * rowstride1 + x * n_channels1;
			p2 = pixels2 + y * rowstride2 + x * n_channels2;
			p2[0]=p1[0];
			p2[1]=p1[1];
			p2[2]=p1[2];
			p2[3]=127;
		}
	}
	if (window)
		gdk_draw_pixmap(parent->drawable, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], overlay->background, 0, 0, overlay->p.x, overlay->p.y, overlay->width, overlay->height);
	else
		gdk_draw_pixmap(overlay->background, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], parent->drawable, overlay->p.x, overlay->p.y, 0, 0, overlay->width, overlay->height);
	gdk_draw_pixbuf(parent->drawable, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], pixbuf2, 0, 0, overlay->p.x, overlay->p.y, overlay->width, overlay->height, GDK_RGB_DITHER_NONE, 0, 0);
	if (window)
		gdk_draw_pixmap(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE(widget)], parent->drawable, overlay->p.x, overlay->p.y, overlay->p.x, overlay->p.y, overlay->width, overlay->height);
#if 0
	gdk_draw_pixmap(gr->gra->drawable,
                        gr->gra->widget->style->fg_gc[GTK_WIDGET_STATE(gr->gra->widget)],
                        img->gra->drawable,
                        0, 0, p->x, p->y, img->gra->width, img->gra->height);
#endif
#endif
}
Example #4
0
static gint panel_expose_event(GtkWidget* widget, GdkEventExpose* ev) {
  gdk_draw_pixmap(widget->window,
                  widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
                  panel->pixmap, ev->area.x, ev->area.y, ev->area.x,
                  ev->area.y, ev->area.width, ev->area.height);
  return FALSE;
}
Example #5
0
static void gtk_plot_gdk_draw_pixmap                (GtkPlotPC *pc,
                                                     GdkPixmap *pixmap,
                                                     GdkBitmap *mask,
                                                     gint xsrc, gint ysrc,
                                                     gint xdest, gint ydest,
                                                     gint width,
                                                     gint height,
                                                     gdouble scale_x, 
                                                     gdouble scale_y)
{
  GdkGC *gc;
  GdkPixmap *new_pixmap;
  GdkBitmap *new_mask = NULL;

  if(!GTK_PLOT_GDK(pc)->drawable) return;
  if(!GTK_PLOT_GDK(pc)->window) return;
  if(!GTK_PLOT_GDK(pc)->gc) return;

  gc = GTK_PLOT_GDK(pc)->gc;

  if(!gc) return;

  new_pixmap = scale_pixmap(GTK_PLOT_GDK(pc)->window, pixmap, scale_x, scale_y);
  
  if(mask)
    new_mask = scale_bitmap(GTK_PLOT_GDK(pc)->window, mask, scale_x, scale_y);

  gtk_plot_pc_clip_mask(pc, xdest, ydest, new_mask);
  gdk_draw_pixmap(GTK_PLOT_GDK(pc)->drawable, gc, new_pixmap,
                  xsrc, ysrc, xdest, ydest, width*scale_x, height*scale_y);
  gtk_plot_pc_clip_mask(pc, xdest, ydest, NULL);

  if(new_mask) gdk_bitmap_unref(new_mask);
  gdk_pixmap_unref(new_pixmap);
}
Example #6
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
	);
}
Example #7
0
void redraw_area(GtkWidget* widget, int x, int y, int w, int h)
{
	gdk_draw_pixmap(widget->window,
			gc,
			pixmap,
			x,y,x,y,w,h);
}
Example #8
0
static void sctp_graph_redraw(struct sctp_udata *u_data)
{
	sctp_graph_t *ios;

	u_data->io->needs_redraw = TRUE;

	sctp_graph_draw(u_data);
	switch (u_data->io->graph_type)
	{
		case 0:
			draw_sack_graph(u_data);
			draw_tsn_graph(u_data);
			break;
		case 1:
			draw_tsn_graph(u_data);
			break;
		case 2:
			draw_sack_graph(u_data);
			break;
	}
	ios=(sctp_graph_t *)g_object_get_data(G_OBJECT(u_data->io->draw_area), "sctp_graph_t");

	if(!ios){
		exit(10);
	}


	gdk_draw_pixmap(u_data->io->draw_area->window,
	                u_data->io->draw_area->style->fg_gc[GTK_WIDGET_STATE(u_data->io->draw_area)],
	                ios->pixmap,
	                0,0,
	                0, 0,
	                u_data->io->draw_area->allocation.width,
	                u_data->io->draw_area->allocation.height);
}
Example #9
0
//! Redraws the exposed area of the board
gboolean board_redraw (GtkWidget *widget, GdkEventExpose *event)
{
	int x, y;
	int xmin = 0, ymin = 0, xmax = board_wid, ymax = board_heit;
	if (!opt_game)
	{
		GdkPixmap *splash_pixmap;
		splash_pixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, 
				gdk_colormap_get_system (), NULL, NULL, splash_xpm);
		gdk_draw_pixmap ((GdkDrawable *)board_area->window, 
				board_area->style->bg_gc[GTK_STATE_NORMAL],
				(GdkDrawable *)splash_pixmap, 
				0, 0, 0, 0, -1, -1);
		gdk_pixmap_unref (splash_pixmap);
		return TRUE;
	}
	if (event)
	{
		xmin = event->area.x / cell_size;
		ymin = event->area.y / cell_size;
		xmax = (event->area.x + event->area.width) / cell_size + 1;
		ymax = (event->area.y + event->area.height) / cell_size + 1;
		if (ymin < 0) ymin = 0;
		if (xmax > board_wid) xmax = board_wid;
		if (ymax > board_heit) ymax = board_heit;
	}
	for (x=xmin; x<xmax; x++)
		for (y=ymin; y<ymax; y++)
				board_refresh_cell_real (
						state_board_flipped ? board_wid - 1 - x : x, 
						state_board_flipped ? y : (board_heit - 1 - y), 
						x, y);
	return TRUE;
}
Example #10
0
static gint draw_func(gpointer data)
{
	gint i;
	
	if(!window)
	{
		timeout_tag = 0;
		return FALSE;
	}
	
	GDK_THREADS_ENTER();
	gdk_draw_rectangle(draw_pixmap,gc,TRUE,0,0,WIDTH,HEIGHT);

	
	for(i = 0; i < NUM_BANDS; i++)
	{
		/*if(bar_heights[i] > 4)
			bar_heights[i] -= 4;
		else
			bar_heights[i] = 0;*/
		gdk_draw_pixmap(draw_pixmap,gc,bar, 0,HEIGHT - 1 - bar_heights[i], i * (WIDTH / NUM_BANDS), HEIGHT - 1 - bar_heights[i], (WIDTH / NUM_BANDS) - 1, bar_heights[i]);
		
	}
	gdk_window_clear(area->window);
	GDK_THREADS_LEAVE();
	
	return TRUE;
}
Example #11
0
static void     
service_hslider(GtkWidget *text, gpointer data)
{
GtkAdjustment *hadj;
gint xsrc;

if(signalpixmap)
	{
	hadj=GTK_ADJUSTMENT(signal_hslider);
	xsrc=(gint)hadj->value;
	DEBUG(printf("Signal HSlider Moved to %d\n",xsrc));

	gdk_draw_rectangle(signalpixmap, signalarea->style->bg_gc[GTK_STATE_ACTIVE], TRUE,
	        0, -1, signal_fill_width, fontheight);
	gdk_draw_line(signalpixmap, signalarea->style->white_gc,  
	        0, fontheight-1, signal_fill_width-1, fontheight-1);
	gdk_draw_string(signalpixmap, signalfont,
	        signalarea->style->fg_gc[0], 3+xsrc, fontheight-4, "Time");

	gdk_draw_pixmap(signalarea->window, signalarea->style->fg_gc[GTK_WIDGET_STATE(signalarea)],
                signalpixmap,
		xsrc, 0,
		0, 0,
                signalarea->allocation.width, signalarea->allocation.height);
	}
}
Example #12
0
gint	handle_map_expose(
	GtkWidget *widget, GdkEventExpose *event
)
{
	GtkAdjustment *hAdj = GTK_ADJUSTMENT( gMapHScrollBarAdjustment );
	GtkAdjustment *vAdj = GTK_ADJUSTMENT( gMapVScrollBarAdjustment );

	long srcX = (long)(hAdj->value + event->area.x);
	long srcY = (long)(vAdj->value + event->area.y);
	long dstX = (long)event->area.x;
	long dstY = (long)event->area.y;
	long w = (long)event->area.width;
	long h = (long)event->area.height;

	// 背景の描画

	GdkGC *gc = gMapDrawingArea->style->fg_gc[GTK_STATE_NORMAL];

	gdk_draw_pixmap(
			gMapDrawingArea->window,
			gc,
			gPcgDun.getWBuf()->getPixMap(),
			srcX, srcY,
			dstX, dstY,
			w, h );
	return TRUE;
}
void
combo_tx_satname_changed                   (GtkEditable     *editable,
                                        gpointer         user_data)
{
  int i;
  GtkWidget *widget;
  GdkRectangle updatewin;

  /* copy original map to draw map */
  if( drawmap )
    gdk_draw_pixmap(drawmap,yellow_gc,sourcemap,0,0,0,0,MAPSIZEX,MAPSIZEY);

  /* Reset dots array */
  for( i=0; i<MAXDOTS; i++ ) {
    dots[i].x=0;
    dots[i].y=0;
  }
  ndots=0;

  /* copy empty az/el graphic to draw pixmap */
  if( drawazel ) {
    gdk_draw_pixmap(drawazel,yellow_gc,sourceazel,0,0,0,0,AZELSIZEX,AZELSIZEY);

    /* Force AZ/EL redraw */
    widget = lookup_widget( dialog_azel_graph, "azelgraph" );
    updatewin.x = 0;
    updatewin.y = 0;
    updatewin.width = widget->allocation.width;
    updatewin.height = widget->allocation.height;
    gtk_widget_draw ( widget, &updatewin);
  }

  /* Reset dots array */
  for( i=0; i<AZELMAXDOTS; i++ ) {
    azeldots[i].x=0;
    azeldots[i].y=0;
  }
  nazeldots=0;

  newsat=1;
  lastel=-90;

  if(autofreq==TRUE)
    lookup_sat_db();

/*    doprediction=TRUE; */
}
Example #14
0
void create_server_pixmap (GtkWidget *window, struct pixmap *stype, 
                                   int n, GdkPixmap **pix, GdkBitmap **mask) {
  GdkGC *white_gc;
  int hb, wb, hs, ws;

  if (!GTK_WIDGET_REALIZED (window))
    gtk_widget_realize (window);

  gdk_window_get_size (buddy_pix[1].pix, &wb, &hb);
  gdk_window_get_size (stype->pix, &ws, &hs);

  *pix  = gdk_pixmap_new (window->window, wb + ws, MAX (hs, hb), -1);
  *mask = gdk_pixmap_new (window->window, wb + ws, MAX (hs, hb), 1);

  white_gc = window->style->base_gc[GTK_STATE_NORMAL];

  if (!masks_gc) {
    masks_gc = gdk_gc_new (*mask);
    gdk_gc_set_exposures (masks_gc, FALSE);
  }

  mask_pattern.pixel = 0;
  gdk_gc_set_foreground (masks_gc, &mask_pattern);
  gdk_draw_rectangle (*mask, masks_gc, TRUE, 0, 0, -1, -1);

  mask_pattern.pixel = 1;
  gdk_gc_set_foreground (masks_gc, &mask_pattern);

  if (n) {
    ensure_buddy_pix (window, n);

    gdk_gc_set_clip_origin (white_gc, 0, 0);
    gdk_gc_set_clip_mask (white_gc, buddy_pix[n].mask);
    gdk_draw_pixmap (*pix, white_gc, buddy_pix[n].pix, 0, 0, 0, 0, wb, hb);

    gdk_draw_pixmap (*mask, masks_gc, buddy_pix[n].mask, 0, 0, 0, 0, wb, hb);
  }

  gdk_gc_set_clip_origin (white_gc, wb, 0);
  gdk_gc_set_clip_mask (white_gc, stype->mask);
  gdk_draw_pixmap (*pix, white_gc, stype->pix, 0, 0, wb, 0, ws, hs);

  gdk_draw_pixmap (*mask, masks_gc, stype->mask, 0, 0, wb, 0, ws, hs);

  gdk_gc_set_clip_origin (white_gc, 0, 0);
  gdk_gc_set_clip_mask (white_gc, NULL);
}
Example #15
0
static GdkPixmap *
scale_pixmap (GdkWindow *window, GdkPixmap *pixmap, gdouble scale_x, gdouble scale_y)
{
  GdkGC *gc;
  GdkColormap *colormap;
  GdkColorContext *cc;
  GdkVisual *visual;
  GdkImage *image;
  GdkPixmap *new_pixmap;
  gint x, y, width, height, new_width, new_height;

  if(!pixmap) return NULL;
  if(!window) return NULL;

  gc = gdk_gc_new(pixmap);
  colormap = gdk_colormap_get_system ();
  visual = gdk_visual_get_system ();
  cc = gdk_color_context_new(visual, colormap);
  gdk_window_get_size(pixmap, &width, &height);

  if(scale_x == 1.0 && scale_y == 1.0){
    new_pixmap = gdk_pixmap_new(window, width, height, -1);
    gdk_draw_pixmap(new_pixmap,
                    gc,
                    pixmap,
                    0, 0,
                    0, 0,
                    width, height);
    return new_pixmap;
  }

  new_width = roundint(width * scale_x);
  new_height = roundint(height * scale_y);
  new_pixmap = gdk_pixmap_new(window, new_width, new_height, -1);

  image = gdk_image_get(pixmap,
                        0, 0,
                        width, height);

  for(x = 0; x < new_width; x++){
    for(y = 0; y < new_height; y++){
      GdkColor color;
      gint px, py;

      px = MIN(roundint(x / scale_x), width - 1);
      py = MIN(roundint(y / scale_y), height - 1);

      color.pixel = gdk_image_get_pixel(image, px, py);
      gdk_color_context_query_color(cc, &color);

      gdk_gc_set_foreground(gc, &color);
      gdk_draw_point(new_pixmap, gc, x, y);
    }
  }

  gdk_image_destroy(image);
  gdk_color_context_free(cc);
  return new_pixmap;
}
Example #16
0
void gtk_graph_smith_plot_traces(GtkGraph *graph)
{
gint i, n;
GtkGraphTrace *tmp;
gfloat CA, CB, CC, CD;

GdkPoint *pts = NULL;

g_return_if_fail (graph != NULL);
g_return_if_fail (GTK_IS_GRAPH (graph));
g_return_if_fail (GTK_WIDGET_REALIZED (graph));
g_return_if_fail (graph->graph_type == SMITH);
	
tmp = graph->traces;
for (n = 0 ; n < graph->num_traces ; n++)
	{
	/* Make sure that there is some data in the trace */
	if (tmp->Xdata == NULL || tmp->Ydata == NULL) 
		continue;

	/* Assign the storage for the co-ordinates of each data point */

	pts = (GdkPoint *) g_malloc ((tmp->num_points) * sizeof(GdkPoint));

	/* The Xdata array contains the resistance whilst the Ydata array has the reactance */
	
	CA = tmp->Xdata[0] - graph->smith_Z0;
	CB = tmp->Ydata[0];
	CC = tmp->Xdata[0] + graph->smith_Z0;
	CD = tmp->Ydata[0];
		
	pts[0].x = centre_x + (CA*CC + CB*CD)/(CC*CC + CD*CD) * graph->dependant->scale_factor;
	pts[0].y = centre_y - (CB*CC - CA*CD)/(CC*CC + CD*CD) * graph->dependant->scale_factor;
	
 	for (i = 1 ; i < tmp->num_points ; i++)
      	{
		CA = tmp->Xdata[i] - graph->smith_Z0;
		CB = tmp->Ydata[i];
		CC = tmp->Xdata[i] + graph->smith_Z0;
		CD = tmp->Ydata[i];
		
		pts[i].x = centre_x + (CA*CC + CB*CD)/(CC*CC + CD*CD) * graph->dependant->scale_factor;
		pts[i].y = centre_y - (CB*CC - CA*CD)/(CC*CC + CD*CD) * graph->dependant->scale_factor;
		}

	gdk_draw_lines (buffer, tmp->format->line_gc, pts, tmp->num_points);/* Draw the lines */	
	for (i = 1 ; i < tmp->num_points ; i++)/* and then draw the markers */	
        if (tmp->format->marker_type != GTK_GRAPH_MARKER_NONE)
			{
			gdk_gc_set_clip_origin(tmp->format->marker_gc, pts[i].x-5, pts[i].y-5);
            gdk_draw_pixmap(buffer, tmp->format->marker_gc, tmp->format->marker, 0, 0, pts[i].x-5, pts[i].y-5, -1, -1);
			}

	g_free(pts);// Free up all storage after use 
	tmp = tmp->next;// and then move onto the next trace 
	
	}
	
}
Example #17
0
void
gpk_redraw(GdkPixmap * pixmap, GtkWidget * pixmapbox)
{
    /* redraw the entire pixmap */
    gdk_draw_pixmap(pixmapbox->window,
                    pixmapbox->style->fg_gc[GTK_WIDGET_STATE(pixmapbox)],
                    pixmap, 0, 0, 0, 0, pixmapbox->allocation.width, pixmapbox->allocation.height);
}
Example #18
0
static void
gtk_hruler_draw_pos (GtkRuler *ruler)
{
  GtkWidget *widget;
  GdkGC *gc;
  int i;
  gint x, y;
  gint width, height;
  gint bs_width, bs_height;
  gint xthickness;
  gint ythickness;
  gfloat increment;

  g_return_if_fail (ruler != NULL);
  g_return_if_fail (GTK_IS_HRULER (ruler));

  if (GTK_WIDGET_DRAWABLE (ruler))
    {
      widget = GTK_WIDGET (ruler);

      gc = widget->style->fg_gc[GTK_STATE_NORMAL];
      xthickness = widget->style->klass->xthickness;
      ythickness = widget->style->klass->ythickness;
      width = widget->allocation.width;
      height = widget->allocation.height - ythickness * 2;

      bs_width = height / 2;
      bs_width |= 1;  /* make sure it's odd */
      bs_height = bs_width / 2 + 1;

      if ((bs_width > 0) && (bs_height > 0))
	{
	  /*  If a backing store exists, restore the ruler  */
	  if (ruler->backing_store && ruler->non_gr_exp_gc)
	    gdk_draw_pixmap (ruler->widget.window,
			     ruler->non_gr_exp_gc,
			     ruler->backing_store,
			     ruler->xsrc, ruler->ysrc,
			     ruler->xsrc, ruler->ysrc,
			     bs_width, bs_height);

	  increment = (gfloat) width / (ruler->upper - ruler->lower);

	  x = ROUND ((ruler->position - ruler->lower) * increment) + (xthickness - bs_width) / 2 - 1;
	  y = (height + bs_height) / 2 + ythickness;

	  for (i = 0; i < bs_height; i++)
	    gdk_draw_line (widget->window, gc,
			   x + i, y + i,
			   x + bs_width - 1 - i, y + i);


	  ruler->xsrc = x;
	  ruler->ysrc = y;
	}
    }
}
Example #19
0
void WinDraw_ShowSplash(void)
{

	gdk_draw_pixmap(pixmap,
	    drawarea->style->fg_gc[GTK_WIDGET_STATE(drawarea)],
	    splash_pixmap, 0, 0,
	    768 - keropi_xpm_width, 512 - keropi_xpm_height,
	    keropi_xpm_width, keropi_xpm_height);
}
static gint
expose_event (GtkWidget *widget, GdkEventExpose *e, C2NetworkTraffic *nt)
{
	gdk_draw_pixmap (widget->window, widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
					 nt->pixmap, e->area.x, e->area.y, e->area.x, e->area.y,
					 e->area.width, e->area.height);
	
	return FALSE;
}
Example #21
0
/** \brief concatenate two pixmaps
 *
 * horizontal concatenation
 * @param window
 * @param dest destination pixmap
 * @param s1 first pixmap
 * @param s2 second pixmap
 * @returns dest for convenience
 */
struct pixmap* cat_pixmaps (GtkWidget *window, struct pixmap *dest, struct pixmap* s1, struct pixmap* s2)
{
  GdkGC *white_gc;
  int h1, w1, h2, w2;

  if (!GTK_WIDGET_REALIZED (window))
    gtk_widget_realize (window);

  gdk_window_get_size (s1->pix, &w1, &h1);
  gdk_window_get_size (s2->pix, &w2, &h2);

  dest->pix  = gdk_pixmap_new (window->window, w1 + w2, MAX (h1, h2), -1);
  dest->mask = gdk_pixmap_new (window->window, w1 + w2, MAX (h1, h2), 1);

  white_gc = window->style->base_gc[GTK_STATE_NORMAL];

  if (!masks_gc) {
    masks_gc = gdk_gc_new (dest->mask);
    gdk_gc_set_exposures (masks_gc, FALSE);
  }

  mask_pattern.pixel = 0;
  gdk_gc_set_foreground (masks_gc, &mask_pattern);
  gdk_draw_rectangle (dest->mask, masks_gc, TRUE, 0, 0, -1, -1);

  mask_pattern.pixel = 1;
  gdk_gc_set_foreground (masks_gc, &mask_pattern);

  gdk_gc_set_clip_origin (white_gc, 0, 0);
  gdk_gc_set_clip_mask (white_gc, s1->mask);
  gdk_draw_pixmap (dest->pix, white_gc, s1->pix, 0, 0, 0, 0, w1, h1);
  gdk_draw_pixmap (dest->mask, masks_gc, s1->mask, 0, 0, 0, 0, w1, h1);

  gdk_gc_set_clip_origin (white_gc, w1, 0);
  gdk_gc_set_clip_mask (white_gc, s2->mask);
  gdk_draw_pixmap (dest->pix, white_gc, s2->pix, 0, 0, w1, 0, w2, h2);
  gdk_draw_pixmap (dest->mask, masks_gc, s2->mask, 0, 0, w1, 0, w2, h2);

  gdk_gc_set_clip_origin (white_gc, 0, 0);
  gdk_gc_set_clip_mask (white_gc, NULL);

  return dest;
}
static gint     expose_event(GtkWidget *widget, GdkEventExpose *event, void *disp)
{
  gdk_draw_pixmap(widget->window,
                  widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
                  pixmap,
                  event->area.x, event->area.y,
                  event->area.x, event->area.y,
                  event->area.width, event->area.height);
  return (FALSE);
}
Example #23
0
gint
wgra_expose(GtkWidget *widget,GdkEventExpose *ee,gpointer data)
{
  gdk_draw_pixmap(widget->window,
		  widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
		  wcanvas,
		  ee->area.x, ee->area.y,
		  ee->area.x, ee->area.y,
		  ee->area.width, ee->area.height);
  return FALSE;
}
/*
 * The job of this function is to update the view from the
 * embeddable's representation of the image data.
 */
static void
view_update (view_data_t *view_data)
{
	gdk_draw_pixmap (view_data->drawing_area->window,
			 view_data->gc,
			 view_data->embeddable_data->pixmap,
			 0, 0,
			 0, 0,
			 MIN (view_data->width, view_data->embeddable_data->width),
			 MIN (view_data->height, view_data->embeddable_data->height));
}
Example #25
0
// Expose callback for the drawing area 
static gint expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
{
	gdk_draw_pixmap(
			widget->window,
			widget->style->white_gc,
			back_buffer,
			event->area.x, event->area.y,
			event->area.x, event->area.y,
			event->area.width, event->area.height
	);
	return TRUE;
}
Example #26
0
static void
draw_restore(struct graphics_priv *gr, struct point *p, int w, int h)
{
#if 0
	GtkWidget *widget=gr->widget;
	gdk_draw_pixmap(widget->window,
                        widget->style->fg_gc[GTK_WIDGET_STATE(widget)],
                        gr->drawable,
                        p->x, p->y, p->x, p->y, w, h);
#endif

}
/* Redraw the screen from the backing pixmap */
static gint
expose_event (GtkWidget * widget, GdkEventExpose * event)
{
  /*  draw_screen();*/
  gdk_draw_pixmap(widget->window,
		  widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
		  ctk_gtksim_pixmap,
		  event->area.x, event->area.y,
		  event->area.x, event->area.y,
		  event->area.width, event->area.height);
  return FALSE;
}
Example #28
0
File: gtkfb.c Project: sgh/aos
static gboolean expose_event_callback (GtkWidget *widget, GdkEventExpose *event, UNUSED gpointer data) {
//   gdk_draw_arc (widget->window, widget->style->fg_gc[GTK_WIDGET_STATE (widget)], TRUE, 0, 0, widget->allocation.width, widget->allocation.height, 0, 64 * 360);
 
		gdk_draw_pixmap(widget->window,
		    widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
		    pixmap,
		    event->area.x, event->area.y,
		    event->area.x, event->area.y,
		    event->area.width, event->area.height);

  return FALSE;
}
Example #29
0
/* video_on_drawing_area_expose */
static gboolean _video_on_drawing_area_expose(GtkWidget * widget,
                GdkEventExpose * event, gpointer data)
{
        /* XXX this code is inspired from GQcam */
        VideoPhonePlugin * video = data;

        gdk_draw_pixmap(widget->window, video->gc, video->pixmap,
                        event->area.x, event->area.y,
                        event->area.x, event->area.y,
                        event->area.width, event->area.height);
        return FALSE;
}
Example #30
0
/* camera_on_drawing_area_expose */
static gboolean _camera_on_drawing_area_expose(GtkWidget * widget,
		GdkEventExpose * event, gpointer data)
{
	/* XXX this code is inspired from GQcam */
	Camera * camera = data;

	gdk_draw_pixmap(widget->window, camera->gc, camera->pixmap,
			event->area.x, event->area.y,
			event->area.x, event->area.y,
			event->area.width, event->area.height);
	return FALSE;
}