gimp drawable question
This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.
This is a read-only list on gimpusers.com so this discussion thread is read-only, too.
gimp drawable question | Tibor Bamhor | 23 Apr 12:55 |
Fwd: gimp drawable question | Tibor Bamhor | 23 Apr 14:51 |
Fwd: gimp drawable question | Joao S. O. Bueno | 23 Apr 15:41 |
Fwd: gimp drawable question | Tibor Bamhor | 23 Apr 15:51 |
gimp drawable question
Hi,
I am working on a plugin and need a help with understanding how drawables works.
I would first describe what the plugin should do: 1. You open an image (lets presume the image is single layered) 2. User launches a plugin, it reads content of image and keep it in memory 3. User paints something to the image and hits a button on the plugin window (plugin stays alive all the time) 4. The plugin will read content from image, do some calculations and changes the image back.
And steps 3 are 4 are repeated many times.
First issue I run into is that when I want to paint (with paintbrush tool f.e.) to the image again, what I had painted in previous iteration is lost - it dissapears... This is my question for now, how to avoid this behaviour...
If I shoud provide some code, my "core" function that is called everytime the button is hit contains following....
gimp_pixel_rgn_init (&rgn_in, source,x1, y1, maindata.width,
maindata.height,FALSE, FALSE);
gimp_pixel_rgn_init (&rgn_out, source, x1, y1, maindata.width,
maindata.height, FALSE,TRUE);
gimp_pixel_rgn_get_rect (&rgn_in,rect_in,x1,
y1,maindata.width,maindata.height);
#here plugin calculates rect_out
gimp_pixel_rgn_set_rect (&rgn_out, rect_out,x1,
y1,maindata.width,maindata.height);
gimp_drawable_flush (source);
gimp_drawable_merge_shadow (source->drawable_id, FALSE);
gimp_drawable_update
(source->drawable_id,x1,y1,maindata.width,maindata.height);
I had read your Gimp reference manual but to no avail :)
Thanks !!
Tibor
Fwd: gimp drawable question
Hi,
after some digging and coding I found that the problem is bit different, so please ignore description in my above mail...
The problem currently is (and I noticed also by other plugins of mine) that the image is not refreshed automatically - I have to click on the "eye" in the layers window to get it refreshed. Do I need to add something to my code in previous mail?
I can post a video if this is not clear :)
Tibor
---------- Forwarded message ----------
From: Tibor Bamhor
Date: 2013/4/23
Subject: gimp drawable question
To: gimp-developer-list@gnome.org
Hi,
I am working on a plugin and need a help with understanding how drawables works.
I would first describe what the plugin should do: 1. You open an image (lets presume the image is single layered) 2. User launches a plugin, it reads content of image and keep it in memory 3. User paints something to the image and hits a button on the plugin window (plugin stays alive all the time) 4. The plugin will read content from image, do some calculations and changes the image back.
And steps 3 are 4 are repeated many times.
First issue I run into is that when I want to paint (with paintbrush tool f.e.) to the image again, what I had painted in previous iteration is lost - it dissapears... This is my question for now, how to avoid this behaviour...
If I shoud provide some code, my "core" function that is called everytime the button is hit contains following....
gimp_pixel_rgn_init (&rgn_in, source,x1, y1, maindata.width,
maindata.height,FALSE, FALSE);
gimp_pixel_rgn_init (&rgn_out, source, x1, y1, maindata.width,
maindata.height, FALSE,TRUE);
gimp_pixel_rgn_get_rect (&rgn_in,rect_in,x1,
y1,maindata.width,maindata.height);
#here plugin calculates rect_out
gimp_pixel_rgn_set_rect (&rgn_out, rect_out,x1,
y1,maindata.width,maindata.height);
gimp_drawable_flush (source);
gimp_drawable_merge_shadow (source->drawable_id, FALSE);
gimp_drawable_update
(source->drawable_id,x1,y1,maindata.width,maindata.height);
I had read your Gimp reference manual but to no avail :)
Thanks !!
Tibor
Fwd: gimp drawable question
On 23 April 2013 11:51, Tibor Bamhor wrote:
Hi,
after some digging and coding I found that the problem is bit different, so please ignore description in my above mail...
The problem currently is (and I noticed also by other plugins of mine) that the image is not refreshed automatically - I have to click on the "eye" in the layers window to get it refreshed. Do I need to add something to my code in previous mail?
Try just making a call to "gimp_displays_flush" after you are done.
I can post a video if this is not clear :)
Tibor
---------- Forwarded message ---------- From: Tibor Bamhor
Date: 2013/4/23
Subject: gimp drawable question
To: gimp-developer-list@gnome.orgHi,
I am working on a plugin and need a help with understanding how drawables works.
I would first describe what the plugin should do: 1. You open an image (lets presume the image is single layered) 2. User launches a plugin, it reads content of image and keep it in memory 3. User paints something to the image and hits a button on the plugin window (plugin stays alive all the time)
4. The plugin will read content from image, do some calculations and changes the image back.And steps 3 are 4 are repeated many times.
First issue I run into is that when I want to paint (with paintbrush tool f.e.) to the image again, what I had painted in previous iteration is lost - it dissapears... This is my question for now, how to avoid this behaviour...
If I shoud provide some code, my "core" function that is called everytime the button is hit contains following....
gimp_pixel_rgn_init (&rgn_in, source,x1, y1, maindata.width, maindata.height,FALSE, FALSE);
gimp_pixel_rgn_init (&rgn_out, source, x1, y1, maindata.width, maindata.height, FALSE,TRUE);gimp_pixel_rgn_get_rect (&rgn_in,rect_in,x1, y1,maindata.width,maindata.height);
#here plugin calculates rect_out
gimp_pixel_rgn_set_rect (&rgn_out, rect_out,x1, y1,maindata.width,maindata.height);gimp_drawable_flush (source); gimp_drawable_merge_shadow (source->drawable_id, FALSE); gimp_drawable_update
(source->drawable_id,x1,y1,maindata.width,maindata.height);I had read your Gimp reference manual but to no avail :)
Thanks !!
Tibor
_______________________________________________ gimp-developer-list mailing list
gimp-developer-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gimp-developer-list
Fwd: gimp drawable question
GREAT!!! gimp_displays_flush() works like a sharm. Thanks!
2013/4/23 Joao S. O. Bueno
On 23 April 2013 11:51, Tibor Bamhor wrote:
Hi,
after some digging and coding I found that the problem is bit different,
so
please ignore description in my above mail...
The problem currently is (and I noticed also by other plugins of mine)
that
the image is not refreshed automatically - I have to click on the "eye"
in
the layers window to get it refreshed. Do I need to add something to my
code
in previous mail?
Try just making a call to "gimp_displays_flush" after you are done.
I can post a video if this is not clear :)
Tibor
---------- Forwarded message ---------- From: Tibor Bamhor
Date: 2013/4/23
Subject: gimp drawable question
To: gimp-developer-list@gnome.orgHi,
I am working on a plugin and need a help with understanding how drawables works.
I would first describe what the plugin should do: 1. You open an image (lets presume the image is single layered) 2. User launches a plugin, it reads content of image and keep it in
memory
3. User paints something to the image and hits a button on the plugin
window
(plugin stays alive all the time) 4. The plugin will read content from image, do some calculations and
changes
the image back.
And steps 3 are 4 are repeated many times.
First issue I run into is that when I want to paint (with paintbrush tool f.e.) to the image again, what I had painted in previous iteration is
lost
- it dissapears... This is my question for now, how to avoid this behaviour...
If I shoud provide some code, my "core" function that is called everytime the button is hit contains following....
gimp_pixel_rgn_init (&rgn_in, source,x1, y1, maindata.width, maindata.height,FALSE, FALSE);
gimp_pixel_rgn_init (&rgn_out, source, x1, y1, maindata.width, maindata.height, FALSE,TRUE);gimp_pixel_rgn_get_rect (&rgn_in,rect_in,x1, y1,maindata.width,maindata.height);
#here plugin calculates rect_out
gimp_pixel_rgn_set_rect (&rgn_out, rect_out,x1, y1,maindata.width,maindata.height);gimp_drawable_flush (source); gimp_drawable_merge_shadow (source->drawable_id, FALSE); gimp_drawable_update
(source->drawable_id,x1,y1,maindata.width,maindata.height);I had read your Gimp reference manual but to no avail :)
Thanks !!
Tibor
_______________________________________________ gimp-developer-list mailing list
gimp-developer-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gimp-developer-list