Recent

Author Topic: [SOLVED] How to install libpng library  (Read 3578 times)

tudi_x

  • Hero Member
  • *****
  • Posts: 532
[SOLVED] How to install libpng library
« on: August 24, 2017, 03:53:31 pm »
hi All,
i want to install a package that is using the png unit.
i searched and found out that this library belongs to libpng library.
i am not using the package manager.
please advise on how i could install the png unit or libpng library.

thank you
« Last Edit: August 24, 2017, 04:45:35 pm by tudi_x »
Lazarus 2.0.2 64b on Debian LXDE 10

wp

  • Hero Member
  • *****
  • Posts: 11853
Re: How to install libpng library
« Reply #1 on: August 24, 2017, 04:00:12 pm »
Do you know that png support is built-in? Just "use" unit graphics, and load the file into a TPortableNetworkGraphic, a TPicture or TImage.Picture directly.

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: How to install libpng library
« Reply #2 on: August 24, 2017, 04:09:51 pm »
Do you know that png support is built-in? Just "use" unit graphics, and load the file into a TPortableNetworkGraphic, a TPicture or TImage.Picture directly.
True, but you also have to know how to optimize. By default it is slower than libpng, with the correct compiler options it is just as fast, though. (libpng is compiled heavily optimized, that's the only reason)

I need to know the platform, too.
For e.g. all Debian derived linux (including Ubuntu) it is simply sudo apt-get install libpng libpng-dev
Apart from the libpng-dev it is probably installed already.

But as wp suggested: why? There is already pure pascal code that is just as good. And is basically the default for FPC/Lazarus.
« Last Edit: August 24, 2017, 04:14:25 pm by Thaddy »
Specialize a type, not a var.

tudi_x

  • Hero Member
  • *****
  • Posts: 532
Re: [SOLVED] How to install libpng library
« Reply #3 on: August 24, 2017, 04:47:12 pm »
due to :  http://forum.lazarus.freepascal.org/index.php/topic,37142.msg248630.html#msg248630
the loaded package had the png unit in uses.
what i am trying to achieve is to embed the GPL 3 license in the executable.
Lazarus 2.0.2 64b on Debian LXDE 10

wp

  • Hero Member
  • *****
  • Posts: 11853
Re: [SOLVED] How to install libpng library
« Reply #4 on: August 24, 2017, 05:32:56 pm »
Just remove png, JPegLib also. When you have graphics in the uses clause you automatically have support for jpeg and png. I tested it, and the runtime package (khnembedsrc.lpj) compiles fine. The designtime package knembedsrc_dsn.lpk fails because the method "Modified" of TRscsEditor is private in its ancestor, TCollectionPropertyEditorForm, in the LCL. You probably can fix this if you copy the source of this method into a private or protected method of TRscsEditor (I did not check...). Like this

Code: Pascal  [Select][+][-]
  1. procedure TRscsEditor.Modified;
  2. begin
  3.   //debugln(['TCollectionPropertyEditorForm.Modified FOwnerPersistent=',DbgSName(FOwnerPersistent),' FCollection=',DbgSName(FCollection),' GlobalDesignHook.LookupRoot=',DbgSName(GlobalDesignHook.LookupRoot)]);
  4.   if GlobalDesignHook <> nil then
  5.     GlobalDesignHook.Modified(Self);
  6. end;

Or maybe there's a better way.

[EDIT]
Ok, I don't want to given bad advice, so I checked it: You also have to add PropEdits to the uses clause of rscs_coledit to make the designtime package compile. I installed it, and it runs fine.
« Last Edit: August 24, 2017, 05:48:53 pm by wp »

 

TinyPortal © 2005-2018