git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2203 8e941d3f-bd1b-0410-a28a-d453659cc2b4

This commit is contained in:
yangjixian
2011-12-29 09:33:16 +00:00
parent feee1b756f
commit 1574515b6d
3 changed files with 82 additions and 5 deletions

View File

@ -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; }

View File

@ -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;

View File

@ -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;