TIP: Click on subject to list as thread! ANSI
echo: cis.os9.68000.osk
to: Kevin Darling 76703,4227 (X)
from: LARRY OLSON 72227,3467
date: 1992-08-29 12:37:49
subject: source_part 1

#: 16334 S12/OS9/68000 (OSK)
    29-Aug-92  12:37:49
Sb: source_part 1
Fm: LARRY OLSON 72227,3467
To: Kevin Darling 76703,4227 (X)

 
           /* p_dis4.c */

           /* a program to display palette info */

#include 

#define STDIN  0
#define STDOUT 1
#define STDERR 2

main()
{
   int path = STDOUT;                              /* stdout */
   int x, y;
   int f_col, b_col;
   int curx, cury;

   int numofpals = 1;          /* read 1 palette at a time      */
   int palnum;
   int clutoffset;
   unsigned char palbuf[48];   /* this should only need to be 3 */
                               /* but 3 doesn't work, 6 or more works ? */
                               /* I should only be getting 3 bytes back */
                               /* from _gs_palette */


   f_col = 15;
   b_col = 0;
   x = 168;
   y = 56;
   curx = 10;
   cury = 5;

   DefColr(path);                          /* reset all palettes to default */

   Palette(path, 10 * 3, 210, 105, 30);    /* palette register 10 (*3) */

   FColor(path, f_col);
   BColor(path, b_col);
   Clear(path);
   CurXY(path, curx, cury);
   printf("Palette #       R    G    B \n");

   curx = 17;
   cury = 7;

   for ( palnum = 0; palnum < 16; palnum++ ) {
       f_col = palnum;
       if ( f_col == b_col )
           f_col = 15;

       CurXY(path, curx, cury);
       FColor(path, f_col);
       printf("%2d\n", palnum);
       fbox(path, x, y, palnum, b_col);

       FColor(path, f_col);
       clutoffset = palnum * 3;
       _gs_palette(path, clutoffset, palbuf, numofpals );
       CurXY(path, curx + 7, cury);
       printf("%3d  %3d  %3d\n", palbuf[0], palbuf[1], palbuf[2] );

       y = y + 8;
       cury = cury + 1;
   }

   exit(0);
}

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.