buffer->colorcomponent[0]->GetPixels();
Then save the pixel data to a bitmap. Here's some code for loading bitmaps, so it's just this reversed:
#pragma once
#include "../Leadwerks3D.h"
namespace Leadwerks3D
{
bool BMPLoader::Load(AssetReference* assetreference, Stream* stream)
{
int format, hsize, pad, hoffset, width, height, planes, bits, compression, isize, xpels, ypels, inuse, size, cols, x, y, r, g, b;
Bank* pixels, *data;
TextureReference* texturereference = (TextureReference*)assetreference;
if (stream->ReadByte()!=Asc("B")) return false;
if (stream->ReadByte()!=Asc("M")) return false;
hsize=stream->ReadInt();
pad=stream->ReadInt();
hoffset=stream->ReadInt();
size=stream->ReadInt();
width=stream->ReadInt();
height=stream->ReadInt();
planes=stream->ReadShort();
bits=stream->ReadShort();
compression=stream->ReadInt();
isize=stream->ReadInt();
xpels=stream->ReadInt();
ypels=stream->ReadInt();
cols=stream->ReadInt();
inuse=stream->ReadInt();
hoffset -= 54;
if (bits==32)
{
format = TEXTURE_RGBA;
}
else
{
format = TEXTURE_RGB;
}
switch (bits)
{
case 1:
break;
case 4:
break;
case 8:
break;
case 24:
format = TEXTURE_BGR;
pixels = CreateBank(width*height*3);
//stream->ReadBytes(pixels->buf,pixels->GetSize());
data = CreateBank(width*height*3);
//stream->ReadBytes(data->buf,data->GetSize());
for (y=height-1; y>-1; y--)
{
//for (x=0; x<width; x++)
//{
//r = stream->ReadByte();
//g = stream->ReadByte();
//b = stream->ReadByte();
/*
r = data->PeekByte(((height-1-y)*width+x)*3+0);
g = data->PeekByte(((height-1-y)*width+x)*3+1);
b = data->PeekByte(((height-1-y)*width+x)*3+2);
pixels->PokeByte((width*y+x)*3+2,r);
pixels->PokeByte((width*y+x)*3+1,g);
pixels->PokeByte((width*y+x)*3+0,B);
*/
stream->ReadBytes(pixels->buf + (y*width*3),width*3);
//}
}
//
break;
case 32:
format = TEXTURE_RGBA;
pixels = CreateBank(width*height*4);
break;
default:
return false;
}
texturereference->Initialize(width,height,format,0,0);
texturereference->GenerateMipmaps(pixels);
delete pixels;
return true;
}
}