Recent

Recent Posts

Pages: 1 ... 8 9 [10]
91
Graphics / Re: Read 1 bit tiff file
« Last post by winni on October 20, 2019, 12:40:28 pm »
Hi!

Use the ImageMagick package. You don't need to download anything.
It is installed in the fpc sources in /packages/imagemagick/

Documentation at https://wiki.freepascal.org/PascalMagick

Winni
92
Beginners / Re: Simple way to inspect complex/array variable on the command line?
« Last post by simone on October 20, 2019, 12:22:37 pm »
In order to show a complex data structure (for example an array of string) in a comfortable way, a possible solution is to define a type helper, as in the following code:

Code: Pascal  [Select]
  1. program Project1;
  2. {$mode objfpc}{$H+}
  3. {$MODESWITCH TYPEHELPERS}
  4.  
  5. uses
  6.   Classes,SysUtils;
  7. type
  8.  
  9.   { TStringArrayHelper }
  10.  
  11.   TStringArrayHelper=type helper for TStringArray
  12.     procedure WriteStrArr;
  13.   end;
  14.  
  15. var
  16.   L : TStringArray;
  17.  
  18. { TStringArrayHelper }
  19.  
  20. procedure TStringArrayHelper.WriteStrArr;
  21. var
  22.   S : string;
  23. begin
  24.   for S in Self do
  25.     writeln(S);
  26. end;
  27.  
  28. begin
  29.   L:=TStringArray.Create('aaa','bbb','ccc');
  30.   L.WriteStrArr;
  31.   readln;
  32. end.
93
Graphics / Re: Read 1 bit tiff file
« Last post by circular on October 20, 2019, 12:05:03 pm »
There is no support for it in BGRABitmap and as far as I can see Vampyre Imagine Library doesn't either. On the other hand LibTIFF seem to read it.

Or you can try and write the decoding function from the documentation. I guess I found the specifications:
https://www.itu.int/rec/T-REC-T.6-198811-I/en

The decoding function basically would take a memory block as parameter (pointer and size) and return a new memory block.
94
Linux / Re: Ubuntu 19.10 and libgdk
« Last post by Handoko on October 20, 2019, 11:51:52 am »
I've just upgraded my Ubuntu Mate to version 19.10. So far, everything seems to works correctly. But only 1 issue which if I remember correctly it already happened since version 18.10:

https://forum.lazarus.freepascal.org/index.php/topic,46771.msg336414.html

Do you experience similar issue when running program that has TOpenGLControl? It only happens if I run it from the Lazarus IDE.

Back to the topic. I checked my system and I found I do not have libgdk-x11 installed too. But I still can do debugging in Lazarus. Is libgdk-x11 really needed?
95
General / Re: XMailer Installation Failure
« Last post by wp on October 20, 2019, 10:24:19 am »
There is another solution: Just copy the files ssl_openssl.pas and ssl_openssl_lib.pas from the synapse directory to the directory xmailer/src.

And a better solution for the laz_synapse_ssl package which avoids sharing the same directory with the main laz_synapse files which may lead to compilation problems: Put laz_synapse_ssl.lpk into a separate directory and copy the units ssl_openssl.pas and ssl_openssl_lib.pas there, too. I am attaching a zip for this solution: Just unzip the files to any folder, open the lpk file in "Package" > "Open Package File" and click "Compile".
96
LCL / Re: TLabel: Autosize error with some UTF8 glyphs
« Last post by Martin_fr on October 20, 2019, 10:21:38 am »
Mystery solved. UTF-8 is not so easy. I found the related block for the    ⃤  .
It is "U+20D0..U+20FF Combining Diacritical Marks for Symbols".
All this glyphs have a width = 0. They are intended not to move forward while writing like
the "dead letters" on the keyboard.

Hence I pointed out "combining".

It may depend on the font what exactly it can combine with... I would have expected it to combine with a space. But then it may not.
97
Graphics / Re: Read 1 bit tiff file
« Last post by trev on October 20, 2019, 10:00:08 am »
> compression CCITT Group 4 fax encoding not supported yet

I suspect it means what it says.
98
Graphics / Read 1 bit tiff file
« Last post by SteenJorgensen on October 20, 2019, 09:48:46 am »
I have a problem reading a 1.bit compress tiff file.


