Ignore:
Timestamp:
Apr 6, 2021, 7:39:39 PM (4 years ago)
Author:
chronos
Message:
Location:
trunk/Packages/CevoComponents
Files:
4 edited

Legend:

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

    r336 r347  
    2323    // defines area to grip the window for moving (from top)
    2424    procedure InitButtons;
    25     procedure OnEraseBkgnd(var m: TMessage); message WM_ERASEBKGND;
     25    procedure OnEraseBkgnd(var Msg: TMessage); message WM_ERASEBKGND;
    2626    procedure OnHitTest(var Msg: TMessage); message WM_NCHITTEST;
    2727    procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
     
    8484end;
    8585
    86 procedure TDrawDlg.OnEraseBkgnd(var m: TMessage);
     86procedure TDrawDlg.OnEraseBkgnd(var Msg: TMessage);
    8787begin
    8888  // Full area should be covered by Paint method
     
    118118          end;
    119119        end;
    120       Msg.Result := HTCAPTION
     120      Msg.Result := HTCAPTION;
    121121    end;
    122122  end;
  • 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
  • trunk/Packages/CevoComponents/Sound.pas

    r317 r347  
    1919    {$IFDEF WINDOWS}
    2020    PrevWndProc: WNDPROC;
    21     procedure OnMCI(var m: TMessage); message MM_MCINOTIFY;
     21    procedure OnMCI(var Msg: TMessage); message MM_MCINOTIFY;
    2222  public
    2323    constructor Create(AOwner: TComponent); override;
     
    255255end;
    256256
    257 procedure TSoundPlayer.OnMCI(var m: TMessage);
    258 begin
    259   if (m.wParam = MCI_NOTIFY_SUCCESSFUL) and (PlayingSound <> nil) then
     257procedure TSoundPlayer.OnMCI(var Msg: TMessage);
     258begin
     259  if (Msg.wParam = MCI_NOTIFY_SUCCESSFUL) and (PlayingSound <> nil) then
    260260  begin
    261261    PlayingSound.Reset;
  • trunk/Packages/CevoComponents/UPixelPointer.pas

    r331 r347  
    4646  function PixelPointer(Bitmap: TRasterImage; BaseX: Integer = 0; BaseY: Integer = 0): TPixelPointer; inline;
    4747  function SwapRedBlue(Color: TColor32): TColor32;
     48  function Color32ToColor(Color: TColor32): TColor;
     49  function ColorToColor32(Color: TColor): TColor32;
    4850
    4951implementation
     
    113115end;
    114116
     117function Color32ToColor(Color: TColor32): TColor;
     118begin
     119  Result := ((Color shr 16) and $ff) or (Color and $00ff00) or
     120    ((Color and $ff) shl 16);
     121end;
     122
     123function ColorToColor32(Color: TColor): TColor32;
     124begin
     125  Result := $ff000000 or ((Color shr 16) and $ff) or (Color and $00ff00) or
     126    ((Color and $ff) shl 16);
     127end;
    115128
    116129end.
Note: See TracChangeset for help on using the changeset viewer.