Recent

Author Topic: How to install image library for freepascal on linux?  (Read 12730 times)

barracuda

  • Full Member
  • ***
  • Posts: 133
Finally I managed to install the fpc, fpc-src and lazarus-project packages
« Reply #30 on: August 10, 2023, 11:54:15 am »
Finally!
So I wanted to uninstall all and then I have found that there is fp-src 2.0 or something like that still installed. So I uninstalled it and then I could run the newer version install from .deb file. But it told me that this version is already installed so I aborted the install and then I could not to install lazarus newer version. I tried gdebi, apt purge, apt remove, apt reinstall, apt  --fix-broken etc. etc. Then chatGPT helped. It suggested first that I should update the packages. I said no!!! And then I copied the my tries from terminal and the commands and errors and he suggested dpkg -i which ignore dependencies. I think that the was nothing broken or missing I just needed to install the newer version but the system with apt it had seen the lower version like fp-src-2.0 or something like that.

I'd like to try your links or project you suggested on the beginning of the thread. I need to create my own viewer for images very simple and easy, I will explain. May you help me? I need an image of size like 1200x1200 to resize to fit my screen which is 800x600 and to display edit box with the file name. The trick I need to do is that I need to open files from terminal like in an array img1 img2 img3 etc.

barracuda

  • Full Member
  • ***
  • Posts: 133
[solved] Configuration update
« Reply #31 on: August 10, 2023, 08:33:43 pm »
Solved. I updated the config but selection Update button.

I can run the Lazarus, but maybe it starts with old config. It seems that I should do apt purge after I uninstalled old version. This is the message I got when I start Lazarus

[Invalid Configuration Directory Found]

Welcome to Lazarus.
The discovered IDE Configuration has previously been used by a different Lazarus installation.
If you have two or more separate Lazarus installations, these installations should not share the same configuration. This could lead to conflicts and make your Lazarus installations unstable.

If you have only one installation and have copied/moved the Lazarus executable file, you can update this configuration.
If you intend to use two different versions of Lazarus, you must launch the second version with the command-line parameter primary-config-path or pcp.

For example:
/usr/share/lazarus/2.2.6/startlazarus --pcp=~/.lazarus_test

Choose:
%:s* Update Information: Use this configuration and update it for future use with Lazarus. The old installation will no longer use it.

    Ignore: Use this configuration but keep the warning. This could lead to conflicts with other installations.
    Cancel: Exit right now. You can resolve the issue by launching Lazarus with the correct configuration afterward.

Additional Information:
This configuration is for: /home/user/.lazarus
Belongs to the Lazarus installation in /usr/lib/lazarus/2.0.6/lazarus-gtk2
The current IDE was launched from: /usr/share/lazarus/2.2.6/lazarus

« Last Edit: August 10, 2023, 08:45:58 pm by barracuda »

barracuda

  • Full Member
  • ***
  • Posts: 133
Re: How to install image library for freepascal on linux?
« Reply #32 on: August 10, 2023, 09:18:22 pm »
Can you help me how to control the Lazarus?
I just cannot grasp it. I tried to compile project downloaded from forum.
I see two lines highlited one is green background and one is violet background.
But I could not do anything because the menu of Lazarus was suspended.
So I had to kill lazarus because I could not control it. Only thing I could do
is to move the windows or switch between them.

But I also could not found what hotkeys to be used to hide Messages window,
which when I want to read the messages takes 2/3 of my screen so I see like 2 lines of the code. Hence I need to close the Messages Window or do display it instead of having both windows (Source Code and the Messages) open.

Also what is hotkey to run the app after compilation. Thank you.

PS: I tried to compile this https://forum.lazarus.freepascal.org/index.php/topic,37242.msg252828.html#msg252828
from hondako.

Handoko

  • Hero Member
  • *****
  • Posts: 5558
  • My goal: build my own game engine using Lazarus
Re: How to install image library for freepascal on linux?
« Reply #33 on: August 11, 2023, 04:26:08 am »
I remember you said your screen resolution was 800x600. That is too low, you will have difficult time working in Lazarus using low resolution setting. Can you increase the resolution?

... But I could not do anything because the menu of Lazarus was suspended.
So I had to kill lazarus because I could not control it.

I am not sure what happened. Can you provide a screenshot?

Also what is hotkey to run the app after compilation. Thank you.

