فهرست منبع

Merge pull request #599 from bgrabitmap/master

sync branch
circular17 5 ماه پیش
والد
کامیت
f88a9fb7ff

+ 7 - 0
.github/dependabot.yml

@@ -0,0 +1,7 @@
+---
+version: 2
+updates:
+  - package-ecosystem: "github-actions"
+    directory: "/"
+    schedule:
+      interval: "monthly"

+ 237 - 0
.github/workflows/make.pas

@@ -0,0 +1,237 @@
+program Make;
+{$mode objfpc}{$H+}
+
+uses
+  Classes,
+  SysUtils,
+  StrUtils,
+  FileUtil,
+  Zipper,
+  fphttpclient,
+  RegExpr,
+  openssl,
+  opensslsockets,
+  Process;
+
+const
+  Target: string = 'lazpaint';
+  Dependencies: array of string = ();
+
+type
+  TLog = (audit, info, error);
+  Output = record
+    Success: boolean;
+    Output: string;
+  end;
+
+  procedure OutLog(Knd: TLog; Msg: string);
+  begin
+    case Knd of
+        error: Writeln(stderr, #27'[31m', Msg, #27'[0m');
+        info:  Writeln(stderr, #27'[32m', Msg, #27'[0m');
+        audit: Writeln(stderr, #27'[33m', Msg, #27'[0m');
+    end;
+  end;
+
+  function CheckModules: Output;
+  begin
+    if FileExists('.gitmodules') then
+      if RunCommand('git', ['submodule', 'update', '--init', '--recursive',
+        '--force', '--remote'], Result.Output) then
+        OutLog(info, Result.Output);
+  end;
+
+  function AddPackage(Path: string): Output;
+  begin
+    with TRegExpr.Create do
+    begin
+      Expression :=
+        {$IFDEF MSWINDOWS}
+          '(cocoa|x11|_template)'
+        {$ELSE}
+          '(cocoa|gdi|_template)'
+        {$ENDIF}
+      ;
+      if not Exec(Path) and RunCommand('lazbuild', ['--add-package-link', Path],
+        Result.Output) then
+        OutLog(audit, 'added ' + Path);
+      Free;
+    end;
+  end;
+
+  function BuildProject(Path: string): Output;
+  var
+    Line: string;
+  begin
+    OutLog(audit, 'build from ' + Path);
+    try
+      Result.Success := RunCommand('lazbuild', ['--build-all', '--recursive',
+        '--no-write-project', Path], Result.Output);
+      if Result.Success then
+        for Line in SplitString(Result.Output, LineEnding) do
+        begin
+          if ContainsStr(Line, 'Linking') then
+          begin
+            Result.Output := SplitString(Line, ' ')[2];
+            OutLog(info, ' to ' + Result.Output);
+            break;
+          end;
+        end
+      else
+      begin
+        ExitCode += 1;
+        for Line in SplitString(Result.Output, LineEnding) do
+          with TRegExpr.Create do
+          begin
+            Expression := '(Fatal|Error):';
+            if Exec(Line) then
+              OutLog(error, #10 + Line);
+            Free;
+          end;
+      end;
+    except
+      on E: Exception do
+        OutLog(error, E.ClassName + #13#10 + E.Message);
+    end;
+  end;
+
+  function RunTest(Path: string): Output;
+  var
+    Temp: string;
+  begin
+    Result := BuildProject(Path);
+    Temp:= Result.Output;
+    if Result.Success then
+        try
+          if not RunCommand(Temp, ['--all', '--format=plain', '--progress'], Result.Output) then
+          begin
+            ExitCode += 1;
+            OutLog(error, Result.Output);
+          end;
+        except
+          on E: Exception do
+            OutLog(error, E.ClassName + #13#10 + E.Message);
+        end;
+  end;
+
+  function InstallOPM(Each: string): string;
+  var
+    OutFile, Uri: string;
+    Zip: TStream;
+  begin
+    Result :=
+      {$IFDEF MSWINDOWS}
+      GetEnvironmentVariable('APPDATA') + '\.lazarus\onlinepackagemanager\packages\'
+      {$ELSE}
+      GetEnvironmentVariable('HOME') + '/.lazarus/onlinepackagemanager/packages/'
+      {$ENDIF}
+      + Each;
+    OutFile := GetTempFileName;
+    Uri := 'https://packages.lazarus-ide.org/' + Each + '.zip';
+    if not DirectoryExists(Result) then
+    begin
+      Zip := TFileStream.Create(OutFile, fmCreate or fmOpenWrite);
+      with TFPHttpClient.Create(nil) do
+      begin
+        try
+          AddHeader('User-Agent', 'Mozilla/5.0 (compatible; fpweb)');
+          AllowRedirect := True;
+          Get(Uri, Zip);
+          OutLog(audit, 'Download from ' + Uri + ' to ' + OutFile);
+        finally
+          Free;
+        end;
+      end;
+      Zip.Free;
+      CreateDir(Result);
+      with TUnZipper.Create do
+      begin
+        try
+          FileName := OutFile;
+          OutputPath := Result;
+          Examine;
+          UnZipAllFiles;
+          OutLog(audit, 'Unzip from ' + OutFile + ' to ' + Result);
+        finally
+          Free;
+        end;
+      end;
+      DeleteFile(OutFile);
+    end;
+  end;
+
+  function LintPython(Path: string): Output;
+  begin
+    OutLog(audit, 'Linting Python file: ' + Path);
+    if not RunCommand('python3', ['-m', 'pylint', Path], Result.Output) then
+      begin
+        OutLog(error, Result.Output);
+        //ExitCode += 1;
+      end
+  end;
+
+  function LintC(Path: string): Output;
+  begin
+    OutLog(audit, 'Linting C file: ' + Path);
+    if not RunCommand('cppcheck', ['--language=c', '--enable=warning,style', '--template=gcc', Path], Result.Output) then
+      begin
+        OutLog(error, Result.Output);
+        //ExitCode += 1;
+      end
+  end;
+
+  function LintShell(Path: string): Output;
+  begin
+    OutLog(audit, 'Linting Shell file: ' + Path);
+    if not RunCommand('shellcheck', ['--external-sources', Path], Result.Output) then
+      begin
+        OutLog(error, Result.Output);
+        //ExitCode += 1;
+      end
+  end;
+
+  procedure BuildAll;
+  var
+    Each, Item: string;
+    List: TStringList;
+  begin
+    CheckModules;
+    InitSSLInterface;
+    for Item in Dependencies do
+    begin
+      List := FindAllFiles(InstallOPM(Item), '*.lpk', True);
+      try
+        for Each in List do
+          AddPackage(Each);
+      finally
+        List.Free;
+      end;
+    end;
+    List := FindAllFiles(GetCurrentDir, '*.lpk', True);
+    try
+      for Each in List do
+        AddPackage(Each);
+    finally
+      List.Free;
+    end;
+    List := FindAllFiles(Target, '*.lpi', True);
+    try
+      for Each in List do
+        if not ContainsStr(Each, 'zengl') then
+          if ContainsStr(ReadFileToString(ReplaceStr(Each, '.lpi', '.lpr')),
+            'consoletestrunner') then
+            RunTest(Each)
+          else
+            BuildProject(Each);
+    finally
+      List.Free;
+    end;
+    if ExitCode <> 0 then
+      OutLog(error, #10 + 'Errors: ' + IntToStr(ExitCode))
+    else
+      OutLog(info, #10 + 'Errors: ' + IntToStr(ExitCode));
+  end;
+
+begin
+  BuildAll;
+end.

+ 56 - 0
.github/workflows/make.yml

@@ -0,0 +1,56 @@
+---
+name: Make
+
+on:
+  schedule:
+    - cron:  '0 0 1 * *'
+  push:
+    branches:
+      - "**"
+  pull_request:
+    branches:
+      - master
+      - main
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+
+jobs:
+  build:
+    runs-on: ${{ matrix.os }}
+    timeout-minutes: 120
+    strategy:
+      matrix:
+        os:
+          - ubuntu-latest
+          - windows-latest
+    steps:
+    - name: Checkout
+      uses: actions/checkout@v4
+      with:
+        submodules: true
+
+    - name: Build on Linux
+      if: runner.os == 'Linux'
+      shell: bash
+      run: |
+        set -xeuo pipefail
+        sudo bash -c 'apt-get update; apt-get install -y lazarus cppcheck pylint shellcheck' >/dev/null
+        instantfpc -Fu/usr/lib/lazarus/*/components/lazutils .github/workflows/make.pas
+
+    - name: Build on Windows
+      if: runner.os == 'Windows'
+      shell: powershell
+      run: |
+        New-Variable -Option Constant -Name VAR -Value @{
+            Uri = 'https://fossies.org/windows/misc/lazarus-3.8-fpc-3.2.2-win64.exe'
+            OutFile = (New-TemporaryFile).FullName + '.exe'
+        }
+        Invoke-WebRequest @VAR
+        & $VAR.OutFile.Replace('Temp', 'Temp\.') /SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART | Out-Null
+        $Env:PATH+=';C:\Lazarus'
+        $Env:PATH+=';C:\Lazarus\fpc\3.2.2\bin\x86_64-win64'
+        (Get-Command 'lazbuild').Source | Out-Host
+        (Get-Command 'instantfpc').Source | Out-Host
+        instantfpc '-FuC:\Lazarus\components\lazutils' .github/workflows/make.pas

+ 6 - 0
.gitmodules

@@ -0,0 +1,6 @@
+[submodule "use/bgrabitmap"]
+	path = use/bgrabitmap
+	url = [email protected]:bgrabitmap/bgrabitmap.git
+[submodule "use/bgracontrols"]
+	path = use/bgracontrols
+	url = [email protected]:bgrabitmap/bgracontrols.git

+ 45 - 0
Install/flatpak/0001-515-runtime-fix-for-Qt.patch

@@ -0,0 +1,45 @@
+From 11b9c647dd96edaf4a3240a3683493fb37a0e0e0 Mon Sep 17 00:00:00 2001
+From: Johann ELSASS <[email protected]>
+Date: Thu, 28 Dec 2023 16:40:48 +0100
+Subject: [PATCH] #515 runtime fix for Qt
+
+---
+ lazpaint/lazpaintmainform.lfm | 1 +
+ lazpaint/lazpaintmainform.pas | 2 ++
+ 2 files changed, 3 insertions(+)
+
+diff --git a/lazpaint/lazpaintmainform.lfm b/lazpaint/lazpaintmainform.lfm
+index a2dffa1..2765760 100644
+--- a/lazpaint/lazpaintmainform.lfm
++++ b/lazpaint/lazpaintmainform.lfm
+@@ -5769,6 +5769,7 @@ object FMain: TFMain
+     Top = 514
+   end
+   object TimerUpdate: TTimer
++    Enabled = False
+     Interval = 50
+     OnTimer = TimerUpdateTimer
+     Left = 653
+diff --git a/lazpaint/lazpaintmainform.pas b/lazpaint/lazpaintmainform.pas
+index 708cb24..551c7d0 100644
+--- a/lazpaint/lazpaintmainform.pas
++++ b/lazpaint/lazpaintmainform.pas
+@@ -1251,6 +1251,7 @@ begin
+   UpdateToolBar;
+   FShouldArrange := true;
+   QueryArrange;
++  TimerUpdate.Enabled := true;
+ end;
+ 
+ procedure TFMain.OnLatestVersionUpdate(ANewVersion: string);
+@@ -2593,6 +2594,7 @@ end;
+ 
+ procedure TFMain.FormHide(Sender: TObject);
+ begin
++  TimerUpdate.Enabled := false;
+   FShouldArrange := false;
+   FTopMostInfo := LazPaintInstance.HideTopmost;
+   LazPaintInstance.SaveMainWindowPosition;
+-- 
+2.43.0
+

+ 37 - 0
Install/flatpak/0001-avoid-crash-on-Qt5.patch

@@ -0,0 +1,37 @@
+From d73455025d71226472e7eb880da36f6fb85c5df0 Mon Sep 17 00:00:00 2001
+From: Johann ELSASS <[email protected]>
+Date: Thu, 6 Oct 2022 21:44:47 +0200
+Subject: [PATCH] avoid crash on Qt5
+
+---
+ lazpaint/lazpaintinstance.pas | 1 +
+ lazpaint/lazpaintmainform.pas | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/lazpaint/lazpaintinstance.pas b/lazpaint/lazpaintinstance.pas
+index 5da9ac6..b5f624b 100644
+--- a/lazpaint/lazpaintinstance.pas
++++ b/lazpaint/lazpaintinstance.pas
+@@ -374,6 +374,7 @@ procedure TLazPaintInstance.ReportActionProgress(AProgressPercent: integer);
+ var
+   delay: Integer;
+ begin
++  {$IFDEF LCLqt5}exit;{$ENDIF}
+   if AProgressPercent < 100 then delay := 10000 else delay := 1000;
+   if Assigned(FMain) then FMain.UpdatingPopup:= true;
+   try
+diff --git a/lazpaint/lazpaintmainform.pas b/lazpaint/lazpaintmainform.pas
+index 0fe875c..708cb24 100644
+--- a/lazpaint/lazpaintmainform.pas
++++ b/lazpaint/lazpaintmainform.pas
+@@ -2695,6 +2695,7 @@ end;
+ 
+ procedure TFMain.TimerUpdateTimer(Sender: TObject);
+ begin
++  if FLazPaintInstance = nil then exit;
+   TimerUpdate.Enabled := false;
+   if ToolManager.ToolSleeping and not spacePressed and
+      ([ssLeft,ssRight,ssMiddle] * FLayout.MouseButtonState = []) then
+-- 
+2.43.0
+

+ 22 - 0
Install/flatpak/build.sh

@@ -0,0 +1,22 @@
+#!/bin/bash
+set -x
+
+BUILD_DIR=build
+REPO_DIR=repo
+FLATPAK_ID=io.github.bgrabitmap.LazPaint
+
+# Install dependencies
+flatpak install --system flathub org.kde.Sdk//5.15-24.08
+flatpak install --system flathub org.kde.Platform//5.15-24.08
+flatpak install --system flathub org.freedesktop.Sdk.Extension.freepascal//24.08
+flatpak install --system flathub org.flatpak.Builder
+
+# Build
+flatpak run org.flatpak.Builder --force-clean --sandbox --user --install --ccache --mirror-screenshots-url=https://dl.flathub.org/media/ --repo=$REPO_DIR $BUILD_DIR $FLATPAK_ID.yml
+
+# Run
+flatpak run $FLATPAK_ID
+
+# Linter
+flatpak run --command=flatpak-builder-lint org.flatpak.Builder manifest $FLATPAK_ID.yml
+flatpak run --command=flatpak-builder-lint org.flatpak.Builder repo $REPO_DIR

+ 186 - 0
Install/flatpak/io.github.bgrabitmap.LazPaint.metainfo.xml

@@ -0,0 +1,186 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<component type="desktop-application">
+  <id>io.github.bgrabitmap.LazPaint</id>
+
+  <name>LazPaint</name>
+  <summary>Fast raster image editor</summary>
+  <developer id="io.github.bgrabitmap">
+    <name>BGRABitmap team</name>
+  </developer>
+
+  <url type="homepage">https://wiki.freepascal.org/LazPaint</url>
+  <url type="vcs-browser">https://github.com/bgrabitmap/lazpaint</url>
+  <url type="donation">http://sourceforge.net/donate/index.php?group_id=404555</url>
+  <url type="bugtracker">https://github.com/bgrabitmap/lazpaint/issues</url>
+  <url type="translate">https://github.com/bgrabitmap/lazpaint/tree/master/lazpaint/release/bin/i18n</url>
+
+  <metadata_license>CC0-1.0</metadata_license>
+  <project_license>GPL-3.0-only</project_license>
+
+  <description>
+    <p>Free cross-platform image editor with raster and vector layers, written in Lazarus (Free Pascal).
+Can read layered files (lzp, ora, pdn, oXo, flat psd), multi-images (gif, ico, tiff), flat files (bmp, jpeg, pcx, png, tga, webp, xpm, xwd), raw images (dng, cr2, nef, arw...), vectorial (svg), 3D (obj). Has drawing tools, vector shapes, phong shading, curve adjustments, filters, render some textures, Python scripting. Uses Qt5 widgetset.</p>
+
+    <p>Features:</p>
+    <ul>
+      <li>Files: read and write a variety of file formats, including layered bitmaps and 3D files.</li>
+      <li>Tools: many tools are available to draw on the layers.</li>
+      <li>Edit/Select: select parts of an image with antialiasing and modify the selection as a mask.</li>
+      <li>View: color window, layer stack window and toolbox window.</li>
+      <li>Command line: call LazPaint from a console.</li>
+    </ul>
+
+    <p>Image manipulation:</p>
+    <ul>
+      <li>An image can be resampled, flipped horizontally and vertically.</li>
+      <li>Smart zoom x3 : resize the image x3 and detects borders; this provides a useful zoom with ancient games sprites.</li>
+    </ul>
+
+    <p>Color manipulation:</p>
+    <ul>
+      <li>Colorize : set the color of an image while preserving intensities</li>
+      <li>Shift colors : cycle colors and change colorness (saturation)</li>
+      <li>Intensity : make colors lighter or darker without making them white</li>
+      <li>Lightness : make colors lighter or darker by making them whiter</li>
+      <li>Normalize : use the whole range of each color channel and alpha channel</li>
+      <li>Negative : invert colors (with gamma correction)</li>
+      <li>Linear negative : invert colors (without gamma correction)</li>
+      <li>Grayscale : converts colors to grayscale with gamma correction</li>
+    </ul>
+
+    <p>Filters:
+Filters can be applied to the whole image or to the active selection.
+    </p>
+    <ul>
+      <li>Radial blur : non directional blur</li>
+      <li>Motion blur : directional blur</li>
+      <li>Custom blur : blur according to a mask</li>
+      <li>Sharpen : makes contours more accurate, complementary to Smooth</li>
+      <li>Smooth : softens whole image, complementary to Sharpen</li>
+      <li>Median : computes the median of colors around each pixel, which softens corners</li>
+      <li>Contour : draws contours on a white background (like a pencil drawing)</li>
+      <li>Emboss : draws contours with shadow</li>
+      <li>Sphere : spherical projection</li>
+      <li>Cylinder : cylinder projection</li>
+      <li>Clouds : add clouds of the current pen color</li>
+      <li>Scripts: scripts are provided to do layer effects. You can as well write your own Python scripts.  </li>
+    </ul>
+  </description>
+
+  <launchable type="desktop-id">io.github.bgrabitmap.LazPaint.desktop</launchable>
+
+  <branding>
+    <color type="primary" scheme_preference="light">#dc8add</color>
+    <color type="primary" scheme_preference="dark">#613583</color>
+  </branding>
+
+  <screenshots>
+    <screenshot type="default">
+      <caption>Light theme</caption>
+      <image>https://wiki.freepascal.org/images/a/a3/lazpaint_pallete.jpg</image>
+    </screenshot>
+    <screenshot>
+      <caption>Dark theme</caption>
+      <image>https://wiki.freepascal.org/images/1/17/lazpaint_pallete_dark.jpg</image>
+    </screenshot>
+  </screenshots>
+
+  <releases>
+    <release version="7.2.2" date="2022-08-23">
+      <url type="details">https://github.com/bgrabitmap/lazpaint/releases/tag/v7.2.2</url>
+      <description>
+        <ul>
+          <li>Completed Czech translation</li>
+          <li>Compilation fixes for Debian and legacy LCL</li>
+          <li>Linux shortcut: specify file parameter</li>
+        </ul>
+      </description>
+    </release>
+    <release version="7.2.1" date="2022-08-21">
+      <url type="details">https://github.com/bgrabitmap/lazpaint/releases/tag/v7.2.1</url>
+      <description>
+        <ul>
+          <li>adapt quick save shortcut on MacOS</li>
+          <li>translations : German, Portuguese, Chinese, Dutch, Spanish</li>
+          <li>added "screenshot" command line</li>
+          <li>libavif dll</li>
+          <li>multi click on text (#266)</li>
+          <li>fix in Python scripting (dialog.py)</li>
+          <li>added "-editor" parameter</li>
+        </ul>
+      </description>
+    </release>
+    <release version="7.2" date="2022-08-06">
+      <url type="details">https://github.com/bgrabitmap/lazpaint/releases/tag/v7.2</url>
+      <description>
+        <ul>
+          <li>MacOS: handle right-click on layerstack</li>
+          <li>MacOS: fixed light theme interface</li>
+          <li>MacOS: avoid key binding conflict with CMD-H</li>
+          <li>interface: handle cancel language or icon size change</li>
+          <li>interface: restore main form after embedded editor</li>
+          <li>interface: restore selection tool after delete</li>
+          <li>interface: fix shift-arrows in file list</li>
+          <li>interface: handle right click on switch color button</li>
+          <li>interface: remember docked toolbox visibility</li>
+          <li>interface: center on zoom fit</li>
+          <li>interface: less margin to select outside of color circle</li>
+          <li>interface: tooltip on arrow start/end</li>
+          <li>interface: show hotkey in toolbar</li>
+          <li>interface: update workspace when resizing/rotating</li>
+          <li>interface: handle keys in embedded editors</li>
+          <li>interface: prevent ALT key from opening menu</li>
+          <li>interface: handle ALT-wheel only when applicable</li>
+          <li>interface: keep fill options visible when changing opacity</li>
+          <li>layer stack: tooltip for visible and opacity controls</li>
+          <li>blend mode: removed horizontal scrollbar in blend mode lists</li>
+          <li>language: tool shortcuts for Cyrillic keyboard</li>
+          <li>language: translation of color description</li>
+          <li>language: completed Russian translation</li>
+          <li>file: prevent saving incorrect filename</li>
+          <li>file: handle path in file textbox</li>
+          <li>file: generate new filename with number</li>
+          <li>file: added quick save action (Ctlr-Q shortcut)</li>
+          <li>file: overwrite prompt when saving palette</li>
+          <li>file: experimental support for AVIF format</li>
+          <li>file: show save prompt when drag'n'drop image to the program</li>
+          <li>file: save CUR and ICO with command line</li>
+          <li>SVG: close path when export as SVG</li>
+          <li>SVG: fixed RTL text export</li>
+          <li>new file: better handling of ratios</li>
+          <li>motion blur: fixed sticky mouse click</li>
+          <li>canvas size: restrict percent to max accepted size</li>
+          <li>tools: update shape when pressing/releasing SHIFT key</li>
+          <li>tools: ignore 0 alpha with solid colors</li>
+          <li>tools: improved hints timing</li>
+          <li>tools: disambiguation of shortcut keys (Y, K, F and R)</li>
+          <li>deformation grid tool: handle extreme deformation</li>
+          <li>déformation grid tool: ESCAPE to exit tool</li>
+          <li>layer perspective tool: change cursor when hovering points</li>
+          <li>layer tools: delete current layer with DELETE key</li>
+          <li>rectangle tool: fixed bug when changing join type</li>
+          <li>text tool: update when change antialiasing</li>
+          <li>text tool: provide text style, bidi mode, vertical alignment in toolbar</li>
+          <li>text tool: allow travel mode with space</li>
+          <li>text tool: display flipped text</li>
+          <li>vector tools: avoid error after rasterizing</li>
+          <li>polygon/closed curve tools: hide center point when ALT key pressed</li>
+          <li>polyline/opened curve tool: don't reopen shape</li>
+          <li>poly tools: added RIGHT-click hint</li>
+          <li>selection tools: deselect when ESCAPE pressed and selection layer empty</li>
+          <li>selection tools: keep selection mode after undo/redo</li>
+          <li>rectangle selection tool: include ratio of current image</li>
+          <li>selection pen: show circular cursor</li>
+          <li>filter: added negative angle for twirl</li>
+          <li>script: ignore some Python errors</li>
+        </ul>
+      </description>
+    </release>
+  </releases>
+
+  <categories>
+    <category>Graphics</category>
+  </categories>
+
+  <content_rating type="oars-1.1"/>
+</component>

+ 61 - 0
Install/flatpak/io.github.bgrabitmap.LazPaint.yml

@@ -0,0 +1,61 @@
+app-id: io.github.bgrabitmap.LazPaint
+runtime: org.kde.Platform
+runtime-version: '5.15-24.08'
+sdk: org.kde.Sdk
+sdk-extensions:
+  - org.freedesktop.Sdk.Extension.freepascal
+command: lazpaint
+rename-icon: lazpaint
+rename-desktop-file: lazpaint.desktop
+finish-args:
+  - --share=ipc
+  - --socket=fallback-x11
+  - --socket=wayland
+  - --device=dri
+modules:
+  - name: qt5pas
+    buildsystem: qmake
+    config-opts:
+      - -after
+      - target.path=/app/lib
+    sources:
+      - type: shell
+        commands:
+          - cp -r /usr/lib/sdk/freepascal/share/lazarus/lcl/interfaces/qt5/cbindings/. .
+  - name: LazPaint
+    sources:
+      - type: git
+        url: https://github.com/bgrabitmap/bgrabitmap.git
+        commit: f9748a37f5382b18d1cd197293d1032a522e8561
+        dest: 'bgrabitmap'
+      - type: git
+        url: https://github.com/bgrabitmap/bgracontrols.git
+        commit: f5efbf8b79d0725d33b88c5bd41857d9139428bd
+        dest: 'bgracontrols'
+      - type: git
+        url: https://github.com/bgrabitmap/lazpaint.git
+        commit: 501d44c511fb49ca166dc0ec101305dddbf3aee6
+      - type: file
+        path: io.github.bgrabitmap.LazPaint.metainfo.xml
+      - type: patch
+        path: 0001-515-runtime-fix-for-Qt.patch
+      - type: patch
+        path: 0001-avoid-crash-on-Qt5.patch
+      - type: patch
+        path: no-image-browser-by-default.patch
+    buildsystem: simple
+    build-commands:
+      - |
+        . /usr/lib/sdk/freepascal/enable.sh
+        lazbuild --build-mode=Release --ws=qt5 bgrabitmap/bgrabitmap/bgrabitmappack.lpk
+        lazbuild --build-mode=Release --ws=qt5 bgracontrols/bgracontrols.lpk
+        lazbuild --build-mode=Release --ws=qt5 lazpaintcontrols/lazpaintcontrols.lpk
+        lazbuild --build-mode=Release --ws=qt5 lazpaint/lazpaint.lpi
+      - install -Dm755 lazpaint/release/bin/lazpaint -t $FLATPAK_DEST/bin
+      - install -Dm644 lazpaint/release/debian/applications/lazpaint.desktop -t $FLATPAK_DEST/share/applications
+      - install -Dm644 resources/icon/256x256.png $FLATPAK_DEST/share/icons/hicolor/256x256/apps/lazpaint.png
+      - install -Dm644 lazpaint/release/bin/i18n/*.po -t $FLATPAK_DEST/share/lazpaint/i18n
+      - cp -r resources/scripts $FLATPAK_DEST/share/lazpaint
+      - cp -r lazpaint/release/bin/models $FLATPAK_DEST/share/lazpaint
+      - install -Dm644 Install/snap/local/lazpaint.xml $FLATPAK_DEST/share/mime/packages/$FLAPTAK_ID.xml
+      - install -Dm644 ${FLATPAK_ID}.metainfo.xml -t $FLATPAK_DEST/share/metainfo

+ 13 - 0
Install/flatpak/no-image-browser-by-default.patch

@@ -0,0 +1,13 @@
+diff --git a/lazpaint/uconfig.pas b/lazpaint/uconfig.pas
+index ee16357..b13b491 100644
+--- a/lazpaint/uconfig.pas
++++ b/lazpaint/uconfig.pas
+@@ -804,7 +804,7 @@ end;
+ 
+ function TLazPaintConfig.DefaultUseImageBrowser: boolean;
+ begin
+-  result := iniOptions.ReadBool('General','UseImageBrowser',{$IFDEF DARWIN}false{$ELSE}true{$ENDIF});
++  result := iniOptions.ReadBool('General','UseImageBrowser',{$IFDEF DARWIN}false{$ELSE}false{$ENDIF});
+ end;
+ 
+ procedure TLazPaintConfig.SetDefaultUseImageBrowser(value: boolean);

+ 1 - 1
Install/snap/local/build.sh

@@ -3,7 +3,7 @@
 ln -s Install/snap ../../../snap
 ln -s Install/snap ../../../snap
 
 
 pushd ../../..
 pushd ../../..
-snapcraft --debug --use-lxd
+snapcraft --debug --use-lxd $@
 popd
 popd
 
 
 rm ../../../snap
 rm ../../../snap

+ 42 - 5
Install/snap/snapcraft.yaml

@@ -1,9 +1,46 @@
 name: lazpaint
 name: lazpaint
 title: LazPaint
 title: LazPaint
-version: '7.1.6'
+version: '7.2.2'
 summary: Image editor with raster and vector layers.
 summary: Image editor with raster and vector layers.
 description: |
 description: |
+  Free cross-platform image editor with raster and vector layers, written in Lazarus (Free Pascal).
   Can read layered files (lzp, ora, pdn, oXo, flat psd), multi-images (gif, ico, tiff), flat files (bmp, jpeg, pcx, png, tga, webp, xpm, xwd), raw images (dng, cr2, nef, arw...), vectorial (svg), 3D (obj). Has drawing tools, vector shapes, phong shading, curve adjustments, filters, render some textures, Python scripting. Uses Qt5 widgetset.
   Can read layered files (lzp, ora, pdn, oXo, flat psd), multi-images (gif, ico, tiff), flat files (bmp, jpeg, pcx, png, tga, webp, xpm, xwd), raw images (dng, cr2, nef, arw...), vectorial (svg), 3D (obj). Has drawing tools, vector shapes, phong shading, curve adjustments, filters, render some textures, Python scripting. Uses Qt5 widgetset.
+  
+  **Features**
+  * Files: read and write a variety of file formats, including layered bitmaps and 3D files.
+  * Tools: many tools are available to draw on the layers.
+  * Edit/Select: select parts of an image with antialiasing and modify the selection as a mask.
+  * View: color window, layer stack window and toolbox window.
+  * Command line: call LazPaint from a console.
+  
+  **Image manipulation**
+  * An image can be resampled, flipped horizontally and vertically.
+  * Smart zoom x3 : resize the image x3 and detects borders; this provides a useful zoom with ancient games sprites.
+ 
+  **Color manipulation**
+  * Colorize : set the color of an image while preserving intensities
+  * Shift colors : cycle colors and change colorness (saturation)
+  * Intensity : make colors lighter or darker without making them white
+  * Lightness : make colors lighter or darker by making them whiter
+  * Normalize : use the whole range of each color channel and alpha channel
+  * Negative : invert colors (with gamma correction)
+  * Linear negative : invert colors (without gamma correction)
+  * Grayscale : converts colors to grayscale with gamma correction
+  
+  **Filters**
+  Filters can be applied to the whole image or to the active selection.
+  * Radial blur : non directional blur
+  * Motion blur : directional blur
+  * Custom blur : blur according to a mask
+  * Sharpen : makes contours more accurate, complementary to Smooth
+  * Smooth : softens whole image, complementary to Sharpen
+  * Median : computes the median of colors around each pixel, which softens corners
+  * Contour : draws contours on a white background (like a pencil drawing)
+  * Emboss : draws contours with shadow
+  * Sphere : spherical projection
+  * Cylinder : cylinder projection
+  * Clouds : add clouds of the current pen color
+  * Scripts: scripts are provided to do layer effects. You can as well write your own Python scripts.  
 confinement: strict
 confinement: strict
 base: core20
 base: core20
 grade: stable
 grade: stable
@@ -19,10 +56,10 @@ parts:
     - wget
     - wget
     - libgtk2.0-dev
     - libgtk2.0-dev
     override-build: |
     override-build: |
-      wget -nc https://deac-ams.dl.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%202.0.12/lazarus-project_2.0.12-0_amd64.deb
-      wget -nc https://netix.dl.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%202.0.12/fpc-laz_3.2.0-1_amd64.deb
-      wget -nc https://netix.dl.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%202.0.12/fpc-src_3.2.0-1_amd64.deb
-      apt install ./lazarus-project_2.0.12-0_amd64.deb ./fpc-laz_3.2.0-1_amd64.deb ./fpc-src_3.2.0-1_amd64.deb
+      wget -nc https://downloads.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%202.2.2/lazarus-project_2.2.2-0_amd64.deb
+      wget -nc https://downloads.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%202.2.2/fpc-laz_3.2.2-210709_amd64.deb
+      wget -nc https://downloads.sourceforge.net/project/lazarus/Lazarus%20Linux%20amd64%20DEB/Lazarus%202.2.2/fpc-src_3.2.2-210709_amd64.deb
+      apt install ./lazarus-project_2.2.2-0_amd64.deb ./fpc-laz_3.2.2-210709_amd64.deb ./fpc-src_3.2.2-210709_amd64.deb
     prime: [-*]
     prime: [-*]
   lazpaint:
   lazpaint:
     plugin: nil
     plugin: nil

+ 5 - 0
_config.yml

@@ -1,2 +1,7 @@
 title: LazPaint
 title: LazPaint
 theme: jekyll-theme-cayman
 theme: jekyll-theme-cayman
+exclude:
+  - use/
+  - Install/
+  - web/
+  - winmake/

+ 82 - 10
lazpaint/test_embedded/project1.lpi

@@ -1,10 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
 <CONFIG>
 <CONFIG>
   <ProjectOptions>
   <ProjectOptions>
-    <Version Value="10"/>
+    <Version Value="12"/>
     <PathDelim Value="\"/>
     <PathDelim Value="\"/>
     <General>
     <General>
-      <MainUnit Value="0"/>
+      <Flags>
+        <CompatibilityMode Value="True"/>
+      </Flags>
       <ResourceType Value="res"/>
       <ResourceType Value="res"/>
       <UseXPManifest Value="True"/>
       <UseXPManifest Value="True"/>
       <Icon Value="0"/>
       <Icon Value="0"/>
@@ -12,18 +14,88 @@
     <i18n>
     <i18n>
       <EnableI18N LFM="False"/>
       <EnableI18N LFM="False"/>
     </i18n>
     </i18n>
-    <BuildModes Count="1" Active="Default">
+    <BuildModes Count="3" Active="Debug">
       <Item1 Name="Default" Default="True"/>
       <Item1 Name="Default" Default="True"/>
+      <Item2 Name="Debug">
+        <CompilerOptions>
+          <Version Value="11"/>
+          <PathDelim Value="\"/>
+          <Target>
+            <Filename Value="project1"/>
+          </Target>
+          <SearchPaths>
+            <IncludeFiles Value="$(ProjOutDir)"/>
+            <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
+          </SearchPaths>
+          <Parsing>
+            <SyntaxOptions>
+              <IncludeAssertionCode Value="True"/>
+            </SyntaxOptions>
+          </Parsing>
+          <CodeGeneration>
+            <Checks>
+              <IOChecks Value="True"/>
+              <RangeChecks Value="True"/>
+              <OverflowChecks Value="True"/>
+              <StackChecks Value="True"/>
+            </Checks>
+            <VerifyObjMethodCallValidity Value="True"/>
+          </CodeGeneration>
+          <Linking>
+            <Debugging>
+              <DebugInfoType Value="dsDwarf3"/>
+              <UseHeaptrc Value="True"/>
+              <TrashVariables Value="True"/>
+              <UseExternalDbgSyms Value="True"/>
+            </Debugging>
+            <Options>
+              <Win32>
+                <GraphicApplication Value="True"/>
+              </Win32>
+            </Options>
+          </Linking>
+        </CompilerOptions>
+      </Item2>
+      <Item3 Name="Release">
+        <CompilerOptions>
+          <Version Value="11"/>
+          <PathDelim Value="\"/>
+          <Target>
+            <Filename Value="project1"/>
+          </Target>
+          <SearchPaths>
+            <IncludeFiles Value="$(ProjOutDir)"/>
+            <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
+          </SearchPaths>
+          <CodeGeneration>
+            <SmartLinkUnit Value="True"/>
+            <Optimizations>
+              <OptimizationLevel Value="3"/>
+            </Optimizations>
+          </CodeGeneration>
+          <Linking>
+            <Debugging>
+              <GenerateDebugInfo Value="False"/>
+              <RunWithoutDebug Value="True"/>
+            </Debugging>
+            <LinkSmart Value="True"/>
+            <Options>
+              <Win32>
+                <GraphicApplication Value="True"/>
+              </Win32>
+            </Options>
+          </Linking>
+        </CompilerOptions>
+      </Item3>
     </BuildModes>
     </BuildModes>
     <PublishOptions>
     <PublishOptions>
       <Version Value="2"/>
       <Version Value="2"/>
-      <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
-      <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
     </PublishOptions>
     </PublishOptions>
     <RunParams>
     <RunParams>
-      <local>
-        <FormatVersion Value="1"/>
-      </local>
+      <FormatVersion Value="2"/>
+      <Modes Count="1">
+        <Mode0 Name="default"/>
+      </Modes>
     </RunParams>
     </RunParams>
     <RequiredPackages Count="2">
     <RequiredPackages Count="2">
       <Item1>
       <Item1>
@@ -40,7 +112,7 @@
         <IsPartOfProject Value="True"/>
         <IsPartOfProject Value="True"/>
         <EditorIndex Value="1"/>
         <EditorIndex Value="1"/>
         <TopLine Value="8"/>
         <TopLine Value="8"/>
-        <CursorPos Y="18"/>
+        <CursorPos Y="19"/>
         <UsageCount Value="20"/>
         <UsageCount Value="20"/>
         <Loaded Value="True"/>
         <Loaded Value="True"/>
       </Unit0>
       </Unit0>
@@ -52,7 +124,7 @@
         <ResourceBaseClass Value="Form"/>
         <ResourceBaseClass Value="Form"/>
         <UnitName Value="Unit1"/>
         <UnitName Value="Unit1"/>
         <IsVisibleTab Value="True"/>
         <IsVisibleTab Value="True"/>
-        <TopLine Value="4"/>
+        <TopLine Value="51"/>
         <CursorPos X="3" Y="66"/>
         <CursorPos X="3" Y="66"/>
         <UsageCount Value="20"/>
         <UsageCount Value="20"/>
         <Loaded Value="True"/>
         <Loaded Value="True"/>

+ 2 - 2
lazpaint/test_embedded/unit1.pas

@@ -41,7 +41,7 @@ procedure TForm1.Button1Click(Sender: TObject);
 var lazpaint: TLazPaintInstance;
 var lazpaint: TLazPaintInstance;
 begin
 begin
   lazpaint := TLazPaintInstance.Create;
   lazpaint := TLazPaintInstance.Create;
-  lazpaint.AboutText:= 'This is the normal application';
+  //lazpaint.AboutText:= 'This is the normal application';
   lazpaint.Run;
   lazpaint.Run;
   lazpaint.Free;
   lazpaint.Free;
 end;
 end;
@@ -51,7 +51,7 @@ var lazpaint: TLazPaintInstance;
     bmp: TBitmap;
     bmp: TBitmap;
 begin
 begin
   lazpaint := TLazPaintInstance.Create(True);
   lazpaint := TLazPaintInstance.Create(True);
-  lazpaint.AboutText:= 'This is an embedded application';
+  //lazpaint.AboutText:= 'This is an embedded application';
   lazpaint.Run;
   lazpaint.Run;
   if lazpaint.EmbeddedResult = mrOK then
   if lazpaint.EmbeddedResult = mrOK then
   begin
   begin

+ 1 - 1
lazpaintcontrols/lcvectorialfillinterface.pas

@@ -1407,6 +1407,6 @@ begin
 end;
 end;
 
 
 begin
 begin
-  {$i fillimages.lrs}
+  {$i ../resources/fillimages.lrs}
 end.
 end.
 
 

+ 1 - 0
use/bgrabitmap

@@ -0,0 +1 @@
+Subproject commit 311fa8d5f9b2baabdb3490ded5f721e68ea67ae2

+ 1 - 0
use/bgracontrols

@@ -0,0 +1 @@
+Subproject commit 555c0df8e2c52c60a9099d1bfd7b14c19852d5a4