Recent

Author Topic: [SOLVED] Status / Maturity of GTK-3 With TBGRABitmap  (Read 3194 times)

del

  • Sr. Member
  • ****
  • Posts: 258
[SOLVED] Status / Maturity of GTK-3 With TBGRABitmap
« on: March 08, 2022, 02:44:12 am »
Hello. I have an image processing GUI written using wxWidgets compiled with GTK-3. I also have a Pascal shared object library that uses TBGRABitmap (compiled with fpc).  TBGRABitmap has a GTK dependency and if I compile the Pascal library with GTK-2 I crash with this error:

Quote
Gtk-ERROR **: 15:35:28.293: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
Trace/breakpoint trap (core dumped)

The solution is simply to compile the Pascal library with GTK-3 ("-dLCLgtk3"). However, GTK-3 for Lazarus in general is kinda unfinished. Is GTK-3 pretty robust / mature in the TBGRABitmap libraries? So far I have had no problems calling TBGRABitmap functionality from the wxWidgets GUI. An equivalent GUI written in Lazarus would have to be GTK-2, and so would my library that uses TBGRABitmap.
« Last Edit: March 09, 2022, 03:36:55 am by del »

AlexTP

  • Hero Member
  • *****
  • Posts: 2401
    • UVviewsoft
Re: Status / Maturity of GTK-3 With TBGRABitmap
« Reply #1 on: March 08, 2022, 08:51:48 am »
GTK3 is far from ready, even when you don't use BGRAbitmap.
My text editor crashes with it.

del

  • Sr. Member
  • ****
  • Posts: 258
Re: Status / Maturity of GTK-3 With TBGRABitmap
« Reply #2 on: March 08, 2022, 09:49:57 am »
GTK3 is far from ready, even when you don't use BGRAbitmap.
My text editor crashes with it.
I agree that it's not ready if I'm doing a GUI with Lazarus. But I'm doing a GUI with wxWidgets (C++) and calling a library built from Pascal code which only involves BGRABitmap and its dependencies. Interface:
Code: C  [Select][+][-]
  1. #ifndef PASCOMMONUTILS_H
  2. #define PASCOMMONUTILS_H
  3.  
  4. #ifdef __cplusplus
  5. extern "C"{
  6. #endif
  7.  
  8. //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\//
  9.  
  10. void PasImageScale(float* inImg, float* outImg, int inRows, int inCols, int outRows,
  11.         int outCols, char* method);
  12.  
  13. //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\//
  14.  
  15. #ifdef __cplusplus
  16. }
  17. #endif

Scaling procedure (type p1Flt = ^single):

Code: Pascal  [Select][+][-]
  1. procedure PasImageScale(inImg, outImg: p1Flt; inRows, inCols, outRows,
  2.         outCols: integer; method: pchar) cdecl;
  3.  
  4. var
  5.         methodStr: string;
  6.  
  7.         interpType: TResampleFilter;
  8.  
  9.         tmpBgra, scaled: TBGRABitmap;
  10.  
  11. begin
  12.         // rfBox: Equivalent of simple stretch with high quality and pixel-centered coordinates
  13.         // rfLinear: Linear interpolation giving slow transition between pixels
  14.         // rfHalfCosine: Mix of ''rfLinear'' and ''rfCosine'' giving medium speed transition between pixels
  15.         // rfCosine: Cosine-like interpolation giving fast transition between pixels
  16.         // rfBicubic: Simple bi-cubic filter (blurry)
  17.         // rfMitchell: Mitchell filter, good for downsizing interpolation
  18.         // rfSpline: Spline filter, good for upsizing interpolation, however slightly blurry
  19.         // rfLanczos2: Lanczos with radius 2, blur is corrected
  20.         // rfLanczos3: Lanczos with radius 3, high contrast
  21.         // rfLanczos4: Lanczos with radius 4, high contrast
  22.         // rfBestQuality: Best quality using rfMitchell or rfSpline
  23.  
  24.         tmpBgra := TBGRABitmap.Create(inCols, inRows, 0);
  25.         ReadFloatMultiChan(tmpBgra, inImg);
  26.         methodStr := method;
  27.         interpType := StrToResampleFilter(methodStr);
  28.         tmpBgra.ResampleFilter := interpType;
  29.         scaled := tmpBgra.Resample(outCols, outRows) as TBGRABitmap;
  30.         tmpBgra.Free;
  31.         WriteFloatMultiChan(scaled, outImg);
  32.         scaled.Free;
  33. end;
  34.  

