Subversion Repositories Kolibri OS

Rev

Rev 8330 | 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. /*
  33. void _img::draw_all(int _x, _y, _w, _h, _start)
  34. {
  35.         int i, img_y;
  36.  
  37.         for (i=0; i<url.count; i++)
  38.         {
  39.                 img_y = y.get(i);
  40.  
  41.                 if (img_y + h.get(i) > _start) && (img_y - _h < _start)
  42.                 && (cache.has(url.get(i))) draw(_x, _y, _w, _h, _start, i);
  43.         }
  44. }
  45. */
  46.  
  47. bool _img::draw(int _x, _y, _w, _h, _start, i)
  48. {
  49.         int img_x, img_y, img_w, img_h, invisible_h=0;
  50.         img_decode stdcall (cache.current_buf, cache.current_size, 0);
  51.         if (EAX) {
  52.                 EDI = EAX;
  53.  
  54.                 img_x = x.get(i);
  55.                 img_y = y.get(i);
  56.                 img_w = math.min(w.set(i, ESDWORD[EDI+4]), _w - img_x);
  57.                 img_h = math.min(h.set(i, ESDWORD[EDI+8]), _h + _start - img_y);
  58.  
  59.                 if (_start > img_y) {
  60.                         invisible_h = _start - img_y;
  61.                         img_y = _start;
  62.                 }
  63.  
  64.                 img_draw stdcall(EDI, img_x + _x, img_y - _start + _y, img_w, img_h - invisible_h, 0, invisible_h);    
  65.                 free(EDI);
  66.         }      
  67. }
  68.  
  69.