Recent

Author Topic: Bitmap resources  (Read 6981 times)

tech-pro

  • Full Member
  • ***
  • Posts: 173
    • Tech-Pro.net
Bitmap resources
« on: February 21, 2006, 05:35:32 pm »
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?
Julian

pch

  • Jr. Member
  • **
  • Posts: 51
    • http://ap-i.net
Bitmap resources
« Reply #1 on: February 22, 2006, 10:17:05 am »
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.

Patrick

 

TinyPortal © 2005-2018