I guess I live under a rock, but I took the time tonight to figure out how ptcgraph (on a windows system) stores the bitmap for getimage and put image.
type
TPackedsprite= packed record
width,height,
extra:dword;
colors:array of word;
end;
var
workingbitmap :pointer = NIL;
// and assuming you set the sprite to the size you want and the colors is set to your imagedata...
// You could probably use a multi dimensional array also, but I didn't work with that
procedure namehere(x,y:integer;sprite:TPackedSprite);
begin
if workingbitmap = nil then
begin
sz := imagesize(0,0,sprite.width-1,sprite.height-1);
getmem(Workingbitmap,sz);
getimage(0,0,sprite.width-1,sprite.height-1,Workingbitmap^);
end;
move(sprite.colors,pointer(PtrUint(Workingbitmap)+4*sizeof(dword)-sizeof(word)*2)^, (sprite.height*sprite.width)*sizeof(word));
putimage(x,y,workingbitmap^,0);
end;
So what I do is use the workingbitmap through the app without allocating memory everytime I want to use it. I will just freemem the image at the end of the app. (I make the sz variable global);
I was using this to display my playing cards:
index := 0;
for r := 0 to sprite.height-1 do
for c := 0 to sprite.width-1 do
begin
putpixel(x+c,y+r,sprite.colors[index]);
inc(index);
end;
Which is more than 10 times slower than using the putimage example above.