Subversion Repositories Kolibri OS

Rev

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

  1. struct libimg_image {
  2.         dword image, w, h;
  3. };
  4.  
  5. :void Libimg_LoadImage(dword struct_pointer, file_path)
  6. {
  7.         dword image_pointer;
  8.         image_pointer = load_image(file_path);
  9.         if (!image_pointer) notify("'Error: Image not loaded' -E");
  10.         ESDWORD[struct_pointer] = image_pointer;
  11.         ESDWORD[struct_pointer+4] = DSWORD[image_pointer+4];
  12.         ESDWORD[struct_pointer+8] = DSWORD[image_pointer+8];
  13. }
  14.  
  15. :void Libimg_FillTransparent(dword struct_pointer, w, h, new_transparent_color)
  16. {
  17.         dword i, max_i, image_data;
  18.         image_data = ESDWORD[struct_pointer + 24];
  19.         max_i =  w * h * 4 + image_data;
  20.         for (i = image_data; i < max_i; i += 4) if (DSDWORD[i]==0) DSDWORD[i] = new_transparent_color;
  21. }