tetrastes

  • Sr. Member
  • ****
  • Posts: 481
Re: Status / Maturity of GTK-3 With TBGRABitmap
« Reply #3 on: March 08, 2022, 10:42:46 am »
There is bgrabitmappack4nogui.lpk, at least in the last BGRABitmap (11.4). Have you tried it?
« Last Edit: March 08, 2022, 11:07:18 am by tetrastes »

del

  • Sr. Member
  • ****
  • Posts: 258
Re: Status / Maturity of GTK-3 With TBGRABitmap
« Reply #4 on: March 08, 2022, 12:40:57 pm »
There is bgrabitmappack4nogui.lpk, at least in the last BGRABitmap (11.4). Have you tried it?
Thanks. That sounds like a good idea. When I try to use it I get this error:

Quote
bgrafreetype.pas(32,57) Fatal: Cannot find EasyLazFreeType used by BGRAFreeType. Make sure all ppu files of a package are in its output directory. ppu in wrong directory=/usr/lib/lazarus/components/freetype/lib/x86_64-linux/easylazfreetype.ppu. Clean up package "freetypelaz"..

So I have to figure this out before going any further.

dsiders

  • Hero Member
  • *****
  • Posts: 1077
Re: Status / Maturity of GTK-3 With TBGRABitmap
« Reply #5 on: March 08, 2022, 05:13:16 pm »
There is bgrabitmappack4nogui.lpk, at least in the last BGRABitmap (11.4). Have you tried it?
Thanks. That sounds like a good idea. When I try to use it I get this error:

Quote
bgrafreetype.pas(32,57) Fatal: Cannot find EasyLazFreeType used by BGRAFreeType. Make sure all ppu files of a package are in its output directory. ppu in wrong directory=/usr/lib/lazarus/components/freetype/lib/x86_64-linux/easylazfreetype.ppu. Clean up package "freetypelaz"..

So I have to figure this out before going any further.

I looked at the .lpk file. It does not include freetype as a required package. FreeType was moved into its own package for 2.2.0 and it appears that this .lpk has not been updated.

[EDIT]

I just noticed that I'm not on 11.4... so that may no longer be correct.

[RE-EDIT]

Dependency on freetype (in the nogui package) is still missing in 11.4.0.0 (from OPM).
« Last Edit: March 08, 2022, 06:30:48 pm by dsiders »
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

tetrastes

  • Sr. Member
  • ****
  • Posts: 481
Re: Status / Maturity of GTK-3 With TBGRABitmap
« Reply #6 on: March 08, 2022, 06:37:36 pm »
There is bgrabitmappack4nogui.lpk, at least in the last BGRABitmap (11.4). Have you tried it?
Thanks. That sounds like a good idea. When I try to use it I get this error:

Quote
bgrafreetype.pas(32,57) Fatal: Cannot find EasyLazFreeType used by BGRAFreeType. Make sure all ppu files of a package are in its output directory. ppu in wrong directory=/usr/lib/lazarus/components/freetype/lib/x86_64-linux/easylazfreetype.ppu. Clean up package "freetypelaz"..

So I have to figure this out before going any further.

At Windows with Lazarus 2.2.0 FPC 3.2.2 I have got
Quote
bgrafreetype.pas(32,57) Fatal: Cannot find EasyLazFreeType used by BGRAFreeType. Check if package freetypelaz is in the dependencies of package BGRABitmapPack4NoGUI.
I have added freetypelaz to Required Packages and have successfully compiled bgrabitmappack4nogui.lpk.

Just have checked at Debian 10 with Lazarus 2.2.0 FPC 3.2.2 - the same.
« Last Edit: March 08, 2022, 07:00:29 pm by tetrastes »

del

  • Sr. Member
  • ****
  • Posts: 258
Re: Status / Maturity of GTK-3 With TBGRABitmap
« Reply #7 on: March 09, 2022, 01:05:54 am »
I'm not a Lazarus expert, but here is the situation (Linux Manjaro 2.2.0 FPC 3.2.2). Even when I add the source file to the project I still get the error:

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: Status / Maturity of GTK-3 With TBGRABitmap
« Reply #8 on: March 09, 2022, 02:56:26 am »
Hello,
I'm not a Lazarus expert, but here is the situation (Linux Manjaro 2.2.0 FPC 3.2.2). Even when I add the source file to the project I still get the error:
you haven't to add freetypelaz to your project but in the requirements of  BGRABitmapPack4NoGui package (see attachment ) and after you must compile the package. OK for me with Ubuntu 20.04 Lazarus 2.2.0
Friendly, J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

