- Timestamp:
- Mar 26, 2021, 3:24:15 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/Help.pas
r330 r331 771 771 xxt * 2 - 8, yyt * 2 - 4, 5 + 2 * (xxt * 2 + 1), 772 772 3 + yyt + 2 * (yyt * 3 + 1)); 773 srcno := 45 773 srcno := 45; 774 774 end 775 775 else -
trunk/LocalPlayer/IsoEngine.pas
r330 r331 1093 1093 var 1094 1094 dx, dy: integer; 1095 PixelPtr: TPixelPointer;1096 1095 begin 1097 1096 if ShowBorder and (Loc >= 0) and (Loc < G.lx * G.ly) and … … 1104 1103 yyt * 2, HGrTerrain.Data.Canvas, 1105 1104 1 + 8 * (xxt * 2 + 1), 1 + yyt + 16 * (yyt * 3 + 1)); 1106 Borders.BeginUpdate; 1107 PixelPtr := PixelPointer(Borders, ScaleToNative(0), ScaleToNative(p1 * (yyt * 2))); 1108 for dy := 0 to ScaleToNative(yyt * 2) - 1 do begin 1109 for dx := 0 to ScaleToNative(xxt * 2) - 1 do begin 1110 if PixelPtr.Pixel^.B = 99 then begin 1111 PixelPtr.Pixel^.B := Tribe[p1].Color shr 16 and $FF; 1112 PixelPtr.Pixel^.G := Tribe[p1].Color shr 8 and $FF; 1113 PixelPtr.Pixel^.R := Tribe[p1].Color and $FF; 1114 end; 1115 PixelPtr.NextPixel; 1116 end; 1117 PixelPtr.NextLine; 1118 end; 1119 Borders.EndUpdate; 1105 BitmapReplaceColor(Borders, 0, p1 * (yyt * 2), xxt * 2, yyt * 2, $636363, Tribe[p1].Color); 1120 1106 BordersOK^ := BordersOK^ or 1 shl p1; 1121 1107 end; -
trunk/Packages/CevoComponents/ScreenTools.pas
r323 r331 42 42 function LoadGraphicSet2(const Name: string): TGraphicSet; 43 43 procedure Dump(dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: integer); 44 procedure BitmapReplaceColor(Dst: TBitmap; X, Y, Width, Height: Integer; OldColor, NewColor: TColor); 44 45 procedure Sprite(Canvas: TCanvas; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: integer); 45 46 overload; … … 567 568 end; 568 569 570 procedure BitmapReplaceColor(Dst: TBitmap; X, Y, Width, Height: Integer; OldColor, NewColor: TColor); 571 var 572 XX, YY: Integer; 573 PixelPtr: TPixelPointer; 574 begin 575 Dst.BeginUpdate; 576 PixelPtr := PixelPointer(Dst, ScaleToNative(X), ScaleToNative(Y)); 577 for YY := 0 to ScaleToNative(Height) - 1 do begin 578 for XX := 0 to ScaleToNative(Width) - 1 do begin 579 if PixelPtr.Pixel^.RGB = SwapRedBlue(OldColor) then begin 580 PixelPtr.Pixel^.RGB := SwapRedBlue(NewColor); 581 end; 582 PixelPtr.NextPixel; 583 end; 584 PixelPtr.NextLine; 585 end; 586 Dst.EndUpdate; 587 end; 588 569 589 procedure MakeBlue(Dst: TBitmap; X, Y, Width, Height: Integer); 570 590 var -
trunk/Packages/CevoComponents/UPixelPointer.pas
r230 r331 9 9 TColor32 = type Cardinal; 10 10 TColor32Component = (ccBlue, ccGreen, ccRed, ccAlpha); 11 12 { TPixel32 } 13 11 14 TPixel32 = packed record 15 private 16 function GetRGB: Cardinal; 17 procedure SetRGB(AValue: Cardinal); 18 public 19 property RGB: Cardinal read GetRGB write SetRGB; 12 20 case Integer of 13 21 0: (B, G, R, A: Byte); … … 37 45 38 46 function PixelPointer(Bitmap: TRasterImage; BaseX: Integer = 0; BaseY: Integer = 0): TPixelPointer; inline; 39 47 function SwapRedBlue(Color: TColor32): TColor32; 40 48 41 49 implementation 50 51 { TPixel32 } 52 53 function TPixel32.GetRGB: Cardinal; 54 begin 55 Result := ARGB and $ffffff; 56 end; 57 58 procedure TPixel32.SetRGB(AValue: Cardinal); 59 begin 60 R := (AValue shr 16) and $ff; 61 G := (AValue shr 8) and $ff; 62 B := (AValue shr 0) and $ff; 63 end; 42 64 43 65 { TPixelPointer } … … 86 108 end; 87 109 110 function SwapRedBlue(Color: TColor32): TColor32; 111 begin 112 Result := (Color and $ff00ff00) or ((Color and $ff) shl 16) or ((Color shr 16) and $ff); 113 end; 114 88 115 89 116 end.
Note:
See TracChangeset
for help on using the changeset viewer.