SMIL  0.9.1
DImageArith_Bit.h
1 /*
2  * Copyright (c) 2011-2016, Matthieu FAESSEL and ARMINES
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of Matthieu FAESSEL, or ARMINES nor the
14  * names of its contributors may be used to endorse or promote products
15  * derived from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21  * COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
22  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28  * OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 
32 #ifndef _D_IMAGE_ARITH_BIT_H
33 #define _D_IMAGE_ARITH_BIT_H
34 
35 
36 #include "DBitArray.h"
37 #include "DLineArith_Bit.h"
38 #include "Base/include/private/DImageArith.hpp"
39 
40 namespace smil
41 {
42 
43  template <>
44  inline RES_T copy<Bit>(const Image<Bit> &imIn, Image<Bit> &imOut)
45  {
46  ASSERT_ALLOCATED(&imIn, &imOut);
47 
48  if (!CHECK_SAME_SIZE(&imIn, &imOut))
49  return copy<Bit,Bit>(imIn, 0, 0, 0, imOut, 0, 0, 0);
50 
51  typename Image<Bit>::sliceType l1 = imIn.getLines();
52  typename Image<Bit>::sliceType l2 = imOut.getLines();
53 
54  UINT width = imIn.getWidth();
55 
56  for (UINT i=0;i<imIn.getLineCount();i++)
57  copyLine<Bit>(l1[i], width, l2[i]);
58 
59  imOut.modified();
60  return RES_OK;
61  }
62 
63 } // namespace smil
64 
65 
66 #endif // _D_IMAGE_ARITH_BIT_H
Definition: DColorConvert.h:38