File: graph.cpp

package info (click to toggle)
dgen 1.23-7
  • links: PTS
  • area: non-free
  • in suites: sarge
  • size: 2,168 kB
  • ctags: 3,086
  • sloc: ansic: 45,404; cpp: 4,405; sh: 1,960; makefile: 116
file content (24 lines) | stat: -rw-r--r-- 463 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// DGen v1.13+
#include <stdio.h>
#include "md.h"

// This allows you to get the palette, mess around with it
// (e.g. contrast/brightness)
// and then pass it back
int get_md_palette(unsigned char pal[256],unsigned char *cram)
{
  int c;
  if (pal==NULL) return 1;
  for (c=0;c<64;c++)
  {
    int r,g,b;
    b=(cram[c*2+0]&0x0e)<<4;
    g=(cram[c*2+1]&0xe0);
    r=(cram[c*2+1]&0x0e)<<4;

    pal[c*4+0]=r;
    pal[c*4+1]=g;
    pal[c*4+2]=b;
  }
  return 0;
}