Lazarus

Programming => Graphics => Graphics and Multimedia => BGRABitmap and LazPaint => Topic started by: abtaylr on July 05, 2016, 06:30:32 am

Title: BGRABitmap 8.9.2 fails to compile fpc-3.0.1
Post by: abtaylr on July 05, 2016, 06:30:32 am
I just updated my fpc and laz using the fixes branch, so fpc-3.0.1 and laz is 1.6.1. BGRABitmap had been compiling, but now I am getting the errors:

Code: Pascal  [Select]
  1. bgracanvas2d.pas(371,21) Error: Operator is not overloaded: "TPointF" + "TPointF"
  2. bgracanvas2d.pas(372,21) Error: Operator is not overloaded: "TPointF" + "TPointF"
  3. bgracanvas2d.pas(387,34) Error: Incompatible type for arg no. 3: Got "TYPES.TPointF", expected "BGRABITMAPTYPES.TPointF"
  4. bgratransform.pas(1365,38) Hint: Found declaration: Fit(TPointF;TPointF;TPointF);
  5. bgracanvas2d.pas(447,71) Error: Incompatible type for arg no. 4: Got "TYPES.TPointF", expected "BGRABITMAPTYPES.TPointF"
  6. bgragradientscanner.pas(1112,34) Hint: Found declaration: constructor Create(TBGRACustomGradient;TGradientType;TPointF;TPointF;Boolean="FALSE";Boolean="FALSE");
  7. bgragradientscanner.pas(1080,34) Hint: Found declaration: constructor Create(TBGRAPixel;TBGRAPixel;TGradientType;TPointF;TPointF;Boolean="TRUE";Boolean="FALSE");
  8. bgracanvas2d.pas(452,9) Error: Incompatible types: got "BGRABITMAPTYPES.TPointF" expected "TYPES.TPointF"
  9. bgracanvas2d.pas(453,9) Error: Incompatible types: got "BGRABITMAPTYPES.TPointF" expected "TYPES.TPointF"
  10. bgracanvas2d.pas(666,24) Error: function header doesn't match any method of this class "GetShadowOffset:<record type>;"
  11. bgracanvas2d.pas(110,14) Error: Found declaration: GetShadowOffset:<record type>;
  12. bgracanvas2d.pas(668,13) Error: Incompatible types: got "BGRABITMAPTYPES.TPointF" expected "TYPES.TPointF"
  13. bgracanvas2d.pas(901,25) Error: function header doesn't match any method of this class "FillPoly(const {Open} Array Of TPointF);"
  14. bgracanvas2d.pas(126,15) Error: Found declaration: FillPoly(const {Open} Array Of TPointF);
  15. bgracanvas2d.pas(906,38) Error: Incompatible type for arg no. 1: Got "{Open} Array Of TPointF", expected "{Open} Array Of TPointF"
  16. bgracanvas2d.pas(142,15) Hint: Found declaration: DrawShadow(const {Open} Array Of TPointF;const {Open} Array Of TPointF);
  17. bgracanvas2d.pas(914,63) Error: Incompatible type for arg no. 2: Got "{Open} Array Of TPointF", expected "{Open} Array Of TPointF"
  18. bgrapolygon.pas(499,11) Hint: Found declaration: FillPolyAntialiasWithTexture(TBGRACustomBitmap;{Open} Array Of TPointF;IBGRAScanner;Boolean;Boolean="FALSE");
  19. bgracanvas2d.pas(916,61) Error: Incompatible type for arg no. 2: Got "{Open} Array Of TPointF", expected "{Open} Array Of TPointF"
  20. bgrapolygon.pas(473,11) Hint: Found declaration: FillPolyAliasedWithTexture(TBGRACustomBitmap;{Open} Array Of TPointF;IBGRAScanner;Boolean;TDrawMode);
  21. bgracanvas2d.pas(926,67) Error: Incompatible type for arg no. 2: Got "{Open} Array Of TPointF", expected "{Open} Array Of TPointF"
  22. bgrapolygon.pas(499,11) Hint: Found declaration: FillPolyAntialiasWithTexture(TBGRACustomBitmap;{Open} Array Of TPointF;IBGRAScanner;Boolean;Boolean="FALSE");
  23. bgracanvas2d.pas(928,65) Error: Incompatible type for arg no. 2: Got "{Open} Array Of TPointF", expected "{Open} Array Of TPointF"
  24. bgrapolygon.pas(473,11) Hint: Found declaration: FillPolyAliasedWithTexture(TBGRACustomBitmap;{Open} Array Of TPointF;IBGRAScanner;Boolean;TDrawMode);
  25. bgracanvas2d.pas(933,67) Error: Incompatible type for arg no. 2: Got "{Open} Array Of TPointF", expected "{Open} Array Of TPointF"
  26. bgrapolygon.pas(499,11) Hint: Found declaration: FillPolyAntialiasWithTexture(TBGRACustomBitmap;{Open} Array Of TPointF;IBGRAScanner;Boolean;Boolean="FALSE");
  27. bgracanvas2d.pas(935,65) Error: Incompatible type for arg no. 2: Got "{Open} Array Of TPointF", expected "{Open} Array Of TPointF"
  28. bgrapolygon.pas(473,11) Hint: Found declaration: FillPolyAliasedWithTexture(TBGRACustomBitmap;{Open} Array Of TPointF;IBGRAScanner;Boolean;TDrawMode);
  29. bgracanvas2d.pas(941,54) Error: Incompatible type for arg no. 2: Got "{Open} Array Of TPointF", expected "{Open} Array Of TPointF"
  30. bgrapolygon.pas(486,11) Hint: Found declaration: FillPolyAntialias(TBGRACustomBitmap;{Open} Array Of TPointF;TBGRAPixel;Boolean;Boolean;Boolean="FALSE");
  31. bgracanvas2d.pas(943,52) Error: Incompatible type for arg no. 2: Got "{Open} Array Of TPointF", expected "{Open} Array Of TPointF"
  32. bgrapolygon.pas(460,11) Hint: Found declaration: FillPolyAliased(TBGRACustomBitmap;{Open} Array Of TPointF;TBGRAPixel;Boolean;Boolean;TDrawMode);
  33. bgracanvas2d.pas(948,25) Error: function header doesn't match any method of this class "FillStrokePoly(const {Open} Array Of TPointF;Boolean);"
  34. bgracanvas2d.pas(127,15) Error: Found declaration: FillStrokePoly(const {Open} Array Of TPointF;Boolean);
  35. bgracanvas2d.pas(967,28) Error: Incompatible type for arg no. 1: Got "{Open} Array Of TPointF", expected "{Open} Array Of TPointF"
  36. bgrapolygon.pas(639,33) Hint: Found declaration: AddPolygon(const {Open} Array Of TPointF;IBGRAScanner);
  37. bgrapolygon.pas(632,33) Hint: Found declaration: AddPolygon(const {Open} Array Of TPointF;TBGRAPixel);
  38. bgracanvas2d.pas(975,32) Error: Incompatible type for arg no. 1: Got "{Open} Array Of TPointF", expected "{Open} Array Of TPointF"
  39. bgrapolygon.pas(639,33) Hint: Found declaration: AddPolygon(const {Open} Array Of TPointF;IBGRAScanner);
  40. bgrapolygon.pas(632,33) Hint: Found declaration: AddPolygon(const {Open} Array Of TPointF;TBGRAPixel);
  41. bgracanvas2d.pas(977,32) Error: Incompatible type for arg no. 1: Got "{Open} Array Of TPointF", expected "{Open} Array Of TPointF"
  42. bgrapolygon.pas(639,33) Hint: Found declaration: AddPolygon(const {Open} Array Of TPointF;IBGRAScanner);
  43. bgrapolygon.pas(632,33) Hint: Found declaration: AddPolygon(const {Open} Array Of TPointF;TBGRAPixel);
  44. bgracanvas2d.pas(980,72) Error: Incompatible type for arg no. 2: Got "TBGRAPixel", expected "IBGRAScanner"
  45. bgrapolygon.pas(639,33) Hint: Found declaration: AddPolygon(const {Open} Array Of TPointF;IBGRAScanner);
  46. bgrapolygon.pas(632,33) Hint: Found declaration: AddPolygon(const {Open} Array Of TPointF;TBGRAPixel);
  47. bgracanvas2d.pas(985,48) Error: Incompatible type for arg no. 1: Got "{Open} Array Of TPointF", expected "{Open} Array Of TPointF"
  48. bgrapen.pas(761,10) Hint: Found declaration: ComputeWidePolylinePoints(const {Open} Array Of TPointF;Single;TBGRAPixel;TFPPenEndCap;TFPPenJoinStyle;const TBGRAPenStyle;TBGRAPolyLineOptions;Single="2";TComputeArrowHeadProc="nil";Single="0";TComputeArrowHeadProc="nil";Single="0"):{Dynamic} Array Of TP
  49. bgracanvas2d.pas(994,31) Error: Incompatible type for arg no. 1: Got "{Dynamic} Array Of TPointF", expected "{Open} Array Of TPointF"
  50. bgrapolygon.pas(639,33) Hint: Found declaration: AddPolygon(const {Open} Array Of TPointF;IBGRAScanner);
  51. bgrapolygon.pas(632,33) Hint: Found declaration: AddPolygon(const {Open} Array Of TPointF;TBGRAPixel);
  52. bgracanvas2d.pas(1001,76) Error: Incompatible type for arg no. 2: Got "TBGRAPixel", expected "IBGRAScanner"
  53. bgrapolygon.pas(639,33) Hint: Found declaration: AddPolygon(const {Open} Array Of TPointF;IBGRAScanner);
  54. bgrapolygon.pas(632,33) Hint: Found declaration: AddPolygon(const {Open} Array Of TPointF;TBGRAPixel);
  55. bgracanvas2d.pas(1003,33) Error: Incompatible type for arg no. 1: Got "{Dynamic} Array Of TPointF", expected "{Open} Array Of TPointF"
  56. bgrapolygon.pas(639,33) Hint: Found declaration: AddPolygon(const {Open} Array Of TPointF;IBGRAScanner);
  57. bgrapolygon.pas(632,33) Hint: Found declaration: AddPolygon(const {Open} Array Of TPointF;TBGRAPixel);
  58. bgracanvas2d.pas(1005,48) Error: Incompatible type for arg no. 2: Got "{Dynamic} Array Of TPointF", expected "{Open} Array Of TPointF"
  59. bgracanvas2d.pas(142,15) Hint: Found declaration: DrawShadow(const {Open} Array Of TPointF;const {Open} Array Of TPointF);
  60. bgracanvas2d.pas(1007,40) Error: Incompatible type for arg no. 1: Got "{Open} Array Of TPointF", expected "{Open} Array Of TPointF"
  61. bgracanvas2d.pas(142,15) Hint: Found declaration: DrawShadow(const {Open} Array Of TPointF;const {Open} Array Of TPointF);
  62. bgracanvas2d.pas(1092,25) Error: function header doesn't match any method of this class "SetShadowOffset(const TPointF);"
  63. bgracanvas2d.pas(135,15) Error: Found declaration: SetShadowOffset(const TPointF);
  64. bgracanvas2d.pas(1129,25) Error: function header doesn't match any method of this class "StrokePoly(const {Open} Array Of TPointF);"
  65. bgracanvas2d.pas(141,15) Error: Found declaration: StrokePoly(const {Open} Array Of TPointF);
  66. bgracanvas2d.pas(1136,46) Error: Incompatible type for arg no. 1: Got "{Open} Array Of TPointF", expected "{Open} Array Of TPointF"
  67. bgrapen.pas(761,10) Hint: Found declaration: ComputeWidePolylinePoints(const {Open} Array Of TPointF;Single;TBGRAPixel;TFPPenEndCap;TFPPenJoinStyle;const TBGRAPenStyle;TBGRAPolyLineOptions;Single="2";TComputeArrowHeadProc="nil";Single="0";TComputeArrowHeadProc="nil";Single="0"):{Dynamic} Array Of TP
  68. bgracanvas2d.pas(1139,39) Error: Incompatible type for arg no. 1: Got "{Dynamic} Array Of TPointF", expected "{Open} Array Of TPointF"
  69. bgracanvas2d.pas(142,15) Hint: Found declaration: DrawShadow(const {Open} Array Of TPointF;const {Open} Array Of TPointF);
  70. bgracanvas2d.pas(1147,63) Error: Incompatible type for arg no. 2: Got "{Dynamic} Array Of TPointF", expected "{Open} Array Of TPointF"
  71. bgrapolygon.pas(499,11) Hint: Found declaration: FillPolyAntialiasWithTexture(TBGRACustomBitmap;{Open} Array Of TPointF;IBGRAScanner;Boolean;Boolean="FALSE");
  72. bgracanvas2d.pas(1149,61) Error: Incompatible type for arg no. 2: Got "{Dynamic} Array Of TPointF", expected "{Open} Array Of TPointF"
  73. bgrapolygon.pas(473,11) Hint: Found declaration: FillPolyAliasedWithTexture(TBGRACustomBitmap;{Open} Array Of TPointF;IBGRAScanner;Boolean;TDrawMode);
  74. bgracanvas2d.pas(1159,54) Error: Incompatible type for arg no. 2: Got "{Dynamic} Array Of TPointF", expected "{Open} Array Of TPointF"
  75. bgrapolygon.pas(486,11) Hint: Found declaration: FillPolyAntialias(TBGRACustomBitmap;{Open} Array Of TPointF;TBGRAPixel;Boolean;Boolean;Boolean="FALSE");
  76. bgracanvas2d.pas(1161,52) Error: Incompatible type for arg no. 2: Got "{Dynamic} Array Of TPointF", expected "{Open} Array Of TPointF"
  77. bgrapolygon.pas(460,11) Hint: Found declaration: FillPolyAliased(TBGRACustomBitmap;{Open} Array Of TPointF;TBGRAPixel;Boolean;Boolean;TDrawMode);
  78. bgracanvas2d.pas(1166,65) Error: Incompatible type for arg no. 2: Got "{Dynamic} Array Of TPointF", expected "{Open} Array Of TPointF"
  79. bgrapolygon.pas(499,11) Hint: Found declaration: FillPolyAntialiasWithTexture(TBGRACustomBitmap;{Open} Array Of TPointF;IBGRAScanner;Boolean;Boolean="FALSE");
  80. bgracanvas2d.pas(1168,63) Error: Incompatible type for arg no. 2: Got "{Dynamic} Array Of TPointF", expected "{Open} Array Of TPointF"
  81. bgrapolygon.pas(473,11) Hint: Found declaration: FillPolyAliasedWithTexture(TBGRACustomBitmap;{Open} Array Of TPointF;IBGRAScanner;Boolean;TDrawMode);
  82. bgracanvas2d.pas(1173,25) Error: function header doesn't match any method of this class "DrawShadow(const {Open} Array Of TPointF;const {Open} Array Of TPointF);"
  83. bgracanvas2d.pas(142,15) Error: Found declaration: DrawShadow(const {Open} Array Of TPointF;const {Open} Array Of TPointF);
  84. bgracanvas2d.pas(1186,29) Error: Incompatible type for arg no. 1: Got "TYPES.TPointF", expected "BGRABITMAPTYPES.TPointF"
  85. geometrytypes.inc(805,10) Hint: Found declaration: isEmptyPointF(const TPointF):Boolean;
  86. bgracanvas2d.pas(1204,13) Error: Incompatible types: got "BGRABITMAPTYPES.TPointF" expected "TYPES.TPointF"
  87. bgracanvas2d.pas(1225,15) Error: Incompatible types: got "BGRABITMAPTYPES.TPointF" expected "TYPES.TPointF"
  88. bgracanvas2d.pas(1234,51) Error: Incompatible type for arg no. 2: Got "TBGRAPixel", expected "IBGRAScanner"

