/**
 * \file G12Image.cpp
 *
 * \date Jul 22, 2009
 * \author: Alexander Pimenov
 */

#include "g12Image.h"

g12Image::g12Image(G12Buffer *buffer) : QImage (buffer->w, buffer->h, QImage::Format_RGB32){
	int i,j;
	uint8_t *data = bits();
	int bpl = bytesPerLine();
	//int depth = image.depth;
	for (i = 0; i < buffer->h; i++ )
		for (j = 0; j < buffer->w; j++ )
		{
			uint8_t c = (buffer->data[i * buffer->w + j] >> 4);
			uint32_t value = c | (c << 8) | (c << 16);
			((uint32_t *)(data + i * bpl))[j] = value;
		}
}

g12Image::~g12Image() {
	// TODO Auto-generated destructor stub
}
