Skip to content

Commit

Permalink
Merge pull request #137 from bgrabitmap/dev-lazpaint
Browse files Browse the repository at this point in the history
Dev lazpaint 7.1
  • Loading branch information
circular17 authored Apr 10, 2020
2 parents d35fa55 + ade6a0d commit 2feccdf
Show file tree
Hide file tree
Showing 27 changed files with 117 additions and 54 deletions.
1 change: 0 additions & 1 deletion lazpaint/dialog/ublendop.pas
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ function TFBlendOp.GetPattern(AWidth,AHeight: integer; APattern: string; AChecke
idx: integer;
fullPatternName, attr: string;
i: integer;
ratio: single;
begin
fullPatternName:= APattern;
for i := 0 to high(FPatterns) do
Expand Down
1 change: 1 addition & 0 deletions lazpaint/dialog/ubrowseimages.pas
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,7 @@ procedure TFBrowseImages.ResetDirectory(AFocus: boolean; AForceReload: boolean);
ShellListView1.Reload
else
ShellListView1.Root := newDir;
SetShellMask;
StartThumbnails;
if AFocus then ShellListView1.SetFocus;
if ShellListView1.ItemCount <> 0 then
Expand Down
6 changes: 4 additions & 2 deletions lazpaint/dialog/ucanvassize.pas
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function ChangeCanvasSize(bmp: TBGRABitmap; ofs: TPoint; oldWidth,oldHeight,newW
end;
end;

function ChangeLayeredImageCanvasSize(layeredBmp: TLazPaintImage; newWidth,
function ChangeLayeredImageCanvasSize(AInstance: TLazPaintCustomInstance; layeredBmp: TLazPaintImage; newWidth,
newHeight: integer; anchor: string; background: TBGRAPixel;
repeatImage: boolean; flipMode: boolean): TBGRALayeredBitmap;
var i,idx: integer;
Expand All @@ -138,6 +138,7 @@ function ChangeLayeredImageCanvasSize(layeredBmp: TLazPaintImage; newWidth,
result := TBGRALayeredBitmap.Create;
for i := 0 to layeredbmp.NbLayers-1 do
begin
AInstance.ReportActionProgress(i*100 div layeredbmp.NbLayers);
newBmp := ChangeCanvasSize(layeredbmp.LayerBitmap[i],layeredbmp.LayerOffset[i],layeredBmp.Width,layeredBmp.Height, newwidth,newHeight,anchor,background,repeatImage,flipMode);
idx := result.AddOwnedLayer(newBmp,layeredBmp.BlendOperation[i],layeredbmp.LayerOpacity[i]);
result.LayerName[idx] := layeredbmp.LayerName[i];
Expand All @@ -155,12 +156,13 @@ function ChangeLayeredImageCanvasSize(layeredBmp: TLazPaintImage; newWidth,
end;
end;
end;
AInstance.ReportActionProgress(100);
end;

function ComputeNewCanvasSize(AInstance: TLazPaintCustomInstance; AWidth,AHeight: integer;
AAnchor: string; ARepeatImage, AFlipMode: boolean): TLayeredBitmapAndSelection;
begin
result.layeredBitmap := ChangeLayeredImageCanvasSize(AInstance.Image,
result.layeredBitmap := ChangeLayeredImageCanvasSize(AInstance, AInstance.Image,
AWidth,AHeight,AAnchor,BGRAPixelTransparent, ARepeatImage, AFlipMode);
if AInstance.Image.SelectionMaskReadonly <> nil then
result.selection := ChangeCanvasSize(AInstance.Image.SelectionMaskReadonly,
Expand Down
10 changes: 9 additions & 1 deletion lazpaint/dialog/uchoosecolorinterface.pas
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ function TChooseColorInterface.DrawTriangleCursor(dest: TBGRABitmap;
procedure TChooseColorInterface.DoSelect(X, Y: integer);
var pix, newColor: TBGRAPixel;
newLight: Word;
dist: single;
begin
case FSelectZone of
szAlphascale:
Expand All @@ -513,8 +514,15 @@ procedure TChooseColorInterface.DoSelect(X, Y: integer);
UpdateColorview(False, False, True);
end;
szColorCircle:
if PtInRect(point(x,y), FColorCircle.Bounds) and Assigned(FColorCircle.bmpMaxlight) then
if Assigned(FColorCircle.bmpMaxlight) then
begin
dist := sqrt(sqr((x-FColorCircle.center.X)/FColorCircle.bounds.Width*2) +
sqr((y-FColorCircle.center.Y)/FColorCircle.bounds.Height*2));
if dist > 1 then
begin
x := round(FColorCircle.center.X + (x-FColorCircle.center.X)/dist);
y := round(FColorCircle.center.Y + (y-FColorCircle.center.Y)/dist);
end;
pix := FColorCircle.bmpMaxlight.GetPixel(x-FColorCircle.Bounds.Left,y-FColorCircle.Bounds.top);
if pix.alpha <> 0 then
begin
Expand Down
2 changes: 0 additions & 2 deletions lazpaint/dialog/usaveoption.pas
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ procedure TFSaveOption.Button_OKClick(Sender: TObject);
var inputStream,outputStream: TStream;
icoCur: TBGRAIconCursor;
picture: TBGRACustomBitmap;
bpp: integer;
begin
icoCur := TBGRAIconCursor.Create;
if FileManager.FileExists(FOutputFilename) then
Expand All @@ -443,7 +442,6 @@ procedure TFSaveOption.Button_OKClick(Sender: TObject);
icoCur.FileType:= ImageFormat;
end;
try
bpp := WantedBitsPerPixel;
if PngStreamNeeded then
begin
MakePngStreamIfNeeded;
Expand Down
9 changes: 7 additions & 2 deletions lazpaint/image/uimage.pas
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ TLazPaintImage = class;

TLazPaintImage = class
private
FLazPaintInstance: TObject;
FActionInProgress: TCustomLayerAction;
FOnActionProgress: TLayeredActionProgressEvent;
FOnSelectedLayerIndexChanging: TOnCurrentLayerIndexChanged;
Expand Down Expand Up @@ -295,7 +296,7 @@ TLazPaintImage = class
property IsTiff: boolean read GetIsTiff;
property IsGif: boolean read GetIsGif;
property DPI: integer read GetDPI;
constructor Create;
constructor Create(ALazPaintInstance: TObject);
destructor Destroy; override;
end;

Expand Down Expand Up @@ -713,7 +714,10 @@ procedure TLazPaintImage.LoadFromFileUTF8(AFilename: string);
layeredBmp.Free;
layeredBmp := temp;
end;
MessagePopupForever(rsResamplingImage);
(FLazPaintInstance as TLazPaintCustomInstance).UpdateWindows;
(layeredBmp as TBGRALayeredBitmap).Resample(cx, cy, rmFineResample);
MessagePopupHide;
end;
CursorHotSpot := Point(0,0);
if layeredBmp is TBGRALazPaintImage then
Expand Down Expand Up @@ -2326,8 +2330,9 @@ function TLazPaintImage.GetLayerIndexByGuid(AGuid: TGuid): integer;
exit(-1);
end;

constructor TLazPaintImage.Create;
constructor TLazPaintImage.Create(ALazPaintInstance: TObject);
begin
FLazPaintInstance := ALazPaintInstance;
FCurrentState := TImageState.Create;
FCurrentState.OnOriginalChange:= @OriginalChange;
FCurrentState.OnOriginalEditingChange:= @OriginalEditingChange;
Expand Down
2 changes: 1 addition & 1 deletion lazpaint/lazpaint.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<VersionInfo>
<UseVersionInfo Value="True"/>
<MajorVersionNr Value="7"/>
<RevisionNr Value="9"/>
<MinorVersionNr Value="1"/>
<CharSet Value="04B0"/>
<StringTable CompanyName="http://sourceforge.net/projects/lazpaint/" ProductName="LazPaint" InternalName="lazpaint" OriginalFilename="lazpaint.exe"/>
</VersionInfo>
Expand Down
2 changes: 1 addition & 1 deletion lazpaint/lazpaintembeddedpack.lpk
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</Debugging>
</Linking>
</CompilerOptions>
<Version Major="7" Release="9"/>
<Version Major="7" Minor="1"/>
<Files Count="94">
<Item1>
<Filename Value="lazpaintinstance.pas"/>
Expand Down
36 changes: 17 additions & 19 deletions lazpaint/lazpaintinstance.pas
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ TLazPaintInstance = class(TLazPaintCustomInstance)
procedure EndLoadingImage; override;
procedure StartSavingImage(AFilename: string); override;
procedure EndSavingImage; override;
procedure ReportActionProgress(AProgressPercent: integer); override;
procedure Donate; override;
procedure SaveMainWindowPosition; override;
procedure RestoreMainWindowPosition; override;
Expand Down Expand Up @@ -313,6 +314,20 @@ procedure TLazPaintInstance.EndSavingImage;
UpdateWindows;
end;

procedure TLazPaintInstance.ReportActionProgress(AProgressPercent: integer);
var
delay: Integer;
begin
if AProgressPercent < 100 then delay := 10000 else delay := 1000;
if Assigned(FMain) then FMain.UpdatingPopup:= true;
try
MessagePopup(rsActionInProgress+'... '+inttostr(AProgressPercent)+'%', delay);
UpdateWindows;
finally
if Assigned(FMain) then FMain.UpdatingPopup:= false;
end;
end;

procedure TLazPaintInstance.Donate;
begin
OpenURL('http://sourceforge.net/donate/index.php?group_id=404555');
Expand Down Expand Up @@ -418,7 +433,7 @@ procedure TLazPaintInstance.Init(AEmbedded: boolean);
RegisterScripts(True);

InColorFromFChooseColor := false;
FImage := TLazPaintImage.Create;
FImage := TLazPaintImage.Create(self);
FImage.OnStackChanged:= @OnStackChanged;
FImage.OnException := @OnFunctionException;
FImage.OnActionProgress:=@OnImageActionProgress;
Expand Down Expand Up @@ -663,17 +678,8 @@ function TLazPaintInstance.GetMainFormVisible: boolean;

procedure TLazPaintInstance.OnImageActionProgress(ASender: TObject;
AProgressPercent: integer);
var
delay: Integer;
begin
if AProgressPercent < 100 then delay := 10000 else delay := 1000;
if Assigned(FMain) then FMain.UpdatingPopup:= true;
try
MessagePopup(rsActionInProgress+'... '+inttostr(AProgressPercent)+'%', delay);
UpdateWindows;
finally
if Assigned(FMain) then FMain.UpdatingPopup:= false;
end;
ReportActionProgress(AProgressPercent);
end;

function TLazPaintInstance.GetInitialized: boolean;
Expand Down Expand Up @@ -1521,7 +1527,6 @@ procedure TLazPaintInstance.ShowTopmost(AInfo: TTopMostInfo);

procedure TLazPaintInstance.UpdateWindows;
begin
{$IFDEF LINUX}
if Assigned(FMain) then FMain.Enabled:= false;
if Assigned(FFormToolbox) then FFormToolbox.Enabled:= false;
if Assigned(FChooseColor) then FChooseColor.Enabled:= false;
Expand All @@ -1533,13 +1538,6 @@ procedure TLazPaintInstance.UpdateWindows;
if Assigned(FChooseColor) then FChooseColor.Enabled:= true;
if Assigned(FLayerStack) then FLayerStack.Enabled:= true;
if Assigned(FImageList) then FImageList.Enabled:= true;
{$ELSE}
if Assigned(FMain) then FMain.Update;
if Assigned(FFormToolbox) then FFormToolbox.Update;
if Assigned(FChooseColor) then FChooseColor.Update;
if Assigned(FLayerStack) then FLayerStack.Update;
if Assigned(FImageList) then FImageList.Update;
{$ENDIF}
end;

procedure TLazPaintInstance.Wait(ACheckActive: TCheckFunction; ADelayMs: integer);
Expand Down
14 changes: 12 additions & 2 deletions lazpaint/lazpaintmainform.pas
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ TFMain = class(TForm)
procedure HideFill(ATimeMs: Integer = 300; AClearTime: boolean = false);
procedure OnPaintHandler;
procedure OnImageChangedHandler({%H-}AEvent: TLazPaintImageObservationEvent);
procedure OnImageRenderChanged(sender: TObject);
procedure OnImageRenderChanged({%H-}Sender: TObject);
procedure LabelAutosize(ALabel: TLabel);
procedure AskMergeSelection(ACaption: string);
procedure ReleaseMouseButtons(Shift: TShiftState);
Expand Down Expand Up @@ -2434,6 +2434,16 @@ procedure TFMain.FormUTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char);
ViewZoomOut.Execute;
UTF8Key := '';
end else
if toolProcessKey and (UTF8Key = '*') then
begin
ViewZoomOriginal.Execute;
UTF8Key := '';
end else
if toolProcessKey and (UTF8Key = '/') then
begin
ViewZoomFit.Execute;
UTF8Key := '';
end else
begin
selectedTool := ToolManager.GetCurrentToolType;
FLayout.Menu.CycleTool(selectedTool, UTF8Key);
Expand Down Expand Up @@ -4400,7 +4410,7 @@ procedure TFMain.OnImageChangedHandler(AEvent: TLazPaintImageObservationEvent);
if AEvent.DelayedStackUpdate then FUpdateStackWhenIdle := true;
end;

procedure TFMain.OnImageRenderChanged(sender: TObject);
procedure TFMain.OnImageRenderChanged(Sender: TObject);
begin
InvalidatePicture;
end;
Expand Down
3 changes: 2 additions & 1 deletion lazpaint/lazpainttype.pas
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface
{$IFDEF LINUX}, InterfaceBase{$ENDIF};

const
LazPaintVersion = 7000900;
LazPaintVersion = 7010000;

function LazPaintVersionStr: string;

Expand Down Expand Up @@ -221,6 +221,7 @@ TLazPaintCustomInstance = class(TInterfacedObject,IConfigProvider)
procedure EndLoadingImage; virtual; abstract;
procedure StartSavingImage(AFilename: string); virtual; abstract;
procedure EndSavingImage; virtual; abstract;
procedure ReportActionProgress(AProgressPercent: integer); virtual; abstract;
procedure SaveMainWindowPosition; virtual; abstract;
procedure RestoreMainWindowPosition; virtual; abstract;
procedure Donate; virtual; abstract;
Expand Down
13 changes: 13 additions & 0 deletions lazpaint/release/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,16 @@ lazpaint (7.0.9) unstable; urgency=low

-- circular <circular@operamail.com> Fri, 3 Apr 2020 12:40:00 +0100

lazpaint (7.1) stable; urgency=low

* tool: fix update of pen style from shape
* interface: fix file extension mask when opening image browser
* interface: fix selection of file after changing folder
* interface: show progress when changing canvas size
* interface: show popup when downsampling opened big image
* interface: fix update of popup on Windows
* interface: allow to select outside color circle of color window
* interface: added shortcuts / and * to shrink and use original zoom

-- circular <circular@operamail.com> Fri, 10 Apr 2020 12:07:00 +0100

13 changes: 13 additions & 0 deletions lazpaint/release/debian/linux32/DEBIAN/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,16 @@ lazpaint (7.0.9) unstable; urgency=low

-- circular <circular@operamail.com> Fri, 3 Apr 2020 12:40:00 +0100

lazpaint (7.1) stable; urgency=low

* tool: fix update of pen style from shape
* interface: fix file extension mask when opening image browser
* interface: fix selection of file after changing folder
* interface: show progress when changing canvas size
* interface: show popup when downsampling opened big image
* interface: fix update of popup on Windows
* interface: allow to select outside color circle of color window
* interface: added shortcuts / and * to shrink and use original zoom

-- circular <circular@operamail.com> Fri, 10 Apr 2020 12:07:00 +0100

2 changes: 1 addition & 1 deletion lazpaint/release/debian/linux32/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: lazpaint
Version: 7.0.9
Version: 7.1
Section: base
Priority: optional
Architecture: i386
Expand Down
13 changes: 13 additions & 0 deletions lazpaint/release/debian/linux64/DEBIAN/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,16 @@ lazpaint (7.0.9) unstable; urgency=low

-- circular <circular@operamail.com> Fri, 3 Apr 2020 12:40:00 +0100

lazpaint (7.1) stable; urgency=low

* tool: fix update of pen style from shape
* interface: fix file extension mask when opening image browser
* interface: fix selection of file after changing folder
* interface: show progress when changing canvas size
* interface: show popup when downsampling opened big image
* interface: fix update of popup on Windows
* interface: allow to select outside color circle of color window
* interface: added shortcuts / and * to shrink and use original zoom

-- circular <circular@operamail.com> Fri, 10 Apr 2020 12:07:00 +0100

2 changes: 1 addition & 1 deletion lazpaint/release/debian/linux64/DEBIAN/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: lazpaint
Version: 7.0.9
Version: 7.1
Section: base
Priority: optional
Architecture: amd64
Expand Down
4 changes: 2 additions & 2 deletions lazpaint/release/macOS/LazPaint.app/Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
<key>CFBundleSignature</key>
<string>lazp</string>
<key>CFBundleShortVersionString</key>
<string>7.0.9</string>
<string>7.1</string>
<key>CFBundleVersion</key>
<string>7.0.9</string>
<string>7.1</string>
<key>CSResourcesFileMapped</key>
<true/>
<key>CFBundleDocumentTypes</key>
Expand Down
2 changes: 1 addition & 1 deletion lazpaint/release/macOS/makedmg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fi


appname=LazPaint
appversion=7.0.9
appversion=7.1
pkgversion=0
appnamenospaces=lazpaint
appbundle="$appname.app"
Expand Down
2 changes: 1 addition & 1 deletion lazpaint/release/windows/lazpaint.iss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#define MyAppName "LazPaint"
#define MyAppOutputName "lazpaint"
#define MyInstallerSuffix "_setup_win32_win64"
#define MyAppVersion "7.0.9"
#define MyAppVersion "7.1"
#define MyAppPublisher "Circular, Fabien Wang, Lainz and others"
#define MyAppURL "http://sourceforge.net/projects/lazpaint/"
#define MyAppExeName "lazpaint.exe"
Expand Down
2 changes: 1 addition & 1 deletion lazpaint/tools/utoolbasic.pas
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ function TToolPen.ContinueDrawing(toolDest: TBGRABitmap; originF, destF: TPointF
if Manager.ShapeOptionAliasing then
begin
pts := toolDest.Pen.ComputePolyline([PointF(destF.X,destF.Y),PointF(originF.X,originF.Y)],
Manager.PenWidth, testPix, False);
Manager.PenWidth, BGRAPixelTransparent, False);
toolDest.FillPoly(pts, b);
end else
begin
Expand Down
Loading

0 comments on commit 2feccdf

Please sign in to comment.