Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
8016 | leency | 1 | struct _img |
4411 | leency | 2 | { |
8016 | leency | 3 | collection url; |
4 | collection_int xywh; |
||
8011 | leency | 5 | collection_int data; |
8016 | leency | 6 | int getid; |
7 | dword add(); |
||
8 | void clear(); |
||
9 | dword current_url(); |
||
10 | bool next_url(); |
||
11 | void set_data(); |
||
12 | void draw(); |
||
4411 | leency | 13 | }; |
4486 | leency | 14 | |
8016 | leency | 15 | dword _img::add(dword _path, _x, _y) |
4411 | leency | 16 | { |
8016 | leency | 17 | char full_path[URL_SIZE]; |
18 | strncpy(#full_path, _path, URL_SIZE); |
||
19 | GetAbsoluteURL(#full_path, history.current()); |
||
20 | |||
21 | url.add(#full_path); |
||
22 | xywh.add(_x); |
||
23 | xywh.add(_y); |
||
24 | xywh.add(0); |
||
25 | xywh.add(0); |
||
26 | return full_path; |
||
27 | } |
||
28 | |||
29 | void _img::clear() |
||
30 | { |
||
31 | url.drop(); |
||
32 | xywh.drop(); |
||
8008 | leency | 33 | data.drop(); |
8016 | leency | 34 | getid = 0; |
4411 | leency | 35 | } |
36 | |||
8016 | leency | 37 | dword _img::current_url() |
38 | { |
||
39 | return url.get(getid); |
||
40 | } |
||
41 | |||
42 | bool _img::next_url() |
||
43 | { |
||
44 | if (getid < url.count-1) { |
||
45 | getid++; |
||
46 | return 1; |
||
47 | } |
||
48 | return 0; |
||
49 | } |
||
50 | |||
51 | void _img::set_data(dword _data, _data_len) |
||
52 | { |
||
53 | data.set(getid, _data); |
||
54 | } |
||
55 | |||
56 | void DrawLibimgImage(dword _x, _y, _data, _data_len) |
||
57 | { |
||
58 | libimg_image im; |
||
59 | img_decode stdcall (_data, _data_len, 0); |
||
60 | $or eax, eax |
||
61 | $jz __ERROR__ |
||
62 | |||
63 | im.image = EAX; |
||
64 | im.set_vars(); |
||
65 | im.draw(_x, _y, im.w, im.h, 0, 0); |
||
66 | __ERROR__: |
||
67 | } |
||
68 | |||
69 | void _img::draw(int _x, _y, _start, _height) |
||
70 | { |
||
71 | int i, img_x, img_y; |
||
72 | |||
73 | for (i=0; i |
||
74 | { |
||
75 | img_x = xywh.get(i*4); |
||
76 | img_y = xywh.get(i*4 + 1); |
||
77 | |||
78 | if (img_y > _start) && (img_y < _start + _height) |
||
79 | { |
||
80 | if (cache.has(url.get(i))) |
||
81 | DrawLibimgImage(img_x + _x, img_y-_start + _y, cache.current_buf, cache.current_size); |
||
82 | } |
||
83 | } |
||
84 | } |
||
85 | |||
8011 | leency | 86 | /* |
4411 | leency | 87 | |
6803 | leency | 88 | void ImageCache::Images(dword left1, top1, width1) |
4411 | leency | 89 | { |
90 | dword image; |
||
6803 | leency | 91 | dword imgw=0, imgh=0, img_lines_first=0, cur_pic=0; |
4411 | leency | 92 | |
7742 | leency | 93 | //GetAbsoluteURL(#img_path); |
94 | //cur_pic = GetImage(#img_path); |
||
4411 | leency | 95 | |
96 | if (!pics[cur_pic].image) |
||
97 | { |
||
5746 | leency | 98 | //cur_pic = GetImage("/sys/network/noimg.png"); |
4411 | leency | 99 | return; |
100 | } |
||
101 | |||
4674 | leency | 102 | imgw = DSWORD[pics[cur_pic].image+4]; |
103 | imgh = DSWORD[pics[cur_pic].image+8]; |
||
104 | if (imgw > width1) imgw = width1; |
||
4411 | leency | 105 | |
7757 | leency | 106 | draw_y += imgh + 5; TEMPORARY TURN OFF!!! |
107 | |||
5718 | leency | 108 | if (top1+imgh |
109 | if (top1 |
||
4411 | leency | 110 | { |
4414 | leency | 111 | img_lines_first=WB1.list.y-top1; |
4674 | leency | 112 | imgh=imgh-img_lines_first; |
4414 | leency | 113 | top1=WB1.list.y; |
4411 | leency | 114 | } |
5718 | leency | 115 | if (top1>WB1.list.y+WB1.list.h-imgh-5) //if image partly visible (at the bottom) |
4411 | leency | 116 | { |
4674 | leency | 117 | imgh=WB1.list.y+WB1.list.h-top1-5; |
4411 | leency | 118 | } |
4674 | leency | 119 | if (imgh<=0) return; |
4411 | leency | 120 | |
4674 | leency | 121 | img_draw stdcall (pics[cur_pic].image, left1-5, top1, imgw, imgh,0,img_lines_first); |
7743 | leency | 122 | DrawBar(left1+imgw - 5, top1, WB1.list.w-imgw, imgh, page_bg); |
123 | DrawBar(WB1.list.x, top1+imgh, WB1.list.w, -imgh % WB1.list.item_h + WB1.list.item_h, page_bg); |
||
5718 | leency | 124 | if (link) |
4550 | leency | 125 | { |
7970 | leency | 126 | UnsafeDefineButton(left1 - 5, top1, imgw, imgh-1, links.count + 400 + BT_HIDE, 0xB5BFC9); |
127 | links.AddText(0, imgw, imgh-1, NOLINE, 1); |
||
7756 | leency | 128 | WB1.DrawPage(); |
4550 | leency | 129 | } |
4491 | leency | 130 | } |
131 | |||
8011 | leency | 132 | ImageCache ImgCache; |
133 | |||
134 | */=0)>>> |