/* ==================================== */ static void highlight_selected(GooCanvasItem * button) { GdkPixbuf *button_pixmap_selected = NULL, *button_pixmap = NULL; if (selected_button != NULL && selected_button != button) { button_pixmap = gc_pixmap_load("missing_letter/button.png"); g_object_set(selected_button, "pixbuf", button_pixmap, NULL); #if GDK_PIXBUF_MAJOR <= 2 && GDK_PIXBUF_MINOR <= 24 gdk_pixbuf_unref(button_pixmap); #else g_object_unref(button_pixmap); #endif } if (selected_button != button) { button_pixmap_selected = gc_pixmap_load("missing_letter/button_selected.png"); g_object_set(button, "pixbuf", button_pixmap_selected, NULL); selected_button = button; #if GDK_PIXBUF_MAJOR <= 2 && GDK_PIXBUF_MINOR <= 24 gdk_pixbuf_unref(button_pixmap_selected); #else g_object_unref(button_pixmap_selected); #endif } }
void gnomegadu_ui_init_statusbar () { GtkComboBox *combobox = GTK_COMBO_BOX (glade_xml_get_widget (gladexml, "StatusComboBox")); GtkListStore *status_store = NULL; GtkCellRenderer *render_text, *render_pixbuf; GtkTreeIter iter, iter_init; GdkPixbuf *pixbuf; gtk_cell_layout_clear (GTK_CELL_LAYOUT (combobox)); status_store = gtk_list_store_new (UI_STATUS_N_COLUMNS, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_INT); render_pixbuf = gtk_cell_renderer_pixbuf_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), render_pixbuf, FALSE); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), render_pixbuf, "pixbuf", UI_STATUS_COLUMN_ICON, NULL); render_text = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), render_text, TRUE); gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combobox), render_text, "markup", UI_STATUS_COLUMN_NAME, NULL); pixbuf = gnomegadu_stock_get_pixbuf ("gnomegadu-user-available"); gtk_list_store_append (status_store, &iter); gtk_list_store_set (status_store, &iter, UI_STATUS_COLUMN_ICON, pixbuf, UI_STATUS_COLUMN_NAME, "Dostępny", UI_STATUS_COLUMN_STATUS, GNOMEGADU_STATUS_AVAIL, -1); gdk_pixbuf_unref (pixbuf); pixbuf = gnomegadu_stock_get_pixbuf ("gnomegadu-user-away"); gtk_list_store_append (status_store, &iter); gtk_list_store_set (status_store, &iter, UI_STATUS_COLUMN_ICON, pixbuf, UI_STATUS_COLUMN_NAME, "Zajęty", UI_STATUS_COLUMN_STATUS, GNOMEGADU_STATUS_BUSY, -1); gdk_pixbuf_unref (pixbuf); pixbuf = gnomegadu_stock_get_pixbuf ("gnomegadu-user-invisible"); gtk_list_store_append (status_store, &iter); gtk_list_store_set (status_store, &iter, UI_STATUS_COLUMN_ICON, pixbuf, UI_STATUS_COLUMN_NAME, "Niewidoczny", UI_STATUS_COLUMN_STATUS, GNOMEGADU_STATUS_INVISIBLE, -1); gdk_pixbuf_unref (pixbuf); pixbuf = gnomegadu_stock_get_pixbuf ("gnomegadu-user-not-available"); gtk_list_store_append (status_store, &iter_init); gtk_list_store_set (status_store, &iter_init, UI_STATUS_COLUMN_ICON, pixbuf, UI_STATUS_COLUMN_NAME, "Niedostępny", UI_STATUS_COLUMN_STATUS, GNOMEGADU_STATUS_UNAVAIL, -1); gdk_pixbuf_unref (pixbuf); gtk_list_store_append (status_store, &iter); gtk_list_store_set (status_store, &iter, UI_STATUS_COLUMN_STATUS, GNOMEGADU_STATUS_UNKNOWN, -1); pixbuf = gnomegadu_stock_get_pixbuf ("gnomegadu-description"); gtk_list_store_append (status_store, &iter); gtk_list_store_set (status_store, &iter, UI_STATUS_COLUMN_ICON, pixbuf, UI_STATUS_COLUMN_NAME, "Ustaw opis", UI_STATUS_COLUMN_STATUS, GNOMEGADU_STATUS_DESC, -1); gdk_pixbuf_unref (pixbuf); gtk_combo_box_set_row_separator_func (combobox, userlist_combo_separator_func, NULL, NULL); gtk_combo_box_set_model (combobox, GTK_TREE_MODEL (status_store)); gtk_combo_box_set_active_iter (combobox, &iter_init); g_object_unref (status_store); }
void x_tile_destroy() { int i; if (tmp_img) { gdk_image_destroy(tmp_img); tmp_img = NULL; } if (tile_pixmap) { gdk_pixmap_unref(tile_pixmap); tile_pixmap = NULL; } if (tmp_pixbuf) { gdk_pixbuf_unref(tmp_pixbuf); tmp_pixbuf = NULL; } if (tile_pixbuf) { gdk_pixbuf_unref(tile_pixbuf); tile_pixbuf = NULL; } if (tile_transp) { for(i = 0; i < total_tiles_used; i++) free(tile_transp[i].data); free(tile_transp); tile_transp = NULL; } if (tile_image) { gdk_image_destroy(tile_image); tile_image = NULL; } #ifdef GTK_PROXY free(GTK_glyph2tile); GTK_glyph2tile = (short *)0; #endif }
GtkWidget * gtk_image_new_from_file_scaled(const gchar *file, gint width, gint height) { GtkWidget *img; ENTER; if (g_file_test(file, G_FILE_TEST_EXISTS)) { GError *err = NULL; GdkPixbuf *pb; pb = gdk_pixbuf_new_from_file(file, &err); if (err || !pb) { g_error_free(err); } else { GdkPixbuf *pb_scaled; pb_scaled = gdk_pixbuf_scale_simple(pb, width, height, GDK_INTERP_BILINEAR); img = gtk_image_new_from_pixbuf(pb_scaled); gdk_pixbuf_unref(pb); gdk_pixbuf_unref(pb_scaled); RET(img); } } img = gtk_image_new_from_stock(GTK_STOCK_MISSING_IMAGE, GTK_ICON_SIZE_BUTTON); RET(img); }
void ISFSetupWin::update_factory_list_store (void) { GtkTreeIter iter; GdkPixbuf *icon = NULL, *icon2 = NULL; GtkWidget *pix = NULL, *pix2 = NULL; _display_selected_items = 0; pix = gtk_image_new_from_file (ISE_SETUP_ICON_FILE); icon = gtk_image_get_pixbuf (GTK_IMAGE (pix)); pix2 = gtk_image_new_from_file (ISE_HELP_ICON_FILE); icon2 = gtk_image_get_pixbuf (GTK_IMAGE (pix2)); String _app_name = gtk_combo_box_get_active_text ((GtkComboBox *) _combo_app); gtk_list_store_clear (_factory_list_store); std::vector<String> f_show; for (MapStringVectorSizeT::iterator it = _groups.begin (); it != _groups.end (); ++it) { String lang_name; lang_name = scim_get_language_name (it->first); if (std::find (_disabled_langs.begin (), _disabled_langs.end (), lang_name) == _disabled_langs.end ()) { for (size_t i = 0; i < it->second.size (); i++) { // protect from add the same ise more than once in case of multiple langs.-->f_show list if (std::find (f_show.begin (), f_show.end (), _uuids[it->second[i]]) == f_show.end ()) { gtk_list_store_append (_factory_list_store, &iter); gtk_list_store_set (_factory_list_store, &iter, FACTORY_LIST_NAME, _names[it->second[i]].c_str (), FACTORY_LIST_MODULE_NAME, _module_names[it->second[i]].c_str (), FACTORY_LIST_UUID, _uuids[it->second[i]].c_str (), FACTORY_LIST_TYPE, (gint)_modes[it->second[i]], FACTORY_LIST_OPTION_PIX, icon, FACTORY_LIST_HELP_PIX,icon2, -1); f_show.push_back (_uuids[it->second[i]]); if (std::find (_disabled_ise_map[_app_name].begin (), _disabled_ise_map[_app_name].end (), _uuids[it->second[i]]) ==_disabled_ise_map[_app_name].end ()) { gtk_list_store_set (_factory_list_store, &iter, FACTORY_LIST_ENABLE, true, -1); _display_selected_items++; } else { gtk_list_store_set (_factory_list_store, &iter, FACTORY_LIST_ENABLE, false, -1); } } } } } if (icon) { gdk_pixbuf_unref (icon); icon = 0; } if (icon2) { gdk_pixbuf_unref (icon2); icon2 = 0; } }
//redrawImage shifts the existing pixels down by one row, and draws // the newest row at the top of the image void redrawImage() { numLines++; //copy the existing image, without the topmost row buf = gdk_pixbuf_new_subpixbuf(imagebuf, 0, 0, WIDTH, HEIGHT - PIX_PER_CELL); //place that copy into a new buffer buf2 = gdk_pixbuf_copy(buf); //release the memory of the first buffer gdk_pixbuf_unref(buf); //copy the second buffer gdk_pixbuf_copy_area(buf2, 0, 0, WIDTH, HEIGHT - PIX_PER_CELL, imagebuf, 0, PIX_PER_CELL); //release the second buffer gdk_pixbuf_unref(buf2); //get the new row std::vector<bool> *data = ca1->getNewRow(); //draw the new row on imagebuf for (unsigned int i = 0; i < ca1->getWidth(); i++) { if ((*data)[i]) { color = black; } else { color = white; } gdk_pixbuf_copy_area(color, 0, 0, PIX_PER_CELL, PIX_PER_CELL, imagebuf, i * PIX_PER_CELL, 0); } //copy imagebuf onto the screen gtk_image_set_from_pixbuf(GTK_IMAGE(mainImage),imagebuf); }
//! Destructor of the Map Class. Map::~Map() { freeGrid(); if(pixbuf) gdk_pixbuf_unref(pixbuf); if(drawingPixBuf) gdk_pixbuf_unref(drawingPixBuf); }
static cairo_surface_t * display_create_drm_surface_from_file(struct display *display, const char *filename, struct rectangle *rect) { cairo_surface_t *surface; GdkPixbuf *pixbuf; GError *error = NULL; int stride, i; unsigned char *pixels, *p, *end; struct drm_surface_data *data; pixbuf = gdk_pixbuf_new_from_file_at_scale(filename, rect->width, rect->height, FALSE, &error); if (error != NULL) return NULL; if (!gdk_pixbuf_get_has_alpha(pixbuf) || gdk_pixbuf_get_n_channels(pixbuf) != 4) { gdk_pixbuf_unref(pixbuf); return NULL; } stride = gdk_pixbuf_get_rowstride(pixbuf); pixels = gdk_pixbuf_get_pixels(pixbuf); for (i = 0; i < rect->height; i++) { p = pixels + i * stride; end = p + rect->width * 4; while (p < end) { unsigned int t; MULT(p[0], p[0], p[3], t); MULT(p[1], p[1], p[3], t); MULT(p[2], p[2], p[3], t); p += 4; } } surface = display_create_drm_surface(display, rect); data = cairo_surface_get_user_data(surface, &surface_data_key); cairo_device_acquire(display->device); glBindTexture(GL_TEXTURE_2D, data->texture); glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, rect->width, rect->height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); cairo_device_release(display->device); gdk_pixbuf_unref(pixbuf); return surface; }
/* gdk_cursor_new_from_pixmap is broken on Windows. this is a workaround using gdk_cursor_new_from_pixbuf. */ GdkCursor* fixed_gdk_cursor_new_from_pixmap(GdkPixmap *source, GdkPixmap *mask, const GdkColor *fg, const GdkColor *bg, gint x, gint y) { GdkPixmap *rgb_pixmap; GdkGC *gc; GdkPixbuf *rgb_pixbuf, *rgba_pixbuf; GdkCursor *cursor; int width, height; /* HACK! It seems impossible to work with RGBA pixmaps directly in GDK-Win32. Instead we pick some third color, different from fg and bg, and use that as the 'transparent color'. We do this using colors_too_similar (see above) because two colors could be unequal in GdkColor's 16-bit/sample, but equal in GdkPixbuf's 8-bit/sample. */ GdkColor candidates[3] = {{0,65535,0,0}, {0,0,65535,0}, {0,0,0,65535}}; GdkColor *trans = &candidates[0]; if (colors_too_similar(trans, fg) || colors_too_similar(trans, bg)) { trans = &candidates[1]; if (colors_too_similar(trans, fg) || colors_too_similar(trans, bg)) { trans = &candidates[2]; } } /* trans is now guaranteed to be unique from fg and bg */ /* create an empty pixmap to hold the cursor image */ gdk_drawable_get_size(source, &width, &height); rgb_pixmap = gdk_pixmap_new(NULL, width, height, 24); /* blit the bitmaps defining the cursor onto a transparent background */ gc = gdk_gc_new(rgb_pixmap); gdk_gc_set_fill(gc, GDK_SOLID); gdk_gc_set_rgb_fg_color(gc, trans); gdk_draw_rectangle(rgb_pixmap, gc, TRUE, 0, 0, width, height); gdk_gc_set_fill(gc, GDK_OPAQUE_STIPPLED); gdk_gc_set_stipple(gc, source); gdk_gc_set_clip_mask(gc, mask); gdk_gc_set_rgb_fg_color(gc, fg); gdk_gc_set_rgb_bg_color(gc, bg); gdk_draw_rectangle(rgb_pixmap, gc, TRUE, 0, 0, width, height); gdk_gc_unref(gc); /* create a cursor out of the created pixmap */ rgb_pixbuf = gdk_pixbuf_get_from_drawable( NULL, rgb_pixmap, gdk_colormap_get_system(), 0, 0, 0, 0, width, height); gdk_pixmap_unref(rgb_pixmap); rgba_pixbuf = gdk_pixbuf_add_alpha( rgb_pixbuf, TRUE, trans->red, trans->green, trans->blue); gdk_pixbuf_unref(rgb_pixbuf); cursor = gdk_cursor_new_from_pixbuf(gdk_display_get_default(), rgba_pixbuf, x, y); gdk_pixbuf_unref(rgba_pixbuf); return cursor; }
static cairo_surface_t * display_create_shm_surface_from_file(struct display *display, const char *filename, struct rectangle *rect) { cairo_surface_t *surface; GdkPixbuf *pixbuf; GError *error = NULL; int stride, i; unsigned char *pixels, *p, *end, *dest_data; int dest_stride; uint32_t *d; pixbuf = gdk_pixbuf_new_from_file_at_scale(filename, rect->width, rect->height, FALSE, &error); if (error != NULL) return NULL; if (!gdk_pixbuf_get_has_alpha(pixbuf) || gdk_pixbuf_get_n_channels(pixbuf) != 4) { gdk_pixbuf_unref(pixbuf); return NULL; } stride = gdk_pixbuf_get_rowstride(pixbuf); pixels = gdk_pixbuf_get_pixels(pixbuf); surface = display_create_shm_surface(display, rect); dest_data = cairo_image_surface_get_data (surface); dest_stride = cairo_image_surface_get_stride (surface); for (i = 0; i < rect->height; i++) { d = (uint32_t *) (dest_data + i * dest_stride); p = pixels + i * stride; end = p + rect->width * 4; while (p < end) { unsigned int t; unsigned char a, r, g, b; a = p[3]; MULT(r, p[0], a, t); MULT(g, p[1], a, t); MULT(b, p[2], a, t); p += 4; *d++ = (a << 24) | (r << 16) | (g << 8) | b; } } gdk_pixbuf_unref(pixbuf); return surface; }
gint render_camera(gpointer data) { GdkPixbuf *pixbuf = NULL; GdkPixbuf *blobbuf= NULL; GdkGC *gc = NULL; GtkWidget *drawing_area = GTK_WIDGET(data); uint16_t i; gc = GTK_WIDGET(drawing_area)->style->fg_gc[GTK_WIDGET_STATE(GTK_WIDGET(drawing_area))]; player_update(); if (g_blob_count > 0) { // Draw the blobs blobbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, false, 8, 1, 1); for (i=0; i< g_blob_count; ++i) { // shift the color by 8-bits to account for the alpha channel gdk_pixbuf_fill(blobbuf, g_blobs[i].color << 8); gdk_pixbuf_composite(blobbuf, g_pixbuf, g_blobs[i].left, g_blobs[i].top, abs(g_blobs[i].right - g_blobs[i].left), abs(g_blobs[i].top - g_blobs[i].bottom), 1, 1, 1, 1, GDK_INTERP_NEAREST, 128); } gdk_pixbuf_unref(blobbuf); } // scale everything at the end if ((g_width==g_window_width)&&(g_height==g_window_height)) { // we don't need to worry about scaling gdk_draw_pixbuf(GTK_WIDGET(drawing_area)->window, gc, g_pixbuf, 0, 0, 0, 0, g_width, g_height, GDK_RGB_DITHER_NONE, 0, 0); } else { pixbuf = gdk_pixbuf_scale_simple(g_pixbuf, g_window_width, g_window_height, GDK_INTERP_BILINEAR); gdk_draw_pixbuf(GTK_WIDGET(drawing_area)->window, gc, pixbuf, 0, 0, 0, 0, g_window_width, g_window_height, GDK_RGB_DITHER_NONE, 0, 0); gdk_pixbuf_unref(pixbuf); } return TRUE; }
static void update_image_preview (GtkFileChooser *chooser, GtkImage *image) { GdkPixbuf *image_pixbuf, *temp; static GdkPixbuf *emblem_pixbuf = NULL; gchar *filename; GdkPixmap *pixmap; gint width, height; if (emblem_pixbuf == NULL) { emblem_pixbuf = gdk_pixbuf_new_from_file (FYRE_DATADIR "/metadata-emblem.png", NULL); if (!emblem_pixbuf) emblem_pixbuf = gdk_pixbuf_new_from_file (BR_DATADIR ("/fyre/metadata-emblem.png"), NULL); } filename = gtk_file_chooser_get_filename (chooser); if (filename == NULL) { gtk_file_chooser_set_preview_widget_active (chooser, FALSE); return; } image_pixbuf = gdk_pixbuf_new_from_file_at_size (filename, 112, 112, NULL); if (image_pixbuf == NULL) { gtk_file_chooser_set_preview_widget_active (chooser, FALSE); return; } width = gdk_pixbuf_get_width (image_pixbuf); height = gdk_pixbuf_get_height (image_pixbuf); pixmap = gdk_pixmap_new (GTK_WIDGET (image)->window, width + 16, height + 16, -1); gdk_draw_rectangle (pixmap, GTK_WIDGET (image)->style->bg_gc[GTK_STATE_NORMAL], TRUE, 0, 0, width + 16, height + 16); gdk_draw_pixbuf (pixmap, NULL, image_pixbuf, 0, 0, 0, 0, width - 1, height - 1, GDK_RGB_DITHER_NONE, 0, 0); temp = gdk_pixbuf_new_from_file (filename, NULL); if (temp) { if (gdk_pixbuf_get_option (temp, "tEXt::fyre_params")) gdk_draw_pixbuf (pixmap, NULL, emblem_pixbuf, 0, 0, width - 16, height - 16, 31, 31, GDK_RGB_DITHER_NONE, 0, 0); else if (gdk_pixbuf_get_option (temp, "tEXt::de_jong_params")) gdk_draw_pixbuf (pixmap, NULL, emblem_pixbuf, 0, 0, width - 16, height - 16, 31, 31, GDK_RGB_DITHER_NONE, 0, 0); gdk_pixbuf_unref (temp); } if (image_pixbuf) gdk_pixbuf_unref (image_pixbuf); gtk_image_set_from_pixmap (GTK_IMAGE (image), pixmap, NULL); gdk_pixmap_unref (pixmap); gtk_file_chooser_set_preview_widget_active (chooser, TRUE); }
static void display_sponsor(GooCanvasItem *rootitem) { GooCanvasItem *item; GdkPixbuf *pixmap = NULL; /* Location for a potential sponsor */ gchar *sponsor_image = gc_file_find_absolute("sponsor.png"); if(sponsor_image) { pixmap = gc_pixmap_load("sponsor.png"); item = goo_canvas_image_new (rootitem, pixmap, 0.0, 0.0, NULL); SET_ITEM_LOCATION_CENTER(item, display_x + display_w/2.0, display_y + display_h/3.0 + 150); #if GDK_PIXBUF_MAJOR <= 2 && GDK_PIXBUF_MINOR <= 24 gdk_pixbuf_unref(pixmap); #else g_object_unref(pixmap); #endif g_free(sponsor_image); } }
void GtkViewWidget::cleanOriginalPixbuf() { if (myOriginalPixbuf != 0) { gdk_pixbuf_unref(myOriginalPixbuf); gdk_image_unref(myImage); myOriginalPixbuf = 0; } }
void WebBrowserObject::BrowserSnapshot(const char *fname) { int width, height; char *c, *buf = 0; GdkColormap *cmap = gdk_colormap_get_system(); gdk_drawable_get_size(GDK_DRAWABLE(mozilla->window), &width, &height); GdkPixbuf *pix = gdk_pixbuf_get_from_drawable(0, GDK_DRAWABLE(mozilla->window), cmap, 0, 0, 0, 0, width, height); if (pix) { if (!fname) { buf = strdup(location ? location : "lmboxweb"); buf = (char*)realloc(buf, strlen(buf) + 16); fname = buf; if ((c = strrchr(buf, '/'))) { //fname = c + 1; } if ((c = strrchr(fname, '.'))) { *c = 0; } strcat((char*)fname, ".png"); } gdk_pixbuf_save (pix, fname, "png", NULL, NULL); gdk_pixbuf_unref(pix); printf("Webbrowser snapshot %s\n",fname); } gdk_colormap_unref(cmap); lmbox_free(buf); }
void glyph_free(glyph_t* pGlyph) { g_assert(pGlyph); gdk_pixbuf_unref(pGlyph->pPixbuf); g_free(pGlyph->pszName); g_free(pGlyph); }
GdkPixbuf* UIManager::getLocalPixbufWithMask(const std::string& fileName) { // Try to find a cached pixbuf before loading from disk PixBufMap::iterator i = _localPixBufsWithMask.find(fileName); if (i != _localPixBufsWithMask.end()) { return i->second; } // Not cached yet, load afresh std::string fullFileName(GlobalRegistry().get(RKEY_BITMAPS_PATH) + fileName); GdkPixbuf* rgb = gdk_pixbuf_new_from_file(fullFileName.c_str(), 0); if (rgb != NULL) { // File load successful, add alpha channel GdkPixbuf* rgba = gdk_pixbuf_add_alpha(rgb, TRUE, 255, 0, 255); gdk_pixbuf_unref(rgb); _localPixBufsWithMask.insert(PixBufMap::value_type(fileName, rgba)); // Avoid destruction of this pixbuf g_object_ref(rgba); return rgba; } else { // File load failed globalErrorStream() << "Couldn't load pixbuf " << fullFileName << std::endl; return NULL; } }
void histogram_imager_load_image_file (HistogramImager *self, const gchar *filename, GError **error) { /* Try to open the given PNG file and load parameters from it */ const gchar *params; GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (filename, error); if (!pixbuf) return; params = gdk_pixbuf_get_option (pixbuf, "tEXt::fyre_params"); /* For backward compatibility with de Jong Explorer and early versions of Fyre */ if (!params) params = gdk_pixbuf_get_option (pixbuf, "tEXt::de_jong_params"); if (params) { parameter_holder_load_string (PARAMETER_HOLDER (self), params); } else { if (error != NULL) { GError *nerror = g_error_new (fyre_histogram_imager_error_quark(), FYRE_HISTOGRAM_IMAGER_ERROR_NO_METADATA, "The image does not contain Fyre metadata"); *error = nerror; } } gdk_pixbuf_unref (pixbuf); }
static void histogram_imager_dispose (GObject *gobject) { HistogramImager *self = HISTOGRAM_IMAGER (gobject); if (self->histogram) { g_free (self->histogram); self->histogram = NULL; } if (self->image) { gdk_pixbuf_unref (self->image); self->image = NULL; } if (self->color_table.table) { g_free (self->color_table.table); self->color_table.table = NULL; } if (self->color_table.quality) { g_free (self->color_table.quality); self->color_table.quality = NULL; } if (self->oversample_tables.linearize) { g_free (self->oversample_tables.linearize); self->oversample_tables.linearize = NULL; } if (self->oversample_tables.nonlinearize) { g_free (self->oversample_tables.nonlinearize); self->oversample_tables.nonlinearize = NULL; } G_OBJECT_CLASS (parent_class)->dispose (gobject); }
GtkWidget* create_aboutdialog1 (void) { GtkWidget *aboutdialog1; const gchar *authors[] = { "*****@*****.**", "*****@*****.**", NULL }; /* TRANSLATORS: Replace this string with your names, one name per line. */ gchar *translators = _("translator-credits"); GdkPixbuf *aboutdialog1_logo_pixbuf; aboutdialog1 = gtk_about_dialog_new (); gtk_about_dialog_set_version (GTK_ABOUT_DIALOG (aboutdialog1), VERSION); gtk_about_dialog_set_name (GTK_ABOUT_DIALOG (aboutdialog1), _("MyNet")); gtk_about_dialog_set_copyright (GTK_ABOUT_DIALOG (aboutdialog1), _("copyright 2006 cc0cc")); gtk_about_dialog_set_comments (GTK_ABOUT_DIALOG (aboutdialog1), _("\345\243\260\346\230\216\357\274\232MyNet\346\230\257\344\273\245\347\240\224\347\251\266\345\222\214\345\255\246\344\271\240\344\270\272\347\233\256\347\232\204\345\274\200\345\217\221\347\232\204\357\274\214\346\210\221\344\273\254\346\211\200\345\201\232\347\232\204\344\270\200\345\210\207\351\203\275\351\201\265\345\276\252\344\270\255\345\215\216\344\272\272\346\260\221\345\205\261\345\222\214\345\233\275\343\200\212\350\256\241\347\256\227\346\234\272\350\275\257\344\273\266\344\277\235\346\212\244\346\235\241\344\276\213\343\200\213\343\200\202\n\345\246\202\346\236\234\344\275\240\345\234\250\345\255\246\344\271\240\350\277\207\347\250\213\344\270\255\351\234\200\350\246\201\346\255\244\350\275\257\344\273\266\357\274\214\350\257\267\345\210\260cc0cc.126.com\346\217\220\344\272\244\344\275\240\347\232\204\345\206\205\347\275\221IP\345\222\214E-mail")); gtk_about_dialog_set_authors (GTK_ABOUT_DIALOG (aboutdialog1), authors); gtk_about_dialog_set_translator_credits (GTK_ABOUT_DIALOG (aboutdialog1), translators); aboutdialog1_logo_pixbuf = gdk_pixbuf_new_from_xpm_data((gchar **)MyNet_xpm); //create_pixbuf ("../pixmaps/MyNet.png"); gtk_about_dialog_set_logo (GTK_ABOUT_DIALOG (aboutdialog1), aboutdialog1_logo_pixbuf); if (aboutdialog1_logo_pixbuf) { gtk_window_set_icon (GTK_WINDOW (aboutdialog1), aboutdialog1_logo_pixbuf); gdk_pixbuf_unref (aboutdialog1_logo_pixbuf); } /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (aboutdialog1, aboutdialog1, "aboutdialog1"); return aboutdialog1; }
static void share_nfs_add_static_combo_elements (GtkListStore *store) { GtkTreeIter iter; GdkPixbuf *pixbuf; pixbuf = gtk_icon_theme_load_icon (gst_tool_get_icon_theme (tool), "gnome-fs-network", 16, 0, NULL); gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, 0, pixbuf, 1, _("Specify hostname"), 2, NFS_SHARE_HOSTNAME, 3, NULL, -1); gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, 0, pixbuf, 1, _("Specify IP address"), 2, NFS_SHARE_ADDRESS, 3, NULL, -1); gtk_list_store_append (store, &iter); gtk_list_store_set (store, &iter, 0, pixbuf, 1, _("Specify network"), 2, NFS_SHARE_NETWORK, 3, NULL, -1); gdk_pixbuf_unref (pixbuf); }
Doppelganger* doppelganger_new (char *name) { Doppelganger *result = g_malloc (sizeof (Doppelganger)); GdkPixbuf *blank; int current_pointer; result->mpx = add_mpx_for_window (name); result->cursor = NULL; doppelganger_set_image (result, NULL); blank = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, 1, 1); gdk_pixbuf_fill (blank, 0); /* transparent */ result->blank = gdk_cursor_new_from_pixbuf (gdk_display_get_default (), blank, 0, 0); gdk_pixbuf_unref (blank); show_cursor (result); return result; }
/* * Same as draw rect but for an image * Returns the created item */ static GooCanvasItem * draw_image(GooCanvasItem *group, int x,int y, GdkPixbuf *pixmap) { GooCanvasItem *item = NULL; int x1,y1; GdkPixbuf *pixmap2; y1=cellsize*(y)-hoogte + board_border_y; x1=cellsize*(x)-breedte + board_border_x; pixmap2 = gdk_pixbuf_scale_simple (pixmap, cellsize-buffer*2, cellsize-buffer*2, GDK_INTERP_BILINEAR); item = goo_canvas_image_new (group, pixmap2, x1+buffer, y1+buffer, NULL); #if GDK_PIXBUF_MAJOR <= 2 && GDK_PIXBUF_MINOR <= 24 gdk_pixbuf_unref(pixmap2); #else g_object_unref(pixmap2); #endif return(item); }
/* ===================================================================== * Submarine explosion * =====================================================================*/ static void submarine_explosion() { GdkPixbuf *pixmap = NULL; if (submarine_destroyed) return; submarine_destroyed = TRUE; gamewon = FALSE; gc_sound_play_ogg("sounds/crash.wav", NULL); /* make the submarine die */ setSpeed(speed_ordered = submarine_horizontal_speed = 0.0); setBattery(battery = 0.0); setAir(air = 0.0); regleur = MAX_REGLEUR; weight = 2000.0; /* Stop the frigate */ goo_canvas_item_stop_animation (frigate_item); /* display the boken submarine */ pixmap = gc_pixmap_load("submarine/submarine-broken.png"); g_object_set(submarine_item, "pixbuf", pixmap, NULL); #if GDK_PIXBUF_MAJOR <= 2 && GDK_PIXBUF_MINOR <= 24 gdk_pixbuf_unref(pixmap); #else g_object_unref(pixmap); #endif ok(); }
BackgroundImageContents::~BackgroundImageContents() { XOJ_CHECK_TYPE(BackgroundImageContents); gdk_pixbuf_unref(this->pixbuf); XOJ_RELEASE_TYPE(BackgroundImageContents); }
static void start_frigate_anim() { GdkPixbuf *pixmap; int w; if (frigate_item) stop_frigate_anim(); // the antisubmarine warfare frigate pixmap = gc_pixmap_load("submarine/asw_frigate.png"); w = gdk_pixbuf_get_width(pixmap); frigate_item = goo_canvas_image_new (goo_canvas_get_root_item(gcomprisBoard->canvas), pixmap, 0, 0, NULL); goo_canvas_item_translate(frigate_item, BOARDWIDTH, 6); goo_canvas_item_animate(frigate_item, -w, 2.0, 1, 0, TRUE, 100*1000, 100, GOO_CANVAS_ANIMATE_RESTART); #if GDK_PIXBUF_MAJOR <= 2 && GDK_PIXBUF_MINOR <= 24 gdk_pixbuf_unref(pixmap); #else g_object_unref(pixmap); #endif }
static void save_itdb_thumb (Itdb_Track *track, GdkPixbuf *pixbuf, guint id) { char *filename; gint width; gint height; g_object_get (G_OBJECT (pixbuf), "width", &width, "height", &height, NULL); filename = g_strdup_printf ("%03d_%s-%s-%s-%xx%x-%016"G_GINT64_MODIFIER"x.png", id, track->artist, track->album, track->title, width, height, track->dbid); if (filename == NULL) { return; } g_print (" %s\n", filename); gdk_pixbuf_save (pixbuf, filename, "png", NULL, NULL); gdk_pixbuf_unref (pixbuf); /* g_print ("Saved %s\n", filename); */ g_free (filename); }
GtkWidget* create_window3 (void) { GtkWidget *window3; GdkPixbuf *window3_icon_pixbuf; GtkWidget *fixed3; GtkWidget *label5; window3 = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_widget_set_size_request (window3, 236, 122); gtk_window_set_title (GTK_WINDOW (window3), _("\346\263\250\345\206\214\350\277\233\350\241\214\344\270\255")); gtk_window_set_resizable (GTK_WINDOW (window3), FALSE); window3_icon_pixbuf = gdk_pixbuf_new_from_xpm_data((gchar **)connecting_xpm); if (window3_icon_pixbuf) { gtk_window_set_icon (GTK_WINDOW (window3), window3_icon_pixbuf); gdk_pixbuf_unref (window3_icon_pixbuf); } fixed3 = gtk_fixed_new (); gtk_widget_show (fixed3); gtk_container_add (GTK_CONTAINER (window3), fixed3); label5 = gtk_label_new (_("\346\263\250\345\206\214\350\277\233\350\241\214\344\270\255\357\274\214\350\257\267\347\250\215\345\200\231\343\200\202\343\200\202\343\200\202")); gtk_widget_show (label5); gtk_fixed_put (GTK_FIXED (fixed3), label5, 24, 40); gtk_widget_set_size_request (label5, 200, 32); /* Store pointers to all widgets, for use by lookup_widget(). */ GLADE_HOOKUP_OBJECT_NO_REF (window3, window3, "window3"); GLADE_HOOKUP_OBJECT (window3, fixed3, "fixed3"); GLADE_HOOKUP_OBJECT (window3, label5, "label5"); return window3; }
static void _mt_draw_image(MT_WINDOW *win, MT_GC *gc, MT_IMAGE *img, int xsrc, int ysrc, int wsrc, int hsrc, int xdest, int ydest, int width, int height) { GdkPixbuf *pixbuf = (GdkPixbuf *)img; GdkPixbuf *pixbuf2 = NULL; /* scale if needed: */ if (wsrc != width || hsrc != height) { double scale_x = (double)width / (double)wsrc; double scale_y = (double)height / (double)hsrc; pixbuf2 = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, width, height); gdk_pixbuf_scale(pixbuf, pixbuf2, 0, 0, width, height, -xsrc * scale_x, -ysrc * scale_y, scale_x, scale_y, GDK_INTERP_NEAREST); pixbuf = pixbuf2; xsrc = 0; ysrc = 0; } _set_clipping(gc); gdk_draw_pixbuf((GdkWindow *)win, ((MT_GTK_GC *)gc)->gc, pixbuf, xsrc, ysrc, xdest, ydest, width, height, GDK_RGB_DITHER_NONE, 0, 0); _unset_clipping(gc); if (pixbuf2) { gdk_pixbuf_unref(pixbuf2); } }
/* * context - returned from image_begin_load * * free context, unref gdk_pixbuf */ void gdk_pixbuf__jpeg_image_stop_load (gpointer data) { JpegProgContext *context = (JpegProgContext *) data; g_return_if_fail (context != NULL); if (context->pixbuf) gdk_pixbuf_unref (context->pixbuf); /* if we have an error? */ if (sigsetjmp (context->jerr.setjmp_buffer, 1)) { jpeg_destroy_decompress (&context->cinfo); } else { jpeg_finish_decompress(&context->cinfo); jpeg_destroy_decompress(&context->cinfo); } if (context->cinfo.src) { my_src_ptr src = (my_src_ptr) context->cinfo.src; g_free (src); } g_free (context); }