Support
Contribute
Contact
Tracker
Navigation
Personal tools
 

Clock Hands

Because Edje can not rotate images, creating a clock face and hands can be very bothersome. Not any more! The included code here will take 2 image files and rotate them 6 degrees then repeat the process till you have a nice set of images to replace the images in the default clock theme. The clock.edc remains the same so no alteration is needed.

Before you begin, the imagemagick package must be installed, as it provides the convert command used to create the image files.

Here are some examples of what your initial clock hand images should look like.

This is a Minute hand.
This is a Minute hand.


This is a Hour hand.
This is a Hour hand.

Ideally, you should have an odd number of pixels in X and Y and have the middle pixel coloured. This makes the hands connect when rotating.

#!/bin/sh
# Usage - spinhand <minute hand image> <hour hand image>
# This will create the images needed to customise the default clock.
# It is recommended to use input files with simple names.
# I am not a bash script expert by any means and have simple copy
# and pasted this script from the Rotate Edje guide on the
# Enlightenment Wiki. Feel free to update modify and upload
# a better version of this script.

a=1
b=360
infile=$1

while [ $a -le $b ]; do
  num=`printf "%.2d\n" $c`

  outfile="e17_clock_minutes_"$num.png
  rotate=`echo $a | bc`

  echo "creating file $outfile..."
  CONVERT="$infile -matte ( +clone -background none -rotate $rotate  ) -gravity center  -compose Src -composite $outfile"

  convert $CONVERT

  a=`expr $a + 6`
  c=`expr $c + 1`
done

d=1
e=360
infile=$2

while [ $d -le $e ]; do
  num=`printf "%.2d\n" $f`

  outfile="e17_clock_hour_"$num.png
  rotate=`echo $d | bc`

  echo "creating file $outfile..."
  CONVERT="$infile -matte ( +clone -background none -rotate $rotate  ) -gravity center  -compose Src -composite $outfile"

  convert $CONVERT

  d=`expr $d + 6`
  f=`expr $f + 1`
done