當前位置: 首頁>>代碼示例>>C++>>正文


C++ GDK_PIXBUF函數代碼示例

本文整理匯總了C++中GDK_PIXBUF函數的典型用法代碼示例。如果您正苦於以下問題:C++ GDK_PIXBUF函數的具體用法?C++ GDK_PIXBUF怎麽用?C++ GDK_PIXBUF使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了GDK_PIXBUF函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: redraw_viewer

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);
  }
}
開發者ID:ulyssesrr,項目名稱:carmen_lcad,代碼行數:35,代碼來源:v_disparity_view.c

示例2: check_message_pixbuf

/* 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;
}
開發者ID:lubing521,項目名稱:gst-embedded-builder,代碼行數:26,代碼來源:gdkpixbufsink.c

示例3: cview_initialize

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;
}
開發者ID:geoffyoungs,項目名稱:ruby-gnome2,代碼行數:32,代碼來源:rbgtkcellview.c

示例4: astro_contact_row_set_property

/* 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;
  }
}
開發者ID:UIKit0,項目名稱:toys,代碼行數:27,代碼來源:astro-contact-row.c

示例5: artwork_notify_cb

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);
}
開發者ID:dignan,項目名稱:control,代碼行數:25,代碼來源:rb-mtp-source.c

示例6: art_cb

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 ();
}
開發者ID:hfiguiere,項目名稱:rhythmbox,代碼行數:27,代碼來源:rb-visualizer-fullscreen.c

示例7: rg_s_from_image

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;
    }
}
開發者ID:Vasfed,項目名稱:ruby-gnome2,代碼行數:26,代碼來源:rbgdkpixbuf.c

示例8: on_sliced_image_loaded

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);
}
開發者ID:kenvandine,項目名稱:gnome-shell,代碼行數:27,代碼來源:st-texture-cache.c

示例9: it_s_add_builtin_icon

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;
}
開發者ID:benolee,項目名稱:ruby-gnome2,代碼行數:7,代碼來源:rbgtkicontheme.c

示例10: o_picture_get_fallback_pixbuf

/*! \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));
}
開發者ID:gareth8118,項目名稱:geda-gaf,代碼行數:36,代碼來源:geda_picture_object.c

示例11: write_image

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);
}
開發者ID:Gontxal0,項目名稱:libfm,代碼行數:30,代碼來源:fm-thumbnail.c

示例12: dump_thumbs

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);
}
開發者ID:Silvirus,項目名稱:libgpod,代碼行數:27,代碼來源:test-photos.c

示例13: rg_m_set_icon

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;
}
開發者ID:Vasfed,項目名稱:ruby-gnome2,代碼行數:31,代碼來源:rbgtkdrag.c

示例14: gdkpixbuf_get_pixels_array

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);
}
開發者ID:Data-link,項目名稱:mypaint,代碼行數:32,代碼來源:gdkpixbuf2numpy.cpp

示例15: get_bounding_box

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;
}
開發者ID:OpenCL,項目名稱:GEGL-OpenCL-old,代碼行數:17,代碼來源:pixbuf.c


注:本文中的GDK_PIXBUF函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。