FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

DRAWING

Customize icons


Icons, of all depths, are dumb simple. They are just a raw dump of pixel data. So an icl8, a 32x32x8 icon, has the simple format of 32 bytes per row times 32 rows equals 1024 bytes. And an icl4 has 16 bytes per row (4 bits per pixel) times 32 rows equals 512 bytes. (The system clut is assumed for both.)
What you need to do is get the GWorld's pixmap (FN GETGWORLDPIXMAP, natch) then lock its pixels (with FN LOCKPIXELS) then look up the address of the pixmap data (FN GETPIXBASEADDR).
Now copy (using BLOCKMOVE or whatever) the data from the pixmap into the handle you will use as your icon resource.
An ICN# resource is a little trickier. One black and white icon is 4 bytes times 32 rows, which equals 128 bytes. But an ICN# has TWO such icons. So the entire ICN# resource is 256 bytes long. The first icon is the icon itself. The second icon is a mask: black mask pixels mean "opaque", and white mask pixels mean "transparent". But you can still use BLOCKMOVEDATA to copy the data into the ICN# resource. Think of it as one single 32 by 64 pixmap.

Mars