The KGLDiaShow is an interpreter for simple scripts. It will allow you to show, move, scale, rotate and fade images on top of openGL.
If you want a fast introduction and a practical entrance, there should have come a demoscript with this archive.
This is the reference documentation for the KGLDiaShow script interpreter.
If anything here does not fit the behaviour of the interpreter, there's something wrong: either in the interpreter or in the documentation.
In this case: mail to thomas.luebking@web.de
Some basic rules:
loop( 3 )
scaleImageTo( $image, 100, -1 )
showImage( $image )
scaleImageTo( $image, 50, -1, 5000 )
wait( 4500 )
setImageAlpha( $image, 0, 500 )
wait( 500 )
hideImage( $image )
endloop( )
Loops can be cascaded.
loadImage( konsole.png, konsole )
loadImage( konqueror.png, konqueror )
loadImage( kmail.png, kmail )
loadImage( kwrite.png, kwrite )
for ( image=$konsole:$konqueror:$kmail:$kwrite )
scaleImageTo( $image, 15, -1 )
moveImageTo( $image, 50, -15 )
showImage( $image )
moveImageTo( $image, 50, 115, 3000 )
hideImage( $image )
endfor( )
For loops can be cascaded.
NOTICE: This has nothing to do with the onscreen action - animations will go on!
wait( ) allows you to control the animation flow. If you e.g. want to scale an image up, then wait some time and in the end, fade it out:
# scale for 5 seconds
scaleImageTo( $image, 80, -1, 5000 )
# wait 4 seconds
wait( 4000 )
# start fade 1 second before scaling ends
setImageAlpha( $image, 0, 1000 )
NOTICE: Images are loaded hidden, you must explpicitly showImage( ) them!
Well, of course one of the first things you want to do, is to load an image ( or more ; )
Qt currently supports jpegs, pngs, bmps and ( probably ) gifs.
To do something with the images, you must be able to reference them.
This is why you better pass the second parameter that may be any kind of string that does NOT contain '( ,;: )' ( those chars are used internal ).
loadImage( wallpaper.png, background )
...
...
...
scaleImageTo( $background, 100 )
The imagepath may be relative or full, where the best choice is probably to make it relative to the script.loadImage( ../images/wallpaper.png, background )
NOTICE: Images are loaded hidden, you must explpicitly showImage( ) them!
If you want to use the same image more than once, instead of loading it several times you should better just copy it.
1: This is MUCH faster
2: It comsumes no additional TRAM
copyImage( $image, imagecopy )
...
removeImage( $imagecopy )
# $image is still available
scaleImageTo( $image, 20, -1, 500 )
NOTICE: Images are loaded hidden, you must explpicitly showImage( ) them!
loadImage( image.png, image ); showImage( $image )
NOTICE: Hiding an images improves performance over setImageAlpha( .,0 )!
rotateImageBy( $image, Z, 360, 2000 )
# this would cancel the above statment and start from an arbitrary rotation
# rotateImageBy( $image, Z, 360, 4000 )
wait( 2000 )
rotateImageBy( $image, Z, 360, 4000 )
NOTICE: Image rotation is relative to the scenery rotation!
NOTICE: Images lie on top of the screen by default,
i.e. if you rotate them around the X or Y axis, the part towards you will be clipped ( as it's now "outside" the screen )!
To avoid that, move the scenery "into" the screen, e.g. moveTo( Z, 2 )
# rotate around the vertical axis
rotateImageBy( $image, Y, 360, 2000 )
wait( 500 )
# this will ensure the image is set back to 0°
# no matter where it was when the call was made
rotateImageTo( $image, Y, 0, 1000 )
NOTICE: Image rotation is relative to the scenery rotation!
NOTICE: Images lie on top of the screen by default,
i.e. if you rotate them around the X or Y axis, the part towards you will be clipped ( as it's now "outside" the screen )!
To avoid that, move the scenery "into" the screen, e.g. moveTo( Z, 2 )
# move the image half the screen width to the left
moveImageBy( $image, X, -50, 2000 )
wait( 2000 )
# and back
moveImageTo( $image, X, 50, 2000 )
NOTICE: Image movement is relative to the scenery movement!
# center the image on the screen
moveImageTo( $image, X, 50 )
moveImageTo( $image, Y, 50 )
NOTICE: Image movement is relative to the scenery movement!
# scale image to 20% of the scenery
scaleImageTo( $image, 20, -1 )
# scale by 150%
scaleImageBy( $image, 150, -1, 2000 )
# the image now takes 30% of the scenery
# scale image to 20% of the scenery and keep the ratio
scaleImageTo( $image, 20, -1 )
# scale image to 20% of the scenery with and 20% of the height ( regardless of the image dimensions )
scaleImageTo( $image, 20, 20 )
setImageAlpha( $image, 0 )
showImage( $image )
# fade in to 70%
setImageAlpha( $image, 70, 2000 )
# don't forget to wait
wait( 2000 )
# fade out
setImageAlpha( $image, 0, 2000 )
loadImage( image.png, image )
...
...
removeImage( $image )
# $image can now be reassigend
...
...
quit( )
rotateBy( Z, 360, 2000 )
# this would cancel the above statment and start from an arbitrary rotation
# rotateImageBy( Z, 360, 4000 )
wait( 2000 )
rotateImageBy( Z, 360, 4000 )
NOTICE: The scenery lies on top of the screen by default,
i.e. if you rotate them around the X or Y axis, the part towards you will be clipped ( as it's now "outside" the screen )!
To avoid that, move the scenery "into" the screen, e.g. moveTo( Z, 2 )
# rotate around the vertical axis
rotateBy( Y, 360, 2000 )
wait( 500 )
# this will ensure the rotation is set back to 0°
# no matter where it was when the call was made
rotateTo( Y, 0, 1000 )
NOTICE: The scenery lies on top of the screen by default,
i.e. if you rotate them around the X or Y axis, the part towards you will be clipped ( as it's now "outside" the screen )!
To avoid that, move the scenery "into" the screen, e.g. moveTo( Z, 2 )
# move the scenery half it's width to the left
moveBy( X, -50, 2000 )
wait( 2000 )
# and back
moveTo( X, 50, 2000 )
NOTICE: Scenery movement distance is relative to the scenery scale!
# center the scenery on the screen
moveTo( X, 50 )
moveTo( Y, 50 )
# scale scenery to 20% of the screen
scaleTo( 20, -1 )
# scale by 150%
scaleBy( 150, -1, 2000 )
# the scenery now takes 30% of the screen
# scale scenery to 20% of the screen
scaleImageTo( $image, 20 )