Re: Image missdisplayed using GdkPixmap
- From: "Jim George" <jimgeorge gmail com>
- To: gtk-app-devel-list gnome org
- Subject: Re: Image missdisplayed using GdkPixmap
- Date: Sun, 24 Sep 2006 09:50:32 -0600
On 9/24/06, Sebastien Roy <morgan sebastien gmail com> wrote:
Image is not well written ...
lines seems to be mixed ... Alignement is incorrect ..
I suppose this is due to a wrong usage of dithering/depth parameters ...
data is pointing to a rgb buffer ...
the same call was working fine when writing directly to a windows instead of
a newly created
pixmap.
Image may not be loaded from a file as it is received from network, that's
while it's stored in a buffer.
cnx->pixmap is a GtkPixmap*
cnx->window is a TOPLEVEL window GtkWidget*
1. cnx->pixmap = gdk_pixmap_new(0, cnx->data.header.width,
2. cnx->data.header.height, 16);
3.
4.
5. gdk_draw_rgb_image(cnx->pixmap,
6. cnx->window->style->fg_gc[GTK_STATE_NORMAL],
7. 0, 0,
8. cnx->data.header.width,
9. cnx->data.header.height,
10. GDK_RGB_DITHER_NORMAL, cnx->data.data,
11. cnx->data.header.width * 3);
12.
13. cnx->draw_area = gtk_image_new_from_pixmap(cnx->pixmap, NULL);
libgtk2.0-dev 2.8.20-1
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
If the goal is to create an offscreen buffer to later be blitted to a
window, you can modify line 1 & 2 to read
1. cnx->pixmap = gdk_pixmap_new(GDK_DRAWABLE(cnx->window->window),
2. cnx->data.header.width,
cnx->data.header.height, -1);
PS, this also shows that cnx->window is a confusing name, perhaps
cnx->widget would work better.
-Jim
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]