henesyinit from p9f47575dc5 years agoHistory
37 lines · 698 B · C
RawDownload
#include <u.h>#include <libc.h>#include <libg.h> /* * This code (and the devbit interface) will have to change * if we ever get bitmaps with ldepth > 3, because the * colormap will have to be read in chunks */ voidrdcolmap(Bitmap *b, RGB *m){	uchar *buf, *p;	uchar ans[256*12];	int i, n; 	bneed(0);	buf = bneed(3);	buf[0] = 'm';	BPSHORT(buf+1, b->id);	n = 1<<(1<<b->ldepth);	if(n > 256)		berror("rdcolmap bitmap too deep");	if(!bwrite())		berror("bad bitmap for colormap read");	if(read(bitbltfd, ans, 12*n) != 12*n)		berror("rdcolmap read");	p = ans;	for(i = 0; i < n; i++){		m->red = BGLONG(p);		m->green = BGLONG(p+4);		m->blue = BGLONG(p+8);		m++;		p += 12;	}}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t