del

  • Sr. Member
  • ****
  • Posts: 258
Re: Status / Maturity of GTK-3 With TBGRABitmap
« Reply #9 on: March 09, 2022, 03:35:59 am »
Hello,
I'm not a Lazarus expert, but here is the situation (Linux Manjaro 2.2.0 FPC 3.2.2). Even when I add the source file to the project I still get the error:
you haven't to add freetypelaz to your project but in the requirements of  BGRABitmapPack4NoGui package (see attachment ) and after you must compile the package. OK for me with Ubuntu 20.04 Lazarus 2.2.0
Friendly, J.P
OK. I get it now. That's what @tetrastes was telling me but I didn't understand. Thanks everybody. Everything is working fine now. The dependency for GTK 2 or 3 is gone and now my wxWidgets GUI (GTK-3) and my Lazarus-built GUI (LCLWidgetType:=gtk2) can both use the same library that uses BGRABitmap.

neuro

  • Jr. Member
  • **
  • Posts: 62
Re: Status / Maturity of GTK-3 With TBGRABitmap
« Reply #10 on: March 10, 2022, 01:46:37 pm »
Thanks. That sounds like a good idea. When I try to use it I get this error:

Quote
bgrafreetype.pas(32,57) Fatal: Cannot find EasyLazFreeType used by BGRAFreeType. Make sure all ppu files of a package are in its output directory. ppu in wrong directory=/usr/lib/lazarus/components/freetype/lib/x86_64-linux/easylazfreetype.ppu. Clean up package "freetypelaz"..

I have solved this error message when compiling BGRABitmapPack4NoGUI for Android (LAMW) by disabling OpenGL and LazFreeType.
Please read the page:
https://forum.lazarus.freepascal.org/index.php/topic,58624.0.html
BGRABitmap for Android demo provides fast pixel access for jBitmap
« Last Edit: March 10, 2022, 01:48:31 pm by neuro »

del

  • Sr. Member
  • ****
  • Posts: 258
Re: Status / Maturity of GTK-3 With TBGRABitmap
« Reply #11 on: March 10, 2022, 02:15:35 pm »
Thanks. That sounds like a good idea. When I try to use it I get this error:

Quote
bgrafreetype.pas(32,57) Fatal: Cannot find EasyLazFreeType used by BGRAFreeType. Make sure all ppu files of a package are in its output directory. ppu in wrong directory=/usr/lib/lazarus/components/freetype/lib/x86_64-linux/easylazfreetype.ppu. Clean up package "freetypelaz"..

I have solved this error message when compiling BGRABitmapPack4NoGUI for Android (LAMW) by disabling OpenGL and LazFreeType.
Please read the page:
https://forum.lazarus.freepascal.org/index.php/topic,58624.0.html
BGRABitmap for Android demo provides fast pixel access for jBitmap

Cool, thanks. The situation that I'm in is I'm decoupling as much Pascal code as I can from Lazarus and putting it into libraries (with "flattened" interfaces) that have no GTK dependencies. That way any GUI app I make becomes a thin shell whose main function is to wrap around robust libraries. Lazarus is awesome, but there may be cases in which the GTK-2 dependency is a show stopper. Then I would go to wxWidgets or QT. To get to the point - I may not want to disable OpenGL in BGRABitmap.

PS - I realize that I can build QT apps with Lazarus, but at the moment I prefer the look of GTK so it's GTK-2 with Lazarus and GTK-3 with wxWidgets.
« Last Edit: March 10, 2022, 02:20:30 pm by del »

circular

  • Hero Member
  • *****
  • Posts: 4217
    • Personal webpage
Re: [SOLVED] Status / Maturity of GTK-3 With TBGRABitmap
« Reply #12 on: May 29, 2022, 09:21:51 am »
Note : I've removed LazUtils completely from BGRABitmap4NoGui and BGRABitmap4fpGui. Remain only freetypelaz and FCL.
Conscience is the debugger of the mind

 

TinyPortal © 2005-2018