My impression was that this problem has been fixed.

I am using Kubuntu 16.04 LTS 64bits.  BGRABitmap 8.92 download 29 June 2016.
Title: Re: BGRABitmap 8.9.2 fails to compile fpc-3.0.1
Post by: circular on July 05, 2016, 11:27:52 am
Yes it has been fixed.

http://forum.lazarus.freepascal.org/index.php/topic,30525.msg194295.html#msg194295

However it seems the proposed code checks for version 3.1.1 and maybe the changes in FreePascal was already in version 3.0.1.

What if you change VER3_1_1 by VER3_0_1 in the compiler directive before TPointF definition in geometrytypes.inc?
Title: Re: BGRABitmap 8.9.2 fails to compile fpc-3.0.1
Post by: Thaddy on July 05, 2016, 01:00:56 pm
Then plz check for equal or greater than... Instead of a particular version. ( {$IF Defined() >=}
Title: Re: BGRABitmap 8.9.2 fails to compile fpc-3.0.1
Post by: circular on July 05, 2016, 03:06:31 pm
I am not fluent with compiler directives. What do you suggest to write exactly?
Title: Re: BGRABitmap 8.9.2 fails to compile fpc-3.0.1
Post by: abtaylr on July 05, 2016, 04:59:38 pm
The change in the directive to VER3_0_1 works.
Title: Re: BGRABitmap 8.9.2 fails to compile fpc-3.0.1
Post by: circular on July 05, 2016, 05:06:16 pm
Cool.  :)
Title: Re: BGRABitmap 8.9.2 fails to compile fpc-3.0.1
Post by: abtaylr on July 05, 2016, 05:33:36 pm
Regarding the condition directive comments above.  I know I have seen that type of directive in some of the LCL or FCL units.  In a project that I am working on I found examples like this: {$define COMPILER_7_UP}{$define DELPHI_7_UP}{$define KYLIX_3_UP}, but I don't think that is what you want.  I'll look around for those that are more like the one in the comment from Thaddy.
Title: Re: BGRABitmap 8.9.2 fails to compile fpc-3.0.1
Post by: abtaylr on July 05, 2016, 05:39:21 pm
Oh, here's one that is getting close:

