Blender V2.27

writeimage.c

00001 
00032 #include <stdio.h>
00033 
00034 #include "IMB_imbuf_types.h"
00035 #include "IMB_imbuf.h"
00036 #include "IMB_filetype.h"
00037 
00038 #include "imbuf.h"
00039 
00040 short IMB_saveiff(struct ImBuf *ibuf, const char *name, int flags)
00041 {
00042         ImFileType *type;
00043 
00044         if(ibuf == NULL) return (FALSE);
00045         ibuf->flags = flags;
00046 
00047         for(type=IMB_FILE_TYPES; type->is_a; type++) {
00048                 if(type->save && type->ftype(type, ibuf)) {
00049                         if(!(type->flag & IM_FTYPE_FLOAT)) {
00050                                 if(ibuf->rect==NULL && ibuf->rect_float)
00051                                         IMB_rect_from_float(ibuf);
00052                         }
00053                         /* TODO. have const char for image write funcs */
00054                         return type->save(ibuf, name, flags);
00055                 }
00056         }
00057 
00058         fprintf(stderr, "Couldn't save picture.\n");
00059 
00060         return FALSE;
00061 }
00062