Skip to content

Commit

Permalink
Merge pull request #195 from bgrabitmap/dev-lazpaint
Browse files Browse the repository at this point in the history
Dev lazpaint 7.1.4
  • Loading branch information
circular17 authored Oct 7, 2020
2 parents 50a3450 + 9c1e267 commit 1769fb4
Show file tree
Hide file tree
Showing 223 changed files with 5,766 additions and 2,194 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@ lazpaint/release/windows/lazpaint64
lazpaint/release/bin/i18n/lazpaint32.*
lazpaint/release/bin/i18n/lazpaint_x64.*
/lazpaint/dialog/color/backup

resources/createresource/backup/

lazpaint/units/
File renamed without changes.
101 changes: 101 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
prefix = /usr/local
USER_DIR = $(DESTDIR)$(prefix)
BIN_DIR = $(USER_DIR)/bin
SHARE_DIR=$(USER_DIR)/share
RESOURCE_DIR=$(SHARE_DIR)/lazpaint
DOC_DIR=$(SHARE_DIR)/doc/lazpaint
SOURCE_BIN_DIR=lazpaint/release/bin
SOURCE_SCRIPT_DIR=resources/scripts
SOURCE_DEBIAN_DIR=lazpaint/release/debian
PO_FILES:=$(shell find "$(SOURCE_BIN_DIR)/i18n" -maxdepth 1 -type f -name *.po -printf "\"%f\" ")
MODEL_FILES:=$(shell find "$(SOURCE_BIN_DIR)/models" -maxdepth 1 -type f -printf "\"%f\" ")
SCRIPT_FILES:=$(shell find "$(SOURCE_SCRIPT_DIR)" -maxdepth 1 -type f -name *.py -printf "\"%f\" ")
SCRIPT_RUNTIME_FILES:=$(shell find "$(SOURCE_SCRIPT_DIR)/lazpaint" -maxdepth 1 -type f -name *.py -printf "\"%f\" ")

ifeq ($(OS),Windows_NT) # true for Windows_NT or later
COPY := winmake\copyfile
REMOVE := winmake\remove
REMOVEDIR := winmake\removedir
THEN := &
RUN :=
else
COPY := cp
REMOVE := rm -f
REMOVEDIR := rm -rf
THEN := ;
RUN := ./
endif

all: compile

install:
ifeq ($(OS),Windows_NT) # true for Windows_NT or later
echo Under Windows, use installation generated by InnoSetup with lazpaint/release/windows/lazpaint.iss
else ifeq ($(shell uname),Linux)
install -D "$(SOURCE_BIN_DIR)/lazpaint" "$(BIN_DIR)/lazpaint"
for f in $(PO_FILES); do install -D "$(SOURCE_BIN_DIR)/i18n/$$f" "${RESOURCE_DIR}/i18n/$$f"; done
for f in $(MODEL_FILES); do install -D "$(SOURCE_BIN_DIR)/models/$$f" "${RESOURCE_DIR}/models/$$f"; done
for f in $(SCRIPT_FILES); do install -D "$(SOURCE_SCRIPT_DIR)/$$f" "${RESOURCE_DIR}/scripts/$$f"; done
for f in $(SCRIPT_RUNTIME_FILES); do install -D "$(SOURCE_SCRIPT_DIR)/lazpaint/$$f" "${RESOURCE_DIR}/scripts/lazpaint/$$f"; done
install -D "$(SOURCE_DEBIAN_DIR)/applications/lazpaint.desktop" "$(SHARE_DIR)/applications/lazpaint.desktop"
install -D "$(SOURCE_DEBIAN_DIR)/pixmaps/lazpaint.png" "$(SHARE_DIR)/pixmaps/lazpaint.png"
install -d "$(SHARE_DIR)/man/man1"
gzip -9 -n -c "$(SOURCE_DEBIAN_DIR)/man/man1/lazpaint.1" >"$(SHARE_DIR)/man/man1/lazpaint.1.gz"
chmod 0644 "$(SHARE_DIR)/man/man1/lazpaint.1.gz"
install -d "$(DOC_DIR)"
gzip -9 -n -c "$(SOURCE_DEBIAN_DIR)/debian/changelog" >"$(DOC_DIR)/changelog.gz"
chmod 0644 "$(DOC_DIR)/changelog.gz"
install "$(SOURCE_DEBIAN_DIR)/debian/copyright" "$(DOC_DIR)/copyright"
install "$(SOURCE_BIN_DIR)/readme.txt" "$(DOC_DIR)/README"
else
echo Unhandled OS
endif

