Guest User

Untitled

a guest
Jul 23rd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. if (Exist(fname))
  2. {
  3. img = corona::OpenImage(fname, corona::FF_AUTODETECT, corona::PF_DONTCARE);
  4. }
  5. else
  6. {
  7. VFILE* vf = vopen(fname);
  8. if (!vf)
  9. {
  10. err("loadimage: couldn't load image %s; couldnt find a file or a vfile", fname);
  11. }
  12. /*FILE* f = fopen("v3img_temp.$$$", "wb");
  13. if (!f)
  14. {
  15. // TODO: implement
  16. }*/
  17. int l = filesize(vf);
  18. char* buffer = new char[l];
  19. vread(buffer, l, vf);
  20. //fwrite(buffer, 1, l, f);
  21. vclose(vf);
  22. //fclose(f);
  23. corona::File* memfile = corona::CreateMemoryFile(buffer, l);
  24. img = corona::OpenImage(memfile, corona::FF_AUTODETECT, corona::PF_DONTCARE);
  25. delete buffer;
  26. //remove("v3img_temp.$$$");
  27. }
Add Comment
Please, Sign In to add comment