More info for PTCGraph users - bitmap data layout lazarus / 39-Graphics ---------------------------------------------------------------------- TBMan · 2025-11-25 04:21 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. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i typeTPackedsprite= packed record      width,height,      extra:dword;      colors:array of word;    end;                               varworkingbitmap :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);beginif 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; mo ve(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: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 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.