Couple of quick questions about pointers as they always drive me nuts in Delphi, especially when doing more complex stuff.
1) I have this simple routine for extracting previously decompressed images that I store in TBitmaps. The function returns type TBitmap.
FaPBitmap is an array of ^TBitmap
function ExtractImage(Index: Integer): TBitmap;
begin
Result := FaPBitmap[Index]^;
end;
The problem I have is when I use a TBitmap variable in the calling routines of this function to hold the result, when I destroy the temporary bitmap after I have finished copying it to a DX surface, the orginial is destroyed. This is because I passed back a pointer to the original! How can I get around this? I want to pass the actuall thing itself as a 'new' entity for the calling procedure to destroy once done. At the moment I can display each image once lol...
2) How can you increment a pointer by x number of bytes? Inc(myPointer) works, but how can I add say 256 for instance?
Bookmarks