These are the common used hotkeys:
F9            = run
Ctrl+Shift+F9 = run without debugging
F2            = stop
Ctrl+F9       = compile
Shift+F9      = build
F12           = toogle unit/form view
F11           = object inspector



barracuda

  • Full Member
  • ***
  • Posts: 133
Re: How to install image library for freepascal on linux?
« Reply #34 on: August 12, 2023, 12:51:51 am »
Changing resolution on VM is complicated. The screen resolution of my display is not supported on VM.

I can work with it. It is a slower solution needing a patience. I need to switch manually between windows and that is a bit pissing.

Handoko

  • Hero Member
  • *****
  • Posts: 5558
  • My goal: build my own game engine using Lazarus
Re: How to install image library for freepascal on linux?
« Reply #35 on: August 12, 2023, 11:25:57 am »
I need to create my own viewer for images very simple and easy, I will explain. May you help me? I need an image of size like 1200x1200 to resize to fit my screen which is 800x600 and to display edit box with the file name. The trick I need to do is that I need to open files from terminal like in an array img1 img2 img3 etc.

I quickly wrote a demo. I haven't tested it thoroughly, it may contain bugs.

Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, LCLType,
  9.   ExtDlgs, ExtCtrls;
  10.  
  11. type
  12.  
  13.   TInfo = record
  14.     Name:  string;
  15.     Image: TImage;
  16.   end;
  17.  
  18.   { TForm1 }
  19.  
  20.   TForm1 = class(TForm)
  21.     Button1: TButton;
  22.     Image1:  TImage;
  23.     Label1:  TLabel;
  24.     OpenPictureDialog1: TOpenPictureDialog;
  25.     procedure Button1Click(Sender: TObject);
  26.     procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
  27.     procedure FormCreate(Sender: TObject);
  28.     procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  29.     procedure FormResize(Sender: TObject);
  30.   private
  31.     Index:     Integer;        // Index of the image currently showing
  32.     Data:      array of TInfo; // Loaded image data and their names
  33.     isViewing: Boolean;
  34.     procedure CenterFilename;
  35.     procedure ShowLoadedImage;
  36.   end;
  37.  
  38. var
  39.   Form1: TForm1;
  40.  
  41. implementation
  42.  
  43. {$R *.lfm}
  44.  
  45. { TForm1 }
  46.  
  47. procedure TForm1.CenterFilename;
  48. begin
  49.   Label1.AutoSize  := False;
  50.   Label1.Alignment := taCenter;
  51.   Label1.Left      := 0;
  52.   Label1.Width     := Form1.Width;
  53. end;
  54.  
  55. procedure TForm1.ShowLoadedImage;
  56. var
  57.   Count: Integer;
  58. begin
  59.   Count := Length(Data);
  60.   if Count <= 0 then Exit;
  61.   if Index > Count-1 then Exit;
  62.   Image1.Picture.Assign(Data[Index].Image.Picture);
  63.   Label1.Caption := Data[Index].Name;
  64.   CenterFilename;
  65. end;
  66.  
  67. procedure TForm1.Button1Click(Sender: TObject);
  68. begin
  69.   if not(OpenPictureDialog1.Execute) then Exit;
  70.   try
  71.     Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
  72.     Button1.Visible     := False;
  73.     Label1.Caption      := ExtractFileName(OpenPictureDialog1.FileName);
  74.     isViewing           := True;
  75.     CenterFilename;
  76.   except
  77.     ShowMessage('Cannot open the file.');
  78.   end;
  79. end;
  80.  
  81. procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState
  82.   );
  83. begin
  84.   case Key of
  85.     VK_ESCAPE: // Exit program
  86.       Close;
  87.     VK_F5:     // Background color
  88.       case Color of
  89.         clDefault: Color := clBlack;
  90.         clBlack:   Color := clGray;
  91.         clGray:    Color := clWhite;
  92.         clWhite:   Color := clDefault;
  93.         else       Color := clDefault;
  94.       end;
  95.     VK_F6:     // Info color;
  96.       case Label1.Font.Color of
  97.         clDefault: Label1.Font.Color := clBlack;
  98.         clBlack:   Label1.Font.Color := clGray;
  99.         clGray:    Label1.Font.Color := clWhite;
  100.         clWhite:   Label1.Font.Color := clYellow;
  101.         clYellow:  Label1.Font.Color := clRed;
  102.         clRed:     Label1.Font.Color := clBlue;
  103.         clBlue:    Label1.Font.Color := clDefault;
  104.         else       Label1.Font.Color := clDefault;
  105.         end;
  106.     VK_F7:     // Proportinal stretch
  107.       Image1.Proportional := not(Image1.Proportional);
  108.     VK_F8:     // Fullscreen modes
  109.       case WindowState of
  110.         wsNormal:     WindowState := wsMaximized;
  111.         wsMaximized:  WindowState := wsFullScreen;
  112.         wsFullScreen: WindowState := wsNormal;
  113.       end;
  114.     VK_LEFT:   // Show preview image
  115.       begin
  116.         Dec(Index);
  117.         if Index < 0 then
  118.           Index := Length(Data)-1;
  119.         ShowLoadedImage;
  120.       end;
  121.     VK_RIGHT,
  122.     VK_SPACE:  // Show next image
  123.       begin
  124.         Inc(Index);
  125.         if Index >= Length(Data) then
  126.           Index := 0;
  127.         Image1.Proportional := True;
  128.         Image1.Stretch      := True;
  129.         Image1.Align        := alClient;
  130.         Button1.Visible     := False;
  131.         ShowLoadedImage;
  132.       end;
  133.   end;
  134. end;
  135.  
  136. procedure TForm1.FormResize(Sender: TObject);
  137. begin
  138.   if isViewing then
  139.     CenterFilename;
  140. end;
  141.  
  142. procedure TForm1.FormCreate(Sender: TObject);
  143. var
  144.   Tmp:   TImage;
  145.   Count: Integer;
  146.   i:     Integer;
  147. begin
  148.  
  149.   Constraints.MinHeight := 240;
  150.   Constraints.MinWidth  := 320;
  151.   KeyPreview            := True;
  152.   Caption               := 'Image Viewer';
  153.   Button1.Caption       := 'Open';
  154.   Image1.Proportional   := True;
  155.   Image1.Stretch        := True;
  156.   Image1.Align          := alClient;
  157.   Index                 := 0;
  158.   isViewing             := False;
  159.  
  160.   // Try to load images using names supplied by parameter string
  161.   for i := 1 to ParamCount do
  162.   begin
  163.     Tmp := TImage.Create(nil);
  164.     try
  165.       Tmp.Picture.LoadFromFile(ParamStr(i));
  166.       Count := Length(Data);
  167.       Inc(Count);
  168.       SetLength(Data, Count);
  169.       Data[Count-1].Image := TImage.Create(nil);
  170.       Data[Count-1].Image.Picture.Assign(Tmp.Picture);
  171.       Data[Count-1].Name := ParamStr(i);
  172.     finally
  173.       Tmp.Free;
  174.     end;
  175.   end;
  176.  
  177.   if Length(Data) > 0 then // Managed to load some images
  178.   begin
  179.     isViewing := True;
  180.     ShowLoadedImage;
  181.   end;
  182.  
  183. end;
  184.  
  185. procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction);
  186. var
  187.   i: Integer;
  188. begin
  189.   if Length(Data) <= 0 then Exit;
  190.   for i := 0 to Length(Data)-1 do
  191.     Data[i].Image.Free;
  192.   SetLength(Data, 0);
  193. end;
  194.  
  195. end.

It supports command line parameter, so you can run from terminal passing the file names. There are 3 images in the attachment for testing. So you can run it by doing this in the termninal:
./project1 img1.jpg img2.jpg img3.jpg

It uses TImage for beginner friendly reason, see line #15. For serious usage, you should use other more lightweight alternative which also has better file format support for example FPImage, but the code will be a bit more trickly if you're not familiar with graphics programming.

barracuda

  • Full Member
  • ***
  • Posts: 133
Re: How to install image library for freepascal on linux?
« Reply #36 on: August 12, 2023, 07:11:11 pm »
Hello friend,
thank you much for your afford. Will you have a patience with me? Before you have created the project I have started to learn with one demo from you and I would like to ask you new question about that project, which I have modified to resize image. So I will create new demo, I will pack the directory and upload it.

barracuda

  • Full Member
  • ***
  • Posts: 133
Re: How to install image library for freepascal on linux?
« Reply #37 on: August 14, 2023, 10:16:27 pm »
It uses TImage for beginner friendly reason, see line #15. For serious usage, you should use other more lightweight alternative which also has better file format support for example FPImage, but the code will be a bit more trickly if you're not familiar with graphics programming.

Once again thank you. I think that the code tries to load all the images? So if I have RGB 1024x1024 it will consume a lot of memory. I am running low RAM because of Firefox and Lazarus.


Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormCreate(Sender: TObject);
  2. var
  3.   Tmp:   TImage;
  4.   Count: Integer;
  5.   i:     Integer;
  6. begin
  7.  
  8.   Constraints.MinHeight := 600;
  9.   Constraints.MinWidth  := 800;
  10.   KeyPreview            := True;
  11.   Caption               := 'Image Viewer';
  12.   Button1.Caption       := 'Open';
  13.   Image1.Proportional   := True;
  14.   Image1.Stretch        := True;
  15.   Image1.Align          := alClient;
  16.   Index                 := 0;
  17.   isViewing             := False;
  18.  
  19.   // Try to load images using names supplied by parameter string
  20.   for i := 1 to ParamCount do
  21.   begin
  22.     Tmp := TImage.Create(nil);
  23.     try
  24.       Tmp.Picture.LoadFromFile(ParamStr(i));
  25.       Count := Length(Data);
  26.       Inc(Count);
  27.       SetLength(Data, Count);
  28.       Data[Count-1].Image := TImage.Create(nil);
  29.       Data[Count-1].Image.Picture.Assign(Tmp.Picture);
  30.       Data[Count-1].Name := ParamStr(i);
  31.     finally
  32.       Tmp.Free;
  33.     end;
  34.   end;
  35.  
  36.   if Length(Data) > 0 then // Managed to load some images
  37.   begin
  38.     isViewing := True;
  39.     ShowLoadedImage;
  40.   end;
  41. end;
  42.  

