Forum > Graphics

Bitmap resources


I have started to convert another of my Delphi programs to Lazarus. (By the way, I have never got it to work using the conversion tools in the IDE. I have always ended up recreating the form in the form designer, and copying and pasting the code from the Delphi .pas file. Perhaps I'm doing it wrong.)

This program has two 2MB bitmaps which are compiled in Windows resources. I found that TBitmap.LoadFromResourceName is still to be implemented. I thought I could implement this, but then I realised that I only know Windows, so I could only do it in a Windows specific way. So I msy as well call the API directly in my program if I want to do that.

There is TBitmap.LoadFromLazarusResource which does seem to be implemented. But the question is, how to get my bitmaps into the Lazarus resource format? If I do, then from inspection of the .lrs files, they will become enormous as the bitmaps will be encoded into something like hex. I'm not sure what that will do to compile time, or whether that will be an efficient way to store it. And how efficient will it be to load from LR format compared to a Windows resource?

What would be the best way to do this?

To convert the bitmap files to resources use:
lazres mybitmaps.lrs bitmap1.bmp bitmap2.bmp ....
lazres is in lazarus\tools

I think the size after compilation is correct (still 2MB in your case) but the source can be bigger because of the hex encoding.



[0] Message Index

Go to full version