コード例 #1
0
static void
redraw_viewer(void)
{
  flush_gdk_buffers();

  if (v_disparity_buffer)
  {
    gdk_draw_pixbuf(drawing_area->window,
        drawing_area->style->fg_gc[GTK_WIDGET_STATE (drawing_area)],
        GDK_PIXBUF(v_disparity_buffer), 0, 0, 0, 0,
        v_disparity_map->width,
        drawing_area->allocation.height,
        GDK_RGB_DITHER_NONE, 0, 0);
  }

  if (road_profile_buffer)
  {
    gdk_draw_pixbuf(drawing_area->window,
        drawing_area->style->fg_gc[GTK_WIDGET_STATE (drawing_area)],
        GDK_PIXBUF(road_profile_buffer), 0, 0, v_disparity_map->width + 10, 0,
        road_profile_image->width,
        drawing_area->allocation.height,
        GDK_RGB_DITHER_NONE, 0, 0);
  }

  if (right_buffer)
  {
    gdk_draw_pixbuf(drawing_area->window,
        drawing_area->style->fg_gc[GTK_WIDGET_STATE (drawing_area)],
        GDK_PIXBUF(right_buffer), 0, 0,  v_disparity_map->width + road_profile_image->width + 20, 0,
        right_image->width,
        drawing_area->allocation.height,
        GDK_RGB_DITHER_NONE, 0, 0);
  }
}
コード例 #2
0
/* doesn't return a ref to the pixbuf */
static GdkPixbuf *
check_message_pixbuf (GstMessage * msg, const gchar * name, gint channels,
    gboolean has_alpha)
{
  GdkPixbuf *pixbuf;
  const GstStructure *s;

  fail_unless (gst_message_get_structure (msg) != NULL);

  s = gst_message_get_structure (msg);
  fail_unless_equals_string (gst_structure_get_name (s), name);

  fail_unless (gst_structure_has_field (s, "pixbuf"));
  fail_unless (gst_structure_has_field_typed (s, "pixel-aspect-ratio",
          GST_TYPE_FRACTION));
  pixbuf =
      GDK_PIXBUF (g_value_get_object (gst_structure_get_value (s, "pixbuf")));
  fail_unless (GDK_IS_PIXBUF (pixbuf));
  fail_unless_equals_int (gdk_pixbuf_get_n_channels (pixbuf), channels);
  fail_unless_equals_int (gdk_pixbuf_get_has_alpha (pixbuf), has_alpha);
  fail_unless_equals_int (gdk_pixbuf_get_width (pixbuf), 319);
  fail_unless_equals_int (gdk_pixbuf_get_height (pixbuf), 241);

  return pixbuf;
}
コード例 #3
0
static VALUE
cview_initialize(int argc, VALUE *argv, VALUE self)
{
    VALUE text;
    VALUE with_markup = Qnil;
    GtkWidget *widget = NULL;

    rb_scan_args(argc, argv, "02", &text, &with_markup);
    
    if (NIL_P(text)) {
        widget = gtk_cell_view_new();
    } else {
        G_CHILD_SET(self, id_text, text);
        if (TYPE(text) == T_STRING){
            if (NIL_P(with_markup) || RVAL2CBOOL(with_markup)){
                widget = gtk_cell_view_new_with_markup(RVAL2CSTR(text));
            } else {
                widget = gtk_cell_view_new_with_text(RVAL2CSTR(text));
            }
        } else if (rb_obj_is_kind_of(text, GTYPE2CLASS(GDK_TYPE_PIXBUF))){
            widget = gtk_cell_view_new_with_pixbuf(GDK_PIXBUF(RVAL2GOBJ(text)));
        } else {
            rb_raise(rb_eArgError, 
                     "invalid argument %s (expect String or Gdk::Pixbuf)", 
                     rb_class2name(CLASS_OF(text)));
        }
    }

    RBGTK_INITIALIZE(self, widget);

    return Qnil;
}
コード例 #4
0
ファイル: astro-contact-row.c プロジェクト: UIKit0/toys
/* GObject stuff */
static void
astro_contact_row_set_property (GObject      *object, 
                                guint         prop_id,
                                const GValue *value,
                                GParamSpec   *pspec)
{
  AstroContactRowPrivate *priv;
  
  g_return_if_fail (ASTRO_IS_CONTACT_ROW (object));
  priv = ASTRO_CONTACT_ROW (object)->priv;

  switch (prop_id)
  {
    case PROP_NAME:
      astro_contact_row_set_name (ASTRO_CONTACT_ROW (object),
                                  g_value_get_string (value));
      break;
    case PROP_ICON:
      astro_contact_row_set_icon (ASTRO_CONTACT_ROW (object),
                                  GDK_PIXBUF (g_value_get_object (value)));
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
      break;
  }
}
コード例 #5
0
ファイル: rb-mtp-source.c プロジェクト: dignan/control
static void
artwork_notify_cb (RhythmDB *db,
		   RhythmDBEntry *entry,
		   const char *property_name,
		   const GValue *metadata,
		   RBMtpSource *source)
{
	RBMtpSourcePrivate *priv = MTP_SOURCE_GET_PRIVATE (source);
	GdkPixbuf *pixbuf;
	const char *album_name;

	album_name = rhythmdb_entry_get_string (entry, RHYTHMDB_PROP_ALBUM);

	/* check if we're looking for art for this entry, and if we actually got some */
	if (g_hash_table_remove (priv->artwork_request_map, album_name) == FALSE)
		return;

	if (G_VALUE_HOLDS (metadata, GDK_TYPE_PIXBUF) == FALSE)
		return;

	pixbuf = GDK_PIXBUF (g_value_get_object (metadata));

	rb_mtp_thread_set_album_image (priv->device_thread, album_name, pixbuf);
	queue_free_space_update (source);
}
コード例 #6
0
static PyObject *
pixbuf_get_pixels_array(PyObject *self, PyObject *args)
{
    /* 1) read in Python pixbuf, get the underlying gdk_pixbuf */
    PyGObject *py_pixbuf;
    GdkPixbuf *gdk_pixbuf;
    PyArrayObject *array;
    int dims[3] = { 0, 0, 3 };

    if (!PyArg_ParseTuple(args, "O!:pixbuf_get_pixels_array",
			  &PyGdkPixbuf_Type, &py_pixbuf))
	return NULL;

    gdk_pixbuf = GDK_PIXBUF(py_pixbuf->obj);

    /* 2) same as pygtk/gtk/gdk.c _wrap_gdk_pixbuf_get_pixels_array()
     * with 'self' changed to py_pixbuf
     */

    dims[0] = gdk_pixbuf_get_height(gdk_pixbuf);
    dims[1] = gdk_pixbuf_get_width(gdk_pixbuf);
    if (gdk_pixbuf_get_has_alpha(gdk_pixbuf))
        dims[2] = 4;

    array = (PyArrayObject *)PyArray_FromDimsAndData(3, dims, PyArray_UBYTE,
			     (char *)gdk_pixbuf_get_pixels(gdk_pixbuf));
    if (array == NULL)
        return NULL;

    array->strides[0] = gdk_pixbuf_get_rowstride(gdk_pixbuf);
    /* the array holds a ref to the pixbuf pixels through this wrapper*/
    Py_INCREF(py_pixbuf);
    array->base = (PyObject *)py_pixbuf;
    return PyArray_Return(array);
}
コード例 #7
0
static void
art_cb (RBExtDBKey *key, const char *filename, GValue *data, MxFrame *frame)
{
    ClutterActor *image;
    GdkPixbuf *pixbuf;

    if (data == NULL || G_VALUE_HOLDS (data, GDK_TYPE_PIXBUF) == FALSE) {
        return;
    }

    clutter_threads_enter ();

    image = gtk_clutter_texture_new ();
    pixbuf = GDK_PIXBUF (g_value_get_object (data));
    gtk_clutter_texture_set_from_pixbuf (GTK_CLUTTER_TEXTURE (image), pixbuf, NULL);
    if (clutter_actor_get_height (image) > MAX_IMAGE_HEIGHT) {
        clutter_actor_set_height (image, MAX_IMAGE_HEIGHT);
        clutter_texture_set_keep_aspect_ratio (CLUTTER_TEXTURE (image), TRUE);
    }
    if (clutter_actor_get_width (image) > MAX_IMAGE_HEIGHT) {
        clutter_actor_set_width (image, MAX_IMAGE_HEIGHT);
    }
    mx_bin_set_child (MX_BIN (frame), image);
    clutter_actor_show_all (CLUTTER_ACTOR (frame));

    clutter_threads_leave ();
}
コード例 #8
0
ファイル: rbgdkpixbuf.c プロジェクト: Vasfed/ruby-gnome2
static VALUE
rg_s_from_image(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
{
    VALUE cmap, src, src_x, src_y, width, height, dest, dest_x, dest_y;
    GdkPixbuf* buf;

    rb_scan_args(argc, argv, "63", &cmap, &src, &src_x, &src_y, &width, &height, 
                 &dest, &dest_x, &dest_y);

    buf = gdk_pixbuf_get_from_image(GDK_PIXBUF(RVAL2GOBJ(dest)),
                                    GDK_IMAGE(RVAL2GOBJ(src)),
                                    GDK_COLORMAP(RVAL2GOBJ(cmap)),
                                    NUM2INT(src_x), NUM2INT(src_y),
                                    NIL_P(dest_x) ? 0 : NUM2INT(dest_x),
                                    NIL_P(dest_y) ? 0 : NUM2INT(dest_y),
                                    NUM2INT(width), NUM2INT(height));
    if (NIL_P(dest)) {
        if (buf) {
            return GOBJ2RVAL(buf);
        } else {
            return Qnil;
        }
    } else {
        return dest;
    }
}
コード例 #9
0
static void
on_sliced_image_loaded (GObject *source_object,
                        GAsyncResult *res,
                        gpointer user_data)
{
  GObject *cache = source_object;
  AsyncImageData *data = (AsyncImageData *)user_data;
  GTask *task = G_TASK (res);
  GList *list, *pixbufs;

  if (g_task_had_error (task))
    return;

  pixbufs = g_task_propagate_pointer (task, NULL);

  for (list = pixbufs; list; list = list->next)
    {
      ClutterActor *actor = load_from_pixbuf (GDK_PIXBUF (list->data));
      clutter_actor_hide (actor);
      clutter_actor_add_child (data->actor, actor);
    }

  g_list_free_full (pixbufs, g_object_unref);

  if (data->load_callback != NULL)
    data->load_callback (cache, data->load_callback_data);
}
コード例 #10
0
ファイル: rbgtkicontheme.c プロジェクト: benolee/ruby-gnome2
static VALUE
it_s_add_builtin_icon(VALUE self, VALUE icon_name, VALUE size, VALUE pixbuf)
{
    gtk_icon_theme_add_builtin_icon(RVAL2CSTR(icon_name), NUM2INT(size),
                                    GDK_PIXBUF(RVAL2GOBJ(pixbuf)));
    return self;
}
コード例 #11
0
/*! \brief Get fallback pixbuf for displaying pictures.
 * \par Function Description
 * Returns a pixbuf containing the fallback image to be used if a
 * picture object fails to load.  The returned pixbuf should be freed
 * with g_object_unref() when no longer needed.
 *
 * \return a #GdkPixbuf containing a warning image.
 */
GdkPixbuf *
o_picture_get_fallback_pixbuf (TOPLEVEL *toplevel)
{
  static GdkPixbuf *pixbuf = NULL;
  static gboolean failed = FALSE;

  if (pixbuf == NULL && !failed) {
    gchar *filename;
    GError *error = NULL;

    filename = g_build_filename (toplevel->bitmap_directory,
                                 "gschem-warning.png", NULL);
    pixbuf = gdk_pixbuf_new_from_file (filename, &error);

    if (pixbuf == NULL) {
      g_warning ( _("Failed to load fallback image %1$s: %2$s.\n"),
                  filename, error->message);
      g_error_free (error);
      failed = TRUE;
    }
    g_free (filename);
  }

  if (failed) return NULL;

  g_assert (GDK_IS_PIXBUF (pixbuf));
  return GDK_PIXBUF (g_object_ref (pixbuf));
}
コード例 #12
0
ファイル: fm-thumbnail.c プロジェクト: Gontxal0/libfm
static gboolean write_image(GObject* image, const char* filename)
{
    char *keys[11]; /* enough for known keys + 1 */
    char *vals[11];
    GdkPixbuf *pix = GDK_PIXBUF(image);
    char *known_keys[] = { "tEXt::Thumb::URI", "tEXt::Thumb::MTime",
                           "tEXt::Thumb::Size", "tEXt::Thumb::Mimetype",
                           "tEXt::Description", "tEXt::Software",
                           "tEXt::Thumb::Image::Width", "tEXt::Thumb::Image::Height",
                           "tEXt::Thumb::Document::Pages", "tEXt::Thumb::Movie::Length" };
    guint i, x;

    /* unfortunately GdkPixbuf APIs does not contain API to get
       list of options that are set, neither there is API to save
       the file with all options, so all we can do now is to scan
       options for known ones and save them into target file */
    for (i = 0, x = 0; i < G_N_ELEMENTS(known_keys); i++)
    {
        const char *val = gdk_pixbuf_get_option(pix, known_keys[i]);
        if (val)
        {
            keys[x] = known_keys[i];
            vals[x] = (char*)val;
            x++;
        }
    }
    keys[x] = NULL;
    vals[x] = NULL;
    return gdk_pixbuf_savev(pix, filename, "png", keys, vals, NULL);
}
コード例 #13
0
ファイル: test-photos.c プロジェクト: Silvirus/libgpod
static void
dump_thumbs (Itdb_PhotoDB *db, Itdb_Artwork *artwork,
	     const gchar *album_name, const gchar *dir)
{
	GList *it;
	gint i = 0;
        GList *thumbnails;

        thumbnails = itdb_thumb_to_pixbufs (db->device, artwork->thumbnail);
	for (it = thumbnails; it != NULL; it = it->next, i++) {
		gchar *filename, *path;
                GdkPixbuf *pixbuf;

                pixbuf = GDK_PIXBUF (it->data);

		g_return_if_fail (pixbuf);

		filename = g_strdup_printf ("%s-%d-%d.png",
					    album_name, artwork->id, i );
		path = g_build_filename (dir, filename, NULL);
		g_free (filename);
		gdk_pixbuf_save (pixbuf, path, "png", NULL, NULL);
		g_object_unref (pixbuf);
		g_free (path);
	}
        g_list_free (thumbnails);
}
コード例 #14
0
ファイル: rbgtkdrag.c プロジェクト: Vasfed/ruby-gnome2
static VALUE
rg_m_set_icon(int argc, VALUE *argv, VALUE self)
{
    VALUE context, obj, pixmap = Qnil, mask = Qnil, hot_x, hot_y;

    if (argc == 6) {
        rb_scan_args(argc, argv, "60", &context, &obj, &pixmap, &mask, &hot_x, &hot_y);
        gtk_drag_set_icon_pixmap(RVAL2DC(context),
                                 GDK_COLORMAP(RVAL2GOBJ(obj)), 
                                 GDK_PIXMAP(RVAL2GOBJ(pixmap)),
                                 GDK_BITMAP(RVAL2GOBJ(mask)), 
                                 NUM2INT(hot_x), NUM2INT(hot_y));
    } else {
        rb_scan_args(argc, argv, "40", &context, &obj, &hot_x, &hot_y);

        if (TYPE(obj) == T_SYMBOL){
            gtk_drag_set_icon_stock(RVAL2DC(context), rb_id2name(SYM2ID(obj)),
                                    NUM2INT(hot_x), NUM2INT(hot_y));
        } else if (rb_obj_is_kind_of(obj, GTYPE2CLASS(GTK_TYPE_WIDGET))){
            gtk_drag_set_icon_widget(RVAL2DC(context), RVAL2WIDGET(obj),
                                     NUM2INT(hot_x), NUM2INT(hot_y));
        } else if (rb_obj_is_kind_of(obj, GTYPE2CLASS(GDK_TYPE_PIXBUF))){
            gtk_drag_set_icon_pixbuf(RVAL2DC(context),
                                     GDK_PIXBUF(RVAL2GOBJ(obj)),
                                     NUM2INT(hot_x), NUM2INT(hot_y));
        } else {
            rb_raise(rb_eArgError, "invalid argument %s", rb_class2name(CLASS_OF(obj)));
        }
    }
    return self;
}
コード例 #15
0
ファイル: gdkpixbuf2numpy.cpp プロジェクト: Data-link/mypaint
PyObject *
gdkpixbuf_get_pixels_array(PyObject *pixbuf_pyobject)
{
    GdkPixbuf *pixbuf = GDK_PIXBUF(((PyGObject *)pixbuf_pyobject)->obj);
    PyArrayObject *array;
    npy_intp dims[3] = { 0, 0, 3 };

    dims[0] = gdk_pixbuf_get_height(pixbuf);
    dims[1] = gdk_pixbuf_get_width(pixbuf);

    if (gdk_pixbuf_get_has_alpha(pixbuf))
        dims[2] = 4;
    guchar *pixels = gdk_pixbuf_get_pixels(pixbuf);

    array = (PyArrayObject *)PyArray_SimpleNewFromData(3, dims, NPY_UBYTE,
                                                       pixels);

    if (array == NULL)
        return NULL;

    PyArray_STRIDES(array)[0] = gdk_pixbuf_get_rowstride(pixbuf);
    // the array holds a ref to the pixbuf pixels through this wrapper
    Py_INCREF(pixbuf_pyobject);

#ifdef NPY_1_7_API_VERSION
    PyArray_SetBaseObject(array, (PyObject *)pixbuf_pyobject);
#else
    array->base = (PyObject *)pixbuf_pyobject;
#endif

    return PyArray_Return(array);
}
コード例 #16
0
ファイル: pixbuf.c プロジェクト: OpenCL/GEGL-OpenCL-old
static GeglRectangle
get_bounding_box (GeglOperation *operation)
{
  GeglProperties   *o = GEGL_PROPERTIES (operation);
  GeglRectangle result = {0,0,0,0};

  if (!o->pixbuf)
    {
      return result;
    }

  result.x = 0;
  result.y = 0;
  result.width  = gdk_pixbuf_get_width (GDK_PIXBUF (o->pixbuf));
  result.height = gdk_pixbuf_get_height (GDK_PIXBUF (o->pixbuf));
  return result;
}
コード例 #17
0
static void
photos_base_item_icon_updated (PhotosBaseItem *self, GIcon *icon)
{
  if (icon == NULL)
    return;

  photos_base_item_set_original_icon (self, GDK_PIXBUF (icon));
}
コード例 #18
0
/*
 * Method: set_mark_category_pixbuf(category, pixbuf)
 * category: a category (as a string).
 * pixbuf: a Gdk::Pixbuf object.
 *
 * Associates a given pixbuf with a given category.
 *
 * Returns: self.
 */
static VALUE
rg_set_mark_category_pixbuf(VALUE self, VALUE category, VALUE pixbuf)
{
    gtk_source_view_set_mark_category_pixbuf(_SELF(self),
                         RVAL2CSTR(category),
                         GDK_PIXBUF(RVAL2GOBJ(pixbuf)));
    return self;
}
コード例 #19
0
ファイル: workspace.c プロジェクト: theojulienne/Claro
void cgraphics_workspace_window_update_icon( widget_t *widget )
{
    workspace_window_widget_t * window = (workspace_window_widget_t *)widget;
    GtkNotebook * notebook = GTK_NOTEBOOK(WIDGET(OBJECT(window)->parent)->native);
	GtkWidget * tab_label = gtk_notebook_get_tab_label(notebook, GTK_WIDGET(widget->native));	
	GtkImage * icon = GTK_IMAGE(g_object_get_data(G_OBJECT(tab_label), "icon"));
	if(window->icon)
	    gtk_image_set_from_pixbuf(icon, GDK_PIXBUF(window->icon->native));
}
コード例 #20
0
ファイル: fm-icon-pixbuf.c プロジェクト: Gontxal0/libfm
/**
 * fm_pixbuf_from_icon_with_fallback
 * @icon: icon descriptor
 * @size: size in pixels
 * @fallback: (allow-none): name of fallback icon
 *
 * Creates a #GdkPixbuf and draws icon there. If icon cannot be found then
 * icon with name @fallback will be loaded instead.
 *
 * Returns: (transfer full): an image.
 *
 * Since: 1.2.0
 */
GdkPixbuf* fm_pixbuf_from_icon_with_fallback(FmIcon* icon, int size, const char *fallback)
{
    GtkIconInfo* ii;
    GdkPixbuf* pix = NULL;
    GSList *pixs, *l;
    PixEntry* ent;

    pixs = (GSList*)g_object_steal_qdata(G_OBJECT(icon), fm_qdata_id);
    for( l = pixs; l; l=l->next )
    {
        ent = (PixEntry*)l->data;
        if(ent->size == size) /* cached pixbuf is found! */
        {
            return ent->pix ? GDK_PIXBUF(g_object_ref(ent->pix)) : NULL;
        }
    }

    /* not found! load the icon from disk */
    ii = gtk_icon_theme_lookup_by_gicon(gtk_icon_theme_get_default(), G_ICON(icon), size, GTK_ICON_LOOKUP_FORCE_SIZE);
    if(ii)
    {
        pix = gtk_icon_info_load_icon(ii, NULL);
        gtk_icon_info_free(ii);

        /* increase ref_count to keep this pixbuf in memory
           even when no one is using it. */
        if(pix)
            g_object_ref(pix);
    }
    if (pix == NULL)
    {
        char* str = g_icon_to_string(G_ICON(icon));
        g_debug("unable to load icon %s", str);
        if(fallback)
            pix = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(), fallback,
                    size, GTK_ICON_LOOKUP_USE_BUILTIN|GTK_ICON_LOOKUP_FORCE_SIZE, NULL);
        if(pix == NULL) /* still unloadable */
            pix = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(), "unknown",
                    size, GTK_ICON_LOOKUP_USE_BUILTIN|GTK_ICON_LOOKUP_FORCE_SIZE, NULL);
        if(G_LIKELY(pix))
            g_object_ref(pix);
        g_free(str);
    }

    /* cache this! */
    ent = g_slice_new(PixEntry);
    ent->size = size;
    ent->pix = pix;

    /* FIXME: maybe we should unload icons that nobody is using to reduce memory usage. */
    /* g_object_weak_ref(); */
    pixs = g_slist_prepend(pixs, ent);
    g_object_set_qdata_full(G_OBJECT(icon), fm_qdata_id, pixs, destroy_pixbufs);

    return pix;
}
コード例 #21
0
static void
gdk_pixbuf_finalize (GObject *object)
{
        GdkPixbuf *pixbuf = GDK_PIXBUF (object);
        
        if (pixbuf->destroy_fn)
                (* pixbuf->destroy_fn) (pixbuf->pixels, pixbuf->destroy_fn_data);
        
        G_OBJECT_CLASS (gdk_pixbuf_parent_class)->finalize (object);
}
コード例 #22
0
ファイル: rbgdk.c プロジェクト: geoffyoungs/ruby-gnome2
static VALUE
rbgdk_rval2gdkpixbufglist_body(VALUE value)
{
    long i;
    struct rval2gdkpixbufglist_args *args = (struct rval2gdkpixbufglist_args *)value;

    for (i = 0; i < args->n; i++)
        args->result = g_list_append(args->result, GDK_PIXBUF(RVAL2GOBJ(RARRAY_PTR(args->ary)[i])));

    return Qnil;
}
コード例 #23
0
ファイル: gtk_liststore.c プロジェクト: htrb/ngraph-gtk
GdkPixbuf *
list_store_get_pixbuf(GtkWidget *w, GtkTreeIter *iter, int col)
{
  GtkTreeModel *model;
  GObject *v;

  model = gtk_tree_view_get_model(GTK_TREE_VIEW(w));
  gtk_tree_model_get(model, iter, col, &v, -1);

  return  GDK_PIXBUF(v);
}
コード例 #24
0
void adm_changeIcon_systray(void)
{
GdkPixbuf *cur;
	flipflop%=nbListOfIcons; // Double check
	cur=listOfIcons[flipflop];
		ADM_assert(cur);
	flipflop++;
	flipflop%=nbListOfIcons; // Double check
  	gtk_image_set_from_pixbuf( GTK_IMAGE(img), GDK_PIXBUF(cur));

}
コード例 #25
0
/*! \brief Get a pixel buffer for a picture object.
 * \par Function Description
 * Returns a #GdkPixbuf for the picture object \a object, or NULL if
 * the picture could not be loaded.
 *
 * The returned value should have its reference count decremented with
 * g_object_unref() when no longer needed.
 *
 * \param toplevel  The current #TOPLEVEL.
 * \param object    The picture #OBJECT to inspect.
 * \return A #GdkPixbuf for the picture.
 */
