Эксперт
Покинул форум
Сообщений всего: 4465
Дата рег-ции: Нояб. 2017
Репутация: 585
|
Картинку сохранить и закинуть в папку с кибор.
http://a.radikal.ru/a22/2104/cb/c41da5b5fe4f.gif
code (Отобразить)CODE:#define UnitPixel 2
#define CP_ACP 0
external(INT, "MultiByteToWideChar", "MultiByteToWideChar", "Kernel32.dll");
external(INT, "GdiplusStartup", "GdiplusStartup", "Gdiplus.dll");
external(INT, "GdiplusShutdown", "GdiplusShutdown", "Gdiplus.dll");
external(INT, "GdipCreateFromHWND", "GdipCreateFromHWND", "Gdiplus.dll");
external(INT, "GdipDrawImageRectRectI", "GdipDrawImageRectRectI", "Gdiplus.dll");
external(INT, "GdipLoadImageFromFile", "GdipLoadImageFromFile", "Gdiplus.dll");
external(INT, "GdipGetImageHeight", "GdipGetImageHeight", "Gdiplus.dll");
external(INT, "GdipGetImageWidth", "GdipGetImageWidth", "Gdiplus.dll");
external(INT, "GdipDisposeImage", "GdipDisposeImage", "Gdiplus.dll");
external(INT, "GdipImageGetFrameDimensionsList", "GdipImageGetFrameDimensionsList", "Gdiplus.dll");
external(INT, "GdipImageGetFrameCount", "GdipImageGetFrameCount", "Gdiplus.dll");
external(INT, "StringFromGUID2", "StringFromGUID2", "Ole32.dll");
external(INT, "GdipImageSelectActiveFrame", "GdipImageSelectActiveFrame", "Gdiplus.dll");
char FrameDimensionTime[16]; // GUID
writeaddress(0x6aedbd6d, address(#FrameDimensionTime[0]));
writeaddress(0x3fb5, address(#FrameDimensionTime[4]));
writeaddress(0x418a, address(#FrameDimensionTime[6]));
FrameDimensionTime[8] = 0x83;
FrameDimensionTime[9] = 0xa6;
FrameDimensionTime[10] = 0x7f;
FrameDimensionTime[11] = 0x45;
FrameDimensionTime[12] = 0x22;
FrameDimensionTime[13] = 0x9d;
FrameDimensionTime[14] = 0xc8;
FrameDimensionTime[15] = 0x72;
string path_to_gif = "c41da5b5fe4f.gif"; // путь к картинке
int Token, lnGraphics;
gdiplusstartup(#Token); // инициализация gdi+
createdialog(2);
showdialog(2, "Диалог", 200, 100, 500, 400, 1, 1);
GdipCreateFromHWND(gethwnd(2), address(#lnGraphics)); // вызывать функцию можно только когда диалог уже открыт
// переменные для картинки
int p_image, image_width, image_height;
int result = load_image(path_to_gif, #p_image, #image_width, #image_height); // загрузить картинку
if (result == 0)goto end; // если картинка не загрузилась
messagebox("Ширина изображения: "+format(image_width)+"^r^n"+"Высота: "+format(image_height));
char m_pDimensionIDs[16];
GdipImageGetFrameDimensionsList(p_image, address(#m_pDimensionIDs[0]), 1);
char strGuid[78];
StringFromGUID2(address(#m_pDimensionIDs[0]), address(#strGuid[0]), 39);
int m_FrameCount;
GdipImageGetFrameCount(p_image, address(#m_pDimensionIDs[0]), address(#m_FrameCount));
messagebox("Количество кадров: "+format(m_FrameCount));
loop()
{
for(int i=0; i<m_FrameCount; i++)
{
GdipImageSelectActiveFrame(p_image, address(#FrameDimensionTime[0]), i); // выбрать кадр
// нарисовать кадр
GdipDrawImageRectRectI(lnGraphics, p_image, 0, 0, image_width, image_height, 0, 0, image_width, image_height, UnitPixel, 0, 0, 0);
sleep(20); // пауза между рисованием кадров
}
}
end:;
GdiplusShutdown(Token);
function getmessage(2, WM_CLOSE)
{
GdipDisposeImage(p_image);
goto global end;
}
function load_image(string path_to_image, int #h_image, int #image_width, int #image_height)
{
char wchar[999];
initialarray(#wchar[0], 0);
MultiByteToWideChar(CP_ACP, 0, path_to_image, size(path_to_image), address(#wchar[0]), sizearray(wchar));
if(GdipLoadImageFromFile(address(#wchar[0]), address(#h_image))!=0)
{
messagebox("Error load_image");
return 0;
}
GdipGetImageWidth(h_image, address(#image_width));
GdipGetImageHeight(h_image, address(#image_height));
return 1;
}
function gdiplusstartup(int #gdiplusToken)
{
char gdiplusStartupInput[16];
initialarray(#gdiplusStartupInput[0], 0);
writeaddress(1, address(#gdiplusStartupInput[0]));
GdiplusStartup(address(#gdiplusToken), address(#gdiplusStartupInput[0]), 0);
} |