Re: GdkPixbuf change brightness [was:(no subject)]
- From: Iago Rubio <iago rubio hispalinux es>
- To: anne isac <anneisac techie com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: GdkPixbuf change brightness [was:(no subject)]
- Date: Wed, 12 Jan 2005 14:22:18 +0100
On Wed, 2005-01-12 at 07:24, anne isac wrote:
On Mon, 10 Jan 2005 17:27:09 +0100 Iago Rubio wrote:
You can change the brightness in a GdkPixbuf in various ways.
One convenient could be a call to
gdk_pixbuf_saturate_and_pixelate().
I tried using gdk_pixbuf_saturate_and_pixelate() it does work but now
the issue is,
gdk_pixbuf_saturate_and_pixelate() takes a sorce Pixbuf and a
Destination PixBuf and if i do
GtkPixBuf *destPixBuf;
gdk_pixbuf_saturate_and_pixelate(srcPixbuf,destPixBuf,brightness,FALSE)
I get a Gtk-CRITICAL message...
Gtk-CRITICAL **: file gtkwidget.c: line 4240 (gtk_widget_set_parent):
assertion `widget->parent == NULL' failed
(try:26788): GdkPixbuf-CRITICAL **: file gdk-pixbuf-util.c: line 180
(gdk_pixbuf_saturate_and_pixelate): assertion `GDK_IS_PIXBUF (dest)'
failed
gdk_pixbuf_saturate_and_pixelate expects a GdkPixbuf object not a
placeholder for the return value.
May be you could try:
GtkPixBuf *destPixBuf = gtk_pixbuff_new(
gdk_pixbuf_get_colorspace (srcPixbuf),
gdk_pixbuf_get_has_alpha (srcPixbuf),
gdk_pixbuf_get_bits_per_sample (srcPixbuf),
gdk_pixbuf_get_width (srcPixbuf),
gdk_pixbuf_get_height (srcPixbuf)
);
gdk_pixbuf_saturate_and_pixelate(srcPixbuf,destPixBuf,brightness,FALSE);
This way you'll got a properly built pixbuf, as placeholder for the
returned value.
and if i assign destPixBuf=srcPixBuf
then every time i have a new source buffer which is not what is
wanted.
how do i copy the contents of the source buffer to the destination
buffer before i call gdk_pixbuf_saturate_and_pixelate();
destPixBuf = gdk_pixbuf_copy (srcPixbuf);
if(destPixBuf)
{
// do something useful
}
else
{
// warn, not enought memory
}
or is there another way to avoid the Gtk-CRITICAL condition???
You should pass a properly built pixbuf to
gdk_pixbuf_saturate_and_pixelate.
It could be a new one, a copy of the source pixbuf, or the same pixbuf
as source and destination, if you don't care to loose the source one.
Please Help
I hope it helps.
Thanking you in anticipation
You're welcome.
--
Iago Rubio
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]