Changeset 211 for trunk


Ignore:
Timestamp:
May 9, 2020, 9:04:03 PM (5 years ago)
Author:
chronos
Message:
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/CityScreen.pas

    r209 r211  
    435435    end;
    436436  end;
    437 
    438   procedure MakeRed(X, Y, W, H: Integer);
    439   var
    440     XX, YY: Integer;
    441     Gray: Integer;
    442     PixelPtr: TPixelPointer;
    443   begin
    444     Offscreen.BeginUpdate;
    445     PixelPtr := PixelPointer(Offscreen, X, Y);
    446     for YY := 0 to H - 1 do begin
    447       for XX := 0 to W - 1 do begin
    448         Gray := (Integer(PixelPtr.Pixel^.B) + Integer(PixelPtr.Pixel^.G) +
    449         Integer(PixelPtr.Pixel^.R)) * 85 shr 8;
    450         PixelPtr.Pixel^.B := 0;
    451         PixelPtr.Pixel^.G := 0;
    452         PixelPtr.Pixel^.R := Gray; // 255-(255-gray) div 2;
    453         PixelPtr.NextPixel;
    454       end;
    455       PixelPtr.NextLine;
    456     end;
    457     Offscreen.EndUpdate;
    458   end;
    459 
    460437var
    461438  line, MessageCount: integer;
     
    561538  if not IsCityAlive then
    562539  begin
    563     MakeRed(18, 280, 298, 40);
     540    MakeRed(Offscreen, 18, 280, 298, 40);
    564541    if cGov = gAnarchy then
    565542      s := Phrases.Lookup('GOVERNMENT', gAnarchy)
     
    697674    else
    698675    begin
    699       MakeRed(xHapp + dxBar - 6, yHapp + 2 * dyBar, wBar + 10, 38);
     676      MakeRed(Offscreen, xHapp + dxBar - 6, yHapp + 2 * dyBar, wBar + 10, 38);
    700677      CountBar(offscreen, xHapp + dxBar, yHapp + 2 * dyBar, wBar, 18,
    701678        Phrases.Lookup('LACK'), -Report.HappinessBalance, RedTex);
     
    722699    else
    723700    begin
    724       MakeRed(xFood + dxBar - 6, yFood + 2 * dyBar, wBar + 10, 38);
     701      MakeRed(Offscreen, xFood + dxBar - 6, yFood + 2 * dyBar, wBar + 10, 38);
    725702      CountBar(offscreen, xFood + dxBar, yFood + 2 * dyBar, wBar, 1,
    726703        Phrases.Lookup('LACK'), -Report.FoodSurplus, RedTex);
     
    755732    else
    756733    begin
    757       MakeRed(xProd + dxBar - 6, yProd + dyBar + 17, wBar + 10, 38);
     734      MakeRed(Offscreen, xProd + dxBar - 6, yProd + dyBar + 17, wBar + 10, 38);
    758735      CountBar(offscreen, xProd + dxBar, yProd + dyBar + 16, wBar, 3,
    759736        Phrases.Lookup('LACK'), -Report.Production, RedTex);
  • trunk/Packages/CevoComponents/ScreenTools.pas

    r208 r211  
    3535procedure Sprite(dst: TBitmap; HGr, xDst, yDst, Width, Height, xGr, yGr: integer);
    3636  overload;
    37 procedure MakeBlue(dst: TBitmap; x, y, Width, Height: Integer);
     37procedure MakeBlue(Dst: TBitmap; X, Y, Width, Height: Integer);
     38procedure MakeRed(Dst: TBitmap; X, Y, Width, Height: Integer);
    3839procedure ImageOp_B(dst, Src: TBitmap; xDst, yDst, xSrc, ySrc, Width, Height: Integer);
    3940procedure ImageOp_BCC(dst, Src: TBitmap;
     
    538539end;
    539540
    540 procedure MakeBlue(dst: TBitmap; x, y, Width, Height: Integer);
    541 var
    542   XX, YY: integer;
     541procedure MakeBlue(Dst: TBitmap; X, Y, Width, Height: Integer);
     542var
     543  XX, YY: Integer;
    543544  PixelPtr: TPixelPointer;
    544545begin
     
    550551      PixelPtr.Pixel^.G := PixelPtr.Pixel^.G div 2;
    551552      PixelPtr.Pixel^.R := PixelPtr.Pixel^.R div 2;
     553      PixelPtr.NextPixel;
     554    end;
     555    PixelPtr.NextLine;
     556  end;
     557  Dst.EndUpdate;
     558end;
     559
     560procedure MakeRed(Dst: TBitmap; X, Y, Width, Height: Integer);
     561var
     562  XX, YY: Integer;
     563  Gray: Integer;
     564  PixelPtr: TPixelPointer;
     565begin
     566  Dst.BeginUpdate;
     567  PixelPtr := PixelPointer(Dst, X, Y);
     568  for YY := 0 to Height - 1 do begin
     569    for XX := 0 to Width - 1 do begin
     570      Gray := (Integer(PixelPtr.Pixel^.B) + Integer(PixelPtr.Pixel^.G) +
     571        Integer(PixelPtr.Pixel^.R)) * 85 shr 8;
     572      PixelPtr.Pixel^.B := 0;
     573      PixelPtr.Pixel^.G := 0;
     574      PixelPtr.Pixel^.R := Gray; // 255-(255-gray) div 2;
    552575      PixelPtr.NextPixel;
    553576    end;
Note: See TracChangeset for help on using the changeset viewer.