File: colormap.sl

package info (click to toggle)
slang2 2.3.3-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 11,488 kB
  • sloc: ansic: 101,756; sh: 3,435; makefile: 1,046; pascal: 440
file content (18 lines) | stat: -rw-r--r-- 478 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require ("png");
define slsh_main ()
{
   variable image_row = [0:255];
   variable gray_img = UChar_Type[32,256];
   variable i;
   _for i (0, 31, 1) gray_img[i,*] = image_row;

   variable cmaps = png_get_colormap_names ();
   variable n = length (cmaps);
   variable rgb_image = UInt32_Type [32*n, 256];
   _for i (0, n-1, 1)
     {
	variable cmap = cmaps[i];
	rgb_image[[i*32+[0:31]],*] = png_gray_to_rgb (gray_img, cmap);
     }
   png_write ("colormap.png", rgb_image);
}