Recent

Author Topic: Assigning a TBitmap to a TBitmap32  (Read 11979 times)

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Assigning a TBitmap to a TBitmap32
« Reply #15 on: May 21, 2021, 06:31:35 pm »
First of all, can you use the latest version of Graphics32 version 2.0?

It is possible that, after you use LoadFromFile, the result is black. For instance:
Code: Pascal  [Select][+][-]
  1. procedure TCustomBitmap32.LoadFromFile(const FileName: string);
  2. ..
  3.     if (LoadFromBMPStream(FileStream, FileStream.Size)) then
  4.     begin
  5.       Changed;
  6.       exit;
  7.     end;
  8.  

LoadFromBMPStream has to return true. Of course in this same procedure it has more code:
Code: Pascal  [Select][+][-]
  1. {$ifndef COMPILERRX2_UP}
  2.   // Fallback to determing file format based on file type for Delphi 10.1. and older
  3.   // See issue #145
  4.   P := TPicture.Create;
  5.   try
  6.     P.LoadFromFile(FileName);
  7.     Assign(P);
  8.   finally
  9.     P.Free;
  10.   end;
  11. {$endif COMPILERRX2_UP}

The logical thing to do is to debug the code. It might be a missing call to "changed":
Code: Pascal  [Select][+][-]
  1.   FImage.Bitmap.changed;

Or you are using a WS that is not supported or has a bug.

Are you using GTK, GTK2, or CustomDrawn?

niotronic

  • New Member
  • *
  • Posts: 13
Re: Assigning a TBitmap to a TBitmap32
« Reply #16 on: May 22, 2021, 07:47:19 am »
Please find attached the DELPHI Project

niotronic

  • New Member
  • *
  • Posts: 13
Re: Assigning a TBitmap to a TBitmap32
« Reply #17 on: May 22, 2021, 07:48:12 am »
This is the Lazarus Project

niotronic

  • New Member
  • *
  • Posts: 13
Re: Assigning a TBitmap to a TBitmap32
« Reply #18 on: May 22, 2021, 07:59:03 am »
Would you like to tell me where to get Version 2.0 ? Github and Sourceforge only offer V1.9.1 fixes ?

BR
KL

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Assigning a TBitmap to a TBitmap32
« Reply #19 on: May 22, 2021, 02:59:56 pm »
Ah, I see. I am using the trunk:
Code: Pascal  [Select][+][-]
  1. const
  2.   Graphics32Version = '2.0.0 alpha';

