[I] can?t seem to get load_image and blend to work.
Grr... I do not know how I managed to get it wrong in the
documentation, but I did (while being positively sure I
cross-checked the examples). I really wondered how it stayed
that way for so many months. :oops:
In you first code snipset, the problem is simply that it do
not copy the image alpha channel information back to the
foreground image during the blend (first parameter should be
one, not zero), which cause the foreground to be interpreted
as purely transparent (the default alpha for the whole
foreground image is 0) when displayed with window
transparency set to true.
As for the second problem, well, keep in mind that direct
piping of commands into the interpreter do not fit that well
with regular X11 use;
pause
brutally freeze the interpreter, and no window refresh of any
kind will occur during its execution: it is an internal
debugging convenience, really. This explains why it is
possible to have all sort of buggy X11 display using it. ;-)
In fact, scripts similar to yours are not usually used under
X11, but more for headless processing of images (it is
generally more simple to use the Python module for
interactive display). Anyway, here is a rough but functionnal
POSIX compliant shell script that replicate yours:
#! /bin/sh
# Variables
#
IMAGE=redbox.png
KEEPIMAGE=false
TIMEOUT=10
# Auto image remove on exit.
#
trap -- "$KEEPIMAGE && rm $IMAGE" EXIT
# First, create the image
#
(
(
cat <<EOF
echo Image creation
window_resize 100 100
context_set_color 255 0 0 200
image_fill_rectangle 25 25 50 50
save_image $IMAGE
EOF
) | adesklets ':'
)
# Then, reload it, just for experimentation' sake.
#
(
cat <<EOF
echo Image display for $TIMEOUT seconds
window_resize 100 100
window_reset managed
load_image $IMAGE
blend_image_onto_image 2 1 0 0 100 100 0 0 100 100
window_set_transparency 1
window_show
EOF
sleep $TIMEOUT
echo 'quit'
) | adesklets :
Yours,