Exemplo n.º 1
0
void main(){
startgraph();
palette(0,32,16,8);
getpal(0,r,g,b);
printf("%i %i %i",*r,*g,*b);
getch();
}
Exemplo n.º 2
0
/*
 * Extract bmp pallet only
 *   data: raw data (pointer to data top)
 *   return: extracted pallet data
*/
cgdata *bmp_getpal(BYTE *data) {
	cgdata *cg = g_new0(cgdata, 1);
	bmp_header *bmp = extract_header(data);
	
	cg->pal = g_new(Pallet256, 1);
	getpal(cg->pal, data + bmp->bmpPp);
	
	cg->type  = ALCG_BMP8;
	cg->pic   = NULL;
	cg->alpha = NULL;
	
	g_free(bmp);
	
	return cg;
}
Exemplo n.º 3
0
/*
 * Extract 8bit bmp, header, pallet and pixel
 *   data: raw data (pointer to data top)
 *   return: extracted image data and information
*/
cgdata *bmp256_extract(BYTE *data) {
	bmp_header *bmp = extract_header(data);
	cgdata *cg = g_new0(cgdata, 1);
	
	cg->pal = g_new(Pallet256, 1);
	getpal(cg->pal, data + bmp->bmpPp);
	
	/* +10: margin for broken cg */
	cg->pic = g_new(BYTE, (bmp->bmpXW + 10) * (bmp->bmpYW + 10));
	extract_8bit(bmp, cg->pic, data + bmp->bmpDp);
	
	cg->type = ALCG_BMP8;
	cg->x = 0;
	cg->y = 0;
	cg->width  = bmp->bmpXW;
	cg->height = bmp->bmpYW;
	cg->alpha  = NULL;
	
	g_free(bmp);
	
	return cg;
}