|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Question about how Gimp displays multiple layers-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 Hi all, I'm working on a gtk application, and I have a need to display a composite image. i.e. a base image, with a 2nd (much smaller) image overlaying a part of the bigger 1st image. Periodically I may need to move the smaller image to a different location within the bigger image. My first attempt was to use the GtkFixed widget, and put both images into the GtkFixed container. The problem I faced is that GtkFixed will always layer the larger image on top of the smaller image (at least this is my observation, and I cannot figure out how to control the layering order for GtkFixed). In [minimal] playing around with Gimp, I am aware that Gimp has the ability to create a composite image, out of multiple layers. I'm kinda curious as to the algorithms (pointers to within the code welcome), and whether there are widgets that are more suited to this, rather than the GtkFixed (that I could not get to work for me). I do not mind loading a pixbuf, and then replacing a designated section of it with the smaller image's pixbuf, if that is what it takes... I cannot figure out from the gtk pixbuf devhelp pages how I might achieve this though. Any thoughts/comments are most welcome. Thanks, and best rgds, - -Greg - -- +---------------------------------------------------------------------+ Please also check the log file at "/dev/null" for additional information. (from /var/log/Xorg.setup.log) | Greg Hosler ghosler@... | +---------------------------------------------------------------------+ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFH8NCq404fl/0CV/QRAnelAJ42K0vVFIy/4g6u1CCQGTdu+v2buwCbBpIZ 8xUITPrCcFIJqPbMpCu98Ew= =lmCC -----END PGP SIGNATURE----- _______________________________________________ Gimp-developer mailing list Gimp-developer@... https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer |
|
|
Re: Question about how Gimp displays multiple layersHello. I cannot address the issue of widgets. Anyway GIMP does not use
widgets to display individual layers, only the final composition, app/display holds the code IIRC(quite a bit of code -- someone else might be able to narrow it down further.). The image is composited and THEN displayed (in one widget). With this sort of display there really is no reason to try to be clever by doing things as confusing as you described. You just need to do the composition (GDK will help you with that) and display the relevant area of it in an expose handler for your display widget. In short, this reminds me of when I used to make more work for myself by being clever about finding ways to reduce the work I needed to do. Do things the plain way first, try to be clever later if it doesn't work well enough, OK? On Mon, Mar 31, 2008 at 10:23 PM, Gregory Hosler <ghosler@...> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi all, > > I'm working on a gtk application, and I have a need to display a composite image. i.e. a > base image, with a 2nd (much smaller) image overlaying a part of the bigger 1st image. > Periodically I may need to move the smaller image to a different location within the > bigger image. > > My first attempt was to use the GtkFixed widget, and put both images into the GtkFixed > container. The problem I faced is that GtkFixed will always layer the larger image on top > of the smaller image (at least this is my observation, and I cannot figure out how to > control the layering order for GtkFixed). > > In [minimal] playing around with Gimp, I am aware that Gimp has the ability to create a > composite image, out of multiple layers. I'm kinda curious as to the algorithms (pointers > to within the code welcome), and whether there are widgets that are more suited to this, > rather than the GtkFixed (that I could not get to work for me). > > I do not mind loading a pixbuf, and then replacing a designated section of it with the > smaller image's pixbuf, if that is what it takes... I cannot figure out from the gtk > pixbuf devhelp pages how I might achieve this though. > > Any thoughts/comments are most welcome. > > Thanks, and best rgds, > > - -Greg > > - -- > +---------------------------------------------------------------------+ > > Please also check the log file at "/dev/null" for additional information. > (from /var/log/Xorg.setup.log) > > | Greg Hosler ghosler@... | > +---------------------------------------------------------------------+ > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.7 (GNU/Linux) > > iD8DBQFH8NCq404fl/0CV/QRAnelAJ42K0vVFIy/4g6u1CCQGTdu+v2buwCbBpIZ > 8xUITPrCcFIJqPbMpCu98Ew= > =lmCC > -----END PGP SIGNATURE----- > _______________________________________________ > Gimp-developer mailing list > Gimp-developer@... > https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer > Gimp-developer mailing list Gimp-developer@... https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer |
|
|
Re: Question about how Gimp displays multiple layersGimp handles all this with its own special code, which you most
definitely don't want to try to replicate. There are several ways to handle this. Basically the thing you have to know is that widget drawing happens in response to "expose" events, and what you need to accomplish is to make the large widget ignore exposures that fall within the area of the small widget. When a container, such as GtkFixed, is called upon to handle an expose event, it generates synthetic expose events for each of its children that overlap the exposed area. You will need to replace the "expose handler" for the large widget with a custom-written one that does what you require it to. If you are custom-drawing the large widget, this should be pretty easy -- you just have to avoid doing any drawing in the part that lies within the small widget. I expect you will find this explanation pretty confusing -- the main thing I am trying to do here is to point you toward "expose" events as the thing you need to read about. -- Bill _______________________________________________ Gimp-developer mailing list Gimp-developer@... https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer |
|
|
Re: Question about how Gimp displays multiple layersHi Gregory
Gregory Hosler wrote: > I'm working on a gtk application, and I have a need to display a composite image. i.e. a > base image, with a 2nd (much smaller) image overlaying a part of the bigger 1st image. > Periodically I may need to move the smaller image to a different location within the > bigger image. Have you checked out the source code for gtk-demo? The Pixbuf demo in it seems to be exactly what you described above. Kind regards, Mukund _______________________________________________ Gimp-developer mailing list Gimp-developer@... https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer |
| Free Forum Powered by Nabble | Forum Help |