- Timestamp:
- Jan 15, 2017, 11:47:01 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Integrated.lpi
r69 r72 450 450 <StackChecks Value="True"/> 451 451 </Checks> 452 <VerifyObjMethodCallValidity Value="True"/>453 452 </CodeGeneration> 454 453 <Linking> -
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; -
trunk/ScreenTools.pas
r68 r72 35 35 Pixel: PPixel32; 36 36 Line: PPixel32; 37 RelLine: PPixel32; 37 38 BytesPerPixel: Integer; 38 39 BytesPerLine: Integer; 39 procedure NextLine; inline; 40 procedure NextPixel; inline; 41 procedure SetXY(X, Y: Integer); inline; 42 procedure SetX(X: Integer); inline; 43 procedure Init(Bitmap: TBitmap; X: Integer = 0;Y: Integer = 0); inline;40 procedure NextLine; inline; // Move pointer to start of new base line 41 procedure NextPixel; inline; // Move pointer to next pixel 42 procedure SetXY(X, Y: Integer); inline; // Set pixel position relative to base 43 procedure SetX(X: Integer); inline; // Set horizontal pixel position relative to base 44 procedure Init(Bitmap: TBitmap; BaseX: Integer = 0; BaseY: Integer = 0); inline; 44 45 end; 45 46 PPixelPointer = ^TPixelPointer; … … 48 49 function ChangeResolution(x, y, bpp, freq: integer): boolean; 49 50 {$ENDIF} 50 function GetBitmapPixelPtr(Bitmap: TBitmap; X, Y: Integer): PPixel32;51 51 procedure RestoreResolution; 52 52 function Play(Item: string; Index: integer = -1): boolean; … … 298 298 end; 299 299 300 function GetBitmapPixelPtr(Bitmap: TBitmap; X, Y: Integer): PPixel32;301 begin302 Result := Pointer(Bitmap.RawImage.Data) + X * (Bitmap.RawImage.Description.BitsPerPixel shr 3) + Y * Bitmap.RawImage.Description.BytesPerLine;303 end;304 305 300 procedure EmptyMenu(MenuItems: TMenuItem; Keep: integer = 0); 306 301 var … … 464 459 begin 465 460 Bmp.BeginUpdate; 466 PixelPtr.Init(bmp , 0, 0);461 PixelPtr.Init(bmp); 467 462 for Y := 0 to Bmp.Height - 1 do begin 468 463 for X := 0 to Bmp.Width - 1 do begin … … 483 478 FileName: string; 484 479 Source: TBitmap; 485 DataPixel, MaskPixel: PPixel32;480 DataPixel, MaskPixel: TPixelPointer; 486 481 begin 487 482 i := 0; … … 517 512 GrExt[nGrExt].Data.BeginUpdate; 518 513 GrExt[nGrExt].Mask.BeginUpdate; 519 for y := 0 to Source.Height - 1 do 520 begin 521 for x := 0 to xmax - 1 do 522 begin 523 DataPixel := GetBitmapPixelPtr(GrExt[nGrExt].Data, x, y); 524 MaskPixel := GetBitmapPixelPtr(GrExt[nGrExt].Mask, x, Y); 525 526 OriginalColor := DataPixel^.ARGB and $FFFFFF; 527 if (OriginalColor = $FF00FF) or (OriginalColor = $7F007F) then 528 begin // transparent 529 MaskPixel^.ARGB := $FFFFFF; 530 DataPixel^.ARGB := DataPixel^.ARGB and $FF000000 531 end 532 else 533 begin 534 MaskPixel^.ARGB := $000000; // non-transparent 535 if Gamma <> 100 then 536 begin 537 DataPixel^.B := GammaLUT[DataPixel^.B]; 538 DataPixel^.G := GammaLUT[DataPixel^.G]; 539 DataPixel^.R := GammaLUT[DataPixel^.R]; 540 end 541 end 542 end 514 DataPixel.Init(GrExt[nGrExt].Data); 515 MaskPixel.Init(GrExt[nGrExt].Mask); 516 for y := 0 to Source.Height - 1 do begin 517 for x := 0 to xmax - 1 do begin 518 OriginalColor := DataPixel.Pixel^.ARGB and $FFFFFF; 519 if (OriginalColor = $FF00FF) or (OriginalColor = $7F007F) then begin // transparent 520 MaskPixel.Pixel^.ARGB := $FFFFFF; 521 DataPixel.Pixel^.ARGB := DataPixel.Pixel^.ARGB and $FF000000 522 end else begin 523 MaskPixel.Pixel^.ARGB := $000000; // non-transparent 524 if Gamma <> 100 then begin 525 DataPixel.Pixel^.B := GammaLUT[DataPixel.Pixel^.B]; 526 DataPixel.Pixel^.G := GammaLUT[DataPixel.Pixel^.G]; 527 DataPixel.Pixel^.R := GammaLUT[DataPixel.Pixel^.R]; 528 end; 529 end; 530 DataPixel.NextPixel; 531 MaskPixel.NextPixel; 532 end; 533 DataPixel.NextLine; 534 MaskPixel.NextLine; 543 535 end; 544 536 GrExt[nGrExt].Data.EndUpdate; … … 562 554 begin 563 555 Dst.BeginUpdate; 564 PixelPtr.Init(Dst , 0, 0);556 PixelPtr.Init(Dst); 565 557 for yy := 0 to h - 1 do begin 566 558 for xx := 0 to w - 1 do begin … … 580 572 var 581 573 X, Y: Integer; 582 Brightness, test: integer; 583 PixelSrc: ^Byte; 584 PixelDst: PPixel32; 585 begin 586 //TODO Assert(Src.PixelFormat = pf8bit); 574 Brightness, Test: Integer; 575 PixelSrc: TPixelPointer; 576 PixelDst: TPixelPointer; 577 pf: TPixelFormat; 578 begin 579 pf := src.PixelFormat; 580 //Assert(Src.PixelFormat = pf8bit); 587 581 Assert(dst.PixelFormat = pf24bit); 588 582 if xDst < 0 then … … 607 601 dst.BeginUpdate; 608 602 Src.BeginUpdate; 603 PixelDst.Init(Dst, xDst, yDst); 604 PixelSrc.Init(Src, xSrc, ySrc); 609 605 for Y := 0 to h - 1 do begin 610 PixelDst := GetBitmapPixelPtr(dst, xDst, yDst + Y);611 PixelSrc := Pointer(GetBitmapPixelPtr(Src, xSrc, ySrc + Y));612 606 for X := 0 to w - 1 do begin 613 Brightness := PixelSrc ^;614 test := (PixelDst ^.R * Brightness) shr 7;615 if test >= 256 then PixelDst ^.R := 255616 else PixelDst ^.R := test; // Red617 test := (PixelDst ^.G * Brightness) shr 7;618 if test >= 256 then PixelDst ^.G := 255619 else PixelDst ^.G := test; // Green620 test := (PixelDst ^.B * Brightness) shr 7;621 if test >= 256 then 622 PixelDst^.R := 255623 else624 PixelDst^.B := test; // Blue625 PixelDst := Pointer(PixelDst) + (Dst.RawImage.Description.BitsPerPixel shr 3);626 PixelSrc := Pointer(PixelSrc) + (Src.RawImage.Description.BitsPerPixel shr 3);627 end;607 Brightness := PixelSrc.Pixel^.B; // One byte for 8-bit color 608 test := (PixelDst.Pixel^.R * Brightness) shr 7; 609 if test >= 256 then PixelDst.Pixel^.R := 255 610 else PixelDst.Pixel^.R := test; // Red 611 test := (PixelDst.Pixel^.G * Brightness) shr 7; 612 if test >= 256 then PixelDst.Pixel^.G := 255 613 else PixelDst.Pixel^.G := test; // Green 614 test := (PixelDst.Pixel^.B * Brightness) shr 7; 615 if test >= 256 then PixelDst.Pixel^.R := 255 616 else PixelDst.Pixel^.B := Test; // Blue 617 PixelDst.NextPixel; 618 PixelSrc.NextPixel; 619 end; 620 PixelDst.NextLine; 621 PixelSrc.NextLine; 628 622 end; 629 623 src.EndUpdate; … … 639 633 var 640 634 ix, iy, amp1, amp2, trans, Value: integer; 641 SrcPixel, DstPixel: PPixel32;635 SrcPixel, DstPixel: TPixelPointer; 642 636 begin 643 637 if xDst < 0 then begin … … 660 654 Src.BeginUpdate; 661 655 dst.BeginUpdate; 662 for iy := 0 to h - 1 do 663 begin 664 for ix := 0 to w - 1 do 665 begin 666 SrcPixel := GetBitmapPixelPtr(Src, xSrc + ix, ySrc + iy); 667 DstPixel := GetBitmapPixelPtr(Dst, xDst + ix, yDst + iy); 668 trans := SrcPixel^.B * 2; // green channel = transparency 669 amp1 := SrcPixel^.G * 2; 670 amp2 := SrcPixel^.R * 2; 671 if trans <> $FF then 672 begin 673 Value := (DstPixel^.B * trans + ((Color2 shr 16) and $FF) * amp2 656 SrcPixel.Init(Src, xSrc, ySrc); 657 DstPixel.Init(Dst, xDst, yDst); 658 for iy := 0 to h - 1 do begin 659 for ix := 0 to w - 1 do begin 660 trans := SrcPixel.Pixel^.B * 2; // green channel = transparency 661 amp1 := SrcPixel.Pixel^.G * 2; 662 amp2 := SrcPixel.Pixel^.R * 2; 663 if trans <> $FF then begin 664 Value := (DstPixel.Pixel^.B * trans + ((Color2 shr 16) and $FF) * amp2 674 665 + ((Color1 shr 16) and $FF) * amp1) div $FF; 675 if Value < 256 then DstPixel ^.B := Value676 else DstPixel^.B := 255;677 Value := (DstPixel ^.G * trans + ((Color2 shr 8) and $FF) * amp2666 if Value < 256 then DstPixel.Pixel^.B := Value 667 else DstPixel.Pixel^.B := 255; 668 Value := (DstPixel.Pixel^.G * trans + ((Color2 shr 8) and $FF) * amp2 678 669 + ((Color1 shr 8) and $FF) * amp1) div $FF; 679 if Value < 256 then DstPixel ^.G := Value680 else DstPixel ^.G := 255;681 Value := (DstPixel ^.R * trans + (Color2 and $FF) * amp2 +670 if Value < 256 then DstPixel.Pixel^.G := Value 671 else DstPixel.Pixel^.G := 255; 672 Value := (DstPixel.Pixel^.R * trans + (Color2 and $FF) * amp2 + 682 673 (Color1 and $FF) * amp1) div $FF; 683 if Value < 256 then DstPixel ^.R := Value684 else DstPixel ^.R := 255;674 if Value < 256 then DstPixel.Pixel^.R := Value 675 else DstPixel.Pixel^.R := 255; 685 676 end; 686 end; 677 SrcPixel.NextPixel; 678 DstPixel.NextPixel; 679 end; 680 SrcPixel.NextLine; 681 DstPixel.NextLine; 687 682 end; 688 683 Src.EndUpdate; … … 698 693 var 699 694 i, Red, Green: integer; 700 Pixel : PPixel32;695 PixelPtr: TPixelPointer; 701 696 begin 702 697 bmp.BeginUpdate; 703 698 assert(bmp.PixelFormat = pf24bit); 704 699 h := y + h; 705 while y < h do 706 begin 707 Pixel := GetBitmapPixelPtr(Bmp, x, y); 708 for i := 0 to w - 1 do 709 begin 710 Red := ((Pixel^.B * (Color0 and $0000FF) + Pixel^.G * (Color1 and $0000FF) 711 + Pixel^.R * (Color2 and $0000FF)) shr 8) and $ff; 712 Green := ((Pixel^.B * ((Color0 shr 8) and $0000FF) + Pixel^.G * 713 ((Color1 shr 8) and $0000FF) + Pixel^.R * ((Color2 shr 8) and 700 PixelPtr.Init(Bmp, x, y); 701 while y < h do begin 702 for i := 0 to w - 1 do begin 703 Red := ((PixelPtr.Pixel^.B * (Color0 and $0000FF) + PixelPtr.Pixel^.G * (Color1 and $0000FF) 704 + PixelPtr.Pixel^.R * (Color2 and $0000FF)) shr 8) and $ff; 705 Green := ((PixelPtr.Pixel^.B * ((Color0 shr 8) and $0000FF) + PixelPtr.Pixel^.G * 706 ((Color1 shr 8) and $0000FF) + PixelPtr.Pixel^.R * ((Color2 shr 8) and 714 707 $0000FF)) shr 8) and $ff; 715 Pixel ^.B := ((Pixel^.B * ((Color0 shr 16) and $0000FF) +Pixel^.G *716 ((Color1 shr 16) and $0000FF) + Pixel ^.R * ((Color2 shr 16) and $0000FF))708 PixelPtr.Pixel^.B := ((PixelPtr.Pixel^.B * ((Color0 shr 16) and $0000FF) + PixelPtr.Pixel^.G * 709 ((Color1 shr 16) and $0000FF) + PixelPtr.Pixel^.R * ((Color2 shr 16) and $0000FF)) 717 710 shr 8) and $ff; // Blue 718 Pixel ^.G := Green;719 Pixel ^.R := Red;720 Pixel := pointer(Pixel) + (Bmp.RawImage.Description.BitsPerPixel shr 3);711 PixelPtr.Pixel^.G := Green; 712 PixelPtr.Pixel^.R := Red; 713 PixelPtr.NextPixel; 721 714 end; 722 715 inc(y); 716 PixelPtr.NextLine; 723 717 end; 724 718 bmp.EndUpdate; … … 749 743 DestCanvas.CopyRect(Rect(X, Y, X + Width, Y + Height), SrcCanvas, 750 744 Rect(XSrc, YSrc, XSrc + Width, YSrc + Height)); 745 Result := True; 751 746 end; 752 747 … … 1447 1442 end; 1448 1443 1449 procedure TPixelPointer.Init(Bitmap: TBitmap; X: Integer = 0; Y: Integer = 0); inline; 1450 begin 1451 Base := PPixel32(Bitmap.RawImage.Data); 1444 procedure TPixelPointer.Init(Bitmap: TBitmap; BaseX: Integer = 0; BaseY: Integer = 0); inline; 1445 begin 1452 1446 BytesPerLine := Bitmap.RawImage.Description.BytesPerLine; 1453 1447 BytesPerPixel := Bitmap.RawImage.Description.BitsPerPixel shr 3; 1454 SetXY(X, Y); 1448 Base := PPixel32(Bitmap.RawImage.Data + BaseX * BytesPerPixel + BaseY * BytesPerLine); 1449 SetXY(0, 0); 1455 1450 end; 1456 1451 -
trunk/Start.pas
r64 r72 822 822 var 823 823 x, y: integer; 824 PicturePixel: PPixel32;824 PicturePixel: TPixelPointer; 825 825 begin 826 826 SetMainTextureByAge(-1); … … 830 830 Fill(EmptyPicture.Canvas, 0, 0, 64, 64, (wMaintexture - 64) div 2, 831 831 (hMaintexture - 64) div 2); 832 for y := 0 to 63 do 833 begin // darken texture for empty slot 834 for x := 0 to 64 - 1 do 835 begin 836 PicturePixel := GetBitmapPixelPtr(EmptyPicture, x, y); 837 PicturePixel^.B := Max(PicturePixel^.B - 28, 0); 838 PicturePixel^.G := Max(PicturePixel^.G - 28, 0); 839 PicturePixel^.R := Max(PicturePixel^.R - 28, 0); 840 end 832 // darken texture for empty slot 833 PicturePixel.Init(EmptyPicture); 834 for y := 0 to 63 do begin 835 for x := 0 to 64 - 1 do begin 836 PicturePixel.Pixel^.B := Max(PicturePixel.Pixel^.B - 28, 0); 837 PicturePixel.Pixel^.G := Max(PicturePixel.Pixel^.G - 28, 0); 838 PicturePixel.Pixel^.R := Max(PicturePixel.Pixel^.R - 28, 0); 839 PicturePixel.NextPixel; 840 end; 841 PicturePixel.NextLine; 841 842 end; 842 843 EmptyPicture.EndUpdate; … … 1001 1002 var 1002 1003 i, x, y, xm, cm: integer; 1003 MiniPixel: PPixel32;1004 MiniPixel: TPixelPointer; 1004 1005 Map: ^TTileList; 1005 1006 begin … … 1011 1012 Mini.SetSize(MiniWidth * 2, MiniHeight); 1012 1013 Mini.BeginUpdate; 1014 MiniPixel.Init(Mini); 1013 1015 for y := 0 to MiniHeight - 1 do begin 1014 1016 for x := 0 to MiniWidth - 1 do begin 1015 1017 for i := 0 to 1 do begin 1016 1018 xm := (x * 2 + i + y and 1) mod (MiniWidth * 2); 1017 MiniPixel := GetBitmapPixelPtr(Mini, xm, y);1019 MiniPixel.SetX(xm); 1018 1020 cm := MiniColors 1019 1021 [Map[x * lxmax div MiniWidth + lxmax * 1020 1022 ((y * (lymax - 1) + MiniHeight div 2) div (MiniHeight - 1))] and 1021 1023 fTerrain, i]; 1022 MiniPixel ^.B := ((cm shr 16) and $FF) * Brightness div 3;1023 MiniPixel ^.G := ((cm shr 8) and $FF) * Brightness div 3;1024 MiniPixel ^.R := ((cm shr 0) and $FF) * Brightness div 3;1024 MiniPixel.Pixel^.B := ((cm shr 16) and $FF) * Brightness div 3; 1025 MiniPixel.Pixel^.G := ((cm shr 8) and $FF) * Brightness div 3; 1026 MiniPixel.Pixel^.R := ((cm shr 0) and $FF) * Brightness div 3; 1025 1027 end; 1026 1028 end; 1029 MiniPixel.NextLine; 1027 1030 end; 1028 1031 Mini.EndUpdate; … … 1035 1038 var 1036 1039 i, x, y, xm, cm, Tile, OwnColor, EnemyColor: integer; 1037 MiniPixel, PrevMiniPixel: PPixel32;1040 MiniPixel, PrevMiniPixel: TPixelPointer; 1038 1041 begin 1039 1042 OwnColor := GrExt[HGrSystem].Data.Canvas.Pixels[95, 67]; … … 1045 1048 begin 1046 1049 Mini.BeginUpdate; 1050 MiniPixel.Init(Mini); 1051 PrevMiniPixel.Init(Mini, 0, -1); 1047 1052 for y := 0 to MiniHeight - 1 do begin 1048 1053 for x := 0 to MiniWidth - 1 do begin 1049 1054 for i := 0 to 1 do begin 1050 1055 xm := (x * 2 + i + y and 1) mod (MiniWidth * 2); 1051 MiniPixel := GetBitmapPixelPtr(Mini, xm, y);1056 MiniPixel.SetX(xm); 1052 1057 Tile := SaveMap[x + MiniWidth * y]; 1053 1058 if Tile and fTerrain = fUNKNOWN then … … 1061 1066 if y > 0 then begin 1062 1067 // 2x2 city dot covers two lines 1063 PrevMiniPixel := GetBitmapPixelPtr(Mini, xm, y - 1);1064 PrevMiniPixel ^.B := cm shr 16;1065 PrevMiniPixel ^.G:= cm shr 8 and $FF;1066 PrevMiniPixel ^.R := cm and $FF;1068 PrevMiniPixel.SetX(xm); 1069 PrevMiniPixel.Pixel^.B := cm shr 16; 1070 PrevMiniPixel.Pixel^.G:= cm shr 8 and $FF; 1071 PrevMiniPixel.Pixel^.R := cm and $FF; 1067 1072 end 1068 1073 end … … 1074 1079 else 1075 1080 cm := MiniColors[Tile and fTerrain, i]; 1076 MiniPixel ^.B := cm shr 16;1077 MiniPixel ^.G:= cm shr 8 and $FF;1078 MiniPixel ^.R := cm and $FF;1081 MiniPixel.Pixel^.B := cm shr 16; 1082 MiniPixel.Pixel^.G:= cm shr 8 and $FF; 1083 MiniPixel.Pixel^.R := cm and $FF; 1079 1084 end; 1080 1085 end;
Note:
See TracChangeset
for help on using the changeset viewer.