Stamps and Animation

E2B Version 1.78 and later versions can use some new features in grub4dos 0.4.6a.
 

Stamps

E2B supports up to 10 stamps. A stamp is a 24-bit colour graphics bitmap or JPEG which will over-write the current wallpaper background.
A stamp can be any size, up to the maximum resolution of the graphics mode chosen (e.g. 800x600 or 1024x768), however, they are normally intended to be smaller than the background wallpaper as they can be positioned anywhere on the screen (even behind the menu area).
 
Try this in your \_ISO\MyE2B.cfg file to add an E2B boiler plate stamp to the top right of the screen:
set STAMP1=0x80=570=23 /_ISO/e2b/grub/E2BPlate.bmp
 
The wallpaper can be a large bitmap or JPEG file, or it can be a plain colour background, but the display must be in graphics mode (not text mode). It does not work if using a GFX Menu.
 
You can define STAMPn variables in the \_ISO\MyE2B.cfg file like this:
 
# Ovewrite the wallpaper. Format: set STAMPn=type=x=y (filespec)   note: must be space before filespec, type = 0 or 0x80=transparent background
set STAMP1=0x00=584=0 /_ISO/docs/Templates/Animate/easy2boot_stamp.bmp
set STAMP2=0x80=680=160 /_ISO/docs/Templates/Animate/E2B.bmp
set STAMP3=0=680=260 /_ISO/mystamp3.bmp
set STAMP4=0=680=360 /_ISO/mystamp4.jpg
 

The graphics file can be compressed using GZip or LZMA and can have any name or file extension.

Tip: If you want to make text with a transparent background, use Microsoft Paint to make a 2-colour (black&white) .bmp file. This will create a non-dithered image with just two colours. Then re-load and re-save it as a 24-colour bmp and change the colour of the letters to whatever colour you want. This will leave a plain background which is suitable for using with transparency.

Alternatively, design and download your own text logo using this site (transparent page here).

Use a different 'stamp' for each menu

If you keep the stamp the same size and position, we can use a different stamp for each submenu.

For instance, when we load the Antivirus submenu, we could display an antivirus logo stamp at the top-right of the menu but use a different stamp for the Main menu.

Make two new .mnu files as follows (0x0=opaque or 0x80=transparent):

\_ISO\MAINMENU\$$$$CONFIG\MMStamp.mnu
splashimage --offset=0x0=680=10 /_ISO/MMStamp.bmp

\_ISO\ANTIVIRUS\$$$$CONFIG\AVStamp.mnu
splashimage --offset=0x80=680=10 /_ISO/AVStamp.bmp

The 'stamps' will need to be exactly the same size and written to exactly the same position on the background so they exactly overwrite each other OR you could also use a splashimage command first to load a completely different background if you wish. (e.g. splashimage /_ISO/AVwall.bmp).
 
We use a folder called $$$$CONFIG because it must be the first alphabetically-sorted folder or file to be enumerated by E2B. Note that if you had a file called \_ISO\MAINMENU\$$$$$special.ISO, then the $$$$CONFIG folder would not be the first file/folder and so the MMStamp.mnu file would not work! Instead of using a $$$$CONFIG folder, you could just use a \_ISO\MAINMENU\$$$$MMStamp.mnu file - as long as it is enumerated first by E2B.
 

Animation

 This animation is playing in non-transparent mode.  
 

You can define one animation sequence using the ANIMATE variable in the MyE2B.cfg file. The sequence will play for 1 to 15 times during E2B start-up and before the E2B Main Menu is displayed, OR it can be continuously displayed on the background wallpaper when the menu is displayed.

Tip: Try the DNA Animation .mnu file (in Alternate Downloads - Other Files area) for a 120-frame rotating transparent DNA model!

The F2 key will stop/start the animation (if the F2 key has not been defined as a menu hotkey).

Avoid positioning an 'infinite' animation inside the E2B Menu area or where text may be located (e.g. avoid the menu help text area under the menu or the 'footer' help text area).

You can specify a transparent background (the first pixel is regarded as the transparent pixel value).

If the 'type' includes %infinite% then it will play the sequence continuously on the wallpaper when the menu is displayed.

If you specify the number of cycles (1-15), then the background will be displayed and the animation will play during E2B start-up and before the E2B menu is displayed.

Grub4dos only supports one animated sequence on the display at any one time.

