Rev 8011 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 8011 | Rev 8016 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | struct img |
1 | struct _img |
2 | { |
2 | { |
3 | collection src; |
3 | collection url; |
4 | collection_int data; |
- | |
5 | collection_int xywh; |
4 | collection_int xywh; |
- | 5 | collection_int data; |
|
- | 6 | int getid; |
|
- | 7 | dword add(); |
|
- | 8 | void clear(); |
|
- | 9 | dword current_url(); |
|
- | 10 | bool next_url(); |
|
- | 11 | void set_data(); |
|
6 | void drop(); |
12 | void draw(); |
7 | }; |
13 | }; |
Line -... | Line 14... | ||
- | 14 | ||
- | 15 | dword _img::add(dword _path, _x, _y) |
|
- | 16 | { |
|
- | 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 | } |
|
8 | 28 | ||
9 | void img::drop() |
29 | void _img::clear() |
10 | { |
30 | { |
- | 31 | url.drop(); |
|
11 | src.drop(); |
32 | xywh.drop(); |
- | 33 | data.drop(); |
|
- | 34 | getid = 0; |
|
- | 35 | } |
|
- | 36 | ||
- | 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 | } |
|
12 | data.drop(); |
83 | } |
Line 13... | Line 84... | ||
13 | } |
84 | } |
Line 14... | Line 85... | ||
14 | 85 |