Subversion Repositories Kolibri OS

Rev

Rev 8336 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1.  
  2. struct _img
  3. {
  4.         collection url;
  5.         collection_int x,y,w,h;
  6.  
  7.         void clear();
  8.         void add();
  9.        
  10.         void draw_all();
  11.         bool draw();
  12. };
  13.  
  14. void _img::clear()
  15. {
  16.         url.drop();
  17.         x.drop();
  18.         y.drop();
  19.         w.drop();
  20.         h.drop();
  21. }
  22.  
  23. void _img::add(dword _path, _x, _y, _w, _h)
  24. {
  25.         url.add(_path);
  26.         x.add(_x);
  27.         y.add(_y);
  28.         w.add(_w);
  29.         h.add(_h);
  30. }
  31.  
  32. bool _img::draw(int _x, _y, _w, _h, _start, i)
  33. {
  34.         int img_x, img_y, img_w, img_h, invisible_h=0;
  35.         char* img_ptr;
  36.  
  37.         img_x = x.get(i);
  38.         img_y = y.get(i);
  39.         img_w = math.min(w.get(i), _w - img_x);
  40.         img_h = math.min(h.get(i), _h + _start - img_y);
  41.  
  42.         if (_start > img_y) {
  43.                 invisible_h = _start - img_y;
  44.                 img_y = _start;
  45.         }
  46.  
  47.         img_decode stdcall (cache.current_buf, cache.current_size, 0);
  48.         img_ptr = EAX;
  49.         img_draw stdcall(img_ptr, img_x + _x, img_y - _start + _y, img_w, img_h - invisible_h, 0, invisible_h);
  50.         img_destroy stdcall(img_ptr);
  51. }
  52.  
  53.