Album
Image is a digital picture with a format as BMP, PNG, JPEG. An image may be in the black and white, 4bit, 16bit, 24bit, or 32bit color. BMP is a uncompressed format on Windows; GIF and PNG are lossless compressed format; and JPEG is the lose compressed format.
In the following code a theme will display a list of images. A date text will be painted on an image through a transform.
package require media
package require mcllib
Load media and mcllib package.
_mcl
open _mcl
set image_list {image001.jpg image002.jpg}
set text_list {
"July 15, 2001"
"August 23, 2001"}
foreach e $image_list {
lappend picture_list [getPath media image $e]
}
generate the list of full image path. getPath function is in the mcllib package. It joins a list of directory name to form a path. foreach command picks up every item from image_list as e and append to form a picture_list with full path.
_theme {
title "Ladybug Studio"
orgx 0
orgy 0
width 352
height 240
region roundrect
wcorner 20
hcorner 20
mode windowless}
open theme with round rect and windowless mode.
set duration 5000
while {1} {
start loop, duration is the waiting seconds. 5000 means 5 seconds.
for {set i 0} {$i < [llength $picture_list]} {incr i} {
set word [lindex $text_list $i]
set pict [lindex $picture_list $i]
get text from text_list and picture from picture_list.
_image {name $pict}
open image with name stored in the variable $pict
_text {string "$word" font Roman size 16
orgx 4 orgy [expr [?image height]-20]
fgcolor 0x000000}
open text with string in $word, font name "Roman", font size 16. [?image height] get the height of the opened image. expr computes the expression. fgcolor is the foreground color.
_transform {name Fade progress 0.4}
open transform Fade with start progress value 0.4
_graph {theme {transform image text}}
graph show
graph_
use image and text as the inputs of transform, and the output of transform is linked to theme.
"graph show" will display the picture. graph_ will close graph link.
transform_
text_
image_
close transform, text and image
after $duration
wait $duration seconds
}
}
theme_
mcl_
close theme and mcl
|