GdkPixbuf *
o_picture_get_pixbuf (TOPLEVEL *toplevel, OBJECT *object)
{
  g_return_val_if_fail (object != NULL, NULL);
  g_return_val_if_fail (object->picture != NULL, NULL);

  if (object->picture->pixbuf != NULL) {
    return GDK_PIXBUF (g_object_ref (object->picture->pixbuf));
  } else {
    return NULL;
  }
}
コード例 #26
0
ファイル: gdk-pixbuf.c プロジェクト: Distrotech/gdk-pixbuf
static void
gdk_pixbuf_finalize (GObject *object)
{
        GdkPixbuf *pixbuf = GDK_PIXBUF (object);
        
        if (pixbuf->pixels && pixbuf->destroy_fn)
                (* pixbuf->destroy_fn) (pixbuf->pixels, pixbuf->destroy_fn_data);

        g_clear_pointer (&pixbuf->bytes, g_bytes_unref);
        
        G_OBJECT_CLASS (gdk_pixbuf_parent_class)->finalize (object);
}
コード例 #27
0
static GdkPixbuf*
gdk_pixbuf_gif_anim_get_static_image (GdkPixbufAnimation *animation)
{
        GdkPixbufGifAnim *gif_anim;

        gif_anim = GDK_PIXBUF_GIF_ANIM (animation);

        if (gif_anim->frames == NULL)
                return NULL;
        else
                return GDK_PIXBUF (((GdkPixbufFrame*)gif_anim->frames->data)->pixbuf);
}
コード例 #28
0
ファイル: rbgdkdraw.c プロジェクト: msakai/ruby-gnome2
static VALUE
rg_draw_pixbuf(VALUE self, VALUE gc, VALUE pixbuf, VALUE src_x, VALUE src_y, VALUE dest_x, VALUE dest_y, VALUE width, VALUE height, VALUE dither, VALUE x_dither, VALUE y_dither)
{
    gdk_draw_pixbuf(_SELF(self),
                    GDK_GC(RVAL2GOBJ(gc)),
                    GDK_PIXBUF(RVAL2GOBJ(pixbuf)),
                    NUM2INT(src_x), NUM2INT(src_y), 
                    NUM2INT(dest_x), NUM2INT(dest_y),
                    NUM2INT(width), NUM2INT(height),
                    RVAL2GENUM(dither, GDK_TYPE_RGB_DITHER),
                    NUM2INT(x_dither), NUM2INT(y_dither));
    return self;
}
コード例 #29
0
ファイル: pixbuf.c プロジェクト: OpenCL/GEGL-OpenCL-old
static gboolean
process (GeglOperation       *operation,
         GeglBuffer          *output,
         const GeglRectangle *result,
         gint                 level)
{
  GeglProperties *o = GEGL_PROPERTIES (operation);

  if (o->pixbuf)
    {
      GeglRectangle extent;

      extent.x = 0;
      extent.y = 0;
      extent.width = gdk_pixbuf_get_width (GDK_PIXBUF (o->pixbuf));
      extent.height = gdk_pixbuf_get_height (GDK_PIXBUF (o->pixbuf));

      gegl_buffer_set (output, &extent, 0, NULL, gdk_pixbuf_get_pixels (GDK_PIXBUF (o->pixbuf)),
                       GEGL_AUTO_ROWSTRIDE);
    }
  return TRUE;
}
コード例 #30
0
ファイル: bookmarks_treeview.c プロジェクト: acli/xiphos
static void create_pixbufs(void)
{
	GtkTextDirection dir =
	    gtk_widget_get_direction(GTK_WIDGET(widgets.app));

	bm_pixbufs = g_new0(BookMarksPixbufs, 1);

	if (dir == GTK_TEXT_DIR_LTR) {
		/* leave this for if we make custom reversable icons
		   if (!bm_pixbufs->pixbuf_closed)
		   bm_pixbufs->pixbuf_closed =
		   pixbuf_finder("book_closed.png", 16, NULL);
		 */

		bm_pixbufs->pixbuf_opened =
		    pixbuf_finder("book_open.png", 16, NULL);
	} else {
		/* leave this for if we make custom reversable icons
		   if (!bm_pixbufs->pixbuf_closed)
		   bm_pixbufs->pixbuf_closed =
		   pixbuf_finder("book_closed_rtol.png", 16, NULL);
		 */

		bm_pixbufs->pixbuf_opened =
		    pixbuf_finder("book_open_rtol.png", 16, NULL);
	}

	bm_pixbufs->pixbuf_closed =
	    pixbuf_finder("epiphany-bookmarks.png", 0, NULL);

	bm_pixbufs->pixbuf_helpdoc =
	    pixbuf_finder("epiphany-bookmark-page.png", 0, NULL);

	if (!bm_pixbufs->pixbuf_helpdoc)
#ifdef USE_GTK_3
		bm_pixbufs->pixbuf_helpdoc =
#ifdef HAVE_GTK_310
		    GDK_PIXBUF(gtk_image_new_from_icon_name("gtk-dnd",
							    GTK_ICON_SIZE_BUTTON));
#else
		    gtk_widget_render_icon_pixbuf(widgets.app,
						  GTK_STOCK_DND,
						  GTK_ICON_SIZE_MENU);
#endif

#else
		bm_pixbufs->pixbuf_helpdoc = gtk_widget_render_icon(widgets.app,
								    GTK_STOCK_DND,
								    GTK_ICON_SIZE_MENU, NULL);
#endif
}