| purpose: Create a .BMP file containing a sequence of images |
| |
| command: &builder &this |
| build-now |
| |
| \ This script merges several individual .BMP files into a single |
| \ multi-plane .BMP file. It is assumed that the individual .BMP |
| \ files all have the same pixel dimensions and use the same color |
| \ lookup table, because the merged file contains only one copy of |
| \ the dimension information and one copy of the color lookup table. |
| |
| \ The primary use of this is for a series of related images, such |
| \ as a sequence of partial images of a logo, to be displayed one |
| \ after another in the same position on the screen to show the |
| \ progress of some process. |
| |
| \ Merging the files in this way saves ROM space, because the merged |
| \ file compresses quite efficiently as a result of the similarity |
| \ of the individual images. It also saves time in displaying the |
| \ images, and saves complexity in color lookup table entry allocation, |
| \ since the color lookup table need only be processed once. |
| |
| fload ${BP}/ofw/gui/bmptoico.fth |
| |
| : put-image ( adr w h clut #colors color# -- ) |
| free-clut ( adr w h ) |
| 3dup write-image free-image ( ) |
| ; |
| |
| writing logos.bmp \ Output file |
| |
| open-bmp ${BP}/ofw/linux/logom16y.bmp ( adr w h clut #colors color# ) |
| |
| \ Create the .BMP header based on the dimensions and color lookup |
| \ table from the first file. |
| write-header ( adr w h clut #colors color# ) |
| 3dup write-clut free-clut ( adr w h ) |
| |
| \ Write the image data for the first file |
| 3dup write-image free-image ( ) |
| |
| \ Write the image data for the other files |
| open-bmp ${BP}/ofw/linux/logom16b.bmp put-image |
| open-bmp ${BP}/ofw/linux/logom16l.bmp put-image |
| open-bmp ${BP}/ofw/linux/logom16r.bmp put-image |
| open-bmp ${BP}/ofw/linux/logom16.bmp put-image |
| |
| \ Fix header to account for the additional file |
| 2 ofd @ fseek ofd @ fsize putl ( ) \ Fix file size field |
| h# 1a ofd @ fseek 5 putw ( ) \ Fix #planes field |
| |
| ofd @ fclose |