Changeset 72 for trunk/LocalPlayer
- Timestamp:
- Jan 15, 2017, 11:47:01 AM (8 years ago)
- Location:
- trunk/LocalPlayer
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/CityScreen.pas
r71 r72 438 438 XX, YY: Integer; 439 439 Gray: Integer; 440 PixelPtr: PPixel32; 441 LinePtr: PPixel32; 440 PixelPtr: TPixelPointer; 442 441 begin 443 442 Offscreen.BeginUpdate; 444 LinePtr := GetBitmapPixelPtr(Offscreen, X, Y);443 PixelPtr.Init(Offscreen, X, Y); 445 444 for YY := 0 to h - 1 do begin 446 PixelPtr := LinePtr;447 445 for XX := 0 to w - 1 do begin 448 Gray := (Integer(PixelPtr ^.B) + Integer(PixelPtr^.G) + Integer(PixelPtr^.R)449 450 PixelPtr ^.B := 0;451 PixelPtr ^.G := 0;452 PixelPtr ^.R := Gray; // 255-(255-gray) div 2;453 PixelPtr := Pointer(PixelPtr) + (Offscreen.RawImage.Description.BitsPerPixel shr 3);446 Gray := (Integer(PixelPtr.Pixel^.B) + Integer(PixelPtr.Pixel^.G) + 447 Integer(PixelPtr.Pixel^.R)) * 85 shr 8; 448 PixelPtr.Pixel^.B := 0; 449 PixelPtr.Pixel^.G := 0; 450 PixelPtr.Pixel^.R := Gray; // 255-(255-gray) div 2; 451 PixelPtr.NextPixel; 454 452 end; 455 LinePtr := Pointer(LinePtr) + Offscreen.RawImage.Description.BytesPerLine;453 PixelPtr.NextLine; 456 454 end; 457 455 Offscreen.EndUpdate; -
trunk/LocalPlayer/TechTree.pas
r57 r72 123 123 X, Y, ad, TexWidth, TexHeight: Integer; 124 124 s: string; 125 SrcPixel, DstPixel: PPixel32;125 SrcPixel, DstPixel: TPixelPointer; 126 126 begin 127 127 if Image = nil then … … 165 165 // texturize background 166 166 Image.BeginUpdate; 167 TexWidth := Paper.width; 168 TexHeight := Paper.height; 169 for Y := 0 to Image.height - 1 do 170 begin 171 for X := 0 to Image.width - 1 do 172 begin 173 DstPixel := GetBitmapPixelPtr(Image, X, Y); 174 if (DstPixel^.ARGB and $FFFFFF) = $7F007F then // transparent 175 begin 176 SrcPixel := GetBitmapPixelPtr(Paper, X mod TexWidth, Y mod TexHeight); 177 DstPixel^.B := SrcPixel^.B; 178 DstPixel^.G := SrcPixel^.G; 179 DstPixel^.R := SrcPixel^.R; 167 TexWidth := Paper.Width; 168 TexHeight := Paper.Height; 169 DstPixel.Init(Image); 170 SrcPixel.Init(Paper); 171 for Y := 0 to Image.Height - 1 do begin 172 for X := 0 to Image.Width - 1 do begin 173 if (DstPixel.Pixel^.ARGB and $FFFFFF) = $7F007F then begin // transparent 174 SrcPixel.SetXY(X mod TexWidth, Y mod TexHeight); 175 DstPixel.Pixel^.B := SrcPixel.Pixel^.B; 176 DstPixel.Pixel^.G := SrcPixel.Pixel^.G; 177 DstPixel.Pixel^.R := SrcPixel.Pixel^.R; 180 178 end; 179 DstPixel.NextPixel; 181 180 end; 181 DstPixel.NextLine; 182 182 end; 183 183 Image.EndUpdate; -
trunk/LocalPlayer/Term.pas
r69 r72 4054 4054 var 4055 4055 uix, cix, x, y, Loc, i, hw, xm, cm, cmPolOcean, cmPolNone: integer; 4056 PrevMiniPixel, MiniPixel: PPixel32;4056 PrevMiniPixel, MiniPixel: TPixelPointer; 4057 4057 begin 4058 4058 cmPolOcean := GrExt[HGrSystem].Data.Canvas.Pixels[101, 67]; … … 4065 4065 end; 4066 4066 Mini.BeginUpdate; 4067 MiniPixel.Init(Mini); 4068 PrevMiniPixel.Init(Mini); 4067 4069 for y := 0 to G.ly - 1 do 4068 4070 begin … … 4074 4076 begin 4075 4077 xm := ((x - xwMini) * 2 + i + y and 1 - hw + G.lx * 5) mod (G.lx * 2); 4076 MiniPixel := GetBitmapPixelPtr(Mini,xm, y);4078 MiniPixel.SetXY(xm, y); 4077 4079 cm := MiniColors[MyMap[Loc] and fTerrain, i]; 4078 4080 if ClientMode = cEditMap then … … 4099 4101 if y > 0 then begin 4100 4102 // 2x2 city dot covers two lines 4101 PrevMiniPixel := GetBitmapPixelPtr(Mini,xm, y - 1);4102 PrevMiniPixel ^.B := cm shr 16;4103 PrevMiniPixel ^.G := cm shr 8 and $FF;4104 PrevMiniPixel ^.R := cm and $FF;4103 PrevMiniPixel.SetXY(xm, y - 1); 4104 PrevMiniPixel.Pixel^.B := cm shr 16; 4105 PrevMiniPixel.Pixel^.G := cm shr 8 and $FF; 4106 PrevMiniPixel.Pixel^.R := cm and $FF; 4105 4107 end 4106 4108 end … … 4131 4133 cm := Tribe[MyRO.Territory[Loc]].Color; 4132 4134 end; 4133 MiniPixel ^.B := cm shr 16;4134 MiniPixel ^.G := cm shr 8 and $FF;4135 MiniPixel ^.R := cm and $FF;4135 MiniPixel.Pixel^.B := cm shr 16; 4136 MiniPixel.Pixel^.G := cm shr 8 and $FF; 4137 MiniPixel.Pixel^.R := cm and $FF; 4136 4138 end; 4137 4139 end; -
trunk/LocalPlayer/Wonders.pas
r52 r72 82 82 var 83 83 X, Y, ch, x0Dst, y0Dst, x0Src, y0Src, darken, c: Integer; 84 Src, Dst: PPixel32;84 Src, Dst: TPixelPointer; 85 85 begin 86 86 x0Dst := ClientWidth div 2 - xSizeBig div 2 + RingPosition[i, 0]; … … 88 88 x0Src := (i mod 7) * xSizeBig; 89 89 y0Src := (i div 7 + SystemIconLines) * ySizeBig; 90 Src.Init(BigImp, x0Src, y0Src); 91 Dst.Init(Offscreen, x0Dst, y0Dst); 90 92 for Y := 0 to ySizeBig - 1 do begin 91 93 for X := 0 to xSizeBig - 1 do begin 92 Src := GetBitmapPixelPtr(BigImp, x0Src + X, y0Src + Y); 93 Dst := GetBitmapPixelPtr(Offscreen, x0Dst + X, y0Dst + Y); 94 darken := ((255 - Src^.B) * 3 + (255 - Src^.G) * 95 15 + (255 - Src^.R) * 9) div 128; 94 Darken := ((255 - Src.Pixel^.B) * 3 + (255 - Src.Pixel^.G) * 95 15 + (255 - Src.Pixel^.R) * 9) div 128; 96 96 for ch := 0 to 2 do begin 97 c := Dst^.Planes[ch] - darken; 98 if c < 0 then Dst^.Planes[ch] := 0 99 else Dst^.Planes[ch] := c; 100 end 101 end 97 c := Dst.Pixel^.Planes[ch] - Darken; 98 if c < 0 then Dst.Pixel^.Planes[ch] := 0 99 else Dst.Pixel^.Planes[ch] := c; 100 end; 101 Src.NextPixel; 102 Dst.NextPixel; 103 end; 104 Src.NextLine; 105 Dst.NextLine; 102 106 end; 103 107 end; … … 122 126 i, X, Y, r, ax, ch, c: Integer; 123 127 HaveWonder: boolean; 124 Line: array [0 .. 1] of PPixel32;128 Line: array [0..1] of TPixelPointer; 125 129 s: string; 126 130 begin … … 153 157 xm := ClientWidth div 2; 154 158 ym := ClientHeight div 2; 159 Line[0].Init(Offscreen); 160 Line[1].Init(Offscreen); 155 161 for Y := 0 to 127 do begin 156 162 for X := 0 to 179 do begin … … 163 169 for i := 0 to 1 do 164 170 for ch := 0 to 2 do begin 165 Line[0] := GetBitmapPixelPtr(Offscreen, xm + X, ym + Y); 166 Line[1] := GetBitmapPixelPtr(Offscreen, xm + X, ym - 1 - Y); 167 c := Line[i]^.Planes[ch] - darken; 168 if c < 0 then 169 Line[i]^.Planes[ch] := 0 170 else 171 Line[i]^.Planes[ch] := c; 172 Line[0] := GetBitmapPixelPtr(Offscreen, xm - 1 - X, ym + Y); 173 Line[1] := GetBitmapPixelPtr(Offscreen, xm - 1 - X, ym - 1 - Y); 174 c := Line[i]^.Planes[ch] - darken; 175 if c < 0 then 176 Line[i]^.Planes[ch] := 0 177 else 178 Line[i]^.Planes[ch] := c; 171 Line[0].SetXY(xm + X, ym + Y); 172 Line[1].SetXY(xm + X, ym - 1 - Y); 173 c := Line[i].Pixel^.Planes[ch] - darken; 174 if c < 0 then Line[i].Pixel^.Planes[ch] := 0 175 else Line[i].Pixel^.Planes[ch] := c; 176 Line[0].SetXY(xm - 1 - X, ym + Y); 177 Line[1].SetXY(xm - 1 - X, ym - 1 - Y); 178 c := Line[i].Pixel^.Planes[ch] - darken; 179 if c < 0 then Line[i].Pixel^.Planes[ch] := 0 180 else Line[i].Pixel^.Planes[ch] := c; 179 181 end; 180 182 end;
Note:
See TracChangeset
for help on using the changeset viewer.