begin
  ...
 {$IF Defined(MY_DEFINE) and (LibVersion > 2.0) }
  Writeln(1);
 {$ELSE}
  Writeln(2); 

  ...
  {$IFEND}
 end;
Title: Re: BGRABitmap 8.9.2 fails to compile fpc-3.0.1
Post by: Thaddy on July 05, 2016, 07:04:08 pm
Oh, here's one that is getting close:
Very close ;)
Title: Re: BGRABitmap 8.9.2 fails to compile fpc-3.0.1
Post by: abtaylr on July 05, 2016, 09:01:18 pm
Read this link:  http://www.freepascal.org/docs-html/prog/progse5.html#x138-1390002.2.

I think the answer lies within that section and specifically this line:  The FPC_FULLVERSION macro contains a version number which always uses 2 digits for the RELEASE and PATCH version numbers. This means that version 2.3.1 will result in FPC_FULLVERSION=20301. This number makes it easier to determine minimum versions.
Title: Re: BGRABitmap 8.9.2 fails to compile fpc-3.0.1
Post by: marcov on July 05, 2016, 09:30:05 pm
Regarding the condition directive comments above.  I know I have seen that type of directive in some of the LCL or FCL units.  In a project that I am working on I found examples like this: {$define COMPILER_7_UP}{$define DELPHI_7_UP}{$define KYLIX_3_UP}, but I don't think that is what you want.  I'll look around for those that are more like the one in the comment from Thaddy.

