Recent

Author Topic: FPC 3.2.0 FortesCE Error "Bitmap with unknow compression (8192)"  (Read 766 times)

patyit

  • New member
  • *
  • Posts: 8
Hi all !

I'm testing my production "big" project with Lazarus Fixes 2.0.9 and FPC Fixes 3.2.0, and until now is good, but when I want to print preview in FortesCE 4.0 got an error with JEPG image printing "Bitmap with unknown compression (8192)" in the fallowing FortesCE RLMetaVCL.pas unit, procedure FromMetaGraphic :

Code: Pascal  [Select][+][-]
  1. function FromMetaGraphic(const ASource: String): TGraphic;
  2. var
  3.   S: TStringStream;
  4.   T: String;
  5. begin
  6.   if ASource = '' then
  7.     Result := nil
  8.   else
  9.   begin
  10.     S := TStringStream.Create(ASource);
  11.     try
  12.       S.Seek(0, soFromBeginning);
  13.       T := S.ReadString(3);
  14.       if T = 'NIL' then
  15.         Result := nil
  16.       else if T = 'BMP' then
  17.         Result := TRLBitmap.Create
  18.       else if T = 'ICO' then
  19.         Result := TIcon.Create
  20.       else
  21.         Result := nil;
  22.       if Assigned(Result) then
  23.         Result.LoadFromStream(S); //<-- "Bitmap with unknown compression (8192)"
  24.     finally
  25.       S.free;
  26.     end;
  27.   end;
  28. end;
  29.  

The interesting is that the code is running perfect good with Lazatus Fixes 2.0.9 and FPC Fixes 3.0.5 ! Something is changed in FPC with StringStream loading ?
Have someone any suggestion to solve this issue ?

Thanks, Patyi.

XUbuntu 64 bit OS.
« Last Edit: April 21, 2020, 05:04:32 pm by patyit »

zeljko

  • Hero Member
  • *****
  • Posts: 1147
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: FPC 3.2.0 FortesCE Error "Bitmap with unknow compression (8192)"
« Reply #1 on: April 21, 2020, 05:16:58 pm »
Maybe you should open an issue on fpc bugtracker before 3.2.0 is out

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 8730
  • FPC developer.
Re: FPC 3.2.0 FortesCE Error "Bitmap with unknow compression (8192)"
« Reply #2 on: April 21, 2020, 05:24:45 pm »
Or have fortesCE debug it first. It is strange that you check for bmp and ico, but get an JPG error.

patyit

  • New member
  • *
  • Posts: 8
Re: FPC 3.2.0 FortesCE Error "Bitmap with unknow compression (8192)"
« Reply #3 on: April 22, 2020, 08:35:11 am »
Hi all !
I found on FPC 3.2.0 RC1 change log witch may break compatibility, where :

Code: Text  [Select][+][-]
  1. Classes TStrings.LoadFromStream/File encoding handling
  2.  
  3.     Old behaviour: The LoadFromStream call totally ignored the encoding of a file, loading it from a stream without regard for encoding, unless an encoding was specified.
  4.     New behaviour: There is an overloaded call with a Boolean parameter 'IgnoreEncoding' which determines whether the encoding should be taken into account or not. By default, this parameter is False, meaning that LoadFromStream with just a stream as argument now calls the encoding-aware version of LoadFromStream, passing it an encoding of Nil, which mean the default encoding will be used.
  5.     Reason for change: Delphi compatibility, and the corresponding changes in TStringStream constructors.
  6.     Remedy: The old behaviour can be restored by setting the IgnoreEncoding parameter to 'True'.
  7.     svn: 37962 and 37965
  8.  
  9. TStringStream now observes system encoding
  10.  
  11.     Old behaviour: TStringStream copied bytes as-is from the string specified in the constructor.
  12.     New behaviour: Now bytes are fetched from the string using the encoding of the string.
  13.     Reason: Delphi-compatibility
  14.     Remedy: Pass a string with the correct encoding to TStringStream
  15.     svn: 36758
  16.  

There is mentioned the overloaded call with a Boolean parameter 'IgnoreEncoding'.
Not clear how to call/write code segment in my first post in context of this, I'm not find parameter 'IgnoreEncoding', witch haw to set to False !
« Last Edit: April 22, 2020, 08:42:13 am by patyit »

RayoGlauco

  • Full Member
  • ***
  • Posts: 108
  • Beers: 1567
Re: FPC 3.2.0 FortesCE Error "Bitmap with unknow compression (8192)"
« Reply #4 on: April 22, 2020, 08:55:35 am »
It's only a guess: may this code work?
Code: Pascal  [Select][+][-]
  1. Result.LoadFromStream(S, False);
To err is human, but to really mess things up, you need a computer.

patyit

  • New member
  • *
  • Posts: 8
Re: FPC 3.2.0 FortesCE Error "Bitmap with unknow compression (8192)"
« Reply #5 on: April 22, 2020, 10:05:44 am »
I think we have to do something with :
Code: Pascal  [Select][+][-]
  1. S := TStringStream.Create(ASource, TEncoding.ANSI, True); // or False
  2. or
  3. S := TStringStream.Create(ASource, TEncoding.ASCII, True); // or False
  4.  
Unfortunately not solve the problem, but I have filing that the encoding is wrong !
Or I'm trying to solve something on totally wrong mode and on wrong place ...

 

TinyPortal © 2005-2018