Changeset 210 for branches/highdpi/LocalPlayer/Wonders.pas
- Timestamp:
- May 9, 2020, 4:02:07 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/LocalPlayer/Wonders.pas
r179 r210 5 5 6 6 uses 7 ScreenTools, BaseWin, Protocol, LCLIntf, LCLType, SysUtils, Classes, Graphics,7 UDpiControls, ScreenTools, BaseWin, Protocol, LCLIntf, LCLType, SysUtils, Classes, Graphics, 8 8 Controls, Forms, ButtonB; 9 9 … … 38 38 39 39 uses 40 Term, ClientTools, Help, Tribes, U DpiControls;40 Term, ClientTools, Help, Tribes, UPixelPointer; 41 41 42 42 {$R *.lfm} … … 104 104 Ch: Integer; 105 105 Line: array [0..1] of TPixelPointer; 106 begin 106 Width: Integer; 107 Height: Integer; 108 CenterNative: TPoint; 109 begin 110 Width := ScaleToVcl(180); 111 Height := ScaleToVcl(128); 112 CenterNative := ScalePointtoVcl(Center); 107 113 Offscreen.BeginUpdate; 108 Line[0] .Init(Offscreen);109 Line[1] .Init(Offscreen);110 for Y := 0 to 127do begin111 for X := 0 to 179do begin112 r := X * X * ( 32 * 32) + Y * Y * (45 * 45);113 ax := ((1 shl 16 div 32) * 45) * Y;114 if (r < 8 * 128 * 180 * 180) and115 ((r >= 32 * 64 * 90 * 90) and (ax < amax2 * X) and114 Line[0] := PixelPointer(Offscreen); 115 Line[1] := PixelPointer(Offscreen); 116 for Y := 0 to Height - 1 do begin 117 for X := 0 to Width - 1 do begin 118 r := X * X * ((Height div 4) * (Height div 4)) + Y * Y * ((Width div 4) * (Width div 4)); 119 ax := ((1 shl 16 div (Height div 4)) * (Width div 4)) * Y; 120 if (r < ScaleToVcl(8) * Height * Width * Width) and 121 ((r >= (Height div 4) * (Height div 2) * (Width div 2) * (Width div 2)) and (ax < amax2 * X) and 116 122 ((ax < amax0 * X) or (ax > amin2 * X)) or (ax > amin1 * X) and 117 123 ((ax < amax1 * X) or (ax > amin3 * X))) then 118 124 for i := 0 to 1 do 119 125 for ch := 0 to 2 do begin 120 Line[0].SetXY(Center .X + X, Center.Y + Y);121 Line[1].SetXY(Center .X + X, Center.Y - 1 - Y);126 Line[0].SetXY(CenterNative.X + X, CenterNative.Y + Y); 127 Line[1].SetXY(CenterNative.X + X, CenterNative.Y - 1 - Y); 122 128 c := Line[i].Pixel^.Planes[ch] - darken; 123 129 if c < 0 then Line[i].Pixel^.Planes[ch] := 0 124 130 else Line[i].Pixel^.Planes[ch] := c; 125 Line[0].SetXY(Center .X - 1 - X, Center.Y + Y);126 Line[1].SetXY(Center .X - 1 - X, Center.Y - 1 - Y);131 Line[0].SetXY(CenterNative.X - 1 - X, CenterNative.Y + Y); 132 Line[1].SetXY(CenterNative.X - 1 - X, CenterNative.Y - 1 - Y); 127 133 c := Line[i].Pixel^.Planes[ch] - darken; 128 134 if c < 0 then Line[i].Pixel^.Planes[ch] := 0 … … 144 150 x0Src := (i mod 7) * xSizeBig; 145 151 y0Src := (i div 7 + SystemIconLines) * ySizeBig; 146 Src.Init(BigImp, x0Src, y0Src); 147 Dst.Init(Offscreen, x0Dst, y0Dst); 148 for Y := 0 to ySizeBig - 1 do begin 149 for X := 0 to xSizeBig - 1 do begin 152 153 Src := PixelPointer(BigImp, ScaleToVcl(x0Src), ScaleToVcl(y0Src)); 154 Dst := PixelPointer(Offscreen, ScaleToVcl(x0Dst), ScaleToVcl(y0Dst)); 155 for Y := 0 to ScaleToVcl(ySizeBig) - 1 do begin 156 for X := 0 to ScaleToVcl(xSizeBig) - 1 do begin 150 157 Darken := ((255 - Src.Pixel^.B) * 3 + (255 - Src.Pixel^.G) * 151 158 15 + (255 - Src.Pixel^.R) * 9) div 128; … … 238 245 begin 239 246 case MyRO.Wonder[I].CityID of 240 - 247 -1: // not built yet 241 248 begin 242 249 Fill(Offscreen.Canvas, Center.X - xSizeBig div 2 + RingPosition[I].X - 3, … … 249 256 begin 250 257 HaveWonder := True; 251 DpiBit Blt(Offscreen.Canvas.Handle,258 DpiBitCanvas(Offscreen.Canvas, 252 259 Center.X - xSizeBig div 2 + RingPosition[I].X, 253 260 Center.Y - ySizeBig div 2 + RingPosition[I].Y, xSizeBig, 254 ySizeBig, BigImp.Canvas .Handle, 0, (SystemIconLines + 3) *255 ySizeBig , SRCCOPY);261 ySizeBig, BigImp.Canvas, 0, (SystemIconLines + 3) * 262 ySizeBig); 256 263 end; 257 264 else 258 265 begin 259 266 HaveWonder := True; 260 DpiBit Blt(Offscreen.Canvas.Handle,267 DpiBitCanvas(Offscreen.Canvas, 261 268 Center.X - xSizeBig div 2 + RingPosition[I].X, 262 269 Center.Y - ySizeBig div 2 + RingPosition[I].Y, xSizeBig, ySizeBig, 263 BigImp.Canvas .Handle, (I mod 7) * xSizeBig,264 (I div 7 + SystemIconLines) * ySizeBig , SRCCOPY);270 BigImp.Canvas, (I mod 7) * xSizeBig, 271 (I div 7 + SystemIconLines) * ySizeBig); 265 272 end; 266 273 end;
Note:
See TracChangeset
for help on using the changeset viewer.