Re: transparent canvas working in gtkextra-2?
"Adrian E. Feiguin" <[email protected]>
| Newsgroups | gmane.comp.scigraphica.gtkextra |
|---|---|
| Message-ID | <[email protected]> |
gtk_plot_canvas_set_transparent simply does not draw a background color. This is useful when you want to superimpose the plots on a background in a presentation, when you export it as an image (jpeg/gif/whatever). Al Hooton wrote: > Hi, Adrian: > > Thanks for responding so quickly, I truly do appreciate it. Let me >describe more of what I'm trying to do. > > I have a situation where I want to display just a plot when the >application is in one operating mode, and optionally display a sheet >"under" the plot when the application is in a second operating mode. In >the second mode, the user will enter data in the sheet, and I will >update the plot "over" the sheet as new data is entered. > > In the descriptions below, the phrase "sw/sheet" will mean a GtkSheet >packed in to a ScrolledWindow container. > > I first tried to use the fact that GtkCanvas is a subclass of GtkFixed, >adding the plot as normal and adding the sw/sheet as a child of the >canvas with gtk_fixed_put(). However, this doesn't work, because there >is no way for the sw/sheet to be transparent (there are other side >effects as well, but the fact that the sw/sheet can not be transparent >causes this approach to not be workable for me). > > The next thing I tried, and one that I think would work well if the >canvas could be transparent, is the following (hopefully the ascii art >will come through): > >GtkFixed > | > |--ScrolledWindow > | | > | |--GtkSheet > | > |--PlotCanvas > | > |--Plot > > > In this solution, I would make the canvas/plot opaque when I did not >want the user to see the sw/sheet, and I would make the canvas/plot >transparent when I did want them to see the sw/sheet. My tests so far >have indicated this would work well, if only the canvas would become >transparent when instructed to do so. But, it does not. > > This is why I am wondering how to get a canvas to be transparent, and >if gtk_plot_canvas_set_transparent() works correctly in gtkextra-2? > > I am definitely open to suggestions for other approaches to get the >desired effect. > > Thanks again, Adrian -- and to anybody else with some ideas to try! > >Regards, >Al > > > >On Mon, 2004-02-09 at 11:02, Adrian E. Feiguin wrote: > > >>I still don't understand what you are trying to do, If you want to show >>other widgets, use the gtkfixed capabilities as I do with the buttons in >>testgtksheet. That's the only way to show other widgets inside a canvas. >>If what you want is to do something called MDI of Window in Window, >>that's not possible with gtk. You can use a notebook to diplay the plot >>in one tab and the sheets in other tabs. You can show buttons or icons >>in a canvas and get a sheet to appear on a different window when you >>click. Those are some ideas. But again, I still don't get it. What are >>you exactly trying to do? >>Saludos, >><ADRIAN> >> >>Al Hooton wrote: >> >> >> >>> Follow-up on this: >>> >>> I have now spent pretty much the entire weekend going trying to get a >>>canvas to be transparent in gtkextra-2. It does not matter if the >>>canvas has no plots, one plot, many plots -- the canvas will never go >>>transparent so I can see what is behind it. >>> >>> I've stepped through gtkplotcanvas.c, and related code, trying to >>>figure out what is happening, but that has lead to a dead end. It >>>appears to me the code should work, in that it is not attempting to draw >>>the main rectangle of the canvas when it is marked transparent. >>>However, it is still being drawn. If I comment out the calls to >>>gtk_plot_pc_draw_rectangle in gtk_plot_canvas_paint the rectangle is not >>>drawn, but the canvas still appears to have a pixbuf that covers >>>whatever is underneath. I would have expected this pixbuf to be >>>unrealized if the canvas widget is transparent, but I'm probably missing >>>something in how this is supposed to work. >>> >>> Has anybody successfully gotten a transparent canvas? I'd really like >>>to use the gtkextra-2 package for what I'm doing, but if the canvas can >>>not be transparent I may have to abandon this for something else -- not >>>my preference, since I already have so much work done on top of >>>gtkextra-2. >>> >>> Thanks! >>> >>>-- Al >>> >>> >>>On Sat, 2004-02-07 at 20:20, Al Hooton wrote: >>> >>> >>> >>> >>>> Version: gtkextra-2 from CVS as a couple of weeks ago. >>>> >>>> I have successfully been using multiple plots on a canvas, with all the >>>>plots transparent. Today for the first time, I tried making the canvas >>>>transparent also, so I could see through the plots and the canvas to >>>>what is below. However, the canvas is not transparent when I set it >>>>with gtk_plot_canvas_set_transparent(). >>>> >>>> I have tried a small test program that just creates a canvas as a child >>>>of a parent window that has a blue background. When I set the canvas to >>>>transparent, I still have the while background of the canvas, instead of >>>>seeing the blue background of the parent, so I know the canvas has not >>>>become transparent. >>>> >>>> Is this a known problem? Do we have a workaround? >>>> >>>> Thanks! >>>> >>>>-Al >>>> >>>> >>>> >>>> >>>> >>> >>> >>>------------------------------------------------------- >>>The SF.Net email is sponsored by EclipseCon 2004 >>>Premiere Conference on Open Tools Development and Integration >>>See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. >>>http://www.eclipsecon.org/osdn >>>_______________________________________________ >>>Scigraphica-gtkextra mailing list >>>[email protected] >>>https://lists.sourceforge.net/lists/listinfo/scigraphica-gtkextra >>> >>>. >>> >>> >>> >>> >>> >> >><!DSPAM:4027d98972192513720775> >> >> > >. > > > ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn