Logo Search packages:      
Sourcecode: blender version File versions

struct ImBuf* IMB_half_x ( struct ImBuf ibuf1  )  [read]

Attention:
defined in scaling.c
***** BEGIN GPL/BL DUAL LICENSE BLOCK *****

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 ***** allocimbuf.c

Id
scaling.c,v 1.3 2002/11/25 12:02:00 mein Exp

Definition at line 57 of file scaling.c.

References ImBuf::depth, IMB_allocImBuf(), IMB_dupImBuf(), IMB_half_x(), ImBuf::rect, ImBuf::x, and ImBuf::y.

Referenced by IMB_half_x(), and IMB_onehalf().

{
      struct ImBuf *ibuf2;
      uchar *p1,*_p1,*dest;
      short a,r,g,b,x,y;

      if (ibuf1==0) return (0);
      if (ibuf1->rect == 0) return (0);
      
      if (ibuf1->x <= 1) return(IMB_dupImBuf(ibuf1));
      
      ibuf2 = IMB_allocImBuf((ibuf1->x)/2 , ibuf1->y , ibuf1->depth,1,0);
      if (ibuf2==0) return (0);

      _p1 = (uchar *) ibuf1->rect;
      dest=(uchar *) ibuf2->rect;

      for(y=ibuf2->y;y>0;y--){
            p1 = _p1;
            for(x = ibuf2->x ; x>0 ; x--){
                  a = *(p1++) ;
                  b = *(p1++) ;
                  g = *(p1++) ;
                  r = *(p1++);
                  a += *(p1++) ;
                  b += *(p1++) ;
                  g += *(p1++) ;
                  r += *(p1++);
                  *(dest++) = a >> 1;
                  *(dest++) = b >> 1;
                  *(dest++) = g >> 1;
                  *(dest++) = r >> 1;
            }
            _p1 += (ibuf1->x << 2);
      }
      return (ibuf2);
}


Generated by  Doxygen 1.6.0   Back to index