Logo Search packages:      
Sourcecode: blender version File versions

short IMB_saveiff ( struct ImBuf ibuf,
char *  naam,
int  flags 

Defined in writeimage.c

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The Blender Foundation also sells licenses for use in proprietary software under the Blender License. See http://www.blender.org/BL/ for information about this.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. All rights reserved.

The Original Code is: all of this file.

Contributor(s): none yet.

***** END GPL/BL DUAL LICENSE BLOCK ***** writeimage.c

writeimage.c,v 1.9 2004/12/09 13:09:11 sirdude Exp

Definition at line 58 of file writeimage.c.

References ImBuf::cmap, ImBuf::flags, IB_rect, IMB_converttocmap(), IMB_flipy(), IMB_saveiff(), IS_amiga, and ImBuf::planes.

Referenced by IMB_saveiff().

      short ok=TRUE,delpl=FALSE;
      int file = -1;

      if (ibuf==0) return (FALSE);
      ibuf->flags = flags;

      /* Put formats that take a filename here */
      if (IS_jpg(ibuf)) {
            if(imb_savejpeg(ibuf, naam, flags)) return (0);
            else return (TRUE);
      if (IS_png(ibuf)) {
            return imb_savepng(ibuf,naam,flags);
        if (IS_bmp(ibuf)) {
                return imb_savebmp(ibuf,naam,flags);
      if (IS_tga(ibuf)) {
            return imb_savetarga(ibuf,naam,flags);
      if (IS_iris(ibuf)) {
            return imb_saveiris(ibuf,naam,flags);

      file = open(naam, O_BINARY | O_RDWR | O_CREAT | O_TRUNC, 0666);
      if (file < 0) return (FALSE);

      if (flags & IB_rect){
            if (ibuf->cmap){

      /* Put formats that take a filehandle here */
      ok = imb_start_iff(ibuf,file);
      if (IS_amiga(ibuf)){
            if (flags & IB_rect){
                  if ((flags & IB_cmap) == 0) {
                        if (IS_ham(ibuf)){
                              if (ok) ok = imb_converttoham(ibuf);
                        }else if (ibuf->cmap){
                              if (ok) ok = IMB_converttocmap(ibuf);
                  if (ok){
                        if (ibuf->planes==0){

            if (flags & IB_vert){
                  if (ok) ok = imb_encodebodyv(ibuf,file);
                  if (ok) ok = imb_encodebodyh(ibuf,file);
            if (ok) ok = imb_update_iff(file,BODY);
      }else if (IS_anim(ibuf)) {
            if (ok) ok = imb_enc_anim(ibuf, file);
            if (ok) ok = imb_update_iff(file, BODY);

      if (ok==FALSE) {
            fprintf(stderr,"Couldn't save picture.\n");
      if (delpl) imb_freeplanesImBuf(ibuf);

      return (ok);

Generated by  Doxygen 1.6.0   Back to index