Exemplo n.º 1
0
gboolean whiteb_expose_event(GtkWidget *white_board, GdkEventExpose *ev, gpointer user_data)
{
	struct question *question_data = user_data;
	if(whiteb_image == NULL)
	{
		/* Load the image */
		whiteb_image = rsvg_pixbuf_from_file_at_size(g_strdup_printf("questions/%s/%s/%s/%s/%s/%s",question_data->group,question_data->level,question_data->type,question_data->topic,question_data->stopic,question_data->filename),768,576, NULL);
		if(whiteb_image!=NULL)
		{
			GdkPixmap *question_map = gdk_pixmap_new(NULL,768,576,24);
			draw_fill_a_buffer(question_map);
			gdk_draw_pixbuf(question_map,gdk_gc_new(question_map),whiteb_image,0,0,0,0,768,576,GDK_RGB_DITHER_NONE,0,0);
			draw_set_original(question_map);
		}
	}
	draw_sync_buffers(white_board);
	return 0;
}
Exemplo n.º 2
0
static VALUE
rg_s_pixbuf_from_file_at_size(G_GNUC_UNUSED VALUE self, VALUE file_name,
                                 VALUE width, VALUE height)
{
    VALUE rb_pixbuf;
    GdkPixbuf *pixbuf;
    GError *error = NULL;

    pixbuf = rsvg_pixbuf_from_file_at_size(RVAL2CSTR(file_name),
                                           NUM2INT(width),
                                           NUM2INT(height),
                                           &error);

    if (error) RAISE_GERROR(error);

    rb_pixbuf = GOBJ2RVAL(pixbuf);
    g_object_unref(pixbuf);
    return rb_pixbuf;
}
Exemplo n.º 3
0
gboolean whiteb_expose_event(GtkWidget *white_board, GdkEventExpose *ev, gpointer user_data)
{
	struct Question *data = user_data;
	if(whiteb_image == NULL)
	{
		/* Load the image */
		char *filename = malloc(140);
		memset(filename,'\0',140);
		strcpy(filename,"questions/");
		strcat(filename,data->filename);
		whiteb_image = rsvg_pixbuf_from_file_at_size(filename,768,576, NULL);
		if(whiteb_image!=NULL)
		{
			GdkPixmap *question_map = gdk_pixmap_new(NULL,768,576,24);
			draw_fill_a_buffer(question_map);
			gdk_draw_pixbuf(question_map,gdk_gc_new(question_map),whiteb_image,0,0,0,0,768,576,GDK_RGB_DITHER_NONE,0,0);
			draw_set_original(question_map);
		}
	}
	draw_sync_buffers(white_board);
	return 0;
}
Exemplo n.º 4
0
GdkPixbuf *
sge_load_svg_to_pixbuf (char *filename, int width,
			int height)
{
	gchar *full_pathname;
	GdkPixbuf *pixbuf = NULL;
	GError *error;

	full_pathname = g_strconcat(DATADIR "/pixmaps/",
	                            filename,
	                            NULL );
	if (g_file_test(full_pathname, G_FILE_TEST_IS_REGULAR)) {
		pixbuf = rsvg_pixbuf_from_file_at_size (full_pathname, width,
						   height, &error);
		g_free (full_pathname);
		if (pixbuf == NULL)
			g_free (error);

	} else
		g_warning ("%s not found", filename);

	return pixbuf;
}