Пример #1
0
BITMAP* ILAPIENTRY ilutAllegLoadImage(ILstring FileName)
{
	ILuint	ImgId;
	PALETTE	Pal;

	ilGenImages(1, &ImgId);
	ilBindImage(ImgId);
	if (!ilLoadImage(FileName)) {
		ilDeleteImages(1, &ImgId);
		return 0;
	}

	ilDeleteImages(1, &ImgId);

	return ilutConvertToAlleg(Pal);
}
Пример #2
0
int main(int argc, char *argv[])
{
  BITMAP *Image;
  PALETTE Pal;
  ILuint Id;

  if (argc != 2) {
     printf("Please specify a filename.\n");
     return 1;
  }

  ilInit();
  ilGenImages(1, &Id);
  ilBindImage(Id);
  ilLoadImage(argv[1]);

//  if (ilGetInteger(IL_IMAGE_FORMAT) == GL_BGR ||
//      ilGetInteger(IL_IMAGE_FORMAT) == GL_BGRA)
        ilSwapColours();

  Image = (BITMAP*)ilutConvertToAlleg(Pal);

  allegro_init();
  install_keyboard();
  if (ilGetInteger(IL_IMAGE_BYTES_PER_PIXEL) == 8) {
     set_color_depth(8);
     set_palette(Pal);
  }
  else
     set_color_depth(32);
  set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0);

  blit(Image, screen, 0, 0, (SCREEN_W - Image->w) / 2,
        (SCREEN_H - Image->h) / 2, Image->w, Image->h);

  destroy_bitmap(Image);

  readkey();

  return 0;
}
Пример #3
0
BITMAP *ilAlleg::Convert(ilImage &Image, PALETTE Pal)
{
	Image.Bind();
	return ilutConvertToAlleg(Pal);
}