Sorry   :-[

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: Assigning a TBitmap to a TBitmap32
« Reply #20 on: May 22, 2021, 04:12:44 pm »
Starting with  Windows 10, 64 bit, Laz-trunk/FPC3.2.0 (32 bit): Cloned the GR32 git repository (https://github.com/graphics32/graphics32, master branch). There are two Lazarus packages, a runtime and a designtime package. Compiled the runtime package --> fine. The designtime package is sett up to be installed only (not compiled), thus I rebuilt the IDE --> fails due to "Can't find GR32_Blend used by GR32"; seems to me that this is because the authors put both runtime and designtime units into the same folder... It took me some time until I found a way how to rebuild the IDE again, i forgot the steps.

Fortunately your project creates the TImage32 at runtime, and thus installation is not needed. But your package requirements contain a "GR32_L" package, rather than the GR32_Lazarus of the github package. Replaced it, your program compiles and runs. As expected, of course.

Went on to a VM with Ubuntu 20.04/64 bit. Cloned the repo again. Now even the runtime package refuses to compile, in some assembler part in procedure BlendMems_SS2 in unit GR32_BlendSSE2.... This issue was already posted in https://forum.lazarus.freepascal.org/index.php?topic=53095.0.

Giving up on the master branch, I moved on to the version distributed by OPM: the package now is the Pilot-Logic version, named pl_Graphics32. Compilation fails due to an error in  "Canvas.Brush.Color := clButton" -- this is due to the unknown clButton identifier. I wonder how anybody could compile this... Replacing this by clBtnFace (and, further down the same procedure, the clDisabledButtonText by clGray, and the clButtonText by clWindowText). Next issue is usage of unit Qt5Objects in GR32_Backends_LCL_Qt5 which does not exist, only a QtObjects (my IDE is compiled for qt5 here). Removing the "5" finally makes the package compile.

Testing your program I do see the black area where the bitmap appears on Windows - so, I confirm the issue. Switching to gtk2 widgetset - same issue.

Going to a notebook which has a 32 bit Linux. Now even the git master version compiles (after making the color changes). But in your demo I still see the black area where the Image32 is supposed to be.

Giving up for the moment. To summarize, I confirm the problem that you reported, but it seems to be a Linux issue in general, not just a 64-bit Linux issue as you write. And it is an issue which exists aöready in the github master version, not only in the PilotLogic version.

It is disappointing to see that the great Graphics32 package essentially is still Windows-only. Compilation issues with undefined identifiers remaining unnoticed indicates that there is little or no maintainance for non-Windows platforms. You should file a bug report on the GR32 github. But I have little hope that this bug will be fixed soon.

att2

  • Jr. Member
  • **
  • Posts: 52
Re: Assigning a TBitmap to a TBitmap32
« Reply #21 on: May 24, 2021, 12:41:36 pm »
I can confirm the issue on a Linux Mint 19 Tara VM with Lazarus 1.8.4 and FPC 3.2.0b1.
When I use the Online Package Manager and when I compile the "pl_Graphics32" libaray, I get the compiling error :

Quote
Compile package pl_Graphics32 7.2.1: Exit code 256, Errors: 1, Hints: 2
Hint: Start of reading config file /home/arm1/fpc2/fpc/bin/x86_64-linux/fpc.cfg
Hint: End of reading config file /home/arm1/fpc2/fpc/bin/x86_64-linux/fpc.cfg
Verbose: Free Pascal Compiler version 3.2.0-beta-r20:39835 [2018/10/17] for aarch64
Verbose: Copyright (c) 1993-2018 by Florian Klaempfl and others
Verbose: Target OS: Linux for AArch64
Verbose: Compiling pl_graphics32.pas
Verbose: Compiling ./source/AllGR32Register.pas
Verbose: Compiling ./source/GR32.pas
/home/arm1/fpc2/config_lazarus/onlinepackagemanager/packages/ct4laz/pl_components/pl_graphics32/source/GR32.inc(48,6) Error: Illegal assembler style specified "INTEL"
Verbose: Compiling ./source/GR32_AllStrings.pas
/home/arm1/fpc2/config_lazarus/onlinepackagemanager/packages/ct4laz/pl_components/pl_graphics32/source/GR32_AllStrings.pas(82,1) Verbose: There were 1 errors compiling module, stopping
Verbose: Compilation aborted
Verbose: /home/arm1/fpc2/fpc/bin/x86_64-linux/ppcrossa64 returned an error exitcode

I am trying to cross-compile for aarch64 in this case. So it seems if I have a project that cross-compiles for a Raspberry-Pi-Clone, I simply cannot do this?




wp

  • Hero Member
  • *****
  • Posts: 11923
Re: Assigning a TBitmap to a TBitmap32
« Reply #22 on: May 24, 2021, 01:06:30 pm »
It is my impression that Graphics32 works correctly only on Windows, at least unless there is nobody who really takes care of it on other platforms.

Handoko

  • Hero Member
  • *****
  • Posts: 5159
  • My goal: build my own game engine using Lazarus
Re: Assigning a TBitmap to a TBitmap32
« Reply #23 on: May 24, 2021, 02:28:30 pm »
I just tested Graphics32 on Linux. I opened some of the examples, all were buggy on Ubuntu Mate 64-bit.

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Assigning a TBitmap to a TBitmap32
« Reply #24 on: May 24, 2021, 03:36:13 pm »
Use BGRAbitmap and BGRAcontrols.

Errors are seldom and quick solved.

Winni

 

TinyPortal © 2005-2018