My idea was to load the list of files, not the list of images. But I can experiment with it to change it.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12948
  • FPC developer.
Re: How to install image library for freepascal on linux?
« Reply #38 on: August 14, 2023, 11:07:34 pm »
Quote
RGB 1280x1024

3.75 MB. That means 270 images or so per GB of memory. How many do you have on that command line !?!?


barracuda

  • Full Member
  • ***
  • Posts: 133
Re: How to install image library for freepascal on linux?
« Reply #39 on: August 15, 2023, 12:45:58 am »
Quote
RGB 1280x1024

3.75 MB. That means 270 images or so per GB of memory. How many do you have on that command line !?!?

It depends on how many I will download. Probably up to 50 images. I have very small amount of memory. It can be like 250 MB when it is alarming. 150 is almost critical.
« Last Edit: August 15, 2023, 12:48:46 am by barracuda »

barracuda

  • Full Member
  • ***
  • Posts: 133
Re: How to install image library for freepascal on linux?
« Reply #40 on: August 15, 2023, 12:49:14 am »
I quickly wrote a demo. I haven't tested it thoroughly, it may contain bugs.

Why the image when I open it exactly fits the height? I see .Width is 800 which is nonsense because the height is 600 and the image is square. I need to center the image

but 800-800 = 0 so I see it on left side.


See CenterFilename ...

