Example #1
0
void LoadImages(char *FileName)
{
    ILuint Image, i;

    hDC = GetDC(HWnd);
    hMemDC = CreateCompatibleDC(hDC);

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

    ilEnable(IL_ORIGIN_SET);
    ilEnable(IL_FORMAT_SET);
    ilOriginFunc(IL_ORIGIN_LOWER_LEFT);
    //ilFormatFunc(IL_BGRA);
    ilConvertImage(IL_BGR, IL_UNSIGNED_BYTE);
    ilutRenderer(ILUT_WIN32);

    CurImage = 0;
    NumImages = ilGetInteger(IL_NUM_IMAGES) + 1;
    Bitmaps = new HBITMAP[NumImages];
    BmpInfo = new BITMAPINFOHEADER[NumImages];
    Durations = new ILuint[NumImages];
    if (Bitmaps == NULL || BmpInfo == NULL || Durations == NULL) {
        ilDeleteImages(1, &Image);
        return;
    }

    for (i = 0; i < NumImages; i++) {
        ilActiveImage(0);
        ilActiveImage(i);
        Durations[i] = ilGetInteger(IL_IMAGE_DURATION);
        *(Bitmaps + i) = ilutConvertToHBitmap(hDC);
        ilutGetBmpInfo((BITMAPINFO*)(BmpInfo + i));
    }

    SelectObject(hMemDC, Bitmaps[0]);

    ilDeleteImages(1, &Image);

    sprintf(NewTitle, "%s - %s", TITLE, FileName);
    SetWindowText(HWnd, NewTitle);

    QueryPerformanceFrequency((LARGE_INTEGER*)&TimerFreq);
    TimerRes = 1.0 / TimerFreq;
    QueryPerformanceCounter((LARGE_INTEGER*)&StartTime);

    return;
}
Example #2
0
void CreateGDI()
{
	ILuint CopyName, CurName, CurImg, CurMip;

	hDC = GetDC(HWnd);
	hMemDC = CreateCompatibleDC(hDC);
	CurName = ilGetInteger(IL_CUR_IMAGE);
	CurImg = ilGetInteger(IL_ACTIVE_IMAGE);
	CurMip = ilGetInteger(IL_ACTIVE_MIPMAP);
	CopyName = ilCloneCurImage();
	ilBindImage(CopyName);
	//ilConvertImage(IL_BGR, IL_UNSIGNED_BYTE);
	hBitmap = ilutConvertToHBitmap(hDC);
	ilutGetBmpInfo((BITMAPINFO*)&BmpInfo);
	DeleteObject(SelectObject(hMemDC, hBitmap));
	ilBindImage(CurName);
	if (CurImg)
		ilActiveImage(CurImg);//ilBindImage(Undos[0]);
	if (CurMip)
		ilActiveMipmap(CurMip);
	ilDeleteImages(1, &CopyName);

	return;
}
void ilWin32::GetInfo(ilImage &Image, BITMAPINFO *Info)
{
	Image.Bind();
	ilutGetBmpInfo(Info);
	return;
}