uninstall:
ifeq ($(OS),Windows_NT) # true for Windows_NT or later
echo Under Windows, go to Add/Remove programs
else ifeq ($(shell uname),Linux)
$(REMOVE) $(BIN_DIR)/lazpaint
$(REMOVEDIR) $(RESOURCE_DIR)
$(REMOVEDIR) $(DOC_DIR)
$(REMOVE) "$(SHARE_DIR)/applications/lazpaint.desktop"
$(REMOVE) "$(SHARE_DIR)/pixmaps/lazpaint.png"
$(REMOVE) "$(SHARE_DIR)/man/man1/lazpaint.1.gz"
else
echo Unhandled OS
endif

clean: clean_lazpaintcontrols clean_vectoredit clean_lazpaint

clean_lazpaintcontrols:
$(REMOVEDIR) "lazpaintcontrols/lib"
$(REMOVEDIR) "lazpaintcontrols/backup"

clean_vectoredit:
$(REMOVEDIR) "vectoredit/lib"
$(REMOVEDIR) "vectoredit/backup"

clean_lazpaint:
$(REMOVEDIR) "lazpaint/debug"
$(REMOVEDIR) "lazpaint/release/lib"
$(REMOVE) "lazpaint/lazpaint.res"
$(REMOVE) "lazpaint/release/bin/lazpaint"
$(REMOVE) "lazpaint/release/bin/lazpaint32.exe"
$(REMOVE) "lazpaint/release/bin/lazpaint_x64.exe"
$(REMOVEDIR) "lazpaint/backup"
$(REMOVEDIR) "lazpaint/dialog/backup"
$(REMOVEDIR) "lazpaint/image/backup"
$(REMOVEDIR) "lazpaint/tablet/backup"
$(REMOVEDIR) "lazpaint/test_embedded/backup"
$(REMOVEDIR) "lazpaint/tools/backup"

compile: lazpaintcontrols vectoredit lazpaint
lazbuild:
#lazbuild will determine what to recompile
lazpaintcontrols: lazbuild lazpaintcontrols/lazpaintcontrols.lpk
lazbuild lazpaintcontrols/lazpaintcontrols.lpk
vectoredit: lazbuild vectoredit/vectoredit.lpi
lazbuild vectoredit/vectoredit.lpi
lazpaint: lazbuild lazpaint/lazpaint.lpi
lazbuild lazpaint/lazpaint.lpi

7 changes: 2 additions & 5 deletions lazpaint.logic
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ project lazpaint.lpi
package lazpaintembeddedpack.lpk
const lazpainttype.pas LazPaintVersion
text release/windows/lazpaint.iss "#define MyAppVersion ""$(Version)"""
text release/debian/linux32/DEBIAN/control "Version: $(Version)"
text release/debian/linux64/DEBIAN/control "Version: $(Version)"
echo "Don't forget to UPDATE changelog file"
copy release/changelog release/debian/linux32/DEBIAN/changelog
copy release/changelog release/debian/linux64/DEBIAN/changelog
text release/debian/debian/control "Version: $(Version)"
echo "DON'T FORGET TO UPDATE release/debian/changelog"
text release/macOS/makedmg.sh "appversion=$(Version)"
bundle release/macOS/LazPaint.app
copy ../resources/icon/lazpaint.icns release/macOS/LazPaint.app/Contents/Resources/lazpaint.icns
3 changes: 2 additions & 1 deletion lazpaint/dialog/color/uadjustcurves.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ object FAdjustCurves: TFAdjustCurves
'Alpha'
)
Align = alClient
Anchors = [akLeft, akTop, akRight, akBottom]
TabOrder = 0
object vsChart: TBGRAVirtualScreen
Left = 2
Expand Down Expand Up @@ -64,7 +65,7 @@ object FAdjustCurves: TFAdjustCurves
Top = 0
Width = 90
Align = alNone
Anchors = [akTop, akRight]
Anchors = [akTop, akLeft]
EdgeBorders = []
Images = FMain.ImageList16
ParentShowHint = False
Expand Down
16 changes: 15 additions & 1 deletion lazpaint/dialog/color/uadjustcurves.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-only
unit uadjustcurves;