Code: Pascal  [Select][+][-]
  1. unit Unit1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, LCLType,
  9.   ExtDlgs, ExtCtrls;
  10.  
  11. type
  12.  
  13.   TInfo = record
  14.     Name:  string;
  15.     Image: TImage;
  16.   end;
  17.  
  18.   { TForm1 }
  19.  
  20.   TForm1 = class(TForm)
  21.     ComboBox1: TComboBox;
  22.     Label1: TLabel;
  23.     Button1: TButton;
  24.     EditFileName: TEdit;
  25.     Image1:  TImage;
  26.     OpenPictureDialog1: TOpenPictureDialog;
  27.     procedure Button1Click(Sender: TObject);
  28.     procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
  29.     procedure FormCreate(Sender: TObject);
  30.     procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
  31.     procedure FormResize(Sender: TObject);
  32.   private
  33.     Index:     Integer;        // Index of the image currently showing
  34.     Data:      array of TInfo; // Loaded image data and their names
  35.     isViewing: Boolean;
  36.     procedure CenterFilename;
  37.     procedure ShowLoadedImage;
  38.   end;
  39.  
  40. var
  41.   Form1: TForm1;
  42.  
  43. implementation
  44.  
  45. {$R *.lfm}
  46.  
  47. { TForm1 }
  48.  
  49. procedure TForm1.CenterFilename;
  50. begin
  51.   EditFileName.AutoSize := False;
  52.   EditFileName.Width := ClientWidth - round(ClientWidth div 30);
  53.   EditFileName.Top := Screen.Height-round(Screen.Height div 10);
  54.   EditFileName.Left := -10+round((ClientWidth div 2) - (EditFileName.Width div 2) ); // Vycentrování horizontálně
  55.   Image1.Left := round((Width - Image1.Width) div 2);
  56. end;
  57.  
  58. procedure TForm1.ShowLoadedImage;
  59. var
  60.   Count: Integer;
  61. begin
  62.   Label1.Visible := False;
  63.   Button1.Visible := False;
  64.   Label1.Visible := False;
  65.   Count := Length(Data);
  66.   if Count <= 0 then Exit;
  67.   if Index > Count-1 then Exit;
  68.   Image1.Picture.Assign(Data[Index].Image.Picture);
  69.   EditFileName.Text := Data[Index].Name;
  70.   CenterFilename;
  71. end;
  72.  
  73. procedure TForm1.Button1Click(Sender: TObject);
  74. begin
  75.   if not(OpenPictureDialog1.Execute) then Exit;
  76.   try
  77.     Image1.Picture.LoadFromFile(OpenPictureDialog1.FileName);
  78.     Button1.Visible     := False;
  79.     EditFileName.Text   := ExtractFileName(OpenPictureDialog1.FileName);
  80.     isViewing           := True;
  81.     CenterFilename;
  82.   except
  83.     ShowMessage('Cannot open the file.');
  84.   end;
  85. end;
  86.  
  87. procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState
  88.   );
  89. begin
  90.   case Key of
  91.     VK_ESCAPE: // Exit program
  92.       Close;
  93.     VK_F5:     // Background color
  94.       case Color of
  95.         clDefault: Color := clBlack;
  96.         clBlack:   Color := clGray;
  97.         clGray:    Color := clWhite;
  98.         clWhite:   Color := clDefault;
  99.         else       Color := clDefault;
  100.       end;
  101.     VK_F6:     // Info color;
  102.       case EditFileName.Font.Color of
  103.         clDefault: EditFileName.Font.Color := clBlack;
  104.         clBlack:   EditFileName.Font.Color := clGray;
  105.         clGray:    EditFileName.Font.Color := clWhite;
  106.         clWhite:   EditFileName.Font.Color := clYellow;
  107.         clYellow:  EditFileName.Font.Color := clRed;
  108.         clRed:     EditFileName.Font.Color := clBlue;
  109.         clBlue:    EditFileName.Font.Color := clDefault;
  110.         else       EditFileName.Font.Color := clDefault;
  111.         end;
  112.     VK_F7:     // Proportinal stretch
  113.       Image1.Proportional := not(Image1.Proportional);
  114.     VK_F8:     // Fullscreen modes
  115.       case WindowState of
  116.         wsNormal:     WindowState := wsMaximized;
  117.         wsMaximized:  WindowState := wsFullScreen;
  118.         wsFullScreen: WindowState := wsNormal;
  119.       end;
  120.     VK_LEFT:   // Show preview image
  121.       begin
  122.         Dec(Index);
  123.         if Index < 0 then
  124.           Index := Length(Data)-1;
  125.         ShowLoadedImage;
  126.       end;
  127.     VK_RIGHT,
  128.     VK_SPACE:  // Show next image
  129.       begin
  130.         Inc(Index);
  131.         if Index >= Length(Data) then
  132.           Index := 0;
  133.         Image1.Proportional := True;
  134.         Image1.Stretch      := True;
  135.         Image1.Align        := alClient;
  136.         Button1.Visible     := False;
  137.         ShowLoadedImage;
  138.       end;
  139.   end;
  140. end;
  141.  
  142. procedure TForm1.FormResize(Sender: TObject);
  143. begin
  144.   if isViewing then
  145.     CenterFilename;
  146. end;
  147.  
  148. procedure TForm1.FormCreate(Sender: TObject);
  149. var
  150.   Tmp:   TImage;
  151.   Count: Integer;
  152.   i:     Integer;
  153. begin
  154.  
  155.   Constraints.MinHeight := 600;
  156.   Constraints.MinWidth  := 800;
  157.   KeyPreview            := True;
  158.   Caption               := 'Image Viewer';
  159.   Button1.Caption       := 'Open';
  160.   Image1.Proportional   := True;
  161.   Image1.Stretch        := True;
  162.   Image1.Align          := alClient;
  163.   Index                 := 0;
  164.   isViewing             := False;
  165.  
  166.   // Try to load images using names supplied by parameter string
  167.   for i := 1 to ParamCount do
  168.   begin
  169.     Tmp := TImage.Create(nil);
  170.     try
  171.       Tmp.Picture.LoadFromFile(ParamStr(i));
  172.       Count := Length(Data);
  173.       Inc(Count);
  174.       SetLength(Data, Count);
  175.       Data[Count-1].Image := TImage.Create(nil);
  176.       Data[Count-1].Image.Picture.Assign(Tmp.Picture);
  177.       Data[Count-1].Name := ParamStr(i);
  178.     finally
  179.       Tmp.Free;
  180.     end;
  181.   end;
  182.  
  183.   if Length(Data) > 0 then // Managed to load some images
  184.   begin
  185.     isViewing := True;
  186.     ShowLoadedImage;
  187.   end;
  188.  
  189. end;
  190.  
  191. procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction);
  192. var
  193.   i: Integer;
  194. begin
  195.   if Length(Data) <= 0 then Exit;
  196.   for i := 0 to Length(Data)-1 do
  197.     Data[i].Image.Free;
  198.   SetLength(Data, 0);
  199. end;
  200.  
  201. end.
  202.  

