Recent

Author Topic: Storing bitmap inside code without component.  (Read 3144 times)

toplek

  • Jr. Member
  • **
  • Posts: 53
Storing bitmap inside code without component.
« on: February 11, 2017, 10:20:19 am »
Hi,

is it possible to store bitmap inside code in declaration part, something like below:

Code: Pascal  [Select][+][-]
  1. const
  2.   Picture: TBitMap = {
  3.     36030000424D3603000000000000360000002800000010000000100000000100
  4.     18000000000000030000C40E0000C40E00000000000000000000FFFFFFFF0000
  5.     FF0000FF0000FF0000FF0000FFFFFFFFFFFFFFFFFFFFFFFFFF0000FF0000FF00
  6.     00FF0000FF0000FFFFFFFFFFFFFF0000FF0000FF0000FF0000FF0000FFFFFFFF
  7.     00FF0000FF0000FFFFFFFFFFFFFF0000FF0000FF0000FF0000FF0000FFFFFFFF
  8.     FFFFFFFFFFFFFFFFFF0000FF0000FF0000FF0000FF0000FFFFFF
  9.   }

br
Piotr Polok

Handoko

  • Hero Member
  • *****
  • Posts: 5154
  • My goal: build my own game engine using Lazarus
Re: Storing bitmap inside code without component.
« Reply #1 on: February 11, 2017, 10:59:56 am »
I think it will better to use resource file.
Read more:
http://wiki.freepascal.org/Lazarus_Resources

Thaddy

  • Hero Member
  • *****
  • Posts: 14373
  • Sensorship about opinions does not belong here.
Re: Storing bitmap inside code without component.
« Reply #2 on: February 11, 2017, 11:03:08 am »
Yes, a resource file is easier.
There is the data2inc utility to create an include file from e.g. a bitmap, though, that can be included in your code.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Roland57

  • Sr. Member
  • ****
  • Posts: 423
    • msegui.net
Re: Storing bitmap inside code without component.
« Reply #3 on: February 11, 2017, 01:29:53 pm »
Hello! You could also use data2pas.
My projects are on Gitlab and on Codeberg.

toplek

  • Jr. Member
  • **
  • Posts: 53
Re: Storing bitmap inside code without component.
« Reply #4 on: February 13, 2017, 10:29:22 pm »
Hi,

thank you for the advice, both solution are interesting, It's look like data2pas will fit my needs.

br
Piotr Polok

 

TinyPortal © 2005-2018