From 1574515b6d811977323e1fb939eeb073d6dc9689 Mon Sep 17 00:00:00 2001 From: yangjixian Date: Thu, 29 Dec 2011 09:33:16 +0000 Subject: [PATCH] git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2203 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- applications/lazimageeditor/DLBmpUtils.inc | 81 +++++++++++++++++++- applications/lazimageeditor/bmprgbtypes.pas | 2 +- applications/lazimageeditor/picturectrls.pas | 4 +- 3 files changed, 82 insertions(+), 5 deletions(-) diff --git a/applications/lazimageeditor/DLBmpUtils.inc b/applications/lazimageeditor/DLBmpUtils.inc index 6afc3a634..c34b0e8e4 100644 --- a/applications/lazimageeditor/DLBmpUtils.inc +++ b/applications/lazimageeditor/DLBmpUtils.inc @@ -776,7 +776,7 @@ end; procedure StretchDLBMPEx(ACanvas: TCanvas; Src: TDLBitmap; NewLeft, NewTop, NewWidth, NewHeight: integer; Posx, Posy, aWidth, aHeight: integer); var - iw, ih, th, ww, dw, dh, i, j, k, m, ypos, xpos, ylen, xlen: DWord; Dest: TDLBitmap; sw, sh: Float; LScan1, LScan2: pRGBATriple; + iw, ih, th, dw, dh, i, j, k, m, n, ypos, xpos, ylen, xlen: DWord; Dest: TDLBitmap; sw, sh: Float; LScan1, LScan2: pRGBATriple; begin Dest := TDLBitmap.Create; dw := NewWidth - NewLeft; @@ -816,14 +816,14 @@ begin ypos := 0 end; m := ypos div ih; - ww := xpos div iw; + n := xpos div iw; for i := ypos to ylen - 1 do begin LScan1 := Dest.Scanline[i]; LScan2 := Src.Scanline[m]; if (i mod ih) = 0 then m := m + 1; - k := ww; + k := n; for j := xpos to xlen - 1 do begin LScan1[j] := LScan2[k]; @@ -836,6 +836,81 @@ begin Dest.Free; end; +{ +procedure StretchDLBMPEx(ACanvas: TCanvas; Src: TDLBitmap; + NewLeft, NewTop, NewWidth, NewHeight: integer; Posx, Posy, aWidth, aHeight: integer); +var + iw, ih, th, dw, dh, i, j, k, m, n, q, r, ypos, xpos, ylen, xlen: DWord; Dest: TDLBitmap; sw, sh: Float; LScan1, LScan2: pRGBATriple; +begin + Dest := TDLBitmap.Create; + dw := NewWidth - NewLeft; + dh := NewHeight - NewTop; + sw := dw / Src.Width; + sh := dh / Src.Height; + iw := dw div Src.Width; + ih := dh div Src.Height; + if sw = 0 then + sw := 1; + if sh = 0 then + sh := 1; + if iw = 0 then + iw := 1; + if ih = 0 then + ih := 1; + Dest.Width := dw; + Dest.Height := dh; + if dw > aWidth then + begin + xlen := Min(aWidth + Posx, dw); + xpos := Posx; + end + else + begin + xlen := dw; + xpos := 0 + end; + if dh > aHeight then + begin + ylen := Min(aHeight + Posy, dh); + ypos := Posy; + end + else + begin + ylen := dh; + ypos := 0 + end; + m := ypos div ih; + n := xpos div iw; + r := 1; + q := 1; + for i := ypos to ylen - 1 do + begin + LScan1 := Dest.Scanline[i]; + LScan2 := Src.Scanline[m]; + if r = ih then + begin + m := m + 1; + r := 0; + end; + r := r + 1; + k := n; + q := 0; + for j := xpos to xlen - 1 do + begin + LScan1[j] := LScan2[k]; + if q = iw then + begin + k := k + 1; + q := 0; + end; + q := q + 1; + end; + end; + Dest.InvalidateScanLine; + ACanvas.Draw(NewLeft, NewTop, Dest); + Dest.Free; +end; } + diff --git a/applications/lazimageeditor/bmprgbtypes.pas b/applications/lazimageeditor/bmprgbtypes.pas index 88e6928f7..a349d33a5 100644 --- a/applications/lazimageeditor/bmprgbtypes.pas +++ b/applications/lazimageeditor/bmprgbtypes.pas @@ -601,7 +601,7 @@ begin // if ACanvas <> nil then // ACanvas.StretchDraw(Rect(DstX, DstY, DstWidth, DstHeight), Self); // StretchDLBMP(Self, 3, 3); - StretchDLBMPEx(ACanvas, Self, DstX, DstY, DstWidth, DstHeight, HPos, VPos, aWidth, aHeight); + StretchDLBMPEx(ACanvas, Self, DstX, DstY, DstWidth, DstHeight, HPos, VPos, aWidth, aHeight); {begin ACanvas.AntialiasingMode:=amOff; ACanvas.CopyMode:=cmSrcPaint; diff --git a/applications/lazimageeditor/picturectrls.pas b/applications/lazimageeditor/picturectrls.pas index 51b4fc6a5..000b1c9db 100644 --- a/applications/lazimageeditor/picturectrls.pas +++ b/applications/lazimageeditor/picturectrls.pas @@ -434,7 +434,9 @@ begin FScrollStop := TPanel.Create(Self); FScrollStop.SetBounds(0, 0, 0, 0); FScrollStop.Parent := Self; - Self.AutoScroll := True; + + Self.HorzScrollBar.Increment:=100; + Self.VertScrollBar.Increment:=100; end; destructor TCustomPictureView.Destroy;