The example below displays 9 frames - 530791_frame_0001.bmp to 530791_frame_0009.bmp - the last frame is 09 so last=9.

The file name and extension must end in nn.eee where nn is 01-99 and eee is any three letters (typically .bmp or .jpg). Bitmap files can be compressed using GZip or LZMA. If there are more than 99 frames, the file name should end in 001.bmp or 001.jpg (max=255). The filename should always be the first frame (e.g. nnn01.bmp or nnn001.bmp).

Note: All individual frames must be the same x,y dimensions or the image will jitter and may leave remnants on the screen during animation.

A sample of some animation code for the MyE2B.cfg file is shown below:

# ANIMATE - displays a sequence - first file must be end in 01.xxx (can be compressed bitmap using gzip or LZMA or JPEG file) - must use .bmp or .jpg as extension
# trans=transparent, infinite=animate on menu or use 1-15 for number of cycles, current animation is stopped if type=0x0
# 18 delay units = 1 second, x and y in pixels, last = last frame number in sequence 01-255.xxx
set trans=0x80 && set infinite=0x10
 
# display sequence on menu (with transparent background)
set /A type=%infinite% + %trans% > nul
# play sequence 3 times immediately
###set /A type=%trans% + 3 > nul
set delay=0x3
set last=09
set x=650
set y=40
set FILE=(bd)/_ISO/docs/Templates/Animate/530791_frame_0001.bmp
set ANIMATE=%type%=%delay%=%last%=%x%=%y% %FILE%
set trans= && set infinite= && set delay= && set type= && set last= && set y= && set x= && set FILE=
 
If you wish, you can reduce this to just one line:
set ANIMATE=0x90=3=9=650=40   /_ISO/docs/Templates/Animate/530791_frame_0001.bmp

 

Note: By using type=1 and last=1, you can display any single picture for a set period of time during E2B startup.

 

Load an animation into memory for an 'infinite' animation

If you use the example shown above using 'infinite' animation, it will continuously load the graphics files from the E2B USB drive.
This can affect the delay between each picture and also can cause wear of a USB Flash memory drive.
 
A much better solution is to load all the graphics files into memory first.
This can be done by making a floppy disk image file (e.g. E2B_GIF.ima) which contains all the frame images.
It is better for performance reasons, to use uncompressed .bmp files for the frames but compress the final .ima file using LZMA.
This image will be loaded as floppy disk 3 (fd3) if you set the ANIMFD3 variable and specify (fd3) for the source of the animation files.
 
# ANIMATE - displays a sequence - first file must be end in 01.xxx (can be a compressed bitmap using gzip or LZMA) - must use .bmp or .jpg as extension
# type: trans=transparent, infinite=animate on menu or add 1-15 for number of cycles, disable playing = 0x0
# 18 delay units = 1 second, top-left offset x and y in pixels, last = last frame number in sequence 01-255.xxx
# display a sequence on the menu (with transparent background)
set trans=0x80 && set infinite=0x10
set /A type=%infinite% + %trans% > nul
set delay=0x3
set last=09
set x=650
set y=40
# if images are inside a disk image, specify (fd3) as the device
set FILE=(fd3)/frame_0001.bmp
set ANIMATE=%type%=%delay%=%last%=%x%=%y% %FILE%
set trans= && set infinite= && set delay= && set type= && set last= && set y= && set x= && set FILE=
# If using a floppy disk image (fd3), we must specify the image file
# The floppy disk image is loaded into memory and so the animation is faster and does not constantly access the disk
# ANIMFD3 if a floppy disk image file containing the files - it is mapped to fd3 by E2B
set ANIMFD3=/_ISO/docs/Templates/Animate/E2B_GIF.ima
 
If you wish, this can be shortened to just two lines:
set ANIMFD3=/_ISO/docs/Templates/Animate/E2B_GIF.ima
set ANIMATE=0x90=3=9=650=40 (fd3)/frame_0001.bmp
 
For details of how to make a floppy disk image containing the frames, see below.
 
You can find example animations in the Alternate Download Area - Other Files folder (e.g. DNA and MrBean).
 

Multiple animations sequences

You can play one animation sequence after another from a MyE2B.cfg file.
To specify an infinite sequence for the menu, you must set the ANIMATE variable last of all.
For instance this will play two sequences immediately first, enumerate the MAINMENU files and then play another one continuously on the menu:
 
