Let us start with the code:
svn checkout svn://labs.trolltech.com/svn/graphics/dojo/genie
cd genie && qmake && make && ./genie
Usually you would not want to do the genie effect (made famous in Mac OS X) like in this implementation, as you can get mesh deformation easily using GLSL. Here I just want to show code as another example of one of the messages from my graphics talk in Qt Developer Days, namely "cheat whenever you can". If you inspect the inner loop, you can see that it is fairly simple. The idea is to store the outline of the genie shape in a table (I use logistic function, as "S" shape looks really good). During the animation, the left start-point and right end-point of each row is used to scale a horizontal slice of the original pixmap. One dimensional scaling like this is fairly cheap, as in ray casting trick. Furthermore, the only division in the loop can be optimized (at the cost of visual quality) to be carried out every N rows (the alternative is a look-up table). Since we are animating anyway, decide yourself if you can get away with the sacrificed quality.
I have no doubt that the experienced readers can further squeeze the scaling code, I left it just like it is because it starts to be less readable. Of course, feel free to have more fun there!
Final word: special thanks to Enrico Ros for the discussion, initial code, and the feedback.
Download the latest release here: www.qt.io/download.
Qt 5.15 was developed with a strong focus on quality and is a long-term-supported (LTS) release that will be supported for 3 years.
Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.
Näytä tämä julkaisu Instagramissa.
Want to build something for tomorrow, join #QtPeople today! We have loads of cool jobs you don’t want to miss! http://qt.io/careers #builtwithQt #software #developers #coding #framework #tool #tooling #C++ #QML #engineers #sales #tech #technology #UI #UX #CX #Qt #Qtdev #global #openpositions #careers #job
Henkilön Qt (@theqtcompany) jakama julkaisu