# ICN and CHR sprites drawing

The unit at gr/icn.fs contains drawing logic for the ICN and CHR formats.

A ICN sprite is a 8 bytes long structure where each byte represent a row in a
8x8 tile. The most significant bit is the leftmost pixel. For example, a ICN
sprite with a dot in its upper left corner and one in its lower right one would
be:

  create example 8 nc, $80 $00 $00 $00 $00 $00 $00 $01

A CHR sprite is a ICN with an extra 8 byte channel appended, allowing 4 colors:

  create example 8 nc, $80 $00 $00 $00 $00 $00 $00 $01
                       $01 $00 $00 $00 $00 $00 $00 $81

In this second example, top left corner has color 1, top right and bottom left
have color 2 and bottom right corner has color 3.

## API

drawicn ( color0 color1 sprite -- )
  Draw sprite pixels to the [gr/pix] destination. "color0" will be drawn when
  bits are unset, "color1" when bits are set. Colors must be in pixbuf color
  encoding.

  "sprite" is the address of a 8 bytes ICN sprite.

  This word takes care of setting [gr/pix] source parameters, you only need to
  call "pixdst!" yourself.

drawicnt ( color1 sprite -- )
  Draw sprite with color0 being "transparent", that is, we "skip" the pixel
  instead of drawing it.

drawchr ( color0 color1 color2 color3 sprite -- )
  Draw the CHR sprite "sprite".

drawchrt ( color1 color2 color3 sprite -- )
  Draw the CHR sprite "sprite" with color0 being transparent.
