Logo Search packages:      
Sourcecode: blender version File versions

struct ImBuf* IMB_ibImageFromMemory ( int *  mem,
int  size,
int  flags 
) [read]

Attention:
Defined in readimage.c

Definition at line 84 of file readimage.c.

References IMB_ibImageFromMemory().

Referenced by IMB_ibImageFromMemory(), and IMB_loadifffile().

                                                            {
      int len;
      struct ImBuf *ibuf;

      if (mem == NULL) {
            printf("Error in ibImageFromMemory: NULL pointer\n");
      } else {
            if ((GS(mem) == IMAGIC) || (GSS(mem) == IMAGIC)){
                  return (imb_loadiris((uchar *) mem, flags));
            } else if ((BIG_LONG(mem[0]) & 0xfffffff0) == 0xffd8ffe0) {
                  return (imb_ibJpegImageFromMemory((uchar *)mem, size, flags));
            }
            
            if (GET_ID(mem) == CAT){
                  mem += 3;
                  size -= 4;
                  while (size > 0){
                        if (GET_ID(mem) == FORM){
                              len = ((GET_BIG_LONG(mem+1) + 1) & ~1) + 8;
                              if ((GET_ID(mem+2) == ILBM) || (GET_ID(mem+2) == ANIM)) break;
                              mem = (int *)((uchar *)mem +len);
                              size -= len;
                        } else return(0);
                  }
            }
      
            if (size > 0){
                  if (GET_ID(mem) == FORM){
                        if (GET_ID(mem+2) == ILBM){
                              return (imb_loadamiga(mem, flags));
                        } else if (GET_ID(mem+5) == ILBM){              /* animaties */
                              return (imb_loadamiga(mem+3, flags));
                        } else if (GET_ID(mem+2) == ANIM){
                              return (imb_loadanim(mem, flags));
                        }
                  }
            }

            /* let quicktime handle png's, skips error messages ;)
             * but only on windows
             */
#ifdef _WIN32
            if(G.have_quicktime == FALSE) {
#else
            if(1) {
#endif
                  ibuf = imb_loadpng((uchar *)mem, size, flags);
                  if (ibuf) return(ibuf);
            }

            ibuf = imb_bmp_decode((uchar *)mem, size, flags);
            if (ibuf) return(ibuf);

            ibuf = imb_loadtarga((uchar *)mem, flags);
            if (ibuf) return(ibuf);

#ifdef WITH_QUICKTIME
#if defined(_WIN32) || defined (__APPLE__)
            if(G.have_quicktime) {
                  ibuf = imb_quicktime_decode((uchar *)mem, size, flags);
                  if (ibuf) return(ibuf);
            }
#endif
#endif      
#ifdef WITH_FREEIMAGE
            ibuf = imb_freeimage_decode((uchar *)mem, size, flags);
            if (ibuf) return(ibuf);
#endif      
#ifdef WITH_IMAGEMAGICK
            ibuf = imb_imagick_decode((uchar *)mem, size, flags);
            if (ibuf) return(ibuf);
#endif      

            if (IB_verbose) fprintf(stderr, "Unknown fileformat\n");
      }
      
      return (0);
}


Generated by  Doxygen 1.6.0   Back to index