Ignore:
Timestamp:
Dec 25, 2023, 11:35:51 AM (5 months ago)
Author:
chronos
Message:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/CevoComponents/ScreenTools.pas

    r505 r506  
    404404  for Y := 0 to ScaleToNative(Src.Height - 1) do begin
    405405    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;
    409409      SrcPtr.NextPixel;
    410410      DstPtr.NextPixel;
     
    536536      for Y := 0 to ScaleToNative(Result.Data.Height) - 1 do begin
    537537        for X := 0 to ScaleToNative(Result.Data.Width) - 1 do begin
    538           OriginalColor := DataPixel.Pixel^.ARGB and $FFFFFF;
     538          OriginalColor := DataPixel.PixelARGB and $FFFFFF;
    539539          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;
    546546          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;
    550550          end;
    551551          DataPixel.NextPixel;
     
    579579  for YY := 0 to ScaleToNative(Height) - 1 do begin
    580580    for XX := 0 to ScaleToNative(Width) - 1 do begin
    581       if PixelPtr.Pixel^.RGB = SwapRedBlue(OldColor) then begin
    582         PixelPtr.Pixel^.RGB := SwapRedBlue(NewColor);
     581      if PixelPtr.PixelRGB = SwapRedBlue(OldColor) then begin
     582        PixelPtr.PixelRGB := SwapRedBlue(NewColor);
    583583      end;
    584584      PixelPtr.NextPixel;
     
    598598  for yy := 0 to ScaleToNative(Height) - 1 do begin
    599599    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;
    603603      PixelPtr.NextPixel;
    604604    end;
     
    618618  for YY := 0 to ScaleToNative(Height) - 1 do begin
    619619    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;
    625625      PixelPtr.NextPixel;
    626626    end;
     
    670670  for Y := 0 to Height - 1 do begin
    671671    for X := 0 to Width - 1 do  begin
    672       Brightness := PixelSrc.Pixel^.B; // One byte for 8-bit color
    673       Test := (PixelDst.Pixel^.R * Brightness) shr 7;
     672      Brightness := PixelSrc.PixelB; // One byte for 8-bit color
     673      Test := (PixelDst.PixelR * Brightness) shr 7;
    674674      if Test >= 256 then
    675         PixelDst.Pixel^.R := 255
     675        PixelDst.PixelR := 255
    676676      else
    677         PixelDst.Pixel^.R := Test; // Red
    678       Test := (PixelDst.Pixel^.G * Brightness) shr 7;
     677        PixelDst.PixelR := Test; // Red
     678      Test := (PixelDst.PixelG * Brightness) shr 7;
    679679      if Test >= 256 then
    680         PixelDst.Pixel^.G := 255
     680        PixelDst.PixelG := 255
    681681      else
    682         PixelDst.Pixel^.G := Test; // Green
    683       Test := (PixelDst.Pixel^.B * Brightness) shr 7;
     682        PixelDst.PixelG := Test; // Green
     683      Test := (PixelDst.PixelB * Brightness) shr 7;
    684684      if Test >= 256 then
    685         PixelDst.Pixel^.R := 255
     685        PixelDst.PixelR := 255
    686686      else
    687         PixelDst.Pixel^.B := Test; // Blue
     687        PixelDst.PixelB := Test; // Blue
    688688      PixelDst.NextPixel;
    689689      PixelSrc.NextPixel;
     
    736736  for iy := 0 to Height - 1 do begin
    737737    for ix := 0 to Width - 1 do begin
    738       trans := SrcPixel.Pixel^.B * 2; // green channel = transparency
    739       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;
    741741      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) *
    743743          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) *
    747747          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) *
    751751          amp2 + (Color1 and $FF) * amp1) div $FF;
    752         DstPixel.Pixel^.R := Min(Value, 255);
     752        DstPixel.PixelR := Min(Value, 255);
    753753      end;
    754754
     
    793793  for iy := 0 to Height - 1 do begin
    794794    for ix := 0 to Width - 1 do begin
    795       trans := SrcPixel.Pixel^.B * 2; // green channel = transparency
    796       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;
    798798      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 +
    800800          (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 +
    804804          (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 +
    808808          (Color0 and $FF) * amp0) div $FF;
    809         DstPixel.Pixel^.R := Min(Value, 255);
     809        DstPixel.PixelR := Min(Value, 255);
    810810      end;
    811811      SrcPixel.NextPixel;
     
    846846  for YY := 0 to Height - 1 do begin
    847847    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 *
    852852        ((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 *
    855855        ((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;
    858858      PixelPtr.NextPixel;
    859859    end;
     
    10351035      if R < DpiGlowRange then
    10361036        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) *
    10391039            (DpiGlowRange - R)) div (DpiGlowRange - 1);
    10401040      DstPtr.NextPixel;
     
    10631063    for Y := 0 to ScaleToNative(Ornament.Height) - 1 do begin
    10641064      for X := 0 to ScaleToNative(Ornament.Width) - 1 do begin
    1065         P := Color32ToColor(PixelPtr.Pixel^.RGB);
    1066         if P = $0000FF then PixelPtr.Pixel^.RGB := Light
    1067         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;
    10681068        PixelPtr.NextPixel;
    10691069      end;
     
    10731073    for Y := 0 to ScaleToNative(Ornament.Height) - 1 do begin
    10741074      for X := 0 to ScaleToNative(Ornament.Width) - 1 do begin
    1075         P := Color32ToColor(PixelPtr.Pixel^.ARGB);
    1076         if P = $0000FF then PixelPtr.Pixel^.ARGB := Light
    1077         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;
    10781078        PixelPtr.NextPixel;
    10791079      end;
     
    16161616  for Y := 0 to ScaleToNative(Dest.Height) - 1 do begin
    16171617    for X := 0 to ScaleToNative(Dest.Width) - 1 do begin
    1618       if (DstPixel.Pixel^.ARGB and $FFFFFF) = TransparentColor then begin
     1618      if (DstPixel.PixelARGB and $FFFFFF) = TransparentColor then begin
    16191619        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;
    16231623      end;
    16241624      DstPixel.NextPixel;
     
    16381638  for Y := 0 to ScaleToNative(Bitmap.Height) - 1 do begin
    16391639    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);
    16431643      PicturePixel.NextPixel;
    16441644    end;
Note: See TracChangeset for help on using the changeset viewer.