Changeset 193 for branches/highdpi/Packages/CevoComponents/ScreenTools.pas
- Timestamp:
- May 7, 2020, 7:05:57 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/Packages/CevoComponents/ScreenTools.pas
r180 r193 410 410 Bitmap.BeginUpdate; 411 411 PixelPtr.Init(Bitmap); 412 for Y := 0 to Bitmap.Height- 1 do begin413 for X := 0 to Bitmap.Width- 1 do begin412 for Y := 0 to ScaleToVcl(Bitmap.Height) - 1 do begin 413 for X := 0 to ScaleToVcl(Bitmap.Width) - 1 do begin 414 414 PixelPtr.Pixel^ := ApplyGammaToPixel(PixelPtr.Pixel^); 415 415 PixelPtr.NextPixel; … … 428 428 SrcPtr.Init(Src); 429 429 DstPtr.Init(Dst); 430 for Y := 0 to S rc.Height- 1 do begin431 for X := 0 to S rc.Width- 1 do begin430 for Y := 0 to ScaleToVcl(Src.Height) - 1 do begin 431 for X := 0 to ScaleToVcl(Src.Width) - 1 do begin 432 432 DstPtr.Pixel^.B := SrcPtr.Pixel^.B; 433 433 DstPtr.Pixel^.G := SrcPtr.Pixel^.B; … … 607 607 PixelPtr: TPixelPointer; 608 608 begin 609 X := ScaleToVcl(X); 610 Y := ScaleToVcl(Y); 611 W := ScaleToVcl(W); 612 H := ScaleToVcl(H); 609 613 Dst.BeginUpdate; 610 614 PixelPtr.Init(Dst, X, Y); … … 630 634 PixelDst: TPixelPointer; 631 635 begin 636 xDst := ScaleToVcl(xDst); 637 yDst := ScaleToVcl(yDst); 638 xSrc := ScaleToVcl(xSrc); 639 ySrc := ScaleToVcl(ySrc); 640 w := ScaleToVcl(w); 641 h := ScaleToVcl(h); 632 642 //Assert(Src.PixelFormat = pf8bit); 633 643 Assert(dst.PixelFormat = pf24bit); … … 642 652 yDst := 0; 643 653 end; 644 if xDst + w > dst.Widththen645 w := dst.Width- xDst;646 if yDst + h > dst.Heightthen647 h := dst.Height- yDst;654 if xDst + w > ScaleToVcl(dst.Width) then 655 w := ScaleToVcl(dst.Width) - xDst; 656 if yDst + h > ScaleToVcl(dst.Height) then 657 h := ScaleToVcl(dst.Height) - yDst; 648 658 if (w < 0) or (h < 0) then 649 659 exit; … … 691 701 SrcPixel, DstPixel: TPixelPointer; 692 702 begin 703 xDst := ScaleToVcl(xDst); 704 yDst := ScaleToVcl(yDst); 705 xSrc := ScaleToVcl(xSrc); 706 ySrc := ScaleToVcl(ySrc); 707 w := ScaleToVcl(w); 708 h := ScaleToVcl(h); 693 709 if xDst < 0 then begin 694 710 w := w + xDst; … … 701 717 yDst := 0; 702 718 end; 703 if xDst + w > dst.Widththen704 w := dst.Width- xDst;705 if yDst + h > dst.Heightthen706 h := dst.Height- yDst;719 if xDst + w > ScaleToVcl(dst.Width) then 720 w := ScaleToVcl(dst.Width) - xDst; 721 if yDst + h > ScaleToVcl(dst.Height) then 722 h := ScaleToVcl(dst.Height) - yDst; 707 723 if (w < 0) or (h < 0) then 708 724 exit; … … 756 772 PixelPtr: TPixelPointer; 757 773 begin 774 X := ScaleToVcl(X); 775 Y := ScaleToVcl(Y); 776 W := ScaleToVcl(W); 777 H := ScaleToVcl(H); 758 778 bmp.BeginUpdate; 759 779 assert(bmp.PixelFormat = pf24bit); … … 892 912 x, y, ch, r: Integer; 893 913 DstPtr: TPixelPointer; 894 begin 914 DpiGlowRange: Integer; 915 begin 916 DpiGlowRange := ScaleToVcl(GlowRange); 917 X0 := ScaleToVcl(X0); 918 Y0 := ScaleToVcl(Y0); 919 Width := ScaleToVcl(Width); 920 Height := ScaleToVcl(Height); 895 921 dst.BeginUpdate; 896 922 DstPtr.Init(dst, x0, y0); 897 for y := - GlowRange + 1 to Height - 1 +GlowRange - 1 do begin898 for x := - GlowRange + 1 to Width - 1 +GlowRange - 1 do begin923 for y := -DpiGlowRange + 1 to Height - 1 + DpiGlowRange - 1 do begin 924 for x := -DpiGlowRange + 1 to Width - 1 + DpiGlowRange - 1 do begin 899 925 DstPtr.SetXY(x, y); 900 926 if x < 0 then … … 924 950 DstPtr.Pixel^.Planes[2 - ch] := 925 951 (DstPtr.Pixel^.Planes[2 - ch] * (r - 1) + (cl shr (8 * ch) and $FF) * 926 ( GlowRange - r)) div (GlowRange - 1);952 (DpiGlowRange - r)) div (DpiGlowRange - 1); 927 953 end; 928 954 end; … … 1559 1585 // 0.8 constant is compensation for Lazarus as size of fonts against Delphi differs 1560 1586 UniFont[section].Size := 1561 Round(Size * Screen.PixelsPerInch / UniFont[section].PixelsPerInch * 0.8);1587 Round(Size * Screen.PixelsPerInch / UniFont[section].PixelsPerInch); 1562 1588 end; 1563 1589 end;
Note:
See TracChangeset
for help on using the changeset viewer.