Re: How does one overlay one image on top of another ?



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bob Murphy wrote:
| Hi Gregory,
|
|> Step 3 (where you put the 1st GtkFixed into the GtkVBox) - You specify
|> that you "position"
|> it in teh "upper left" corner. GtkVBox doesn't let you position it's
|> children, and
|> GtkFixed doesn't let you position itself (only it's children). So I'm
|> wondering about your
|> statement of "put it at the upper left of the GtkVBox"
|
| I was writing that from memory, and clearly remembered it wrong. It
| should have been that I added the GtkFixed to the the GtkVBox, and then
| added the GtkImage to that so it was positioned at the upper left corner
| of the screen.
|
|> Step 4) The 2nd GtkFixed is a child of which ? the GtkVBox, or the 1st
|> GtkFixed. It seems
|> to me that the only way to position the 2nd GtkFixed, is to make it a
|> child of the 1st
|> GtkFixed. Is this what you did ?
|
| My recollection on this is wrong, too. Upon reviewing the documentation,
| I'm pretty sure I only used one GtkFixed and put both GtkImages into it
| at different positions. I may have even omitted the GtkVBox, and just
| put one GtkFixed into the window.
|
|>
|> Other than that, this looks pretty much like what I'm looking for.
|> When I want to move the
|> embedded image, I just gtk_fixed_move the embedded image within the
|> 1st GtkFixed. In
|> fact... it looks to me like I do not need the 2nd GtkImage embedded
|> inside of a GtkFixed,
|> since (as near as I can tell from reading the GtkFixed documentation),
|> positioning the
|> embedded image will be done by gtk_fixed_move() of the child inside
|> the top layer
|> GtkFixed. Do you concur ?
|
| I strongly suggest you experiment with this.
|
| Here's what I hear you saying:
| 1. Make a window, and put some kind of container (GtkVBox/GtkHBox) in it.
| 2. Make a GtkFixed, put that in the container, and put the first
| GtkImage inside it.
| 3. Make a second GtkImage and put it in the container, too.
| 4. When you want, move the first GtkImage around with gtk_fixed_move().
|
|
| If that's correct, I doubt it will work. The GtkFixed from step 2 and
| the GtkImage from step 3 are peers, and won't overlap. The GtkFixed will
| try to set its size to accommodate its children, and second (non-child)
| GtkImage (or any other peer widgets) will try to move out of its way.
|
| In fact, I just reviewed the GtkFixed sources. When you do a
| gtk_fixed_move() on the child GtkImage, that triggers a size
| renegotiation, and the non-child GtkImage will keep moving out of its
| way. So you won't be able to make the two GtkImages overlap by moving
| one of them around.
|
| So if you want overlap, you would probably do better to put both
| GtkImages inside the same GtkFixed. Then you can move them around and
| force them to overlap.

I tried the above. Both widgets into 1 GtkFixed. Both objects are GtkImage's. One is
larger than the other (by a significant amount).

If the 2 objects don't overlap, I can see them both.

However, when they partially, or fully, overlap, the larger image will ALWAYS be on top. I
have tried removing and putting the 2 images into the GtkFixed, in all possible orders
(being only 2 images, there are only 2 possible combinations :) Yet, the large image will
always overlap the smaller image in my testing.

Unfortunately, I want the smaller image to overlap, and lie on top of the larger image.

Is there any way to control the overlay order ? (I looked at the gtkfixed.c code, and I
cannot see any such order control, but I'm not that up on how gtk's display processing
works...

Any suggestions ?

As an alternate, how might I generate a new pixbuf with the 2nd image's bits replacing the
1st image's bits at a specific location ? (I'm sure Gimp can do this, I'm just curious as
to how it manages this...)

- -G

| - Bob
|


- --
+---------------------------------------------------------------------+

Please also check the log file at "/dev/null" for additional information.
                (from /var/log/Xorg.setup.log)

| Greg Hosler                                   ghosler redhat com    |
+---------------------------------------------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQFH8D2n404fl/0CV/QRAm8kAJ9pqUaPq9iHPHOapJqEj4jF9AYu+wCg4Pwb
aZHv/Ld/k89sJEfT3j8FgsM=
=bIGE
-----END PGP SIGNATURE-----



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]