Ignore:
Timestamp:
Apr 6, 2021, 7:39:39 PM (3 years ago)
Author:
chronos
Message:
File:
1 edited

Legend:

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

    r331 r347  
    10351035procedure InitOrnament;
    10361036var
    1037   x, y, p, Light, Shade: Integer;
     1037  P: TColor;
     1038  X, Y: Integer;
     1039  Light, Shade: TColor32;
     1040  PixelPtr: TPixelPointer;
    10381041begin
    10391042  if InitOrnamentDone then Exit;
    1040   Light := MainTexture.clBevelLight;
     1043  Light := ColorToColor32(MainTexture.clBevelLight);
    10411044  // and $FCFCFC shr 2*3+MainTexture.clBevelShade and $FCFCFC shr 2;
    1042   Shade := MainTexture.clBevelShade and $FCFCFC shr 2 * 3 +
    1043     MainTexture.clBevelLight and $FCFCFC shr 2;
    1044   for x := 0 to Ornament.Width - 1 do
    1045     for y := 0 to Ornament.Height - 1 do begin
    1046       p := HGrSystem2.Data.Canvas.Pixels[Ornament.Left + x, Ornament.Top + y];
    1047       if p = $0000FF then
    1048         HGrSystem2.Data.Canvas.Pixels[Ornament.Left + x, Ornament.Top + y] := Light
    1049       else if p = $FF0000 then
    1050         HGrSystem2.Data.Canvas.Pixels[Ornament.Left + x, Ornament.Top + y] := Shade;
    1051     end;
     1045  Shade := ColorToColor32(MainTexture.clBevelShade and $FCFCFC shr 2 * 3 +
     1046    MainTexture.clBevelLight and $FCFCFC shr 2);
     1047  HGrSystem2.Data.BeginUpdate;
     1048  PixelPtr := PixelPointer(HGrSystem2.Data, ScaleToNative(Ornament.Left), ScaleToNative(Ornament.Top));
     1049  if PixelPtr.BytesPerPixel = 3 then begin
     1050    for Y := 0 to ScaleToNative(Ornament.Height) - 1 do begin
     1051      for X := 0 to ScaleToNative(Ornament.Width) - 1 do begin
     1052        P := Color32ToColor(PixelPtr.Pixel^.RGB);
     1053        if P = $0000FF then PixelPtr.Pixel^.RGB := Light
     1054        else if P = $FF0000 then PixelPtr.Pixel^.RGB := Shade;
     1055        PixelPtr.NextPixel;
     1056      end;
     1057      PixelPtr.NextLine;
     1058    end;
     1059  end else begin
     1060    for Y := 0 to ScaleToNative(Ornament.Height) - 1 do begin
     1061      for X := 0 to ScaleToNative(Ornament.Width) - 1 do begin
     1062        P := Color32ToColor(PixelPtr.Pixel^.ARGB);
     1063        if P = $0000FF then PixelPtr.Pixel^.ARGB := Light
     1064        else if P = $FF0000 then PixelPtr.Pixel^.ARGB := Shade;
     1065        PixelPtr.NextPixel;
     1066      end;
     1067      PixelPtr.NextLine;
     1068    end;
     1069  end;
    10521070  InitOrnamentDone := True;
     1071  HGrSystem2.Data.EndUpdate;
    10531072end;
    10541073
Note: See TracChangeset for help on using the changeset viewer.