Logo Search packages:      
Sourcecode: blender version File versions

struct ImBuf* IMB_loadifffile ( int  file,
int  flags 
) [read]

Attention:
defined in readimage.c
Deprecated:
Only here for backwards compatibility of the
Deprecated:
plugin system.

Definition at line 209 of file readimage.c.

References IMB_ibImageFromMemory(), and IMB_loadifffile().

Referenced by IMB_loadifffile(), IMB_loadiffname(), and IMB_testiffname().

                                                   {
      struct ImBuf *ibuf;
      int size, *mem;

      if (file == -1) return (0);

      size = BLI_filesize(file);

#if defined(AMIGA) || defined(__BeOS) || defined(WIN32)
      mem= (int *)malloc(size);
      if (mem==0) {
            printf("Out of mem\n");
            return (0);
      }

      if (read(file, mem, size)!=size){
            printf("Read Error\n");
            free(mem);
            return (0);
      }

      ibuf = IMB_ibImageFromMemory(mem, size, flags);
      free(mem);

      /* for jpeg read */
      lseek(file, 0L, SEEK_SET);

#else
      mem= (int *)mmap(0,size,PROT_READ,MAP_SHARED,file,0);
      if (mem==(int *)-1){
            printf("Couldn't get mapping\n");
            return (0);
      }

      ibuf = IMB_ibImageFromMemory(mem, size, flags);

      if (munmap( (void *) mem, size)){
            printf("Couldn't unmap file.\n");
      }
#endif
      return(ibuf);
}


Generated by  Doxygen 1.6.0   Back to index