(that style is only needed if you want to support Delphi from before $IF support. For newer Delphi components that is also overkill and $if's with version are better)
Title: Re: BGRABitmap 8.9.2 fails to compile fpc-3.0.1
Post by: abtaylr on July 05, 2016, 10:42:29 pm
Using the information from link above I changed geometrytypes.inc as follows:

Code: Pascal  [Select]
  1.   {$IFDEF FPC_FULLVERSION>=030001}
  2.   TPointF = Types.TPointF;
  3.   {$else}
  4.   TPointF = packed record x, y: single;
  5.   end;
  6.   {$endif}
  7.  
  8.   {$IFDEF FPC_FULLVERSION>=030001}
  9.   TRectF = Types.TRectF;
  10.   {$else}
  11.   TRectF =
  12.   {$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}
  13.   packed
  14.   {$endif FPC_REQUIRES_PROPER_ALIGNMENT}
  15.   record
  16.     case Integer of
  17.      0: (Left, Top, Right, Bottom: Single);
  18.      1: (TopLeft, BottomRight: TPointF);
  19.   end;
  20.   {$endif}

I opened the PackageInspector->Options->CustomOptions->All Options and selected '-Sm'. Then compiled successfully.
Title: Re: BGRABitmap 8.9.2 fails to compile fpc-3.0.1
Post by: circular on July 06, 2016, 12:50:27 am
Ok. Looking at the code I found another FPC_FULLVERSION test, and it did not require the option -Sm.

So I changed as follows:
Code: Pascal  [Select]
  1.   {$if FPC_FULLVERSION>=030001}
  2.   TPointF = Types.TPointF;
  3.   {$else}
  4.   TPointF = packed record x, y: single;
  5.   end;
  6.   {$endif}
  7.  
  8.   {$if FPC_FULLVERSION>=030001}
  9.   TRectF = Types.TRectF;
  10.   {$else}
  11.   TRectF =
  12.   {$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}
  13.   packed
  14.   {$endif FPC_REQUIRES_PROPER_ALIGNMENT}
  15.   record
  16.     case Integer of
  17.      0: (Left, Top, Right, Bottom: Single);
  18.      1: (TopLeft, BottomRight: TPointF);
  19.   end;
  20.   {$endif}  

Thanks everybody for your help. It feels good not to be alone in front of those compiler directives. :)
Title: Re: BGRABitmap 8.9.2 fails to compile fpc-3.0.1
Post by: abtaylr on July 16, 2016, 03:25:34 am
I just download BGRABitmap 9.0.0 from SourceForge and it is still showing the old code and not the new code discussed above, so upon compiling I am getting the 25 errors shown above.  I am changing the code in my version, but it doesn't look like SourceForge got the message . . . O:-)

