Well, I'm using Lazarus but I think the question is Ok here.

I did a program to manage data files that include bitmaps. I use a TPaintBox to show these images on the window but it's too slow because I'm using Allegro.pas not the TImage widget to load and manage the bitmap images. The function that manages the "OnPaint" message of the TPaintBox is similar than this (sort of pseudocode):
[pascal]procedure TForm1.PaintBox1Paint(Sender: TObject);
VAR
X, Y: INTEGER;
ImageBox: TImageBox;
begin
ImageBox := Sender;
FOR Y := 0 TO (Image^.h - 1) DO
FOR X := 0 TO (Image^.w - 1) DO
ImageBox.canvas.drawpixel (X, Y, al_getpixel (Image, X, Y));
end;
[/pascal] That is, I copy the image pixel-to-pixel.

As I've said this is too slow and I'm wondering if there's a faster way to do it. The "Image" object also has a pointer to the raw data named "data" that stores the color information in 8, 15, 16, 24 or 32 bits-per-pixel.

May be I can do something as:[pascal]procedure TForm1.PaintBox1Paint(Sender: TObject);
VAR
ImageBox: TImageBox;
Copy: AL_BITMAPptr;
begin
Copy := copy_bitmap_to_32bpp (Image);
ImageBox := Sender;
ImageBox.Canvas.DrawRawImage (Copy^w, Copy^.h, Copy^.data); { Is there such method? }
al_destroy_bitmap (Copy);
end;
[/pascal] Where copy_bitmap_to_32bpp creates a copy of "Image" in 32bpp for sure and the "DrawRawImgage" method is an optimised function that draws a "raw 32bpp bitmap" in the TPaintBox' canvas.

How can I do that?