Using Tools: 16 cvtpcx

Up: GEOS SDK TechDocs | Up | Prev: 15 dumpgeo | Next: 17 pvm

cvtpcx.exe is an application that converts PCX graphics files to the GEOS icon format, either as a .ui or a .goh file. There are two kinds of possible conversions. The PCX file may be converted to a single icon resource. Or the PCX file may contain the same icon image in a variety of different formats arranged in a predefined grid arrangement. The cvtpcx utility will convert each of these formats into its own icon resource within a single .goh or .ui file. For more information, refer to the bottom of this document.

The source PCX file may have at most a 16-color (4 bit) color lookup table. Use a program like Paint Shop Pro to reduce the number of colors to 2-16 colors and save it in PCX format.

The syntax for cvtpcx is

     cvtpcx <options> <filename> 
If no <options> are specified, then this utility will convert the PCX file <filename> to single GEOS icon in a file called "mkr.ui" and display information about the icon.


<options> for either single icons or icons in a grid

These options specify the parameters for converting and saving the icon file.

-o<filename>
The file name for the moniker(s).
-G
Produce .goh output instead of .ui.
-g
Do not put resulting bitmaps in gstrings. The bitmap is still in a chunk, but no gstring opcodes surround it.
-j
Only output the gstring (don't create a moniker or put the gstring in a chunk)
-2
Use 2.0 constants in the resulting gstring/bitmap.
-f
Uses GrFillBitmap instead of GrDrawBitmap for all monochrome bitmaps. Also implies the use of 2.0 constants, since this will not work prior to version 2.0 as GrFillBitmap didn't exist.
-t
Cause the bitmap to be drawn relative to the current pen position if the program decides to optimize the moniker by drawing the bitmap somewhere other than 0,0. All monikers destined for the token database should be created with this flag.
-m<pixel>
Pixel to be masked out. Any pixel containing the color <pixel> (a decimal number) will be given a 0 bit in the mask for the color bitmap. Defaults to none.
-u
Insist the resulting bitmaps remain uncompacted. By default, cvtpcx will determine if it's worthwhile and automatically compact each bitmap for you.

Converting single icons:

A rectangle of the PCX image plane is converted into a single GEOS icon. The resulting file will have no start/end resource directives. The possible options include:

-n<filename>
Name the moniker "<filename>Moniker"
-N
map the colors to the indices for the Nokia device.
-w <width>
width to make GEOS icon bitmap. The input will be trimmed or extended (but masked) as necessary to accommodate this. Defaults to Standard size (48)
-h<height>
height to make GEOS icon bitmap. The input will be trimmed or extended (masked) as necessary to accommodate this. Defaults to Standard size (30)
-S<style>
<style> is one of the defined moniker styles: text, abbrevText, graphicText, icon, or tool. It defaults to icon. (The "-S" option is only for 2.0 and above.)
-s<size>
<size> is one of the defined moniker sizes: large, standard, or tiny. It defaults to standard.
-a<aspect>
<aspect> is one of the defined aspectRatio values: normal (vga), squished (ega) or verySquished (cga). Defaults to squished.
-b<aspect>
Forces creation of a single bitplane (B&W) icon, even if the source is 16 colors. Any pixel that isn't black (pixel 0) is set to 0 in the resulting bitmap. Black pixels are, of course, set to 1.
-B
Similar to -b, but any pixel that isn't white (pixel 15) or the mask (set by "-m") is set to 1.

Icons in a grid:

A grid is a sequence of the same icon in a variety of formats which are laid out from the left to the right. These formats share a common top edge, have a one pixel margin between icons, and a one pixel margin around the grid as a whole. There are 11 formats and three predefined grids.

The 11 predefined icon formats are:
Abbr Color Aspect Size Style Width Height
LC 4-bit normal large icon 64 40
LM Mono normal large icon 64 40
SC 4-bit normal standard icon 48 30
SM mono normal standard icon 48 30
LCGA Mono verySquished large icon 64 18
SCGA Mono verySquished tiny icon 48 14
YC 4-bit normal tiny icon 32 20
YM Mono normal tiny icon 32 20
TC 4-bit normal tiny tool 15 15
TM Mono normal tiny tool 15 15
TCGA Mono verySquished tiny tool 15 10

The three grid layouts are:

Grid Flag Formats within Grid
-l LC, LM, SC, SM, LCGA, SCGA
-L LC, LM, SC, SM, LCGA, SCGA, YC, YM, TM, TCGA (the YC and YM icons are used for application icons on handheld devices, while the TM and TCGA icons are used for the Presentation Manager system menu)
-z TC, TM, TCGA

When the cvtpcx utility converts a grid to a GEOS icon resource file, it creates one file which contains a series of monikers which correspond to the formats in the grid. For example, a PCX file which is a -l grid will be converted to a GEOS header file which has a moniker with a LC format, followed by a moniker in a LM format, followed by a moniker in a SC format... etc. Each moniker is created with its own start/end resource directives.

The following options modify where in the PCX image plane the grid starts, how to name the monikers, which formats to not use, and how the GEOS file will be created.

-x<xoffset>
Specifies the left edge of the grid in the PCX image plane (the X coordinate of the 1-pixel margin to the left of the left-most icon in the grid.)
-y<yoffset>
Specifies the top edge of the grid (the Y coordinate of the 1-pixel margin to the top of the top- most icon in the grid.)
-n<moniker name>
Allows specifying the core name to give the moniker. The name for each moniker in a grid is formed as:
<moniker name><format abbrev>Moniker
For instance -nHello would create "HelloLCMoniker" for the leftmost icon in the "-l" grid.
-d<format(s)>
This flag indicates that the no moniker for the formats in the comma-separated list <format(s)> should be created for that grid.
-r<resource>
Specifies the string (other than the default "App") to begin the name of each resource. The resource names are of the form
<resource><format abbrev>MonikerResource.
The resource name is all uppercase for GOC output.
-R
Don't put out resource start/end directives; just produce the monikers, one after another.

Examples of cvtpcx:

The following converts the single icon "old_icon.pcx" to a .goh icon called "test.goh." The options for this icon specify that this icon uses GEOS 2.0 constants, is defined with GrFillBitmap(), uses Nokia colors, and will be drawn relative to the pen's location.

         cvtpcx -2 -f -t -N -G -otest.goh old_icon.pcx
The following converts the grid "grid_icon.pcx" in the -l grid arrangement into a .goh file with monikers for all the formats in a -l grid, with the exception of the LC format. The "-m11" option specifies that yellow pixels (those with the color 11) will be masked out. The output has the name "mkrconverted_grid_icon.goh".
        cvtpcx -l -2 -f -t -g -G -dLC -m11 -nconverted_grid_icon grid_icon.pcx

Up: GEOS SDK TechDocs | Up | Prev: 15 dumpgeo | Next: 17 pvm