home *** CD-ROM | disk | FTP | other *** search
- Image2C 1.2
- Copyright © 1994,1995 Udo Schuermann
- All rights reserved
-
- This program converts an image in an IFF FORM ILBM to a 'C' struct Image
- structure which you can use as part of your C programming projects. The
- program is not intended (in its present form) for creation of sprites or
- raw bitplane data, although you are welcome to improve it. If you do, I
- would much appreciate if you sent me the revised code!
-
- Image2C accomplishes a number of things which I have time and again found
- to be important to me, but have somehow not found in quite the right form
- elsewhere:
-
- 1. You get to specify your own "key" string on the command line by which
- the source code's identifiers are prefixed. The program does not make
- any "guesses." Whatever you specify is added as a prefix, and nothing
- else. You can specify a null string, such as "" whereby no prefix is
- added.
-
- 2. You get to specify exactly what you want included in the file. You can
- also include everything and have the program add #ifdef/#endif around
- the sections so you can define LATER what you want to actually use
- without having to reconvert the image.
-
- 3. The program uses the iffparse.library as part of a demonstration of
- how to extract image information. It was my goal to learn how to do
- this properly, especially since CITAS 2.0 failed to properly handle
- 6-bitplane images (this was the ultimate reason why I wrote Image2'C')
-
- 4. Image2C adds the __chip identifier automatically, unless you specify
- the NOCHIP flag. This permits you to store image data in Fast RAM,
- and use some pen-remapping functions to recolor the image; the new
- image would then end up in Chip RAM without having the original waste
- space there.
-
- 5. The information is nicely and intelligently formatted. No mess! :-)
- It should, therefore, be easy to understand (i.e. makes a good learning
- tool) and, depending on your own skill, easy to modify, too!
-
- In its simplest form, Image2C could be used as part of a Makefile in the
- following manner:
-
- ---------------------------------------------------------------------------
- MyImages.o: Image1.c Image2.c Image3.c Image4.c\
- Image5.c Image6.c Image7.c\
- MyImages.c
- sc MyImages.c
-
- Image1.c: Image1.IFF
- i2c Image1.IFF Image1_ >Image1.c
-
- Image2.c: Image2.IFF
- i2c Image2.IFF Image2_ >Image2.c
-
- Image3.c: Image3.IFF
- i2c Image3.IFF Image3_ >Image3.c
- ...etc.
- ---------------------------------------------------------------------------
-
-
- Your file MyImages.c could be something as simple as this:
-
- ---------------------------------------------------------------------------
- #include "MyImage1.c"
- #include "MyImage2.c"
- #include "MyImage3.c"
- ...etc.
- ---------------------------------------------------------------------------
-
-
- Now you can modify your .IFF files to your heart's content and each time
- you run 'smake' (or make) all altered .IFF files will be reconverted to .c
- files with unique "ImageX_" prefixes in their headers.
-
-
- The program uses the following CLI template. I am parsing this on my own,
- without help from the system's own libraries (so shoot me!)
-
- ILBMFILE/A,SYMPREFIX/A,NOINFO/S,NOPENS/S,NODATA/S,NOIMAGESTRUCT/S,
- NORGB4/S,USEIFDEFS/S,NOCHIP/S
-
- ILBMFILE/A Must always be given. This is the IFF ILBM input
- file to be converted. I2C supports images up to
- 8 bitplanes deep (actually, any bitplane oriented
- ILBM)
-
- SYMPREFIX/A Must always be given. The symbol prefix for this
- image file. This forms the prefix to all symbols
- in the file.
- Example: A prefix of "myImage_" will generate
- symbols such as "UWORD myImage_ImageData[]"
-
- NOINFO/S This switch will cause image information, such
- such as height, width, depth, number of colors
- to be omitted. See also NOIMAGESTRUCT below!
-
- NOPENS/S This switch will cause pens (used by LoadRGB32()
- for example) to be omitted.
-
- NODATA/S This switch will cause the actual image data to
- be omitted. See also NOIMAGESTRUCT below!
-
- NOIMAGESTRUCT/S This switch will cause a "struct Image ..." item
- to be omitted. This item requires the presence
- of INFO and DATA items; if you specify that either
- or both of those should not be included (NOINFO
- and/or NODATA) but you do not also specify the
- NOIMAGESTRUCT, then I2C will reverse your decision
- on NOINFO and/or NODATA so that the Image struct
- can be built.
-
- ADDRGB4/S This switch will cause register color values to
- be added. Such values are 12-bit only and are
- probably of use only for older software. It is
- for this reason that this is the only switch that
- needs to be specified to add something to the
- code; i.e. if not specified you will NOT get the
- information for this item.
-
- USEIFDEFS/S This switch encloses the INFO, PENS, DATA, IMG,
- and RGB4 sections with #ifdef/#endif constructs
- to allow you to build a source file with ALL
- information, but decide at a later time which
- portions the compiler should include or ignore.
- Use of this switch enables an additional level
- of flexibility, which you may or may not find
- of use.
-
- The following #define statements used BEFORE you
- #include the source code generated by I2C will
- tell the compiler which portions of the file to
- use and which to ignore:
-
- #define I2C_IMAGE_INFO Accept image info
- #define I2C_IMAGE_PENS Accept RGB32 pens
- #define I2C_IMAGE_RGB4 Accept 4-bit pens
- #define I2C_IMAGE_DATA Accept image data
- #define I2C_IMAGE_IMG Accept struct Image
-
- NOCHIP/S Omit the __chip attribute on structures. This may
- be desirable if you are going to remap image colors
- anyway and won't be needing the original in chip
- RAM.
-
- If you are not clear on some of the points described above, you are hereby
- STRONGLY advised to run the program on a test image and see what the
- resulting output file contains. Try this:
-
- I2C TestImage.IFF MyTest_ USEIFDEFS
-
- Some limitations:
-
- · Image2C does not support optimization to eliminate bit planes of all
- 1's or all 0's.
-
- Cheers!
-
- ._. Udo Schuermann
- ( ) walrus@wam.umd.edu
-