No bugs!TwoHeaded Software

Tools Documentation

Objective 1.12

Objective is a tool which converts frames of graphics to OBJs for use on the GBA. Large frames are converted into matrices of smaller-OBJs. Placement of OBJs is optimised to reduce the total number of OBJs used to define the original frame. Reported results indicate a space-saving of 40% on original data!

This tool is command-line driven, and is intended primarily for use through calls from a makefile environment. It takes graphics data (BMP, PNG, JPG) as input, and outputs a C source-file containing a packed/optimised representation of that graphics data suitable for display as OBJ metasprites on the GBA machine.

A metasprite is simply a sprite built up from a number of smaller sprites (=OBJs).

History

1.12    Header file now external, with auto-generated external for inclusion
1.11Changed char output to hex to aid in visual recognition of data
1.10changed OBJECTIVE_PALETTE to a u16 array (fixes packing problem)
1.0916-colour support added. -16 and -156 switches to select. Default 16-colour
1.08fixed the palette AGAIN! Now BGR
1.07-g switch for GCC modifications
1.06added extern "C" option, beginning 16-bit palette output
1.04added multi-frame and frametable root capability
1.03fixed Bagley problem - pal 255 transparent, 0 used in image. Bah!
1.02added -bR,G,B option for defining transparency
Suddenly 24bit images are better than pre-palettised. Sort of, anyway :)
1.01Palette to BGR ordering
1.0Initial working version

Usage

This tool is DOS command-line driven. It takes graphics data (BMP, PNG, JPG) as input, and outputs C source-code containing optimised sprite definitions.

Command Line

objective [[-switch] file ]

Items enclosed in square brackets [...] are optional, and may appear zero or more times. Switches are described below. file is a graphics file of BMP, GIF, PNG, or JPG format. Wildcards ? and * can be used in the file descriptor. All matching files are processed.
 

Command Line Switches

Switch

Function

Default

-sX[,Y]

Set the size of the OBJs used to X*X or X*Y chars (1 char = 8*8 pixels)
eg: -s1 sets OBJ size to 8x8 pixels
-s1,2 sets OBJ size to 8x16 pixels

2*2
-bR,B,G

Set the transparent colour (default is to use colour 0 of palette, whatever that is). By setting the transparent colour (8-bit Red, Green, Blue - eg: white= -b255,255,255) you are telling the tool which exact colour in the image is transparent. The utility swaps all pixels of exactly that RGB value to colour 0 (in the palettised form of the image), and if necessary swaps out colour 0 pixels to the last colour. This is only done if the colour 0 pixels are not the same colour as the transparent colour. I know this is complex; in short, preferentially use -b, as it gives exact control over which colour is transparent.

0,0,0

-16

Set the output to 16-colour sprites
Also generates 16-colour palette.

default

-256

Set the output to 256-colour sprites
Also generates 256-colour palette.

 
-cX,Y

Set the centerpoint to pixel X,Y

0, 0

-nS

Set name of data to S

Output name, less extension

-e

Export table as extern "C"

no extern C

-g

Explicitly cast structure members in OBJECTIVE_HEADER, so GCC doesn't give (incorrect) warnings during compilation

no cast

-oS

Write Output to file

Input file + .C extension

-p+

Force palette generation

256 colour palette enabled

-p

Suppress generation of palette

 
-p[N]

Generate palette with N colours

256 colours

-tN

Set threshold (pixels which may be discarded per OBJ) to N pixels

0

-HELP
or -?

Display switch/help information

 
-v

Create visual of optimisation to test.bmp

 

 

Input

Input files may be .BMP, .JPG, or .PNG format. Files are first down-converted to 8-bit format, and colour #0 is used to determine unused pixels. Any colour-depth input may be chosen, but using images already converted to your target colour depth will probably provide better result GIF file import currently does not work (due to a bug in paintlib?)

Output

The OBJs can be of user-defined size (ie: conforming to the GBA capabilities of M x N OBJ size). The C file contains palette data (BGR 5:5:5 format), data describing the number and positioning of OBJs used to define the metasprite it is defining, and a list of OBJ image data used by that metasprite.

Bugs

Sometimes you may see (some) sprites with transparent colour not correct. These are the result of having a non-transparent colour 0, and defining a transparent colour with the -b switch. There's a bug where it decides what is really transparent off the edge of the original bitmap. Solution (pending a fix)... make your source bitmap larger and center the frame data, so that the utility will not attempt to get off-frame pixels. Fix coming soon, hopefully :)

If you'd like to report one, or suggest something, then please let us know!

Cautions

Though the utility can handle images with colours > 256, these are internally converted to 256 colours before optimisation begins. Tranparent colour may be specifically defined (-b switch), and this becomes colour 0 in the converted image. Still, it is better to pre-palettise the images, and use colour 0 as your transparent colour.

Copyright

The Objective utility and documentation are Copyright ©2001 TwoHeaded Software.

The Objective executable is supplied "AS IS". TwoHeaded Software disclaims all warranties, expressed or implied, including, without limitation, the warranties of merchantability and of fitness for any purpose. The authors assume no liability for direct, indirect, incidental, special, exemplary, or consequential damages, which may result from the use of Objective, even if advised of the possibility of such damage.

In short, use at your own risk.

Paintlib

Objective uses a public-domain library for reading graphics files. This library (Paintlib) is available at http://www.paintlib.de/paintlib/, and is an excellent package. Highly recommended, and a big thanks to Ulrich.

 

Get It Here!

TwoHeaded's tools are free for non-commercial use. If you'd like to use the tool for commercial games, please email first.

There are a couple of requests and conditions of use...

a) Please do not redistribute
b) Please report bugs and suggestions!


You may need to find some additional DLL files such as MFC42.DLL

 






Home
Framage
Tumeric
Mode 7
Atari 2600

Site design & contents Copyright ©2001 TwoHeaded Software.
Please ask before using any images/HTML from this site.