Using IntfGraphics, FPReadTiff, FPWriteTiff units.
My code is:
Code: Pascal  [Select]
  1.     img := TLazIntfImage.Create(0,0);
  2.     img.DataDescription := GetDescriptionFromDevice(0);
  3.     rt := TFPReaderTiff.create;
  4.     img.LoadFromFile(FileName,rt);
  5.     Image2.Picture.Bitmap.LoadFromIntfImage(img);
  6.     rt.free;
  7.     img.free;
  8.  

I get this excpetion:
compression CCITT Group 4 fax encoding not supported yet at position 59222

How to read this???
99
General / Re: Forcing TVector To Copy Construct
« Last post by Thaddy on October 20, 2019, 09:02:03 am »
Unless you want a true copy of a living object that has already been manipulated, there is no need to mimic a copy constructor in Object Pascal.
100
General / Forcing TVector To Copy Construct
« Last post by del on October 20, 2019, 08:54:50 am »
I have this utility that reads a file into a TStringList (bandList) and then populates an array to be used as a lookup table (lut) to cross reference YouTube ID with the band that's in the video. Simple enough - but I wanted to try TVector. The problem was that every time I "pushed back" new stuff, all the old stuff then pointed to (referenced) the new stuff. So I ended up with a table entirely populated with the last stuff entered. Not cool.

I read somewhere that std::vector automatically calls the copy constructor when objects are "pushed back". I was not seeing this behavior with TVector. So I put copy constructors where the objects would normally go and now every entry stays the way it was when first entered. MStr0D and VStr0D are just classes that contain UnicodeString and TVector and have functions which manage the member variables. "lut" is an instance of a class that manages a TVector of VStr0D. At any rate the main idea is to force copy construction during TVector push back.

Code: Pascal  [Select]
  1. for i := 0 to numBands - 1 do
  2. begin
  3.   tmpArr.Clear;
  4.   tmpStr.Assign(bandList[i]);
  5.   tmpStr.Extract('_', ':'); //extracts YouTube ID
  6.   tmpArr.PushBack(MStr0D.Copy(tmpStr)); //copy constructor as parameter
  7.   tmpStr.Assign(bandList[i]);
  8.   tmpStr.Extract('"', '"'); //extracts band name
  9.   tmpArr.PushBack(MStr0D.Copy(tmpStr));
  10.   lut.PushBack(VStr0D.Copy(tmpArr)); //copy constructor as parameter
  11. end;
  12.  

This was driving me crazy but I learned stuff. Here's the last few rows of the result.

Quote
1899 lut.V1D[1899].V0D[0].S0D 43434 oIIxlgcuQRU lut.V1D[1899].V0D[1].S0D 87943 Yeah Yeah Yeahs
1900 lut.V1D[1900].V0D[0].S0D 21024 vo4rbhR_vsk lut.V1D[1900].V0D[1].S0D 87466 Yeasayer
1901 lut.V1D[1901].V0D[0].S0D 37200 MVVsUMNMgLg lut.V1D[1901].V0D[1].S0D 65296 Yellow Days
1902 lut.V1D[1902].V0D[0].S0D 44829 -OB0PJEreus lut.V1D[1902].V0D[1].S0D 14347 Yo La Tengo
1903 lut.V1D[1903].V0D[0].S0D 81989 UIkMeaAfIRw lut.V1D[1903].V0D[1].S0D 14427 Yo La Tengo
1904 lut.V1D[1904].V0D[0].S0D 31283 O9VzggHUzMo lut.V1D[1904].V0D[1].S0D 18929 Yolks, The
1905 lut.V1D[1905].V0D[0].S0D 74755 ni4DHoNmnsI lut.V1D[1905].V0D[1].S0D 12977 You Am I
1906 lut.V1D[1906].V0D[0].S0D 30465 blNCvZG_LT4 lut.V1D[1906].V0D[1].S0D 18158 Young Marble Giants
1907 lut.V1D[1907].V0D[0].S0D 58282 hxvZ65K2IA4 lut.V1D[1907].V0D[1].S0D 33707 Young Prisms
1908 lut.V1D[1908].V0D[0].S0D 85286 tbG-wR-oXq8 lut.V1D[1908].V0D[1].S0D 44343 Young, The
1909 lut.V1D[1909].V0D[0].S0D 64935 Ta3OsyNCuvs lut.V1D[1909].V0D[1].S0D 4229 Zella Day

Each MStr0D object was given a random number (0 to 99999) during its construction so I could track it. I like it but I'm definitely open to other approaches (that specifically use TVector), comments regarding nuances, leaks, ownership, etc.


Pages: 1 ... 8 9 [10]