Re: Get and set pixel values
- From: Havoc Pennington <hp redhat com>
- To: Björne Lindberg <bjorne lindberg tfe umu se>
- Cc: <gtk-app-devel-list gnome org>
- Subject: Re: Get and set pixel values
- Date: 28 Jan 2001 11:10:00 -0500
Björne Lindberg <bjorne lindberg tfe umu se> writes:
I have loaded a pixmap image into a drawable area and now I want to rewrite it
with some of the pixels moved from (xa.ya) to (xb, yb), but how can I get the
pixel value at point (x,y) and how do I set the pixel value at the new
(x1,y1)?
I need something like this:
setPixelValue(getPixelValue(x,y),x1,y1)
and it would be nice if it's quite fast, gdk_draw_point() will probably be to
slow.
Are there anyone who might have a solution for me?
The only remotely fast way to do this is to gtk_image_get() part of
the pixmap, modify the image, then draw the image back; with the
rather nasty problem that pixels have a different size and format
according to display visual.
With gdk-pixbuf you can use gdk_pixbuf_get_from_drawable() instead and
modify the GdkPixbuf (a GdkPixbuf is essentially a GtkImage with a
nicer format). For now this is a separate library from GTK but will
ship with GTK 2.0.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]