Ignore:
Timestamp:
May 7, 2020, 10:33:59 AM (4 years ago)
Author:
chronos
Message:
  • Modified: Code cleanup.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/TechTree.pas

    r188 r190  
    7878  X, w: Integer;
    7979begin
    80   with Canvas do
    81   begin
     80  with Canvas do begin
    8281    // black border
    8382    brush.color := $000000;
     
    120119procedure TTechTreeDlg.FormShow(Sender: TObject);
    121120var
    122   X, Y, ad, TexWidth, TexHeight: Integer;
     121  X, Y, ad: Integer;
    123122  s: string;
    124   SrcPixel, DstPixel: TPixelPointer;
    125 begin
    126   if Image = nil then
    127   begin
     123const
     124  TransparentColor = $7F007F;
     125begin
     126  if Image = nil then begin
    128127    Image := TBitmap.Create;
    129128    Image.PixelFormat := pf24bit;
    130129    LoadGraphicFile(Image, HomeDir + 'Help' + DirectorySeparator + 'AdvTree.png', gfNoGamma);
    131130
    132     with Image.Canvas do
    133     begin
     131    with Image.Canvas do begin
    134132      // write advance names
    135133      Font.Assign(UniFont[ftSmall]);
     
    147145            TextOut(xStart + X * xPitch + 2, yStart + Y * yPitch, s);
    148146            Pixels[xStart + X * xPitch + 10, yStart + Y * yPitch - 1]
    149               := $7F007F;
     147              := TransparentColor;
    150148          end
    151149        end;
     
    162160    end;
    163161
    164     // texturize background
    165     Image.BeginUpdate;
    166     TexWidth := Paper.Width;
    167     TexHeight := Paper.Height;
    168     DstPixel.Init(Image);
    169     SrcPixel.Init(Paper);
    170     for Y := 0 to Image.Height - 1 do begin
    171       for X := 0 to Image.Width - 1 do begin
    172         if (DstPixel.Pixel^.ARGB and $FFFFFF) = $7F007F then begin // transparent
    173           SrcPixel.SetXY(X mod TexWidth, Y mod TexHeight);
    174           DstPixel.Pixel^.B := SrcPixel.Pixel^.B;
    175           DstPixel.Pixel^.G := SrcPixel.Pixel^.G;
    176           DstPixel.Pixel^.R := SrcPixel.Pixel^.R;
    177         end;
    178         DstPixel.NextPixel;
    179       end;
    180       DstPixel.NextLine;
    181     end;
    182     Image.EndUpdate;
     162    Texturize(Image, Paper, TransparentColor);
    183163  end;
    184164
     
    205185    xDown := X;
    206186    yDown := Y;
    207   end
     187  end;
    208188end;
    209189
     
    235215
    236216    SmartInvalidate;
    237   end
     217  end;
    238218end;
    239219
     
    247227procedure TTechTreeDlg.CloseBtnClick(Sender: TObject);
    248228begin
    249   Close();
     229  Close;
    250230end;
    251231
Note: See TracChangeset for help on using the changeset viewer.