2020-06-02 00:18:26 +02:00
|
|
|
struct _img
|
2013-12-27 00:36:17 +01:00
|
|
|
{
|
2020-06-02 00:18:26 +02:00
|
|
|
collection url;
|
2020-05-30 00:24:39 +02:00
|
|
|
collection_int xywh;
|
2020-06-02 00:18:26 +02:00
|
|
|
collection_int data;
|
|
|
|
int getid;
|
|
|
|
dword add();
|
|
|
|
void clear();
|
|
|
|
dword current_url();
|
|
|
|
bool next_url();
|
|
|
|
void set_data();
|
|
|
|
void draw();
|
2013-12-27 00:36:17 +01:00
|
|
|
};
|
2014-01-19 18:12:45 +01:00
|
|
|
|
2020-06-02 00:18:26 +02:00
|
|
|
dword _img::add(dword _path, _x, _y)
|
2013-12-27 00:36:17 +01:00
|
|
|
{
|
2020-06-02 00:18:26 +02:00
|
|
|
char full_path[URL_SIZE];
|
|
|
|
strncpy(#full_path, _path, URL_SIZE);
|
|
|
|
GetAbsoluteURL(#full_path, history.current());
|
|
|
|
|
|
|
|
url.add(#full_path);
|
|
|
|
xywh.add(_x);
|
|
|
|
xywh.add(_y);
|
|
|
|
xywh.add(0);
|
|
|
|
xywh.add(0);
|
|
|
|
return full_path;
|
|
|
|
}
|
|
|
|
|
|
|
|
void _img::clear()
|
|
|
|
{
|
|
|
|
url.drop();
|
|
|
|
xywh.drop();
|
2020-05-30 00:24:39 +02:00
|
|
|
data.drop();
|
2020-06-02 00:18:26 +02:00
|
|
|
getid = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
dword _img::current_url()
|
|
|
|
{
|
|
|
|
return url.get(getid);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool _img::next_url()
|
|
|
|
{
|
|
|
|
if (getid < url.count-1) {
|
|
|
|
getid++;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void _img::set_data(dword _data, _data_len)
|
|
|
|
{
|
|
|
|
data.set(getid, _data);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DrawLibimgImage(dword _x, _y, _data, _data_len)
|
|
|
|
{
|
|
|
|
libimg_image im;
|
|
|
|
img_decode stdcall (_data, _data_len, 0);
|
|
|
|
$or eax, eax
|
|
|
|
$jz __ERROR__
|
|
|
|
|
|
|
|
im.image = EAX;
|
|
|
|
im.set_vars();
|
|
|
|
im.draw(_x, _y, im.w, im.h, 0, 0);
|
|
|
|
__ERROR__:
|
|
|
|
}
|
|
|
|
|
|
|
|
void _img::draw(int _x, _y, _start, _height)
|
|
|
|
{
|
|
|
|
int i, img_x, img_y;
|
|
|
|
|
|
|
|
for (i=0; i<url.count; i++)
|
|
|
|
{
|
|
|
|
img_x = xywh.get(i*4);
|
|
|
|
img_y = xywh.get(i*4 + 1);
|
|
|
|
|
|
|
|
if (img_y > _start) && (img_y < _start + _height)
|
|
|
|
{
|
|
|
|
if (cache.has(url.get(i)))
|
|
|
|
DrawLibimgImage(img_x + _x, img_y-_start + _y, cache.current_buf, cache.current_size);
|
|
|
|
}
|
|
|
|
}
|
2013-12-27 00:36:17 +01:00
|
|
|
}
|
|
|
|
|
2020-05-30 00:31:32 +02:00
|
|
|
/*
|
2013-12-27 00:36:17 +01:00
|
|
|
|
2016-12-21 11:56:06 +01:00
|
|
|
void ImageCache::Images(dword left1, top1, width1)
|
2013-12-27 00:36:17 +01:00
|
|
|
{
|
|
|
|
dword image;
|
2016-12-21 11:56:06 +01:00
|
|
|
dword imgw=0, imgh=0, img_lines_first=0, cur_pic=0;
|
2013-12-27 00:36:17 +01:00
|
|
|
|
2020-03-21 15:33:54 +01:00
|
|
|
//GetAbsoluteURL(#img_path);
|
|
|
|
//cur_pic = GetImage(#img_path);
|
2013-12-27 00:36:17 +01:00
|
|
|
|
|
|
|
if (!pics[cur_pic].image)
|
|
|
|
{
|
2015-08-19 14:48:31 +02:00
|
|
|
//cur_pic = GetImage("/sys/network/noimg.png");
|
2013-12-27 00:36:17 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-03-21 22:21:11 +01:00
|
|
|
imgw = DSWORD[pics[cur_pic].image+4];
|
|
|
|
imgh = DSWORD[pics[cur_pic].image+8];
|
|
|
|
if (imgw > width1) imgw = width1;
|
2013-12-27 00:36:17 +01:00
|
|
|
|
2020-03-29 12:57:14 +02:00
|
|
|
draw_y += imgh + 5; TEMPORARY TURN OFF!!!
|
|
|
|
|
2015-08-13 14:23:35 +02:00
|
|
|
if (top1+imgh<WB1.list.y) || (top1>WB1.list.y+WB1.list.h-10) return; //if all image is out of visible area
|
|
|
|
if (top1<WB1.list.y) //if image partly visible (at the top)
|
2013-12-27 00:36:17 +01:00
|
|
|
{
|
2013-12-27 02:08:50 +01:00
|
|
|
img_lines_first=WB1.list.y-top1;
|
2014-03-21 22:21:11 +01:00
|
|
|
imgh=imgh-img_lines_first;
|
2013-12-27 02:08:50 +01:00
|
|
|
top1=WB1.list.y;
|
2013-12-27 00:36:17 +01:00
|
|
|
}
|
2015-08-13 14:23:35 +02:00
|
|
|
if (top1>WB1.list.y+WB1.list.h-imgh-5) //if image partly visible (at the bottom)
|
2013-12-27 00:36:17 +01:00
|
|
|
{
|
2014-03-21 22:21:11 +01:00
|
|
|
imgh=WB1.list.y+WB1.list.h-top1-5;
|
2013-12-27 00:36:17 +01:00
|
|
|
}
|
2014-03-21 22:21:11 +01:00
|
|
|
if (imgh<=0) return;
|
2013-12-27 00:36:17 +01:00
|
|
|
|
2014-03-21 22:21:11 +01:00
|
|
|
img_draw stdcall (pics[cur_pic].image, left1-5, top1, imgw, imgh,0,img_lines_first);
|
2020-03-21 19:49:45 +01:00
|
|
|
DrawBar(left1+imgw - 5, top1, WB1.list.w-imgw, imgh, page_bg);
|
|
|
|
DrawBar(WB1.list.x, top1+imgh, WB1.list.w, -imgh % WB1.list.item_h + WB1.list.item_h, page_bg);
|
2015-08-13 14:23:35 +02:00
|
|
|
if (link)
|
2014-01-30 19:28:50 +01:00
|
|
|
{
|
2020-05-22 23:39:04 +02:00
|
|
|
UnsafeDefineButton(left1 - 5, top1, imgw, imgh-1, links.count + 400 + BT_HIDE, 0xB5BFC9);
|
|
|
|
links.AddText(0, imgw, imgh-1, NOLINE, 1);
|
2020-03-27 21:18:44 +01:00
|
|
|
WB1.DrawPage();
|
2014-01-30 19:28:50 +01:00
|
|
|
}
|
2014-01-19 23:46:58 +01:00
|
|
|
}
|
|
|
|
|
2020-05-30 00:31:32 +02:00
|
|
|
ImageCache ImgCache;
|
|
|
|
|
|
|
|
*/
|