source: nanovis/trunk/imgLoaders/Image.cpp @ 4587

Last change on this file since 4587 was 2857, checked in by ldelgass, 13 years ago

Remove vr3d library - texture classes were redundant. Remove last vestiges of
opencv usage in code and remove from configure - replaced by imgLoaders library
functions.

  • Property svn:eol-style set to native
File size: 954 bytes
Line 
1/* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2#include <memory.h>
3#include <stdlib.h>
4
5#include "Image.h"
6
7Image::Image(const unsigned int width, const unsigned int height,
8             const ImageFormat format, const Image::DataType type, void *data) :
9    _width(width),
10    _height(height),
11    _format(format),
12    _dataType(type)
13{
14    switch (type) {
15    case IMG_UNSIGNED_BYTE:
16        _dataTypeByteSize = 1;
17        break;
18    case IMG_FLOAT:
19        _dataTypeByteSize = 4;
20        break;
21    }
22
23    //_dataBuffer = aligned_malloc(width * height * comp * _dataTypeByteSize, 16);
24    _dataBuffer = malloc(width * height * format * _dataTypeByteSize);
25
26    if (data != NULL) {
27        memcpy(_dataBuffer, data, width *height * format * _dataTypeByteSize);
28    } else {
29        memset(_dataBuffer, 0, width * height * format * _dataTypeByteSize);
30    }
31}
32
33Image::~Image()
34{
35    //aligend_free(_dataBuffer);
36    free(_dataBuffer);
37}   
Note: See TracBrowser for help on using the repository browser.