jamie

  • Hero Member
  • *****
  • Posts: 7834
Re: How to install image library for freepascal on linux?
« Reply #41 on: August 15, 2023, 02:48:13 am »
I take it you are trying to maintain the aspect ratio of the image regardless of viewing size ?

The only true wisdom is knowing you know nothing

barracuda

  • Full Member
  • ***
  • Posts: 133
Re: How to install image library for freepascal on linux?
« Reply #42 on: August 15, 2023, 11:13:49 am »
I take it you are trying to maintain the aspect ratio of the image regardless of viewing size ?

In monday night, I tried to modify few thing in the demo. My goals:
1) To keep aspect ratio of the image.
2) Calculate the ratio needed to resize the image to height of the screen.
2.1) Maybe this goal will be changed to different calculation, later.
3) To calculate and to center the edit box (horizontally). The position is at bottom.
4) To center the image (horizontally). Both goals to be done in the same function.

I failed At point 2. I found that the image width value 800 is wrong.
What I would expect. If I'm having height 600, then the image should be 600x600 with the original ratio (proportional change).

The I can calculate the correct left position. I calculate the spacing: 800-600 = 200. I devied the spacing by 2. So I need to have a space 100 on left and 100 on right. So left=100.

So the question is why there is TImage.width=800 instead TImage.width=600?

I would like to continue solving next steps with the edit control. For example. How to make it semitransparent? I think this will be harder. I quess if I want semitransparent background, I will need to calculate the bounds of the control, and then I will need to calculate overwrap in the image. I could copy the area in image to new image, modify colors in the new image, and then use it as a background for the edit box. Right?

Then I will need to create onChange even for the edit box and when I will press enter, this will change the file name to value in the box. Or I could better run a bash script to change it to make more easier to control the filename. I could use the viewer just for viewing images and the enter would send a command to script. Something like:
img_rename_rules.sh "downloaded_image.jpg"

Handoko

  • Hero Member
  • *****
  • Posts: 5558
  • My goal: build my own game engine using Lazarus
Re: How to install image library for freepascal on linux?
« Reply #43 on: August 15, 2023, 12:16:20 pm »
So the question is why there is TImage.width=800 instead TImage.width=600?

Because of this:
Code: Pascal  [Select][+][-]
  1.   Image1.Align          := alClient;


I would like to continue solving next steps with the edit control. For example. How to make it semitransparent? I think this will be harder.

Impossible, unless you're clever enough to hack into how the TEdit works. That's why I used TLabel.

barracuda

  • Full Member
  • ***
  • Posts: 133
Re: How to install image library for freepascal on linux?
« Reply #44 on: August 15, 2023, 04:43:50 pm »
Impossible, unless you're clever enough to hack into how the TEdit works. That's why I used TLabel.

So if I understand you correctly. I cannot even set the background image to it?

Here I read about the semitransparency
https://stackoverflow.com/questions/3714495/how-to-make-a-tmemo-and-tedit-with-a-transparent-background
JVCL can do that using TJvMemo

 

TinyPortal © 2005-2018