"The life of man is divided between waking, dreaming and dreamless sleep." or so it's written in "The Upanishads"... I wouldn't know because the cartoon version still hasn't been released and I refuse to spend even a second of my life pumping a stream of information into my brain that hasn't been properly sprinkled with commercials and product placement. Which reminds me: use Qt...
I can almost see you sitting at your desk with the same expression the great Plato had when he said: "What?" (not one of his greatest quotes, but I'm sure he said it at one point or the other). In my last blog I described how the engineering department at Trolltech spent the last few months fixing bugs in, what could be described as, a constant "waking" state. By natural progression the next Qt release is putting us in the "dreaming" state.
It's been a while since the last time that I've posted an example on how to do something funky so today I'll partially make up for it. I get a lot of questions asking me how to do something windowing system specific. People at the office can approximate the exact time of delivery of each one of the emails relating to that topic as the seismographic vibrations, originating in the vicinity of the area where the table meets with my head (in a repeated and aggressive fashion), cause ripples to appear in coffee mugs around the office. Hopefully today's example will satisfy the most vicious desires for X11 wackiness.
6'2" (height by association - as measured by the height of the author), weighting at about 139 lines of code (while wearing the license header), the undisputed (mainly because the only one) champion (questionably) of... well, nothing: QX11Mirror. QX11Mirror is a class that can monitor and return the contents of any X11 window in real time. So you could start your favorite media player, pass its window id to QX11Mirror and then render the contents half-the-size with perspective transformation. It would look like this:
One thing that you can't see is that the contents of the movie is updated while the movie is playing and the perspective transformation is animating. All of which is done in real-time. It's really cool.
The original reason for writing this, seemingly, silly example was not "making something pretty". Even though the inability to make applications look gorgeous is the number one cause of hair loss (as shown in a study by doctor "me". Note: "me" is not really a doctor. In fact "me" doesn't even fulfill grammatical requirements of the previous sentences.), which is number one reason for you not looking gorgeous and I'm a big proponent of having KDE developers look beautiful. "KDE - we got hair... In all the right places...". (I know... I'm as shocked as you are that I'm not being paid a zillion dollars to do marketing.) No, the original reason for all of this was to make web plugins behave a lot nicer. Currently the problem is that they don't compose correctly within the web rendering tree. So what I wanted to do is correctly fetch the offscreen contents of those windows, render them in correct stacking order and propagate the events back to them. This goes along the "make stuff work" ideology which I consider myself to be a big fan off. Oh, and here's Flash plugin rendering inside of a Qt applications (as always in my example, things are animating inside):
Oh, and the code is available at Graphics Dojo.
14 comments:
"People at the office can approximate the exact time of delivery of each one of the emails relating to that topic as the seismographic vibrations, originating in the vicinity of the area where the table meets with my head (in a repeated and aggressive fashion), cause ripples to appear in coffee mugs around the office."
Man... You can create some cool quotes...
What a cool list of examples do you have in http://labs.trolltech.com/page/Graphics/Examples/Examples2 ! Nice work. But I'm having trouble compiling the browser. I get this :P :
browser.cpp: In member function 'void Browser::drawItemAt(QPainter*, const QPoint&, const QImage&, int, int, int)':
browser.cpp:237: error: 'const class QImage' has no member named 'cacheKey'
browser.cpp:239: error: 'const class QImage' has no member named 'cacheKey'
browser.cpp:243: error: 'QTransform' was not declared in this scope
browser.cpp:243: error: expected `;' before 'trans'
browser.cpp:244: error: 'trans' was not declared in this scope
browser.cpp:245: error: 'YAxis' is not a member of 'Qt'
browser.cpp:246: error: 'class QPainter' has no member named 'setTransform'
browser.cpp:248: error: 'const class QImage' has no member named 'cacheKey'
Uhm there are also other examples that have some errors. In folder1, it seems to me that widget.h should have the following line in the headers part in order to compile:
#include <QPainterPath>
Please use Qt 4.3 or ideally snapshots for those examples.
Could you explain more how this relates to browser plugins? Specifically, I am remembering XEmbed being mentioned on Penguin.SWF and wondering if this is a different solution to the same problem.
No this has nothing to do with XEmbed plugin interface. Implementing XEmbed plugin interface is trivial but doesn't solve at all the fact that layering with plugins is currently broken. The goal of this code is to fix the stacking, independently of what the plugin is doing (whether it's windowless, xt, xembed, blah plugin)
hooray ninja flash thing :D
Pray tell ...what do you use there to render the .swf?
Does this work with transparency if you give the plugin a window with an RGBA visual? If so, maybe we don't need to worry about windowless plugins after all.
(Flash used to crash with such visuals though ... don't know if it still does.)
Awesome! This totally counters http://blogs.gnome.org/view/otte/2007/05/29/0 by doing the right thing AND making everything work. Man, you're so cute.
Zack, you totally ROCK!
Zack, I can't found the "Flash plugin rendering inside of a Qt applications" example code in http://labs.trolltech.com/page/Graphics/Examples/Examples2
where is it????
I know that picture:"coffee mugs around the office":)
hello ! I try to get source code
from svn://labs.trolltech.com/svn/graphics/dojo/qx11mirror
but it can't be checkout by svn!
Post a Comment