{$mode objfpc}{$H+}
Expand Down Expand Up @@ -67,6 +68,7 @@ TFAdjustCurves = class(TForm)
FGridColor: TBGRAPixel;
FTickSize: integer;
FPointSize, FCurvePenWidth: single;
FScaling: single;
FHueTabPrecomputed: boolean;
FSelectedPoint: integer;
FMovingPoint: boolean;
Expand Down Expand Up @@ -126,6 +128,7 @@ procedure TFAdjustCurves.FormCreate(Sender: TObject);
i: Integer;
begin
ScaleControl(Self, OriginalDPI);
vsChart.BitmapAutoScale:= false;

CheckOKCancelBtns(Button_OK, Button_Cancel);
FSelectedPoint:= -1;
Expand Down Expand Up @@ -379,6 +382,8 @@ procedure TFAdjustCurves.ToolButton_NewCurveClick(Sender: TObject);
procedure TFAdjustCurves.vsChartMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
X := round(X*FScaling);
Y := round(Y*FScaling);
if Button = mbLeft then
begin
FSelectedPoint:= NearestPoint(X,Y);
Expand All @@ -391,6 +396,8 @@ procedure TFAdjustCurves.vsChartMouseDown(Sender: TObject;
procedure TFAdjustCurves.vsChartMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
begin
X := round(X*FScaling);
Y := round(Y*FScaling);
if FMovingPoint then
begin
SetPointCoord(FSelectedPoint, BitmapToCoord(X,Y));
Expand Down Expand Up @@ -538,8 +545,9 @@ procedure TFAdjustCurves.RecomputeGraphBackground(AWidth, AHeight: integer);
if length(labels[i])>maxLabelLength then maxLabelLength := length(labels[i]);
totalLabelLength:= maxLabelLength + length(labels[0]) + (1+maxLabelLength)*(length(labels)-1);

FScaling := GetCanvasScaleFactor;
th := Min(AHeight div (length(labels)+2), round(AWidth*1.8/totalLabelLength));
th := Min(th, DoScaleY(20,96));
th := Min(th, DoScaleY(round(20*FScaling),96));
FCurvePenWidth := th/10;
FPointSize := th/4;
FTickSize := th div 4;
Expand Down Expand Up @@ -621,6 +629,10 @@ function TFAdjustCurves.NearestPoint(xBmp, yBmp: single): integer;
result := -1;
curve := SelectedCurve;
if curve = nil then exit;
if xBmp < FPoint0.x then xBmp := FPoint0.x;
if xBmp > FPoint1.x then xBmp := FPoint1.x;
if yBmp > FPoint0.y then yBmp := FPoint0.y;
if yBmp < FPoint1.y then yBmp := FPoint1.y;
pointList := curve.GetVariable('Points');
pointCount := curve.GetListCount(pointList);
minDist := sqr(ScaleX(20,96)+0.0);
Expand Down Expand Up @@ -656,6 +668,8 @@ function TFAdjustCurves.InsertPoint(xBmp, yBmp: single): integer;
if (pt1.x <= xBmp-1) and (pt2.x >= xBmp+1) then
begin
coord := BitmapToCoord(xBmp,yBmp);
if coord.y < 0 then coord.y := 0;
if coord.y > 1 then coord.y := 1;
curve.AppendPoint(pointList, curve.GetPoint2DAt(pointList, pointCount-1));
for j := pointCount-1 downto i do curve.AssignPointAt(pointList, j+1, curve.GetPoint2DAt(pointList, j));
curve.AssignPointAt(pointList, i, coord);
Expand Down
1 change: 1 addition & 0 deletions lazpaint/dialog/color/ucolorintensity.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-only
unit UColorintensity;

{$mode objfpc}{$H+}
Expand Down
1 change: 1 addition & 0 deletions lazpaint/dialog/color/ucolorize.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-only
unit UColorize;

{$mode objfpc}{$H+}
Expand Down
1 change: 1 addition & 0 deletions lazpaint/dialog/color/ushiftcolors.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-only
unit UShiftColors;

{$mode objfpc}{$H+}
Expand Down
1 change: 1 addition & 0 deletions lazpaint/dialog/filter/ucustomblur.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-only
unit UCustomblur;

{$mode objfpc}{$H+}
Expand Down
37 changes: 21 additions & 16 deletions lazpaint/dialog/filter/uemboss.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-only
unit UEmboss;

{$mode objfpc}{$H+}
Expand Down Expand Up @@ -145,23 +146,27 @@ procedure TFEmboss.PaintBox1Paint(Sender: TObject);
x1,y1,x2,y2: single;
dx,dy,t: single;
c: TBGRAPixel;
scaling: Double;
begin
bmp := TBGRABitmap.Create(PaintBox1.Width,PaintBox1.Height);
bmp.Fill(ColorToRGB(clBtnFace));
c := ColorToBGRA(ColorToRGB(clWindowText));
t := min(PaintBox1.Width/2,PaintBox1.Height/2);
dx := cos(angle*Pi/180);
dy := sin(angle*Pi/180);
x1 := PaintBox1.Width/2;
y1 := PaintBox1.Height/2;
x2 := x1+dx*(t-2);
y2 := y1+dy*(t-2);
bmp.FillEllipseAntialias(x1,y1,t-1,t-1,BGRA(c.red,c.green,c.blue,48));
bmp.DrawLineAntialias(x1,y1,x2,y2,c,2,true);
bmp.DrawLineAntialias(x2+dy*5-dx*5,y2-dx*5-dy*5,x2,y2,c,2,false);
bmp.DrawLineAntialias(x2-dy*5-dx*5,y2+dx*5-dy*5,x2,y2,c,2,false);
bmp.Draw(PaintBox1.Canvas,0,0,true);
bmp.Free;
scaling := GetCanvasScaleFactor;
bmp := TBGRABitmap.Create(round(PaintBox1.Width*scaling),round(PaintBox1.Height*scaling));
bmp.Fill(clForm);
c := ColorToBGRA(ColorToRGB(clWindowText));
t := min(bmp.Width/2,bmp.Height/2);
dx := cos(angle*Pi/180);
dy := sin(angle*Pi/180);
x1 := bmp.Width/2;
y1 := bmp.Height/2;
x2 := x1+dx*(t-2);
y2 := y1+dy*(t-2);
bmp.FillEllipseAntialias(x1,y1,t-1,t-1,BGRA(c.red,c.green,c.blue,48));
bmp.DrawLineAntialias(x1,y1,x2,y2,c,2*scaling,true);
bmp.DrawLineAntialias(x2+dy*5*scaling-dx*5*scaling,
y2-dx*5*scaling-dy*5*scaling,x2,y2,c,2*scaling,false);
bmp.DrawLineAntialias(x2-dy*5*scaling-dx*5*scaling,
y2+dx*5*scaling-dy*5*scaling,x2,y2,c,2*scaling,false);
bmp.Draw(PaintBox1.Canvas, rect(0,0,PaintBox1.Width,PaintBox1.Height), true);
bmp.Free;
end;

procedure TFEmboss.TrackBar_StrengthChange(Sender: TObject);
Expand Down
1 change: 1 addition & 0 deletions lazpaint/dialog/filter/ufilterfunction.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-only
unit UFilterFunction;

{$mode objfpc}{$H+}
Expand Down
3 changes: 2 additions & 1 deletion lazpaint/dialog/filter/uformrain.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-only
unit UFormRain;

{$mode objfpc}{$H+}
Expand Down Expand Up @@ -161,7 +162,7 @@ procedure TFRain.PaintBox_WindPaint(Sender: TObject);
begin
if wind = 0 then exit;
bmp := TBGRABitmap.Create(PaintBox_Wind.Width,PaintBox_Wind.Height);
bmp.Fill(ColorToRGB(clBtnFace));
bmp.Fill(clForm);
c := ColorToBGRA(ColorToRGB(clWindowText));
if wind < 0 then angle := 180 else angle := 0;
t := PaintBox_Wind.Width/2*abs(wind);
Expand Down
54 changes: 30 additions & 24 deletions lazpaint/dialog/filter/umotionblur.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-only
unit UMotionBlur;

{$mode objfpc}{$H+}
Expand Down Expand Up @@ -101,31 +102,36 @@ procedure TFMotionBlur.PaintBox1Paint(Sender: TObject);
x0,y0,x1,y1,x2,y2: single;
dx,dy,t: single;
c: TBGRAPixel;
scaling: Double;
begin
bmp := TBGRABitmap.Create(PaintBox1.Width,PaintBox1.Height);
bmp.Fill(ColorToRGB(clBtnFace));
c := ColorToBGRA(ColorToRGB(clWindowText));
t := min(PaintBox1.Width/2,PaintBox1.Height/2);
dx := cos(angle*Pi/180);
dy := sin(angle*Pi/180);
x1 := PaintBox1.Width/2;
y1 := PaintBox1.Height/2;
x0 := x1-dx*(t-2);
y0 := y1-dy*(t-2);
x2 := x1+dx*(t-2);
y2 := y1+dy*(t-2);
bmp.FillEllipseAntialias(x1,y1,t-1,t-1,BGRA(c.red,c.green,c.blue,48));
if Checkbox_Oriented.Checked then
begin
bmp.DrawLineAntialias(x1,y1,x2,y2,c,2,true);
bmp.DrawLineAntialias(x2+dy*5-dx*5,y2-dx*5-dy*5,x2,y2,c,2,false);
bmp.DrawLineAntialias(x2-dy*5-dx*5,y2+dx*5-dy*5,x2,y2,c,2,false);
end else
begin
bmp.DrawLineAntialias(x0,y0,x2,y2,c,2,true);
end;
bmp.Draw(PaintBox1.Canvas,0,0,true);
bmp.Free;
scaling := GetCanvasScaleFactor;
bmp := TBGRABitmap.Create(round(PaintBox1.Width*scaling),
round(PaintBox1.Height*scaling));
bmp.Fill(clForm);
c := ColorToBGRA(ColorToRGB(clWindowText));
t := min(bmp.Width/2,bmp.Height/2);
dx := cos(angle*Pi/180);
dy := sin(angle*Pi/180);
x1 := bmp.Width/2;
y1 := bmp.Height/2;
x0 := x1-dx*(t-2);
y0 := y1-dy*(t-2);
x2 := x1+dx*(t-2);
y2 := y1+dy*(t-2);
bmp.FillEllipseAntialias(x1,y1,t-1,t-1,BGRA(c.red,c.green,c.blue,48));
if Checkbox_Oriented.Checked then
begin
bmp.DrawLineAntialias(x1,y1,x2,y2,c,2*scaling,true);
bmp.DrawLineAntialias(x2+dy*5*scaling-dx*5*scaling,
y2-dx*5*scaling-dy*5*scaling,x2,y2,c,2*scaling,false);
bmp.DrawLineAntialias(x2-dy*5*scaling-dx*5*scaling,
y2+dx*5*scaling-dy*5*scaling,x2,y2,c,2*scaling,false);
end else
begin
bmp.DrawLineAntialias(x0,y0,x2,y2,c,2*scaling,true);
end;
bmp.Draw(PaintBox1.Canvas, rect(0,0,PaintBox1.Width,PaintBox1.Height), true);
bmp.Free;
end;

procedure TFMotionBlur.SpinEdit_DistanceChange(Sender: TObject);
Expand Down
1 change: 1 addition & 0 deletions lazpaint/dialog/filter/unoisefilter.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-only
unit unoisefilter;

{$mode objfpc}{$H+}
Expand Down
1 change: 1 addition & 0 deletions lazpaint/dialog/filter/uphongfilter.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-only
unit UPhongFilter;

{$mode objfpc}{$H+}
Expand Down
1 change: 1 addition & 0 deletions lazpaint/dialog/filter/upixelate.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-only
unit UPixelate;

{$mode objfpc}{$H+}
Expand Down
1 change: 1 addition & 0 deletions lazpaint/dialog/filter/uposterize.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-only
unit uposterize;

{$mode objfpc}{$H+}
Expand Down
1 change: 1 addition & 0 deletions lazpaint/dialog/filter/uradialblur.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-only
unit URadialBlur;

{$mode objfpc}{$H+}
Expand Down
1 change: 1 addition & 0 deletions lazpaint/dialog/filter/usharpen.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-only
unit USharpen;

{$mode objfpc}
Expand Down
1 change: 1 addition & 0 deletions lazpaint/dialog/filter/utwirl.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-3.0-only
unit UTwirl;

{$mode objfpc}
Expand Down
Loading

0 comments on commit 1769fb4

Please sign in to comment.