Changeset 506 for trunk/Packages/CevoComponents
- Timestamp:
- Dec 25, 2023, 11:35:51 AM (11 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/CevoComponents/ScreenTools.pas
r505 r506 404 404 for Y := 0 to ScaleToNative(Src.Height - 1) do begin 405 405 for X := 0 to ScaleToNative(Src.Width - 1) do begin 406 DstPtr.Pixel ^.B := SrcPtr.Pixel^.B;407 DstPtr.Pixel ^.G := SrcPtr.Pixel^.B;408 DstPtr.Pixel ^.R := SrcPtr.Pixel^.B;406 DstPtr.PixelB := SrcPtr.PixelB; 407 DstPtr.PixelG := SrcPtr.PixelB; 408 DstPtr.PixelR := SrcPtr.PixelB; 409 409 SrcPtr.NextPixel; 410 410 DstPtr.NextPixel; … … 536 536 for Y := 0 to ScaleToNative(Result.Data.Height) - 1 do begin 537 537 for X := 0 to ScaleToNative(Result.Data.Width) - 1 do begin 538 OriginalColor := DataPixel.Pixel ^.ARGB and $FFFFFF;538 OriginalColor := DataPixel.PixelARGB and $FFFFFF; 539 539 if (OriginalColor = TransparentColor1) or (OriginalColor = TransparentColor2) then begin 540 MaskPixel.Pixel ^.R := $FF;541 MaskPixel.Pixel ^.G := $FF;542 MaskPixel.Pixel ^.B := $FF;543 DataPixel.Pixel ^.R := 0;544 DataPixel.Pixel ^.G := 0;545 DataPixel.Pixel ^.B := 0;540 MaskPixel.PixelR := $FF; 541 MaskPixel.PixelG := $FF; 542 MaskPixel.PixelB := $FF; 543 DataPixel.PixelR := 0; 544 DataPixel.PixelG := 0; 545 DataPixel.PixelB := 0; 546 546 end else begin 547 MaskPixel.Pixel ^.R := $00;548 MaskPixel.Pixel ^.G := $00;549 MaskPixel.Pixel ^.B := $00;547 MaskPixel.PixelR := $00; 548 MaskPixel.PixelG := $00; 549 MaskPixel.PixelB := $00; 550 550 end; 551 551 DataPixel.NextPixel; … … 579 579 for YY := 0 to ScaleToNative(Height) - 1 do begin 580 580 for XX := 0 to ScaleToNative(Width) - 1 do begin 581 if PixelPtr.Pixel ^.RGB = SwapRedBlue(OldColor) then begin582 PixelPtr.Pixel ^.RGB := SwapRedBlue(NewColor);581 if PixelPtr.PixelRGB = SwapRedBlue(OldColor) then begin 582 PixelPtr.PixelRGB := SwapRedBlue(NewColor); 583 583 end; 584 584 PixelPtr.NextPixel; … … 598 598 for yy := 0 to ScaleToNative(Height) - 1 do begin 599 599 for xx := 0 to ScaleToNative(Width) - 1 do begin 600 PixelPtr.Pixel ^.B := PixelPtr.Pixel^.B div 2;601 PixelPtr.Pixel ^.G := PixelPtr.Pixel^.G div 2;602 PixelPtr.Pixel ^.R := PixelPtr.Pixel^.R div 2;600 PixelPtr.PixelB := PixelPtr.PixelB div 2; 601 PixelPtr.PixelG := PixelPtr.PixelG div 2; 602 PixelPtr.PixelR := PixelPtr.PixelR div 2; 603 603 PixelPtr.NextPixel; 604 604 end; … … 618 618 for YY := 0 to ScaleToNative(Height) - 1 do begin 619 619 for XX := 0 to ScaleToNative(Width) - 1 do begin 620 Gray := (Integer(PixelPtr.Pixel ^.B) + Integer(PixelPtr.Pixel^.G) +621 Integer(PixelPtr.Pixel ^.R)) * 85 shr 8;622 PixelPtr.Pixel ^.B := 0;623 PixelPtr.Pixel ^.G := 0;624 PixelPtr.Pixel ^.R := Gray; // 255-(255-gray) div 2;620 Gray := (Integer(PixelPtr.PixelB) + Integer(PixelPtr.PixelG) + 621 Integer(PixelPtr.PixelR)) * 85 shr 8; 622 PixelPtr.PixelB := 0; 623 PixelPtr.PixelG := 0; 624 PixelPtr.PixelR := Gray; // 255-(255-gray) div 2; 625 625 PixelPtr.NextPixel; 626 626 end; … … 670 670 for Y := 0 to Height - 1 do begin 671 671 for X := 0 to Width - 1 do begin 672 Brightness := PixelSrc.Pixel ^.B; // One byte for 8-bit color673 Test := (PixelDst.Pixel ^.R * Brightness) shr 7;672 Brightness := PixelSrc.PixelB; // One byte for 8-bit color 673 Test := (PixelDst.PixelR * Brightness) shr 7; 674 674 if Test >= 256 then 675 PixelDst.Pixel ^.R := 255675 PixelDst.PixelR := 255 676 676 else 677 PixelDst.Pixel ^.R := Test; // Red678 Test := (PixelDst.Pixel ^.G * Brightness) shr 7;677 PixelDst.PixelR := Test; // Red 678 Test := (PixelDst.PixelG * Brightness) shr 7; 679 679 if Test >= 256 then 680 PixelDst.Pixel ^.G := 255680 PixelDst.PixelG := 255 681 681 else 682 PixelDst.Pixel ^.G := Test; // Green683 Test := (PixelDst.Pixel ^.B * Brightness) shr 7;682 PixelDst.PixelG := Test; // Green 683 Test := (PixelDst.PixelB * Brightness) shr 7; 684 684 if Test >= 256 then 685 PixelDst.Pixel ^.R := 255685 PixelDst.PixelR := 255 686 686 else 687 PixelDst.Pixel ^.B := Test; // Blue687 PixelDst.PixelB := Test; // Blue 688 688 PixelDst.NextPixel; 689 689 PixelSrc.NextPixel; … … 736 736 for iy := 0 to Height - 1 do begin 737 737 for ix := 0 to Width - 1 do begin 738 trans := SrcPixel.Pixel ^.B * 2; // green channel = transparency739 amp1 := SrcPixel.Pixel ^.G * 2;740 amp2 := SrcPixel.Pixel ^.R * 2;738 trans := SrcPixel.PixelB * 2; // green channel = transparency 739 amp1 := SrcPixel.PixelG * 2; 740 amp2 := SrcPixel.PixelR * 2; 741 741 if trans <> $FF then begin 742 Value := (DstPixel.Pixel ^.B * trans + ((Color2 shr 16) and $FF) *742 Value := (DstPixel.PixelB * trans + ((Color2 shr 16) and $FF) * 743 743 amp2 + ((Color1 shr 16) and $FF) * amp1) div $FF; 744 DstPixel.Pixel ^.B := Min(Value, 255);745 746 Value := (DstPixel.Pixel ^.G * trans + ((Color2 shr 8) and $FF) *744 DstPixel.PixelB := Min(Value, 255); 745 746 Value := (DstPixel.PixelG * trans + ((Color2 shr 8) and $FF) * 747 747 amp2 + ((Color1 shr 8) and $FF) * amp1) div $FF; 748 DstPixel.Pixel ^.G := Min(Value, 255);749 750 Value := (DstPixel.Pixel ^.R * trans + (Color2 and $FF) *748 DstPixel.PixelG := Min(Value, 255); 749 750 Value := (DstPixel.PixelR * trans + (Color2 and $FF) * 751 751 amp2 + (Color1 and $FF) * amp1) div $FF; 752 DstPixel.Pixel ^.R := Min(Value, 255);752 DstPixel.PixelR := Min(Value, 255); 753 753 end; 754 754 … … 793 793 for iy := 0 to Height - 1 do begin 794 794 for ix := 0 to Width - 1 do begin 795 trans := SrcPixel.Pixel ^.B * 2; // green channel = transparency796 amp0 := SrcPixel.Pixel ^.G * 2;797 amp1 := SrcPixel.Pixel ^.R * 2;795 trans := SrcPixel.PixelB * 2; // green channel = transparency 796 amp0 := SrcPixel.PixelG * 2; 797 amp1 := SrcPixel.PixelR * 2; 798 798 if trans <> $FF then begin 799 Value := (DstPixel.Pixel ^.B * trans + (Color2 shr 16 and $FF) * amp1 +799 Value := (DstPixel.PixelB * trans + (Color2 shr 16 and $FF) * amp1 + 800 800 (Color0 shr 16 and $FF) * amp0) div $FF; 801 DstPixel.Pixel ^.B := Min(Value, 255);802 803 Value := (DstPixel.Pixel ^.G * trans + (Color2 shr 8 and $FF) * amp1 +801 DstPixel.PixelB := Min(Value, 255); 802 803 Value := (DstPixel.PixelG * trans + (Color2 shr 8 and $FF) * amp1 + 804 804 (Color0 shr 8 and $FF) * amp0) div $FF; 805 DstPixel.Pixel ^.G := Min(Value, 255);806 807 Value := (DstPixel.Pixel ^.R * trans + (Color2 and $FF) * amp1 +805 DstPixel.PixelG := Min(Value, 255); 806 807 Value := (DstPixel.PixelR * trans + (Color2 and $FF) * amp1 + 808 808 (Color0 and $FF) * amp0) div $FF; 809 DstPixel.Pixel ^.R := Min(Value, 255);809 DstPixel.PixelR := Min(Value, 255); 810 810 end; 811 811 SrcPixel.NextPixel; … … 846 846 for YY := 0 to Height - 1 do begin 847 847 for XX := 0 to Width - 1 do begin 848 Red := ((PixelPtr.Pixel ^.B * (Color0 and $0000FF) + PixelPtr.Pixel^.G *849 (Color1 and $0000FF) + PixelPtr.Pixel ^.R * (Color2 and $0000FF)) shr 8) and $ff;850 Green := ((PixelPtr.Pixel ^.B * ((Color0 shr 8) and $0000FF) +851 PixelPtr.Pixel ^.G * ((Color1 shr 8) and $0000FF) + PixelPtr.Pixel^.R *848 Red := ((PixelPtr.PixelB * (Color0 and $0000FF) + PixelPtr.PixelG * 849 (Color1 and $0000FF) + PixelPtr.PixelR * (Color2 and $0000FF)) shr 8) and $ff; 850 Green := ((PixelPtr.PixelB * ((Color0 shr 8) and $0000FF) + 851 PixelPtr.PixelG * ((Color1 shr 8) and $0000FF) + PixelPtr.PixelR * 852 852 ((Color2 shr 8) and $0000FF)) shr 8) and $ff; 853 PixelPtr.Pixel ^.B := ((PixelPtr.Pixel^.B * ((Color0 shr 16) and $0000FF) +854 PixelPtr.Pixel ^.G * ((Color1 shr 16) and $0000FF) + PixelPtr.Pixel^.R *853 PixelPtr.PixelB := ((PixelPtr.PixelB * ((Color0 shr 16) and $0000FF) + 854 PixelPtr.PixelG * ((Color1 shr 16) and $0000FF) + PixelPtr.PixelR * 855 855 ((Color2 shr 16) and $0000FF)) shr 8) and $ff; // Blue 856 PixelPtr.Pixel ^.G := Green;857 PixelPtr.Pixel ^.R := Red;856 PixelPtr.PixelG := Green; 857 PixelPtr.PixelR := Red; 858 858 PixelPtr.NextPixel; 859 859 end; … … 1035 1035 if R < DpiGlowRange then 1036 1036 for ch := 0 to 2 do 1037 DstPtr.Pixel ^.Planes[2 - ch] :=1038 (DstPtr.Pixel ^.Planes[2 - ch] * (R - 1) + (cl shr (8 * ch) and $FF) *1037 DstPtr.PixelPlane[2 - ch] := 1038 (DstPtr.PixelPlane[2 - ch] * (R - 1) + (cl shr (8 * ch) and $FF) * 1039 1039 (DpiGlowRange - R)) div (DpiGlowRange - 1); 1040 1040 DstPtr.NextPixel; … … 1063 1063 for Y := 0 to ScaleToNative(Ornament.Height) - 1 do begin 1064 1064 for X := 0 to ScaleToNative(Ornament.Width) - 1 do begin 1065 P := Color32ToColor(PixelPtr.Pixel ^.RGB);1066 if P = $0000FF then PixelPtr.Pixel ^.RGB := Light1067 else if P = $FF0000 then PixelPtr.Pixel ^.RGB := Shade;1065 P := Color32ToColor(PixelPtr.PixelRGB); 1066 if P = $0000FF then PixelPtr.PixelRGB := Light 1067 else if P = $FF0000 then PixelPtr.PixelRGB := Shade; 1068 1068 PixelPtr.NextPixel; 1069 1069 end; … … 1073 1073 for Y := 0 to ScaleToNative(Ornament.Height) - 1 do begin 1074 1074 for X := 0 to ScaleToNative(Ornament.Width) - 1 do begin 1075 P := Color32ToColor(PixelPtr.Pixel ^.ARGB);1076 if P = $0000FF then PixelPtr.Pixel ^.ARGB := Light1077 else if P = $FF0000 then PixelPtr.Pixel ^.ARGB := Shade;1075 P := Color32ToColor(PixelPtr.PixelARGB); 1076 if P = $0000FF then PixelPtr.PixelARGB := Light 1077 else if P = $FF0000 then PixelPtr.PixelARGB := Shade; 1078 1078 PixelPtr.NextPixel; 1079 1079 end; … … 1616 1616 for Y := 0 to ScaleToNative(Dest.Height) - 1 do begin 1617 1617 for X := 0 to ScaleToNative(Dest.Width) - 1 do begin 1618 if (DstPixel.Pixel ^.ARGB and $FFFFFF) = TransparentColor then begin1618 if (DstPixel.PixelARGB and $FFFFFF) = TransparentColor then begin 1619 1619 SrcPixel.SetXY(X mod TexWidth, Y mod TexHeight); 1620 DstPixel.Pixel ^.B := SrcPixel.Pixel^.B;1621 DstPixel.Pixel ^.G := SrcPixel.Pixel^.G;1622 DstPixel.Pixel ^.R := SrcPixel.Pixel^.R;1620 DstPixel.PixelB := SrcPixel.PixelB; 1621 DstPixel.PixelG := SrcPixel.PixelG; 1622 DstPixel.PixelR := SrcPixel.PixelR; 1623 1623 end; 1624 1624 DstPixel.NextPixel; … … 1638 1638 for Y := 0 to ScaleToNative(Bitmap.Height) - 1 do begin 1639 1639 for X := 0 to ScaleToNative(Bitmap.Width) - 1 do begin 1640 PicturePixel.Pixel ^.B := Max(PicturePixel.Pixel^.B - Change, 0);1641 PicturePixel.Pixel ^.G := Max(PicturePixel.Pixel^.G - Change, 0);1642 PicturePixel.Pixel ^.R := Max(PicturePixel.Pixel^.R - Change, 0);1640 PicturePixel.PixelB := Max(PicturePixel.PixelB - Change, 0); 1641 PicturePixel.PixelG := Max(PicturePixel.PixelG - Change, 0); 1642 PicturePixel.PixelR := Max(PicturePixel.PixelR - Change, 0); 1643 1643 PicturePixel.NextPixel; 1644 1644 end;
Note:
See TracChangeset
for help on using the changeset viewer.