The current version of the V Icon Editor will handle the native VVBM icon format, as well as XBM and XPM X Windows format files, and Windows BMP format files, so files generated by the X and Windows host platforms can be easily edited and converted to VBM format.
The V Icon Editor was originally developed as a team project for the Spring, 1996 Software Engineering class at the University of New Mexico by Philip Eckenroth, Mike Tipping, Marilee Padilla, and John Fredric Jr. Masciantoni. It has been heavily enhanced by Bruce Wampler. Although this program makes use of many V\ features, as a largely student project, the quality of the code is somewhat variable, especially in its use of objects.
The icon editor functions very much like other similar programs, and should be easy to use. This guide is not intended as a complete tutorial, but more as a brief, but complete, reference.
The V Icon Editor will usually be called viconed. It may be started with the name of a file to edit on the command line.
The interface to the V Icon Editor consists of a standard menu bar, two tool bars, a drawing canvas, and a status bar. The most common operations are supported by the tool bars (which, for the most part, duplicate menu commands). The drawing canvas shows an enlarged view of the icon as well as an actual size view of the icon. The enlarged view may be zoomed to several sizes, and displayed with or without a grid. The remainder of this guide will describe each menu command, and other features that can be invoked from the tool bars.
You draw an icon using one of three types of brushes: the normal brush, the text brush, and the copy/paste brush. The brush will draw in one of several shapes. Not all shapes work with all three brushes, but you can get some interesting effects using the text or copy/paste brush to draw a line or rectangle, for example. The normal brush also has a choice of several sizes and styles. Drawing with the left mouse button uses the foreground color, while drawing with the right mouse button selects the background color. Colors are selected with the color selection dialog.
The File menu generally includes commands needed to open, close, and manipulate icon files.
This will create a new ML> ./usr/share/doc/libv-doc/vrefman/vhtmldoc.book 0100644 0000000 0000000 00000002663 07000621427 020230 0 ustar root root #HTMLDOC 1.7 52 c:/v/doc/vrefbook.htm c:/v/doc/tutintro.htm c:/v/doc/tutgetst.htm c:/v/doc/drawing.htm c:/v/doc/vapp.htm c:/v/doc/vawinfo.htm c:/v/doc/vbglcnv.htm c:/v/doc/vbrush.htm c:/v/doc/vcanvas.htm c:/v/doc/vcpdc.htm c:/v/doc/vcmdpane.htm c:/v/doc/vcmdwin.htm c:/v/doc/vcolor.htm c:/v/doc/vdc.htm c:/v/doc/vdebug.htm c:/v/doc/vdialog.htm c:/v/doc/vfilesel.htm c:/v/doc/vfont.htm c:/v/doc/vfontsel.htm c:/v/doc/vicon.htm c:/v/doc/vmemdc.htm c:/v/doc/vmenu.htm c:/v/doc/vmodald.htm c:/v/doc/vnotice.htm c:/v/doc/vos.htm c:/v/doc/vpane.htm c:/v/doc/vpen.htm c:/v/doc/vprintdc.htm c:/v/doc/vprinter.htm c:/v/doc/vreply.htm c:/v/doc/vslist.htm c:/v/doc/vstatus.htm c:/v/doc/vtextcnv.htm c:/v/doc/vtexted.htm c:/v/doc/vtimer.htm c:/v/doc/vwindow.htm c:/v/doc/vutil.htm c:/v/doc/vynreply.htm c:/v/doc/cmdattr.htm c:/v/doc/cmdobj.htm c:/v/doc/commands.htm c:/v/doc/stdvals.htm c:/v/doc/vkeys.htm c:/v/doc/miscutil.htm c:/v/doc/vappgen.htm c:/v/doc/viconed.htm c:/v/doc/vide.htm c:/v/doc/cxxstyle.htm c:/v/doc/vclassh.htm c:/v/doc/pnotes.htm c:/v/doc/geninst.htm c:/v/doc/vlatest.htm -t pdf -f c:/v/doc/vref121.pdf --toclevels 1 --logo c:/v/doc/vguibtn.gif --title c:/v/doc/vguibtn.gif --size Universal --left 1.0in --right 0.5in --top 0.5in --bottom 0.5in --header .t. --footer h.1 --tocheader .t. --tocfooter h.i --compression=4 --jpeg=100 --fontsize 11.0 --fontspacing 1.2 --headingfont Helvetica --bodyfont Times --headfootsize 11.0 --headfootfont Helvetica ./usr/share/doc/libv-doc/vrefman/vicon.htm 0100644 0000000 0000000 00000022575 07000621427 017370 0 ustar root root
Icons may be used for simple graphical labels in dialogs, as well as for graphical command buttons in dialogs and command bars. See the sections vButton and Dialog Commands for descriptions of using icons.
Presently, V supports monochrome icons which allow an on or off state for each pixel, and color icons of either 256 or 224 colors. The format of V monochrome icons is identical to the X bitmap format. This is a packed array of unsigned characters (or bytes), with each bit representing one pixel. The size of the icon is specified separately from the icon array. The V color icon format is internally defined, and allows easy conversion to various color file formats used by X and Windows.
int height This is the height in pixels of the icon.
int width This is the width in pixels of the icon. A icon will thus require (height * width) pixels. These bits are packed into bytes, with 0's padding the final byte if needed.
int depth For monochrome icons, this will be one. For color icons, the value is either 8 (for 28 or 256 colors) or 24 (for 224 colors).
unsigned char* icon This is a pointer to the array of bytes that contain the icon. V basically uses the format defined by X (.XBM) bitmaps for monochrome bitmaps. It uses an internal format consisting of a color map followed by a one byte per pixel color icon description, or a three bytes per pixel color icon description.
The easiest way to define an icon is to include the definition of it in your code (either directly or by an #include). You then provide the address of the icon data plus its height and width to the initializer of the vIcon object.
The V distribution includes a simple icon editor that can be used to create and edit icons in standard .vbm format, as well as several other formats. You can also generate monochrome icons is with the X bitmap utility. That program allows you to draw a bitmap, and then save the definition as C code. This code can be included directly in your code and used in the initialization of the vIcon object. If you follow the example, you should be able to modify and play with your icons very easily.
A simple converter that converts a Windows .bmp format file to a V .vbm V bitmap format is also included in the standard V distribution. There are many utilities that let you generate .bmp files on both Windows and X, so this tool easily lets you add color icons of arbitrary size. Chapter 9 has more details on bmp2vbm.
The standard V distribution also contains a directory (v/icons) with quite a few sample icons suitable for using in a command bar.
Once you have a .vbm file, the easiest way to add an icon to your program is to include code similar to this in your source:
#include "bruce.vbm" // Picture of Bruce
static vIcon bruceIcon(&bruce_bits[0], bruce_height,
bruce_width,8);
The following sections describe the format of the
unsigned char* icon data for 1, 8, and 24 bit
V icons.
Icon definitions are packed into bytes. A bit value of 1 represents Black, a 0 is White. The bytes are arranged by rows, starting with the top row, with the bytes padded with leading zeros to come out to whole bytes. The bytes are scanned in ascending order (icon[0], icon[1], etc.). Within bytes, the bits are scanned from LSB to MSB. A 12 bit row with the pattern BBBWWBBWBWBW would be represented as unsigned char row[ ] = { 0x67, 0x05 };. This is the format produced by the X bitmap program.
Eight bit icons support 256 colors. Each pixel of the icon is represented by one byte. Bytes are arranged in row order, starting with the top row. Each byte represents an index into a color map. The color map consists of RGB byte entries. While an 8 bit icon can only have 256 colors, it can map into 224 possible colors. Thus, each 8 bit icon must also include the color map as part of its data. The very first byte of the icon data is the number of entries in the color map minus one1 (you don't have to define all 256 colors), followed by the color map RGB bytes, followed by the icon pixels. The following is a very simple example of an icon:
//vbm8
#define color_width 16
#define color_height 12
#define color_depth 8
static unsigned char color_bits[] = {
2, // 3 colors in color map (2 == 3-1)
255,0,0, // byte value 0 maps to red
0,255,0, // 1 -> green
0,0,255, // 2 -> blue
// Now, the pixels: an rgb "flag", 3 16x4 rows
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // RRRRRRRRRRRRRRRR
0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0, // RRRRRRRRRRBBBBBR
0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0, // RRRRRRRRRRBBBBBR
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, // RRRRRRRRRRRRRRRR
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // GGGGGGGGGGGGGGGG
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // GGGGGGGGGGGGGGGG
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // GGGGGGGGGGGGGGGG
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // GGGGGGGGGGGGGGGG
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // BBBBBBBBBBBBBBBB
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // BBBBBBBBBBBBBBBB
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, // BBBBBBBBBBBBBBBB
2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 // BBBBBBBBBBBBBBBB
};
static vIcon colo