Forum > LCL

Timage in V2.2

<< < (4/4)

wp:

--- Quote from: Sage on April 26, 2022, 07:13:24 am ---I have done some comparison between the unit form files to see what the difference is. When I set the same image in both Lazarus versions I get different raw data for the Picture.Data in the unit1.lfm file.

--- End quote ---
Looking at the source code of TPicture.ReadData which extracts the image from the Picture.Data entry in the lfm file, I see that the streams begins with the class name of the graphic contained:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TPicture.ReadData(Stream: TStream);var  GraphicClassName: Shortstring;  ...begin  Stream.Read(GraphicClassName[0], 1);  Stream.Read(GraphicClassName[1], length(GraphicClassName));  ...
Knowing this I can write a little program which converts the first line of the lfm's Picture.Data to some human-readable text:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.FormCreate(Sender: TObject);const//  hex: String = '1754506F727461626C654E6574776F726B47726170686963D108000089504E47';  hex: String = '0B54496D6167696E67504E4789504E470D0A1A0A0000000D4948445200000040';var  s: String;  i, j, n: Integer;begin  s := '';  i := 3;  while i < Length(hex) do  begin    s := s + char(StrToInt('$' + hex[i] + hex[i+1]));    inc(i, 2);  end;  Caption := s;end;From here I see that the file written by Laz 2.0.6. begins with the identification "TPortableNetworkGraphic" - the standard LCL class for PNG images. The file written by Laz 2.2.0, however, begins with the identification of "TImagingPNG". This class belongs to some other imaging library, possibly VampyreImaging, which is not installed by default.

Therefore, I am rather sure that your issue is due to some third-party graphics libary installed in one of your Laz installations taking over handling of PNG images in an incompatible way. For further investigation, tell me which graphics-related packages are installed in your Laz 2.2.0 and 2.0.6.

Navigation

[0] Message Index

[*] Previous page

Go to full version