Monday, February 6, 2012

How to create a slide-show background

To create a slide-show background you need create a xml file and insert the information necessary.

If you go to /usr/share/backgrounds/cosmos/background-1.xml, you can see the configuration information necessary to run the background as slide-show.

Here is what it looks like:


<background>
  <starttime>
    <year>2012</year>
    <month>02</month>
    <day>06</day>
    <hour>00</hour>
    <minute>00</minute>
    <second>00</second>
  </starttime>
<!-- This animation will start at midnight. -->
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/cosmos/cloud.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/cosmos/cloud.jpg</from>
    <to>/usr/share/backgrounds/cosmos/comet.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/cosmos/comet.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/cosmos/comet.jpg</from>
    <to>/usr/share/backgrounds/cosmos/earth-horizon.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/cosmos/earth-horizon.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/cosmos/earth-horizon.jpg</from>
    <to>/usr/share/backgrounds/cosmos/blue-marble-west.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/cosmos/blue-marble-west.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/cosmos/blue-marble-west.jpg</from>
    <to>/usr/share/backgrounds/cosmos/galaxy-ngc3370.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/cosmos/galaxy-ngc3370.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/cosmos/galaxy-ngc3370.jpg</from>
    <to>/usr/share/backgrounds/cosmos/helix-nebula.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/cosmos/helix-nebula.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/cosmos/helix-nebula.jpg</from>
    <to>/usr/share/backgrounds/cosmos/jupiter.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/cosmos/jupiter.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/cosmos/jupiter.jpg</from>
    <to>/usr/share/backgrounds/cosmos/sombrero.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/cosmos/sombrero.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/cosmos/sombrero.jpg</from>
    <to>/usr/share/backgrounds/cosmos/whirlpool.jpg</to>
  </transition>
  <static>
    <duration>1795.0</duration>
    <file>/usr/share/backgrounds/cosmos/whirlpool.jpg</file>
  </static>
  <transition>
    <duration>5.0</duration>
    <from>/usr/share/backgrounds/cosmos/whirlpool.jpg</from>
    <to>/usr/share/backgrounds/cosmos/cloud.jpg</to>
  </transition>
</background>



The static tag (<static>) allows show the specified image during x seconds.

The duration tag (<duration>)  must be specified in seconds. For example, if you want one hour to show a wallpaper, you must type 3600 (<duration>3600.0</duration>).

The transition tag (<transition>) also must be specified in seconds. This tag allows move to next file. Attention, don't forget to transition to first file when it is the last file.

The logic of XML file is:
  1. Transition from the previous image to the current image;
  2. Indicate the duration of the current image;
  3. Transition from the current image to the next image.
You can change the name of XML file but never can change .xml extension!








Wednesday, February 1, 2012

Web Colors

While I was working on my project, I was invaded by a question.
What exactly means: "color: #1c9aff;"?
hex triplet is a six-digit, three-byte hexadecimal number used in HTMLCSSSVG, and other computing applications, to represent colors. The bytes represent the red, green and blue components of the color. One byte (8 bits) represents a number in the range 00 to FF (in hexadecimal notation). This represents the least (00) to the most (FF) intensity of each of the color components. Thus web colors specify colors in the Truecolor (24-bit RGB) color scheme. 
Can you understand why is 24 bits? Because each color components have 8 bits of size. And there are 3 bytes so 3*8 bits=24 bits.

The hex triplet is formed by concatenating three bytes in hexadecimal notation, in the following order:
Byte 1: red value (color type red);
Byte 2: green value (color type green);
Byte 3: blue value (color type blue);


The format of an RGB value in hexadecimal notation is a ‘#’ immediately followed by six hexadecimal characters. 
The number of colors that can be represented by this system is 2(256) × 2(256) × 2(256) = 16,777,216.