Hola Logan:A ver si te sirve esto como ejemplo:
- Creamos un proyecto nuevo vacio y añadimos al Form un TImage de 320x240 pixels y un TButton.
Añadimos el código siguiente al evento OnClick del TButton:
// pinta el TImage con un degradado de rojo
const int ANCHO = 320, ALTO = 240;
BYTE pant[ANCHO][ALTO];
int x, y, i;
// Dibujamos en el array
for (y=0; y<ALTO; y++)
for (x=0; x<ANCHO; x++)
pant[x][y] = x/2+90;
BITMAPINFO *bmi;
bmi = (BITMAPINFO*) new BYTE[sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256];
bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi->bmiHeader.biWidth = ANCHO;
// Si especificamos el alto en negativo la linea 0 estara arriba
// y si es en positivo se dibuja desde abajo hacia arriba
bmi->bmiHeader.biHeight = -ALTO;
// Será un bitmap de 256 colores, o sea 8 bits de color
bmi->bmiHeader.biPlanes = 1;
bmi->bmiHeader.biBitCount = 8;
bmi->bmiHeader.biCompression = BI_RGB;
bmi->bmiHeader.biSizeImage = 0;
bmi->bmiHeader.biXPelsPerMeter = 0;
bmi->bmiHeader.biYPelsPerMeter = 0;
bmi->bmiHeader.biClrUsed = 0;
bmi->bmiHeader.biClrImportant = 0;
// Rellenamos la paleta con tonos de rojo
for (i=0; i<256; i++)
{
bmi->bmiColors[i].rgbRed = i;
bmi->bmiColors[i].rgbGreen = 0;
bmi->bmiColors[i].rgbBlue = 0;
bmi->bmiColors[i].rgbReserved = 0;
}
// Dibujamos el array en el canvas del TImage
SetDIBitsToDevice(Image1->Canvas->Handle, 0, 0,
ANCHO, ALTO, 0, 0,
0, ALTO,
pant, bmi, DIB_RGB_COLORS);
delete bmi;
Saludos.