home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / oslib / Examples / p1-110 < prev    next >
Encoding:
Text File  |  1994-05-16  |  630 b   |  28 lines

  1. #include "os.h"
  2. #include "osword.h"
  3.  
  4. os_error *read_palette (os_gcol gcol, int entry_type, int on, int off)
  5.  
  6. {  os_error *error = NULL;
  7.    bool incomplete;
  8.    osword_palette_block entry;
  9.  
  10.    if ((error = xpalettev_set_entry (gcol, entry_type,
  11.          on, off, &incomplete)) != NULL)
  12.       goto finish;
  13.  
  14.    if (incomplete)
  15.    {  entry.gcol = gcol;
  16.       entry.colour_number = entry_type;
  17.       entry.r = (on & os_R) >> os_RSHIFT;
  18.       entry.g = (on & os_G) >> os_GSHIFT;
  19.       entry.b = (on & os_B) >> os_BSHIFT;
  20.  
  21.       if ((error = xosword_write_palette (&entry)) != NULL)
  22.          goto finish;
  23.    }
  24.  
  25. finish:
  26.    return error;
  27. }
  28.