# we must be in graphics mode
graphicsmode -1 800
#first display a background (optional)
splashimage /_ISO/wallpaper.bmp
 
# first play animation
set trans=0x80 && set infinite=0x10
# play sequence 3 times immediately
set /A type=%trans% + 3 > nul
set delay=0x3 && set last=15 && set x=350 && set y=40
set FILE=/_ISO/ANIM/A_frame_01.bmp
set ANIMATE=%type%=%delay%=%last%=%x%=%y% %FILE%
# play sequence now
splashimage --animated=%ANIMATE%
 
# second animation
set delay=0x5 && set last=12 && set x=650 && set y=400
set FILE=/_ISO/ANIM/B_frame_01.bmp
set ANIMATE=%type%=%delay%=%last%=%x%=%y% %FILE%
# play sequence now
splashimage --animated=%ANIMATE%
 
# setup ANIMATE for Menu from a floppy disk image
set ANIMFD3=/_ISO/docs/Templates/Animate/E2B_GIF.ima
set ANIMATE=0x90=3=9=650=40 (fd3)/frame_0001.bmp
 
# delete unwanted variables
set trans= && set infinite= && set delay= && set type= && set last= && set y= && set x= && set FILE=
 
 

How to make animated frames

We need to find or make an Animated GIF file and then de-construct it into .bmp files.
 
1. Select a static picture that you want to animate. If you want to use a transparent background in E2B, the top-left pixel should be the 'transparent' colour.
For example, if the top left pixel has an RGB value of 0xFF0000 (pure red), then all pixels of that colour will be written as 'transparent' pixels.
 
Tip: If you want to make animated text, use Microsoft Paint to make a 2-colour (black&white) .bmp file. This will create a non-dithered image with just two colours. Then re-load and re-save it as a 24-colour bmp and change the colour of the letters to whatever colour you want. This will leave a plain background which is suitable for using with transparency.
 
2. There are many web-based animated GIF makers, use Google to find one. I used Animizer.
 
Select the desired effect and choose the number of frames you want (use less than 20 if possible, max=255).
Make the .GIF file and download it.
 
3. I used IrfanView 4.41 to load the GIF file and then Options - Extract all frames to extract the frames as aaaaa-0001.bmp files (they will be in the correct format if you use IrfanView).
 
There are also many web-based sites that will convert .GIF files to a sequence of .bmp files, but you may have to rename the files because they must end in 01.bmp, 02.bmp, etc..  Some sites you may find useful for web-based extraction from a GIF file are herehere and here.
 
Tip: Many animated GIFs do not extract to the same size .bmp frames. After you extract the .bmp files, check that all frames are exactly the same dimensions or else the animation will jitter, leave remnants on the screen and won't work properly.
 
4. To reduce the size of the .bmp files and for faster loading, select all the files and then drag-and-drop them onto the \_ISO\docs\E2B Utilities\LZMA\LZMA_Encode.cmd file. This will compress all the .bmp files in one go, but will not change their file extension. if you are going to make a .ima file (recommended - see below), then don not compress the .bmp files.
 
For the fastest animation, use uncompressed .bmp files rather than .jpg files, make a floppy disk image as below and then compress the .ima file using LZMA_Encode.cmd (find it in the \_ISO\docs\E2B Utilities\LZMA folder).
 

How to make a floppy disk image

To make a floppy disk image containing the graphics frames, you can use WinImage or ImDisk.
Once you have made the .IMA image file, you can compress the .IMA file using LZMA_Encode.
 

WinImage (max 2.88MB)

1. Download and install WinImage
 
2. Click on File - New and choose a suitable size for the disk (max 2.88MB)
Choose a size just large enough to hold all the images.
 
3. Drag-and-drop the bitmaps onto the window
 
4. Save the file
 
 

ImDisk (for images larger than 2.88MB)

 
ImDisk is slightly more difficult to use, but you can make a floppy image of any size (small or large).
 
1. Install ImDisk (if not already installed)
 
2. Run ImDisk Virtual Disk Driver from the Start Menu - Programs menu (or click on it in the Windows - Control Panel) and choose Mount New...
 
3. Specify the filename and size of floppy image, etc. (see screenshot) and Format the new volume (Windows will pop-up a Format dialogue box for you).
 
4. Copy the bitmap files onto the new virtual drive (e.g. I:)
 
5. Select the Drive\Image in the ImDisk Control panel and click on Remove.
 
Compress the .ima file using LZMA_Encode.