a program im fiddling with uses exactly 2 small .gif pictures that are to be
stored in the code and written out to the file system.
For several reasons - no gif writer, complicates ressouce file handling,
linking fpimage or similar - I want to handle those files directly in code,
having an array of hex bytes and some code writing those consts to file.
What I need:
- A program taking a binary file and spitting out pascal code for the const
array. I know I have seen such program in the past, but do not know where.
- Some hints on using this constant for making files out of them. Currently
I'm plannig to use a TFileStreaam writing out Bytes, should do.
On Thu, 2018-09-20 at 00:47 +0200, Tomas Hajny wrote:
> On Wed, September 19, 2018 23:58, Marc Santhoff wrote:
> > What I need:
> > - A program taking a binary file and spitting out pascal code for the
> > const array. I know I have seen such program in the past, but do not know
> > where.
> data2inc is included with FPC.
FPC is amazing! Batteries included. :)
> > - Some hints on using this constant for making files out of them.
> > Currently I'm plannig to use a TFileStreaam writing out Bytes, should do.
> Indeed, should do; simple file of byte and BlockWrite should do as well.
Oncemore using the correct from address...
On Thu, 2018-09-20 at 23:45 +0200, Bo Berglund wrote:
> On Wed, 19 Sep 2018 23:58:36 +0200, Marc Santhoff
> <[hidden email]> wrote:
> > Any pointers or hints, please?
> You can convert any file you like to an inc file with pascal syntax:
> data2inc -A -B laz/images/ide_icon48x48.png datatest.inc icon48x48
> This will produce a datatest.inc file ready to be included in your
> project and with content looking like this:
> const icon48x48 : array[0..4236] of byte=(
> data2inc is installed with fpc/lazarus ready for use.
> I used a png file shipped with lazarus as the example above.