Thx!
abt
Title: Re: BGRABitmap 8.9.2 fails to compile fpc-3.0.1
Post by: molly on July 16, 2016, 03:55:13 am
@abtaylr

I can confirm:
...
Maybe forgot ?


BGRABITMAP archive on sourceforge (https://sourceforge.net/projects/lazpaint/files/src/) is dated: 2016-07-01

The change in the source (https://github.com/bgrabitmap/lazpaint/commit/3b5572030c1c530bc98d56deee64f2a50e0102c6) is dated:  committed Jul 5, 2016

Which explains why it is not in release 9.0.o yet.
Title: Re: BGRABitmap 8.9.2 fails to compile fpc-3.0.1
Post by: circular on July 16, 2016, 09:08:47 am
Yes, changes are on Git first before they are released.

I did a release for you (9.1):
http://forum.lazarus.freepascal.org/index.php/topic,24239.msg216165.html#msg216165
Title: Re: BGRABitmap 8.9.2 fails to compile fpc-3.0.1
Post by: circular on July 18, 2016, 12:18:08 pm
Apologies for the delay. The fix has been released in version 9.1.
Title: Re: BGRABitmap 8.9.2 fails to compile fpc-3.0.1
Post by: Awesome Programmer on March 04, 2019, 06:03:49 am
I understand that this is an old post, but it appears that this issue or problem with BGRAControls has yet to be solved or NOT SOLVED at all. That's because I recently downloaded and installed BGRA components on Ubuntu from two different sources; SourceForge and github. At first, I installed the sourceforge bgra download, it complained about something about utf8lowercase and solved that issue after reading a post on that... https://forum.lazarus.freepascal.org/index.php?topic=33814.0 (https://forum.lazarus.freepascal.org/index.php?topic=33814.0) All I had to do was add LazUTF8 wherever BGRABitmap complained in its uses clause.

Then, when I finally got the BGRA component installed, I started to work on my code. When I compiled my code, BGRA complained again. This time something about Operators not being overloaded. That's when I went looking for a file (geometrytypes.inc). It turns out that file didn't even exist in the folder. In fact, half the files in the folders were missing. So, I got on Github website, searched for BGRA component, downloaded the zip file and examined it for the missing file. Sure enough it was in that download. Once I replaced my new bgrabitmap folder with the old one, I was Not only able to install BGRA component but also compile my code and run it after these changes.

Title: Re: BGRABitmap 8.9.2 fails to compile fpc-3.0.1
Post by: circular on March 04, 2019, 09:31:19 pm
I am not sure. Which file did you download on SourceForge?

Which error do you get with the version from GitHub ?