11 template <
typename PixelType>
15 static PixelType* alloc(
unsigned int width,
unsigned int height,
size_t *pitch)
17 if ((width == 0) || (height == 0))
throw IuException(
"width or height is 0", __FILE__,__FUNCTION__, __LINE__);
20 *pitch = width *
sizeof(PixelType);
22 unsigned int elements_to_pitch = (32-(*pitch % 32))/
sizeof(PixelType);
27 elements_to_pitch = 0;
29 width += elements_to_pitch;
30 PixelType *buffer =
new PixelType[width * height];
31 *pitch = width *
sizeof(PixelType);
35 static void free(PixelType *buffer)
40 static void copy(
const PixelType *src,
size_t src_pitch,
43 size_t src_stride = src_pitch/
sizeof(PixelType);
44 size_t dst_stride = dst_pitch/
sizeof(PixelType);
46 for(
unsigned int y=0; y< size.
height; ++y)
48 for(
unsigned int x=0; x<size.
width; ++x)
50 dst[y*dst_stride+x] = src[y*src_stride+x];
Definition: image_allocator_cpu.h:12
unsigned int & height
Definition: vector.h:531
Exceptions with additional error information.
Definition: coredefs.h:32
unsigned int & width
Definition: vector.h:529
Template specialization for 2-d unsigned int vectors (size vectors).
Definition: vector.h:525