Ignore:
Timestamp:
Dec 24, 2023, 11:24:57 PM (12 months ago)
Author:
chronos
Message:
  • Modified: Code cleanup.
Location:
trunk/Packages/CevoComponents
Files:
2 edited

Legend:

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

    r471 r505  
    3636
    3737procedure Register;
     38
    3839
    3940implementation
  • trunk/Packages/CevoComponents/ScreenTools.pas

    r502 r505  
    3232function LoadGraphicFile(Bmp: TBitmap; FileName: string; Options: TLoadGraphicFileOptions = []): Boolean;
    3333function LoadGraphicSet(const Name: string; Transparency: Boolean = True): TGraphicSet;
    34 procedure Dump(dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer);
     34procedure Dump(Dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer);
    3535procedure BitmapReplaceColor(Dst: TBitmap; X, Y, Width, Height: Integer; OldColor, NewColor: TColor);
    3636procedure Sprite(Canvas: TCanvas; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer);
    3737  overload;
    38 procedure Sprite(dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer);
     38procedure Sprite(Canvas: TCanvas; xDst, yDst: Integer; GraphicSetItem: TGraphicSetItem);
     39  overload;
     40procedure Sprite(Dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer);
    3941  overload;
    4042procedure MakeBlue(Dst: TBitmap; X, Y, Width, Height: Integer);
     
    8587procedure VDarkGradient(Canvas: TCanvas; X, Y, Height, Kind: Integer);
    8688procedure UnderlinedTitleValue(Canvas: TCanvas; Title, Value: string; X, Y, Width: Integer);
    87 procedure NumberBar(dst: TBitmap; X, Y: Integer; Cap: string; val: Integer;
     89procedure NumberBar(Dst: TBitmap; X, Y: Integer; Cap: string; val: Integer;
    8890  T: TTexture);
    89 procedure CountBar(dst: TBitmap; X, Y, W: Integer; Kind: Integer;
     91procedure CountBar(Dst: TBitmap; X, Y, W: Integer; Kind: Integer;
    9092  Cap: string; val: Integer; T: TTexture);
    9193procedure PaintProgressBar(Canvas: TCanvas; Kind, X, Y, Pos, Growth, Max: Integer;
     
    562564end;
    563565
    564 procedure Dump(dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer);
    565 begin
    566   BitBltCanvas(dst.Canvas, xDst, yDst, Width, Height,
     566procedure Dump(Dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer);
     567begin
     568  BitBltCanvas(Dst.Canvas, xDst, yDst, Width, Height,
    567569    HGr.Data.Canvas, xGr, yGr);
    568570end;
     
    863865procedure Sprite(Canvas: TCanvas; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer);
    864866begin
    865   BitBltCanvas(Canvas, xDst, yDst, Width, Height,
    866     HGr.Mask.Canvas, xGr, yGr, SRCAND);
    867   BitBltCanvas(Canvas, xDst, yDst, Width, Height,
    868     HGr.Data.Canvas, xGr, yGr, SRCPAINT);
    869 end;
    870 
    871 procedure Sprite(dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer);
    872 begin
    873   BitBltCanvas(dst.Canvas, xDst, yDst, Width, Height,
    874     HGr.Mask.Canvas, xGr, yGr, SRCAND);
    875   BitBltCanvas(dst.Canvas, xDst, yDst, Width, Height,
    876     HGr.Data.Canvas, xGr, yGr, SRCPAINT);
     867  BitBltCanvas(Canvas, xDst, yDst, Width, Height, HGr.Mask.Canvas, xGr, yGr, SRCAND);
     868  BitBltCanvas(Canvas, xDst, yDst, Width, Height, HGr.Data.Canvas, xGr, yGr, SRCPAINT);
     869end;
     870
     871procedure Sprite(Canvas: TCanvas; xDst, yDst: Integer; GraphicSetItem: TGraphicSetItem);
     872begin
     873  Sprite(Canvas, GraphicSetItem.GraphicSet, xDst, yDst, GraphicSetItem.Width,
     874    GraphicSetItem.Height, GraphicSetItem.Left, GraphicSetItem.Top);
     875end;
     876
     877procedure Sprite(Dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer);
     878begin
     879  Sprite(Dst.Canvas, HGr, xDst, yDst, Width, Height, xGr, yGr);
    877880end;
    878881
     
    12111214  procedure PaintIcon(X, Y, Kind: Integer);
    12121215  begin
    1213     BitBltCanvas(Canvas, X, Y + 6, 10, 10, HGrSystem.Mask.Canvas,
    1214       66 + Kind mod 11 * 11, 115 + Kind div 11 * 11, SRCAND);
    1215     BitBltCanvas(Canvas, X, Y + 6, 10, 10, HGrSystem.Data.Canvas,
    1216       66 + Kind mod 11 * 11, 115 + Kind div 11 * 11, SRCPAINT);
     1216    Sprite(Canvas, HGrSystem, X, Y + 6, 10, 10,
     1217      66 + Kind mod 11 * 11, 115 + Kind div 11 * 11);
    12171218  end;
    12181219
     
    13831384end;
    13841385
    1385 procedure NumberBar(dst: TBitmap; X, Y: Integer; Cap: string;
     1386procedure NumberBar(Dst: TBitmap; X, Y: Integer; Cap: string;
    13861387  val: Integer; T: TTexture);
    13871388var
     
    13901391  if val > 0 then
    13911392  begin
    1392     DLine(dst.Canvas, X - 2, X + 170, Y + 16, T.ColorBevelShade,
     1393    DLine(Dst.Canvas, X - 2, X + 170, Y + 16, T.ColorBevelShade,
    13931394      T.ColorBevelLight);
    1394     LoweredTextOut(dst.Canvas, -1, T, X - 2, Y, Cap);
     1395    LoweredTextOut(Dst.Canvas, -1, T, X - 2, Y, Cap);
    13951396    S := IntToStr(val);
    1396     RisedTextOut(dst.Canvas, X + 170 - BiColorTextWidth(dst.Canvas,
     1397    RisedTextOut(Dst.Canvas, X + 170 - BiColorTextWidth(Dst.Canvas,
    13971398      S), Y, S);
    13981399  end;
    13991400end;
    14001401
    1401 procedure CountBar(dst: TBitmap; X, Y, W: Integer; Kind: Integer;
     1402procedure CountBar(Dst: TBitmap; X, Y, W: Integer; Kind: Integer;
    14021403  Cap: string; val: Integer; T: TTexture);
    14031404var
     
    14091410    Exit;
    14101411  Assert(Kind >= 0);
    1411   with dst.Canvas do
     1412  with Dst.Canvas do
    14121413  begin
    14131414    // xIcon:=x+100;
    14141415    // yIcon:=y;
    1415     // DLine(dst.Canvas,x-2,x+170+32,y+16,T.ColorBevelShade,T.ColorBevelLight);
     1416    // DLine(Dst.Canvas,x-2,x+170+32,y+16,T.ColorBevelShade,T.ColorBevelLight);
    14161417
    14171418    xIcon := X - 5;
    14181419    yIcon := Y + 15;
    1419     DLine(dst.Canvas, X - 2, xIcon + W + 2, yIcon + 16, T.ColorBevelShade,
     1420    DLine(Dst.Canvas, X - 2, xIcon + W + 2, yIcon + 16, T.ColorBevelShade,
    14201421      T.ColorBevelLight);
    14211422
     
    14251426    else
    14261427      cl := -1;
    1427     LoweredTextOut(dst.Canvas, cl, T, X - 2, Y, Cap);
    1428     LoweredTextOut(dst.Canvas, cl, T,
    1429       xIcon + W + 2 - BiColorTextWidth(dst.Canvas, S), yIcon, S);
     1428    LoweredTextOut(Dst.Canvas, cl, T, X - 2, Y, Cap);
     1429    LoweredTextOut(Dst.Canvas, cl, T,
     1430      xIcon + W + 2 - BiColorTextWidth(Dst.Canvas, S), yIcon, S);
    14301431
    14311432    if (Kind = 12) and (val >= 100) then
     
    14411442      for I := 0 to val mod 10 - 1 do
    14421443      begin
    1443         BitBltCanvas(dst.Canvas, xIcon + 4 + I * (14 * ld div sd), yIcon + 2 + 1, 14,
     1444        BitBltCanvas(Dst.Canvas, xIcon + 4 + I * (14 * ld div sd), yIcon + 2 + 1, 14,
    14441445          14, HGrSystem.Mask.Canvas, 67 + Kind mod 8 * 15,
    14451446          70 + Kind div 8 * 15, SRCAND);
    1446         Sprite(dst, HGrSystem, xIcon + 3 + I * (14 * ld div sd), yIcon + 2,
     1447        Sprite(Dst, HGrSystem, xIcon + 3 + I * (14 * ld div sd), yIcon + 2,
    14471448          14, 14, 67 + Kind mod 8 * 15, 70 + Kind div 8 * 15);
    14481449      end;
    14491450      for I := 0 to val div 10 - 1 do
    14501451      begin
    1451         BitBltCanvas(dst.Canvas, xIcon + 4 + (val mod 10) *
     1452        BitBltCanvas(Dst.Canvas, xIcon + 4 + (val mod 10) *
    14521453          (14 * ld div sd) + I * (14 * ld div sd), yIcon + 3, 14, 14,
    14531454          HGrSystem.Mask.Canvas, 67 + 7 mod 8 * 15,
    14541455          70 + 7 div 8 * 15, SRCAND);
    1455         Sprite(dst, HGrSystem, xIcon + 3 + (val mod 10) *
     1456        Sprite(Dst, HGrSystem, xIcon + 3 + (val mod 10) *
    14561457          (14 * ld div sd) + I * (14 * ld div sd), yIcon + 2, 14,
    14571458          14, 67 + 7 mod 8 * 15,
     
    14741475      for I := 0 to val div 10 - 1 do
    14751476      begin
    1476         BitBltCanvas(dst.Canvas, xIcon + 4 + I * (14 * ld div sd), yIcon + 3, 14, 14,
     1477        BitBltCanvas(Dst.Canvas, xIcon + 4 + I * (14 * ld div sd), yIcon + 3, 14, 14,
    14771478          HGrSystem.Mask.Canvas, 67 + Kind mod 8 * 15,
    14781479          70 + Kind div 8 * 15, SRCAND);
    1479         Sprite(dst, HGrSystem, xIcon + 3 + I * (14 * ld div sd), yIcon + 2,
     1480        Sprite(Dst, HGrSystem, xIcon + 3 + I * (14 * ld div sd), yIcon + 2,
    14801481          14, 14, 67 + Kind mod 8 * 15, 70 + Kind div 8 * 15);
    14811482      end;
    14821483      for I := 0 to val mod 10 - 1 do
    14831484      begin
    1484         BitBltCanvas(dst.Canvas, xIcon + 4 + (val div 10) *
     1485        BitBltCanvas(Dst.Canvas, xIcon + 4 + (val div 10) *
    14851486          (14 * ld div sd) + I * (10 * ld div sd), yIcon + 7, 10, 10,
    14861487          HGrSystem.Mask.Canvas, 66 + Kind mod 11 * 11,
    14871488          115 + Kind div 11 * 11, SRCAND);
    1488         Sprite(dst, HGrSystem, xIcon + 3 + (val div 10) *
     1489        Sprite(Dst, HGrSystem, xIcon + 3 + (val div 10) *
    14891490          (14 * ld div sd) + I * (10 * ld div sd), yIcon + 6, 10,
    14901491          10, 66 + Kind mod 11 * 11,
Note: See TracChangeset for help on using the changeset viewer.