diff --git a/applications/lazimageeditor/DLBitmap.pas b/applications/lazimageeditor/DLBitmap.pas index f2cd4dc35..c06c1b244 100644 --- a/applications/lazimageeditor/DLBitmap.pas +++ b/applications/lazimageeditor/DLBitmap.pas @@ -38,6 +38,8 @@ type procedure SetFillColor(const AValue: TColor); procedure SetOutlineColor(const AValue: TColor); procedure SetPaperColor(const AValue: TColor); + function GetScanLinePixel(X, Y: Integer): TColor; + procedure SetScanLinePixel(X, Y: Integer; Value: TColor); protected procedure SetWidth(Value: integer); override; procedure SetHeight(Value: integer); override; @@ -73,6 +75,7 @@ type property FillColor: TColor read GetFillColor write SetFillColor; property OutlineColor: TColor read GetOutlineColor write SetOutlineColor; property PaperColor: TColor read GetPaperColor write SetPaperColor; + property ScanLinePixels[X, Y: Integer]: TColor read GetScanLinePixel write SetScanLinePixel; end; TTextEditor = class; @@ -433,6 +436,31 @@ begin Canvas.FloodFill(x, y, Canvas.Pixels[x, y], fsSurface); end; +function TDLBitmap.GetScanLinePixel(X, Y: Integer): TColor; +var SrcRow: pRGBATriple; RR, GG, BB: integer; +begin + if (x >= 0) and (x < Width) and (y >= 0) and (y < Height) then + begin + SrcRow := ScanLine[y]; + RR := SrcRow[x].rgbtRed; + GG := SrcRow[x].rgbtGreen; + BB := SrcRow[x].rgbtBlue; + end; + Result := RR + (GG shl 8) and $FF00 + (BB shl 16) and $FF0000; +end; + +procedure TDLBitmap.SetScanLinePixel(X, Y: Integer; Value: TColor); +var SrcRow: pRGBATriple; +begin + if (x >= 0) and (x < Width) and (y >= 0) and (y < Height) then + begin + SrcRow := ScanLine[y]; + SrcRow[x].rgbtRed:=GetRColor(Value); + SrcRow[x].rgbtGreen:=GetGColor(Value); + SrcRow[x].rgbtBlue:=GetBColor(Value); + end; +end; + procedure TDLBitmap.Spray(x, y, radian: integer; PColor: TColor); begin SprayPoints(Self, x, y, radian, PColor); diff --git a/applications/lazimageeditor/DLBmpUtils.inc b/applications/lazimageeditor/DLBmpUtils.inc index c3a7bb5e3..95a56d8ee 100644 --- a/applications/lazimageeditor/DLBmpUtils.inc +++ b/applications/lazimageeditor/DLBmpUtils.inc @@ -487,11 +487,10 @@ begin DestBmp.Free; end; -procedure SetCanvasPixel(DLBmp: TDLBitmap; x, y: integer; aColor: TColor); +procedure SetDLBMPPixel(DLBmp: TDLBitmap; x, y: integer; aColor: TColor); var SrcRow: pRGBATriple; begin - if (x > 0) and (x < DLBmp.Width) and (y > 0) and (y < DLBmp.Height) then - //aCanvas.Pixels[x, y] := aColor; + if (x >= 0) and (x < DLBmp.Width) and (y >= 0) and (y < DLBmp.Height) then begin SrcRow := DLBmp.ScanLine[y]; SrcRow[x].rgbtRed:=GetRColor(aColor); @@ -516,7 +515,7 @@ begin b := Random(Round(Radians * 0.65)); if (temp < 50) then b := 0 - b; if (a * a + b * b < Sqr(Round(Radians * 0.65))) then - SetCanvasPixel(DLBmp, X + a, Y + b, PColor); + DLBmp.ScanLinePixels[X + a, Y + b] := PColor; Radian2 := Radians div 3; temp := Random(100); a := Random(Round(Radian2 * 0.65)); @@ -525,7 +524,7 @@ begin b := Random(Round(Radian2 * 0.65)); if (temp < 50) then b := 0 - b; if (a * a + b * b < Sqr(Round(Radian2 * 0.65))) then - SetCanvasPixel(DLBmp, X + a, Y + b, PColor); + DLBmp.ScanLinePixels[X + a, Y + b] := PColor; Radian3 := Radians * 2 div 3; temp := Random(100); a := Random(Round(Radian3 * 0.65)); @@ -534,7 +533,7 @@ begin b := Random(Round(Radian3 * 0.65)); if (temp < 50) then b := 0 - b; if (a * a + b * b < Sqr(Round(Radian3 * 0.65))) then - SetCanvasPixel(DLBmp, X + a, Y + b, PColor); + DLBmp.ScanLinePixels[X + a, Y + b] := PColor; end; DLBmp.InvalidateScanLineRect(Rect(X - Radians, Y - Radians, X + Radians, Y + Radians)); end; diff --git a/applications/lazimageeditor/lazimageeditor.lpi b/applications/lazimageeditor/lazimageeditor.lpi index b6d0e7070..8ccc62f0e 100644 --- a/applications/lazimageeditor/lazimageeditor.lpi +++ b/applications/lazimageeditor/lazimageeditor.lpi @@ -41,7 +41,7 @@ - + @@ -49,7 +49,7 @@ - + @@ -62,7 +62,7 @@ - + @@ -71,9 +71,9 @@ - - - + + + @@ -169,19 +169,17 @@ - - + + - - @@ -242,10 +240,12 @@ + - - - + + + + @@ -290,8 +290,8 @@ - - + + @@ -340,8 +340,8 @@ - - + + @@ -357,9 +357,9 @@ - - - + + + @@ -391,9 +391,9 @@ - - - + + + @@ -404,128 +404,106 @@ + + + + + + + + + + + + + + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -