(******************************************************************************
*                                DITH11  .DEF                                 *
*                              ABO Software Dep.                              *
*                                                                             *
* Purpose : To provide simple routines for doing colour dithering.            *
*                                                                             *
*   Notes :                                                                   *
*                                                                             *
*         Version Date : 03/12/96                                             *
******************************************************************************)
DEFINITION MODULE DITH1;

FROM COLORI1 IMPORT ColorRGB;

TYPE
  Index    = SHORTCARD;
  LPattern = ARRAY [0..7] OF Index;
  FPattern = ARRAY [0..7] OF LPattern;
  DitherV  = ARRAY [0..7] OF SHORTCARD;
  DitherM  = ARRAY [0..7] OF DitherV;

CONST
  dither= DitherM(
    DitherV( 1,33, 9,41, 3,35,11,43),
    DitherV(49,17,57,25,51,19,59,27),
    DitherV(13,45, 5,37,15,47, 7,39),
    DitherV(61,29,53,21,63,31,55,23),
    DitherV( 4,36,12,44, 2,34,10,42),
    DitherV(52,20,60,28,50,18,58,26),
    DitherV(16,48, 8,40,14,46, 6,38),
    DitherV(64,32,56,24,62,30,54,22));


PROCEDURE genLIndex(rgb   :ColorRGB):Index;
PROCEDURE genLColor(i     :Index   ):ColorRGB;
PROCEDURE ditherLIndex(rgb :ColorRGB;x,y :INTEGER):Index;
PROCEDURE ditherLLine (rgb :ColorRGB;y   :INTEGER):LPattern;
PROCEDURE ditherLFill (rgb :ColorRGB             ):FPattern;

PROCEDURE genMIndex(rgb   :ColorRGB):Index;
PROCEDURE genMColor(i     :Index   ):ColorRGB;
PROCEDURE ditherMIndex(rgb :ColorRGB;x,y :INTEGER):Index;
PROCEDURE ditherMLine (rgb :ColorRGB;y   :INTEGER):LPattern;
PROCEDURE ditherMFill (rgb :ColorRGB             ):FPattern;

END DITH1.
