Changeset 447 for trunk/Packages/CevoComponents/ScreenTools.pas
- Timestamp:
- May 19, 2022, 10:39:34 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/CevoComponents/ScreenTools.pas
r442 r447 17 17 18 18 {$IFDEF WINDOWS} 19 function ChangeResolution( x, y, bpp, freq: integer): boolean;19 function ChangeResolution(X, Y, bpp, freq: Integer): Boolean; 20 20 {$ENDIF} 21 21 procedure RestoreResolution; 22 22 procedure EmptyMenu(MenuItems: TMenuItem; Keep: Integer = 0); 23 function TurnToYear(Turn: integer): integer;24 function TurnToString(Turn: integer): string;25 function MovementToString(Movement: integer): string;26 procedure BtnFrame(ca: TCanvas; p: TRect; T: TTexture);27 procedure EditFrame(ca: TCanvas; p: TRect; T: TTexture);28 function HexStringToColor(S: string): integer;23 function TurnToYear(Turn: Integer): Integer; 24 function TurnToString(Turn: Integer): string; 25 function MovementToString(Movement: Integer): string; 26 procedure BtnFrame(ca: TCanvas; P: TRect; T: TTexture); 27 procedure EditFrame(ca: TCanvas; P: TRect; T: TTexture); 28 function HexStringToColor(S: string): Integer; 29 29 function ExtractFileNameWithoutExt(const Filename: string): string; 30 function LoadGraphicFile(Bmp: TBitmap; FileName: string; Options: TLoadGraphicFileOptions = []): boolean;30 function LoadGraphicFile(Bmp: TBitmap; FileName: string; Options: TLoadGraphicFileOptions = []): Boolean; 31 31 function LoadGraphicSet(const Name: string; Transparency: Boolean = True): TGraphicSet; 32 procedure Dump(dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: integer);32 procedure Dump(dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer); 33 33 procedure BitmapReplaceColor(Dst: TBitmap; X, Y, Width, Height: Integer; OldColor, NewColor: TColor); 34 procedure Sprite(Canvas: TCanvas; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: integer);34 procedure Sprite(Canvas: TCanvas; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer); 35 35 overload; 36 procedure Sprite(dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: integer);36 procedure Sprite(dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer); 37 37 overload; 38 38 procedure MakeBlue(Dst: TBitmap; X, Y, Width, Height: Integer); … … 45 45 procedure ImageOp_CBC(Dst, Src: TBitmap; xDst, yDst, xSrc, ySrc, Width, Height, 46 46 Color0, Color2: Integer); 47 procedure ImageOp_CCC(bmp: TBitmap; x, y, Width, Height, Color0, Color1, Color2: Integer);47 procedure ImageOp_CCC(bmp: TBitmap; X, Y, Width, Height, Color0, Color1, Color2: Integer); 48 48 function BitBltCanvas(DestCanvas: TCanvas; X, Y, Width, Height: Integer; 49 49 SrcCanvas: TCanvas; XSrc, YSrc: Integer; Rop: DWORD = SRCCOPY): Boolean; overload; … … 54 54 function BitBltBitmap(Dest: TBitmap; DestRect: TRect; 55 55 Src: TBitmap; SrcPos: TPoint; Rop: DWORD = SRCCOPY): Boolean; overload; 56 procedure SLine(ca: TCanvas; x0, x1, y: integer; cl: TColor);57 procedure DLine(ca: TCanvas; x0, x1, y: integer; cl0, cl1: TColor);58 procedure Frame(ca: TCanvas; x0, y0, x1, y1: integer; cl0, cl1: TColor);59 procedure RFrame(ca: TCanvas; x0, y0, x1, y1: integer; cl0, cl1: TColor);60 procedure CFrame(ca: TCanvas; x0, y0, x1, y1, Corner: integer; cl: TColor);56 procedure SLine(ca: TCanvas; x0, x1, Y: Integer; cl: TColor); 57 procedure DLine(ca: TCanvas; x0, x1, Y: Integer; cl0, cl1: TColor); 58 procedure Frame(ca: TCanvas; x0, y0, x1, y1: Integer; cl0, cl1: TColor); 59 procedure RFrame(ca: TCanvas; x0, y0, x1, y1: Integer; cl0, cl1: TColor); 60 procedure CFrame(ca: TCanvas; x0, y0, x1, y1, Corner: Integer; cl: TColor); 61 61 procedure FrameImage(ca: TCanvas; Src: TBitmap; 62 x, y, Width, Height, xSrc, ySrc: integer; IsControl: boolean = False);63 procedure GlowFrame(Dst: TBitmap; x0, y0, Width, Height: integer; cl: TColor);62 X, Y, Width, Height, xSrc, ySrc: Integer; IsControl: Boolean = False); 63 procedure GlowFrame(Dst: TBitmap; x0, y0, Width, Height: Integer; cl: TColor); 64 64 procedure InitOrnament; 65 65 procedure InitCityMark(T: TTexture); 66 procedure Fill(ca: TCanvas; Left, Top, Width, Height, xOffset, yOffset: integer); overload;66 procedure Fill(ca: TCanvas; Left, Top, Width, Height, xOffset, yOffset: Integer); overload; 67 67 procedure Fill(Canvas: TCanvas; Rect: TRect; Offset: TPoint); overload; 68 procedure FillLarge(ca: TCanvas; x0, y0, x1, y1, xm: integer);69 procedure FillSeamless(ca: TCanvas; Left, Top, Width, Height, xOffset, yOffset: integer;68 procedure FillLarge(ca: TCanvas; x0, y0, x1, y1, xm: Integer); 69 procedure FillSeamless(ca: TCanvas; Left, Top, Width, Height, xOffset, yOffset: Integer; 70 70 const Texture: TBitmap); 71 procedure FillRectSeamless(ca: TCanvas; x0, y0, x1, y1, xOffset, yOffset: integer;71 procedure FillRectSeamless(ca: TCanvas; x0, y0, x1, y1, xOffset, yOffset: Integer; 72 72 const Texture: TBitmap); 73 procedure PaintBackground(Form: TForm; Left, Top, Width, Height: integer);74 procedure Corner(ca: TCanvas; x, y, Kind: integer; T: TTexture);75 procedure BiColorTextOut(ca: TCanvas; clMain, clBack: TColor; x, y: integer; s: string);73 procedure PaintBackground(Form: TForm; Left, Top, Width, Height: Integer); 74 procedure Corner(ca: TCanvas; X, Y, Kind: Integer; T: TTexture); 75 procedure BiColorTextOut(ca: TCanvas; clMain, clBack: TColor; X, Y: Integer; S: string); 76 76 procedure LoweredTextOut(ca: TCanvas; cl: TColor; T: TTexture; 77 x, y: integer; s: string);78 function BiColorTextWidth(ca: TCanvas; s: string): integer;79 procedure RisedTextOut(ca: TCanvas; x, y: integer; s: string);80 procedure LightGradient(ca: TCanvas; x, y, Width, Color: integer);81 procedure DarkGradient(ca: TCanvas; x, y, Width, Kind: integer);82 procedure VLightGradient(ca: TCanvas; x, y, Height, Color: integer);83 procedure VDarkGradient(ca: TCanvas; x, y, Height, Kind: integer);77 X, Y: Integer; S: string); 78 function BiColorTextWidth(ca: TCanvas; S: string): Integer; 79 procedure RisedTextOut(ca: TCanvas; X, Y: Integer; S: string); 80 procedure LightGradient(ca: TCanvas; X, Y, Width, Color: Integer); 81 procedure DarkGradient(ca: TCanvas; X, Y, Width, Kind: Integer); 82 procedure VLightGradient(ca: TCanvas; X, Y, Height, Color: Integer); 83 procedure VDarkGradient(ca: TCanvas; X, Y, Height, Kind: Integer); 84 84 procedure UnderlinedTitleValue(Canvas: TCanvas; Title, Value: string; X, Y, Width: Integer); 85 procedure NumberBar(dst: TBitmap; x, y: integer; Cap: string; val: integer;85 procedure NumberBar(dst: TBitmap; X, Y: Integer; Cap: string; val: Integer; 86 86 T: TTexture); 87 procedure CountBar(dst: TBitmap; x, y, w: integer; Kind: integer;88 Cap: string; val: integer; T: TTexture);89 procedure PaintProgressBar(ca: TCanvas; Kind, x, y, pos, Growth, max: integer;87 procedure CountBar(dst: TBitmap; X, Y, W: Integer; Kind: Integer; 88 Cap: string; val: Integer; T: TTexture); 89 procedure PaintProgressBar(ca: TCanvas; Kind, X, Y, Pos, Growth, Max: Integer; 90 90 T: TTexture); 91 91 procedure PaintRelativeProgressBar(ca: TCanvas; 92 Kind, x, y, size, pos, Growth, max: integer; IndicateComplete: boolean;92 Kind, X, Y, size, Pos, Growth, Max: Integer; IndicateComplete: Boolean; 93 93 T: TTexture); 94 procedure PaintLogo(Canvas: TCanvas; X, Y, LightColor, ShadeColor: integer);94 procedure PaintLogo(Canvas: TCanvas; X, Y, LightColor, ShadeColor: Integer); 95 95 procedure LoadPhrases; 96 96 procedure Texturize(Dest, Texture: TBitmap; TransparentColor: Cardinal); … … 204 204 {$IFDEF WINDOWS} 205 205 StartResolution: TDeviceMode; 206 ResolutionChanged: boolean;206 ResolutionChanged: Boolean; 207 207 {$ENDIF} 208 208 … … 210 210 211 211 {$IFDEF WINDOWS} 212 function ChangeResolution( x, y, bpp, freq: integer): boolean;212 function ChangeResolution(X, Y, bpp, freq: Integer): Boolean; 213 213 var 214 214 DevMode: TDeviceMode; … … 217 217 DevMode.dmFields := DM_PELSWIDTH or DM_PELSHEIGHT or DM_BITSPERPEL or 218 218 DM_DISPLAYFREQUENCY; 219 DevMode.dmPelsWidth := x;220 DevMode.dmPelsHeight := y;219 DevMode.dmPelsWidth := X; 220 DevMode.dmPelsHeight := Y; 221 221 DevMode.dmBitsPerPel := bpp; 222 222 DevMode.dmDisplayFrequency := freq; … … 318 318 end; 319 319 320 procedure BtnFrame(ca: TCanvas; p: TRect; T: TTexture);321 begin 322 RFrame(ca, p.Left - 1, p.Top - 1, p.Right, p.Bottom, T.ColorBevelShade,320 procedure BtnFrame(ca: TCanvas; P: TRect; T: TTexture); 321 begin 322 RFrame(ca, P.Left - 1, P.Top - 1, P.Right, P.Bottom, T.ColorBevelShade, 323 323 T.ColorBevelLight); 324 324 end; 325 325 326 procedure EditFrame(ca: TCanvas; p: TRect; T: TTexture);327 begin 328 Frame(ca, p.Left - 1, p.Top - 1, p.Right, p.Bottom, $000000, $000000);329 Frame(ca, p.Left - 2, p.Top - 2, p.Right + 1, p.Bottom + 1, $000000, $000000);330 Frame(ca, p.Left - 3, p.Top - 3, p.Right + 2, p.Bottom + 1, $000000, $000000);331 RFrame(ca, p.Left - 4, p.Top - 4, p.Right + 3, p.Bottom + 2, T.ColorBevelShade,326 procedure EditFrame(ca: TCanvas; P: TRect; T: TTexture); 327 begin 328 Frame(ca, P.Left - 1, P.Top - 1, P.Right, P.Bottom, $000000, $000000); 329 Frame(ca, P.Left - 2, P.Top - 2, P.Right + 1, P.Bottom + 1, $000000, $000000); 330 Frame(ca, P.Left - 3, P.Top - 3, P.Right + 2, P.Bottom + 1, $000000, $000000); 331 RFrame(ca, P.Left - 4, P.Top - 4, P.Right + 3, P.Bottom + 2, T.ColorBevelShade, 332 332 T.ColorBevelLight); 333 333 end; … … 335 335 function HexCharToInt(X: Char): Integer; 336 336 begin 337 case xof337 case X of 338 338 '0' .. '9': Result := Ord(X) - Ord('0'); 339 339 'A' .. 'F': Result := Ord(X) - Ord('A') + 10; … … 492 492 function LoadGraphicSet(const Name: string; Transparency: Boolean = True): TGraphicSet; 493 493 var 494 x: Integer;495 y: Integer;494 X: Integer; 495 Y: Integer; 496 496 OriginalColor: Integer; 497 497 FileName: string; … … 522 522 DataPixel := PixelPointer(Result.Data); 523 523 MaskPixel := PixelPointer(Result.Mask); 524 for y:= 0 to ScaleToNative(Result.Data.Height) - 1 do begin525 for x:= 0 to ScaleToNative(Result.Data.Width) - 1 do begin524 for Y := 0 to ScaleToNative(Result.Data.Height) - 1 do begin 525 for X := 0 to ScaleToNative(Result.Data.Width) - 1 do begin 526 526 OriginalColor := DataPixel.Pixel^.ARGB and $FFFFFF; 527 527 if (OriginalColor = TransparentColor1) or (OriginalColor = TransparentColor2) then begin … … 552 552 end; 553 553 554 procedure Dump(dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: integer);554 procedure Dump(dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer); 555 555 begin 556 556 BitBltCanvas(dst.Canvas, xDst, yDst, Width, Height, … … 650 650 Height := ScaleToNative(dst.Height) - yDst; 651 651 if (Width < 0) or (Height < 0) then 652 exit;652 Exit; 653 653 654 654 dst.BeginUpdate; … … 659 659 for X := 0 to Width - 1 do begin 660 660 Brightness := PixelSrc.Pixel^.B; // One byte for 8-bit color 661 test := (PixelDst.Pixel^.R * Brightness) shr 7;662 if test >= 256 then661 Test := (PixelDst.Pixel^.R * Brightness) shr 7; 662 if Test >= 256 then 663 663 PixelDst.Pixel^.R := 255 664 664 else 665 PixelDst.Pixel^.R := test; // Red666 test := (PixelDst.Pixel^.G * Brightness) shr 7;667 if test >= 256 then665 PixelDst.Pixel^.R := Test; // Red 666 Test := (PixelDst.Pixel^.G * Brightness) shr 7; 667 if Test >= 256 then 668 668 PixelDst.Pixel^.G := 255 669 669 else 670 PixelDst.Pixel^.G := test; // Green671 test := (PixelDst.Pixel^.B * Brightness) shr 7;672 if test >= 256 then670 PixelDst.Pixel^.G := Test; // Green 671 Test := (PixelDst.Pixel^.B * Brightness) shr 7; 672 if Test >= 256 then 673 673 PixelDst.Pixel^.R := 255 674 674 else … … 716 716 Height := ScaleToNative(dst.Height) - yDst; 717 717 if (Width < 0) or (Height < 0) then 718 exit;718 Exit; 719 719 720 720 Src.BeginUpdate; … … 765 765 // R channel = Color2 amp 766 766 var 767 ix, iy, amp0, amp1, trans, Value: integer;767 ix, iy, amp0, amp1, trans, Value: Integer; 768 768 SrcPixel: TPixelPointer; 769 769 DstPixel: TPixelPointer; … … 807 807 end; 808 808 809 procedure ImageOp_CCC(bmp: TBitmap; x, y, Width, Height, Color0, Color1, Color2: Integer);809 procedure ImageOp_CCC(bmp: TBitmap; X, Y, Width, Height, Color0, Color1, Color2: Integer); 810 810 // Bmp is template 811 811 // B channel = Color0 amp, 128=original brightness … … 813 813 // R channel = Color2 amp, 128=original brightness 814 814 var 815 i, Red, Green: Integer;815 I, Red, Green: Integer; 816 816 PixelPtr: TPixelPointer; 817 817 begin … … 821 821 Height := ScaleToNative(Height); 822 822 bmp.BeginUpdate; 823 assert(bmp.PixelFormat = pf24bit);824 Height := y+ Height;825 PixelPtr := PixelPointer(Bmp, x, y);826 while y< Height do begin827 for i:= 0 to Width - 1 do begin823 Assert(bmp.PixelFormat = pf24bit); 824 Height := Y + Height; 825 PixelPtr := PixelPointer(Bmp, X, Y); 826 while Y < Height do begin 827 for I := 0 to Width - 1 do begin 828 828 Red := ((PixelPtr.Pixel^.B * (Color0 and $0000FF) + PixelPtr.Pixel^.G * 829 829 (Color1 and $0000FF) + PixelPtr.Pixel^.R * (Color2 and $0000FF)) shr 8) and $ff; … … 838 838 PixelPtr.NextPixel; 839 839 end; 840 Inc( y);840 Inc(Y); 841 841 PixelPtr.NextLine; 842 842 end; … … 844 844 end; 845 845 846 procedure Sprite(Canvas: TCanvas; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: integer);846 procedure Sprite(Canvas: TCanvas; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer); 847 847 begin 848 848 BitBltCanvas(Canvas, xDst, yDst, Width, Height, … … 852 852 end; 853 853 854 procedure Sprite(dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: integer);854 procedure Sprite(dst: TBitmap; HGr: TGraphicSet; xDst, yDst, Width, Height, xGr, yGr: Integer); 855 855 begin 856 856 BitBltCanvas(dst.Canvas, xDst, yDst, Width, Height, … … 890 890 end; 891 891 892 procedure SLine(ca: TCanvas; x0, x1, y: integer; cl: TColor);892 procedure SLine(ca: TCanvas; x0, x1, Y: Integer; cl: TColor); 893 893 begin 894 894 with ca do begin 895 895 Pen.Color := cl; 896 MoveTo(x0, y);897 LineTo(x1 + 1, y);898 end; 899 end; 900 901 procedure DLine(ca: TCanvas; x0, x1, y: integer; cl0, cl1: TColor);896 MoveTo(x0, Y); 897 LineTo(x1 + 1, Y); 898 end; 899 end; 900 901 procedure DLine(ca: TCanvas; x0, x1, Y: Integer; cl0, cl1: TColor); 902 902 begin 903 903 with ca do begin 904 904 Pen.Color := cl0; 905 MoveTo(x0, y);906 LineTo(x1, y);905 MoveTo(x0, Y); 906 LineTo(x1, Y); 907 907 Pen.Color := cl1; 908 MoveTo(x0 + 1, y+ 1);909 LineTo(x1 + 1, y+ 1);910 Pixels[x0, y+ 1] := cl0;911 Pixels[x1, y] := cl1;912 end; 913 end; 914 915 procedure Frame(ca: TCanvas; x0, y0, x1, y1: integer; cl0, cl1: TColor);908 MoveTo(x0 + 1, Y + 1); 909 LineTo(x1 + 1, Y + 1); 910 Pixels[x0, Y + 1] := cl0; 911 Pixels[x1, Y] := cl1; 912 end; 913 end; 914 915 procedure Frame(ca: TCanvas; x0, y0, x1, y1: Integer; cl0, cl1: TColor); 916 916 begin 917 917 with ca do begin … … 926 926 end; 927 927 928 procedure RFrame(ca: TCanvas; x0, y0, x1, y1: integer; cl0, cl1: TColor);928 procedure RFrame(ca: TCanvas; x0, y0, x1, y1: Integer; cl0, cl1: TColor); 929 929 begin 930 930 with ca do begin … … 942 942 end; 943 943 944 procedure CFrame(ca: TCanvas; x0, y0, x1, y1, Corner: integer; cl: TColor);944 procedure CFrame(ca: TCanvas; x0, y0, x1, y1, Corner: Integer; cl: TColor); 945 945 begin 946 946 with ca do begin … … 962 962 963 963 procedure FrameImage(ca: TCanvas; Src: TBitmap; 964 x, y, Width, Height, xSrc, ySrc: integer; IsControl: boolean = False);964 X, Y, Width, Height, xSrc, ySrc: Integer; IsControl: Boolean = False); 965 965 begin 966 966 if IsControl then begin 967 Frame(ca, x - 1, y - 1, x + Width, y+ Height, $B0B0B0, $FFFFFF);968 RFrame(ca, x - 2, y - 2, x + Width + 1, y+ Height + 1, $FFFFFF, $B0B0B0);967 Frame(ca, X - 1, Y - 1, X + Width, Y + Height, $B0B0B0, $FFFFFF); 968 RFrame(ca, X - 2, Y - 2, X + Width + 1, Y + Height + 1, $FFFFFF, $B0B0B0); 969 969 end else 970 Frame(ca, x - 1, y - 1, x + Width, y+ Height, $000000, $000000);971 BitBltCanvas(ca, x, y, Width, Height, Src.Canvas, xSrc, ySrc);970 Frame(ca, X - 1, Y - 1, X + Width, Y + Height, $000000, $000000); 971 BitBltCanvas(ca, X, Y, Width, Height, Src.Canvas, xSrc, ySrc); 972 972 end; 973 973 974 974 procedure GlowFrame(Dst: TBitmap; x0, y0, Width, Height: Integer; cl: TColor); 975 975 var 976 x, y, ch, r: Integer;976 X, Y, ch, R: Integer; 977 977 DstPtr: TPixelPointer; 978 978 DpiGlowRange: Integer; … … 985 985 Dst.BeginUpdate; 986 986 DstPtr := PixelPointer(Dst, x0 - DpiGlowRange + 1, y0 - DpiGlowRange + 1); 987 for y:= -DpiGlowRange + 1 to Height - 1 + DpiGlowRange - 1 do begin988 for x:= -DpiGlowRange + 1 to Width - 1 + DpiGlowRange - 1 do begin989 if x< 0 then990 if y< 0 then991 r := round(sqrt(sqr(x) + sqr(y)))992 else if y>= Height then993 r := round(sqrt(sqr(x) + sqr(y- (Height - 1))))987 for Y := -DpiGlowRange + 1 to Height - 1 + DpiGlowRange - 1 do begin 988 for X := -DpiGlowRange + 1 to Width - 1 + DpiGlowRange - 1 do begin 989 if X < 0 then 990 if Y < 0 then 991 R := round(sqrt(sqr(X) + sqr(Y))) 992 else if Y >= Height then 993 R := round(sqrt(sqr(X) + sqr(Y - (Height - 1)))) 994 994 else 995 r := -x996 else if x>= Width then997 if y< 0 then998 r := round(sqrt(sqr(x - (Width - 1)) + sqr(y)))999 else if y>= Height then1000 r := round(sqrt(sqr(x - (Width - 1)) + sqr(y- (Height - 1))))995 R := -X 996 else if X >= Width then 997 if Y < 0 then 998 R := round(sqrt(sqr(X - (Width - 1)) + sqr(Y))) 999 else if Y >= Height then 1000 R := round(sqrt(sqr(X - (Width - 1)) + sqr(Y - (Height - 1)))) 1001 1001 else 1002 r := x- (Width - 1)1003 else if y< 0 then1004 r := -y1005 else if y>= Height then1006 r := y- (Height - 1)1002 R := X - (Width - 1) 1003 else if Y < 0 then 1004 R := -Y 1005 else if Y >= Height then 1006 R := Y - (Height - 1) 1007 1007 else begin 1008 1008 DstPtr.NextPixel; 1009 1009 continue; 1010 1010 end; 1011 if r= 0 then1012 r:= 1;1013 if r< DpiGlowRange then1011 if R = 0 then 1012 R := 1; 1013 if R < DpiGlowRange then 1014 1014 for ch := 0 to 2 do 1015 1015 DstPtr.Pixel^.Planes[2 - ch] := 1016 (DstPtr.Pixel^.Planes[2 - ch] * ( r- 1) + (cl shr (8 * ch) and $FF) *1017 (DpiGlowRange - r)) div (DpiGlowRange - 1);1016 (DstPtr.Pixel^.Planes[2 - ch] * (R - 1) + (cl shr (8 * ch) and $FF) * 1017 (DpiGlowRange - R)) div (DpiGlowRange - 1); 1018 1018 DstPtr.NextPixel; 1019 1019 end; … … 1065 1065 procedure InitCityMark(T: TTexture); 1066 1066 var 1067 x: Integer;1068 y: Integer;1067 X: Integer; 1068 Y: Integer; 1069 1069 Intensity: Integer; 1070 1070 begin 1071 for x:= 0 to CityMark1.Width - 1 do begin1072 for y:= 0 to CityMark1.Height - 1 do begin1073 if HGrSystem.Mask.Canvas.Pixels[CityMark1.Left + x, CityMark1.Top + y] = 0 then1071 for X := 0 to CityMark1.Width - 1 do begin 1072 for Y := 0 to CityMark1.Height - 1 do begin 1073 if HGrSystem.Mask.Canvas.Pixels[CityMark1.Left + X, CityMark1.Top + Y] = 0 then 1074 1074 begin 1075 1075 Intensity := HGrSystem.Data.Canvas.Pixels[CityMark1.Left + 1076 x, CityMark1.Top + y] and $FF;1077 HGrSystem.Data.Canvas.Pixels[CityMark2.Left + x, CityMark2.Top + y] :=1076 X, CityMark1.Top + Y] and $FF; 1077 HGrSystem.Data.Canvas.Pixels[CityMark2.Left + X, CityMark2.Top + Y] := 1078 1078 T.ColorMark and $FF * Intensity div $FF + T.ColorMark shr 8 and 1079 1079 $FF * Intensity div $FF shl 8 + T.ColorMark shr 16 and … … 1103 1103 function Band(I: Integer): Integer; 1104 1104 var 1105 n: integer;1105 N: Integer; 1106 1106 begin 1107 n:= ((MainTexture.Height div 2) div (y1 - y0)) * 2;1107 N := ((MainTexture.Height div 2) div (y1 - y0)) * 2; 1108 1108 while MainTexture.Height div 2 + (I + 1) * (y1 - y0) > MainTexture.Height do 1109 Dec(I, n);1109 Dec(I, N); 1110 1110 while MainTexture.Height div 2 + I * (y1 - y0) < 0 do 1111 Inc(I, n);1111 Inc(I, N); 1112 1112 Result := I; 1113 1113 end; … … 1137 1137 const Texture: TBitmap); 1138 1138 var 1139 x, y, x0cut, y0cut, x1cut, y1cut: Integer;1139 X, Y, x0cut, y0cut, x1cut, y1cut: Integer; 1140 1140 begin 1141 1141 while xOffset < 0 do … … 1143 1143 while yOffset < 0 do 1144 1144 Inc(yOffset, Texture.Height); 1145 for y:= (Top + yOffset) div Texture.Height to (Top + yOffset + Height - 1) div1145 for Y := (Top + yOffset) div Texture.Height to (Top + yOffset + Height - 1) div 1146 1146 Texture.Height do 1147 1147 begin 1148 y0cut := Top + yOffset - y* Texture.Height;1148 y0cut := Top + yOffset - Y * Texture.Height; 1149 1149 if y0cut < 0 then 1150 1150 y0cut := 0; 1151 y1cut := ( y+ 1) * Texture.Height - (Top + yOffset + Height);1151 y1cut := (Y + 1) * Texture.Height - (Top + yOffset + Height); 1152 1152 if y1cut < 0 then 1153 1153 y1cut := 0; 1154 for x:= (Left + xOffset) div Texture.Width to (Left + xOffset + Width - 1) div1154 for X := (Left + xOffset) div Texture.Width to (Left + xOffset + Width - 1) div 1155 1155 Texture.Width do 1156 1156 begin 1157 x0cut := Left + xOffset - x* Texture.Width;1157 x0cut := Left + xOffset - X * Texture.Width; 1158 1158 if x0cut < 0 then 1159 1159 x0cut := 0; 1160 x1cut := ( x+ 1) * Texture.Width - (Left + xOffset + Width);1160 x1cut := (X + 1) * Texture.Width - (Left + xOffset + Width); 1161 1161 if x1cut < 0 then 1162 1162 x1cut := 0; 1163 BitBltCanvas(ca, x* Texture.Width + x0cut - xOffset,1164 y* Texture.Height + y0cut - yOffset, Texture.Width - x0cut - x1cut,1163 BitBltCanvas(ca, X * Texture.Width + x0cut - xOffset, 1164 Y * Texture.Height + y0cut - yOffset, Texture.Width - x0cut - x1cut, 1165 1165 Texture.Height - y0cut - y1cut, Texture.Canvas, x0cut, y0cut); 1166 1166 end; … … 1180 1180 end; 1181 1181 1182 procedure Corner(ca: TCanvas; x, y, Kind: Integer; T: TTexture);1182 procedure Corner(ca: TCanvas; X, Y, Kind: Integer; T: TTexture); 1183 1183 begin 1184 1184 { BitBltCanvas(ca,x,y,8,8,T.HGr.Mask.Canvas, 1185 1185 T.xGr+29+Kind*9,T.yGr+89,SRCAND); 1186 BitBltCanvas(ca, x,y,8,8,T.HGr.Data.Canvas,1186 BitBltCanvas(ca,X,Y,8,8,T.HGr.Data.Canvas, 1187 1187 T.xGr+29+Kind*9,T.yGr+89,SRCPAINT); } 1188 1188 end; 1189 1189 1190 procedure BiColorTextOut(ca: TCanvas; clMain, clBack: TColor; x, y: Integer; s: string);1191 1192 procedure PaintIcon( x, y, Kind: Integer);1190 procedure BiColorTextOut(ca: TCanvas; clMain, clBack: TColor; X, Y: Integer; S: string); 1191 1192 procedure PaintIcon(X, Y, Kind: Integer); 1193 1193 begin 1194 BitBltCanvas(ca, x, y+ 6, 10, 10, HGrSystem.Mask.Canvas,1194 BitBltCanvas(ca, X, Y + 6, 10, 10, HGrSystem.Mask.Canvas, 1195 1195 66 + Kind mod 11 * 11, 115 + Kind div 11 * 11, SRCAND); 1196 BitBltCanvas(ca, x, y+ 6, 10, 10, HGrSystem.Data.Canvas,1196 BitBltCanvas(ca, X, Y + 6, 10, 10, HGrSystem.Data.Canvas, 1197 1197 66 + Kind mod 11 * 11, 115 + Kind div 11 * 11, SRCPAINT); 1198 1198 end; 1199 1199 1200 1200 var 1201 p, xp: Integer;1201 P, xp: Integer; 1202 1202 sp: string; 1203 1203 shadow: Boolean; 1204 1204 Text: string; 1205 1205 begin 1206 Inc( x);1207 Inc( y);1206 Inc(X); 1207 Inc(Y); 1208 1208 for shadow := True downto False do 1209 1209 with ca do … … 1214 1214 else 1215 1215 Font.Color := clMain; 1216 sp := s;1217 xp := x;1216 sp := S; 1217 xp := X; 1218 1218 repeat 1219 p := pos('%', sp);1220 if ( p = 0) or (p+ 1 > Length(sp)) or not1221 (sp[ p+ 1] in ['c', 'f', 'l', 'm', 'n', 'o', 'p', 'r', 't', 'w']) then1219 P := Pos('%', sp); 1220 if (P = 0) or (P + 1 > Length(sp)) or not 1221 (sp[P + 1] in ['c', 'f', 'l', 'm', 'n', 'o', 'p', 'r', 't', 'w']) then 1222 1222 begin 1223 ca.Textout(xp, y, sp);1223 ca.Textout(xp, Y, sp); 1224 1224 Break; 1225 1225 end 1226 1226 else 1227 1227 begin 1228 Text := Copy(sp, 1, p- 1);1229 Textout(xp, y, Text);1228 Text := Copy(sp, 1, P - 1); 1229 Textout(xp, Y, Text); 1230 1230 Inc(xp, ca.TextWidth(Text)); 1231 1231 if not shadow then 1232 case sp[ p+ 1] of1233 'c': PaintIcon(xp + 1, y, 6);1234 'f': PaintIcon(xp + 1, y, 0);1235 'l': PaintIcon(xp + 1, y, 8);1236 'm': PaintIcon(xp + 1, y, 17);1237 'n': PaintIcon(xp + 1, y, 7);1238 'o': PaintIcon(xp + 1, y, 16);1239 'p': PaintIcon(xp + 1, y, 2);1240 'r': PaintIcon(xp + 1, y, 12);1241 't': PaintIcon(xp + 1, y, 4);1242 'w': PaintIcon(xp + 1, y, 13);1232 case sp[P + 1] of 1233 'c': PaintIcon(xp + 1, Y, 6); 1234 'f': PaintIcon(xp + 1, Y, 0); 1235 'l': PaintIcon(xp + 1, Y, 8); 1236 'm': PaintIcon(xp + 1, Y, 17); 1237 'n': PaintIcon(xp + 1, Y, 7); 1238 'o': PaintIcon(xp + 1, Y, 16); 1239 'p': PaintIcon(xp + 1, Y, 2); 1240 'r': PaintIcon(xp + 1, Y, 12); 1241 't': PaintIcon(xp + 1, Y, 4); 1242 'w': PaintIcon(xp + 1, Y, 13); 1243 1243 end; 1244 1244 Inc(xp, 10); 1245 Delete(sp, 1, p+ 1);1245 Delete(sp, 1, P + 1); 1246 1246 end; 1247 1247 until False; 1248 Dec( x);1249 Dec( y);1248 Dec(X); 1249 Dec(Y); 1250 1250 end; 1251 1251 end; 1252 1252 1253 function BiColorTextWidth(ca: TCanvas; s: string): Integer;1253 function BiColorTextWidth(ca: TCanvas; S: string): Integer; 1254 1254 var 1255 1255 P: Integer; … … 1257 1257 Result := 1; 1258 1258 repeat 1259 P := Pos('%', s);1260 if (P = 0) or (P = Length( s)) then1259 P := Pos('%', S); 1260 if (P = 0) or (P = Length(S)) then 1261 1261 begin 1262 Inc(Result, ca.TextWidth( s));1262 Inc(Result, ca.TextWidth(S)); 1263 1263 Break; 1264 1264 end 1265 1265 else 1266 1266 begin 1267 if not ( s[P + 1] in ['c', 'f', 'l', 'm', 'n', 'o', 'p', 'r', 't', 'w'])1267 if not (S[P + 1] in ['c', 'f', 'l', 'm', 'n', 'o', 'p', 'r', 't', 'w']) 1268 1268 then 1269 Inc(Result, ca.TextWidth( copy(s, 1, P + 1)))1269 Inc(Result, ca.TextWidth(Copy(S, 1, P + 1))) 1270 1270 else 1271 Inc(Result, ca.TextWidth( copy(s, 1, P - 1)) + 10);1272 Delete( s, 1, P + 1);1271 Inc(Result, ca.TextWidth(Copy(S, 1, P - 1)) + 10); 1272 Delete(S, 1, P + 1); 1273 1273 end; 1274 1274 until False; … … 1276 1276 1277 1277 procedure LoweredTextOut(ca: TCanvas; cl: TColor; T: TTexture; 1278 x, y: Integer; s: string);1278 X, Y: Integer; S: string); 1279 1279 begin 1280 1280 if cl = -2 then 1281 1281 BiColorTextOut(ca, (T.ColorBevelShade and $FEFEFE) shr 1, 1282 T.ColorBevelLight, x, y, s)1282 T.ColorBevelLight, X, Y, S) 1283 1283 else if cl < 0 then 1284 BiColorTextOut(ca, T.ColorTextShade, T.ColorTextLight, x, y, s)1284 BiColorTextOut(ca, T.ColorTextShade, T.ColorTextLight, X, Y, S) 1285 1285 else 1286 BiColorTextOut(ca, cl, T.ColorTextLight, x, y, s);1287 end; 1288 1289 procedure RisedTextOut(ca: TCanvas; x, y: integer; s: string);1290 begin 1291 BiColorTextOut(ca, $FFFFFF, $000000, x, y, s);1292 end; 1293 1294 procedure Gradient(ca: TCanvas; x, y, dx, dy, Width, Height, Color: Integer;1295 Brightness: array of integer);1296 var 1297 i, r, g, b: Integer;1298 begin 1299 for i:= 0 to Length(Brightness) - 1 do begin // gradient1300 r := Color and $FF + Brightness[i];1301 if r< 0 then1302 r:= 01303 else if r>= 256 then1304 r:= 255;1305 g := Color shr 8 and $FF + Brightness[i];1306 if g< 0 then1307 g:= 01308 else if g>= 256 then1309 g:= 255;1310 b := Color shr 16 and $FF + Brightness[i];1311 if b< 0 then1312 b:= 01313 else if b>= 256 then1314 b:= 255;1315 ca.Pen.Color := r + g shl 8 + bshl 16;1316 ca.MoveTo( x + dx * i, y + dy * i);1317 ca.LineTo( x + dx * i + Width, y + dy * i+ Height);1286 BiColorTextOut(ca, cl, T.ColorTextLight, X, Y, S); 1287 end; 1288 1289 procedure RisedTextOut(ca: TCanvas; X, Y: Integer; S: string); 1290 begin 1291 BiColorTextOut(ca, $FFFFFF, $000000, X, Y, S); 1292 end; 1293 1294 procedure Gradient(ca: TCanvas; X, Y, dx, dy, Width, Height, Color: Integer; 1295 Brightness: array of Integer); 1296 var 1297 I, R, G, B: Integer; 1298 begin 1299 for I := 0 to Length(Brightness) - 1 do begin // gradient 1300 R := Color and $FF + Brightness[I]; 1301 if R < 0 then 1302 R := 0 1303 else if R >= 256 then 1304 R := 255; 1305 G := Color shr 8 and $FF + Brightness[I]; 1306 if G < 0 then 1307 G := 0 1308 else if G >= 256 then 1309 G := 255; 1310 B := Color shr 16 and $FF + Brightness[I]; 1311 if B < 0 then 1312 B := 0 1313 else if B >= 256 then 1314 B := 255; 1315 ca.Pen.Color := R + G shl 8 + B shl 16; 1316 ca.MoveTo(X + dx * I, Y + dy * I); 1317 ca.LineTo(X + dx * I + Width, Y + dy * I + Height); 1318 1318 end; 1319 1319 ca.Pen.Color := $000000; 1320 ca.MoveTo( x + 1, y+ 16 * dy + Height);1321 ca.LineTo( x + 16 * dx + Width, y+ 16 * dy + Height);1322 ca.LineTo( x + 16 * dx + Width, y);1323 end; 1324 1325 procedure LightGradient(ca: TCanvas; x, y, Width, Color: Integer);1320 ca.MoveTo(X + 1, Y + 16 * dy + Height); 1321 ca.LineTo(X + 16 * dx + Width, Y + 16 * dy + Height); 1322 ca.LineTo(X + 16 * dx + Width, Y); 1323 end; 1324 1325 procedure LightGradient(ca: TCanvas; X, Y, Width, Color: Integer); 1326 1326 const 1327 Brightness: array [0 .. 15] of integer =1327 Brightness: array [0 .. 15] of Integer = 1328 1328 (16, 12, 8, 4, 0, -4, -8, -12, -16, -20, -24, -28, -32, -36, -40, -44); 1329 1329 begin 1330 Gradient(ca, x, y, 0, 1, Width, 0, Color, Brightness);1331 end; 1332 1333 procedure DarkGradient(ca: TCanvas; x, y, Width, Kind: Integer);1330 Gradient(ca, X, Y, 0, 1, Width, 0, Color, Brightness); 1331 end; 1332 1333 procedure DarkGradient(ca: TCanvas; X, Y, Width, Kind: Integer); 1334 1334 const 1335 Brightness: array [0 .. 15] of integer =1335 Brightness: array [0 .. 15] of Integer = 1336 1336 (16, 12, 8, 4, 0, -4, -8, -12 - 24, -16 + 16, -20, -24, -28, -32, -36, -40, -44); 1337 1337 begin 1338 Gradient(ca, x, y, 0, 1, Width, 0, HGrSystem.Data.Canvas.Pixels1338 Gradient(ca, X, Y, 0, 1, Width, 0, HGrSystem.Data.Canvas.Pixels 1339 1339 [187, 137 + Kind], Brightness); 1340 1340 end; 1341 1341 1342 procedure VLightGradient(ca: TCanvas; x, y, Height, Color: Integer);1342 procedure VLightGradient(ca: TCanvas; X, Y, Height, Color: Integer); 1343 1343 const 1344 Brightness: array [0 .. 15] of integer =1344 Brightness: array [0 .. 15] of Integer = 1345 1345 (16, 12, 8, 4, 0, -4, -8, -12, -16, -20, -24, -28, -32, -36, -40, -44); 1346 1346 begin 1347 Gradient(ca, x, y, 1, 0, 0, Height, Color, Brightness);1348 end; 1349 1350 procedure VDarkGradient(ca: TCanvas; x, y, Height, Kind: Integer);1347 Gradient(ca, X, Y, 1, 0, 0, Height, Color, Brightness); 1348 end; 1349 1350 procedure VDarkGradient(ca: TCanvas; X, Y, Height, Kind: Integer); 1351 1351 const 1352 Brightness: array [0 .. 15] of integer =1352 Brightness: array [0 .. 15] of Integer = 1353 1353 (16, 12, 8, 4, 0, -4, -8, -12 - 24, -16 + 16, -20, -24, -28, -32, -36, -40, -44); 1354 1354 begin 1355 Gradient(ca, x, y, 1, 0, 0, Height,1355 Gradient(ca, X, Y, 1, 0, 0, Height, 1356 1356 HGrSystem.Data.Canvas.Pixels[187, 137 + Kind], Brightness); 1357 1357 end; … … 1364 1364 end; 1365 1365 1366 procedure NumberBar(dst: TBitmap; x, y: integer; Cap: string;1366 procedure NumberBar(dst: TBitmap; X, Y: Integer; Cap: string; 1367 1367 val: Integer; T: TTexture); 1368 1368 var 1369 s: string;1369 S: string; 1370 1370 begin 1371 1371 if val > 0 then 1372 1372 begin 1373 DLine(dst.Canvas, x - 2, x + 170, y+ 16, T.ColorBevelShade,1373 DLine(dst.Canvas, X - 2, X + 170, Y + 16, T.ColorBevelShade, 1374 1374 T.ColorBevelLight); 1375 LoweredTextOut(dst.Canvas, -1, T, x - 2, y, Cap);1376 s:= IntToStr(val);1377 RisedTextOut(dst.Canvas, x+ 170 - BiColorTextWidth(dst.Canvas,1378 s), y, s);1379 end; 1380 end; 1381 1382 procedure CountBar(dst: TBitmap; x, y, w: Integer; Kind: Integer;1375 LoweredTextOut(dst.Canvas, -1, T, X - 2, Y, Cap); 1376 S := IntToStr(val); 1377 RisedTextOut(dst.Canvas, X + 170 - BiColorTextWidth(dst.Canvas, 1378 S), Y, S); 1379 end; 1380 end; 1381 1382 procedure CountBar(dst: TBitmap; X, Y, W: Integer; Kind: Integer; 1383 1383 Cap: string; val: Integer; T: TTexture); 1384 1384 var 1385 i, sd, ld, cl, xIcon, yIcon: Integer;1386 s: string;1385 I, sd, ld, cl, xIcon, yIcon: Integer; 1386 S: string; 1387 1387 begin 1388 1388 // val:=random(40); //!!! … … 1396 1396 // DLine(dst.Canvas,x-2,x+170+32,y+16,T.ColorBevelShade,T.ColorBevelLight); 1397 1397 1398 xIcon := x- 5;1399 yIcon := y+ 15;1400 DLine(dst.Canvas, x - 2, xIcon + w+ 2, yIcon + 16, T.ColorBevelShade,1398 xIcon := X - 5; 1399 yIcon := Y + 15; 1400 DLine(dst.Canvas, X - 2, xIcon + W + 2, yIcon + 16, T.ColorBevelShade, 1401 1401 T.ColorBevelLight); 1402 1402 1403 s:= IntToStr(val);1403 S := IntToStr(val); 1404 1404 if val < 0 then 1405 1405 cl := $0000FF 1406 1406 else 1407 1407 cl := -1; 1408 LoweredTextOut(dst.Canvas, cl, T, x - 2, y, Cap);1408 LoweredTextOut(dst.Canvas, cl, T, X - 2, Y, Cap); 1409 1409 LoweredTextOut(dst.Canvas, cl, T, 1410 xIcon + w + 2 - BiColorTextWidth(dst.Canvas, s), yIcon, s);1410 xIcon + W + 2 - BiColorTextWidth(dst.Canvas, S), yIcon, S); 1411 1411 1412 1412 if (Kind = 12) and (val >= 100) then … … 1416 1416 if sd = 0 then 1417 1417 sd := 1; 1418 if sd < w- 44 then1418 if sd < W - 44 then 1419 1419 ld := sd 1420 1420 else 1421 ld := w- 44;1422 for i:= 0 to val mod 10 - 1 do1421 ld := W - 44; 1422 for I := 0 to val mod 10 - 1 do 1423 1423 begin 1424 BitBltCanvas(dst.Canvas, xIcon + 4 + i* (14 * ld div sd), yIcon + 2 + 1, 14,1424 BitBltCanvas(dst.Canvas, xIcon + 4 + I * (14 * ld div sd), yIcon + 2 + 1, 14, 1425 1425 14, HGrSystem.Mask.Canvas, 67 + Kind mod 8 * 15, 1426 1426 70 + Kind div 8 * 15, SRCAND); 1427 Sprite(dst, HGrSystem, xIcon + 3 + i* (14 * ld div sd), yIcon + 2,1427 Sprite(dst, HGrSystem, xIcon + 3 + I * (14 * ld div sd), yIcon + 2, 1428 1428 14, 14, 67 + Kind mod 8 * 15, 70 + Kind div 8 * 15); 1429 1429 end; 1430 for i:= 0 to val div 10 - 1 do1430 for I := 0 to val div 10 - 1 do 1431 1431 begin 1432 1432 BitBltCanvas(dst.Canvas, xIcon + 4 + (val mod 10) * 1433 (14 * ld div sd) + i* (14 * ld div sd), yIcon + 3, 14, 14,1433 (14 * ld div sd) + I * (14 * ld div sd), yIcon + 3, 14, 14, 1434 1434 HGrSystem.Mask.Canvas, 67 + 7 mod 8 * 15, 1435 1435 70 + 7 div 8 * 15, SRCAND); 1436 1436 Sprite(dst, HGrSystem, xIcon + 3 + (val mod 10) * 1437 (14 * ld div sd) + i* (14 * ld div sd), yIcon + 2, 14,1437 (14 * ld div sd) + I * (14 * ld div sd), yIcon + 2, 14, 1438 1438 14, 67 + 7 mod 8 * 15, 1439 1439 70 + 7 div 8 * 15); … … 1449 1449 if sd = 0 then 1450 1450 sd := 1; 1451 if sd < w- 44 then1451 if sd < W - 44 then 1452 1452 ld := sd 1453 1453 else 1454 ld := w- 44;1455 for i:= 0 to val div 10 - 1 do1454 ld := W - 44; 1455 for I := 0 to val div 10 - 1 do 1456 1456 begin 1457 BitBltCanvas(dst.Canvas, xIcon + 4 + i* (14 * ld div sd), yIcon + 3, 14, 14,1457 BitBltCanvas(dst.Canvas, xIcon + 4 + I * (14 * ld div sd), yIcon + 3, 14, 14, 1458 1458 HGrSystem.Mask.Canvas, 67 + Kind mod 8 * 15, 1459 1459 70 + Kind div 8 * 15, SRCAND); 1460 Sprite(dst, HGrSystem, xIcon + 3 + i* (14 * ld div sd), yIcon + 2,1460 Sprite(dst, HGrSystem, xIcon + 3 + I * (14 * ld div sd), yIcon + 2, 1461 1461 14, 14, 67 + Kind mod 8 * 15, 70 + Kind div 8 * 15); 1462 1462 end; 1463 for i:= 0 to val mod 10 - 1 do1463 for I := 0 to val mod 10 - 1 do 1464 1464 begin 1465 1465 BitBltCanvas(dst.Canvas, xIcon + 4 + (val div 10) * 1466 (14 * ld div sd) + i* (10 * ld div sd), yIcon + 7, 10, 10,1466 (14 * ld div sd) + I * (10 * ld div sd), yIcon + 7, 10, 10, 1467 1467 HGrSystem.Mask.Canvas, 66 + Kind mod 11 * 11, 1468 1468 115 + Kind div 11 * 11, SRCAND); 1469 1469 Sprite(dst, HGrSystem, xIcon + 3 + (val div 10) * 1470 (14 * ld div sd) + i* (10 * ld div sd), yIcon + 6, 10,1470 (14 * ld div sd) + I * (10 * ld div sd), yIcon + 6, 10, 1471 1471 10, 66 + Kind mod 11 * 11, 1472 1472 115 + Kind div 11 * 11); … … 1476 1476 end; 1477 1477 1478 procedure PaintProgressBar(ca: TCanvas; Kind, x, y, pos, Growth, max: Integer;1478 procedure PaintProgressBar(ca: TCanvas; Kind, X, Y, Pos, Growth, Max: Integer; 1479 1479 T: TTexture); 1480 1480 var 1481 i: Integer;1482 begin 1483 if pos > max then1484 pos := max;1481 I: Integer; 1482 begin 1483 if Pos > Max then 1484 Pos := Max; 1485 1485 if Growth < 0 then 1486 1486 begin 1487 pos := pos + Growth;1488 if pos < 0 then1487 Pos := Pos + Growth; 1488 if Pos < 0 then 1489 1489 begin 1490 Growth := Growth - pos;1491 pos := 0;1490 Growth := Growth - Pos; 1491 Pos := 0; 1492 1492 end; 1493 1493 end 1494 else if pos + Growth > max then1495 Growth := max - pos;1496 Frame(ca, x - 1, y - 1, x + max, y+ 7, $000000, $000000);1497 RFrame(ca, x - 2, y - 2, x + max + 1, y+ 8, T.ColorBevelShade,1494 else if Pos + Growth > Max then 1495 Growth := Max - Pos; 1496 Frame(ca, X - 1, Y - 1, X + Max, Y + 7, $000000, $000000); 1497 RFrame(ca, X - 2, Y - 2, X + Max + 1, Y + 8, T.ColorBevelShade, 1498 1498 T.ColorBevelLight); 1499 1499 with ca do 1500 1500 begin 1501 for i := 0 to pos div 8 - 1 do1502 BitBltCanvas(ca, x + i * 8, y, 8, 7,1501 for I := 0 to Pos div 8 - 1 do 1502 BitBltCanvas(ca, X + I * 8, Y, 8, 7, 1503 1503 HGrSystem.Data.Canvas, 104, 9 + 8 * Kind); 1504 BitBltCanvas(ca, x + 8 * (pos div 8), y, pos - 8 * (pos div 8), 7,1504 BitBltCanvas(ca, X + 8 * (Pos div 8), Y, Pos - 8 * (Pos div 8), 7, 1505 1505 HGrSystem.Data.Canvas, 104, 9 + 8 * Kind); 1506 1506 if Growth > 0 then 1507 1507 begin 1508 for i:= 0 to Growth div 8 - 1 do1509 BitBltCanvas(ca, x + pos + i * 8, y, 8, 7,1508 for I := 0 to Growth div 8 - 1 do 1509 BitBltCanvas(ca, X + Pos + I * 8, Y, 8, 7, 1510 1510 HGrSystem.Data.Canvas, 112, 9 + 8 * Kind); 1511 BitBltCanvas(ca, x + pos + 8 * (Growth div 8), y,1511 BitBltCanvas(ca, X + Pos + 8 * (Growth div 8), Y, 1512 1512 Growth - 8 * (Growth div 8), 7, HGrSystem.Data.Canvas, 1513 1513 112, 9 + 8 * Kind); … … 1515 1515 else if Growth < 0 then 1516 1516 begin 1517 for i:= 0 to -Growth div 8 - 1 do1518 BitBltCanvas(ca, x + pos + i * 8, y, 8, 7,1517 for I := 0 to -Growth div 8 - 1 do 1518 BitBltCanvas(ca, X + Pos + I * 8, Y, 8, 7, 1519 1519 HGrSystem.Data.Canvas, 104, 1); 1520 BitBltCanvas(ca, x + pos + 8 * (-Growth div 8), y, -Growth -1520 BitBltCanvas(ca, X + Pos + 8 * (-Growth div 8), Y, -Growth - 1521 1521 8 * (-Growth div 8), 7, 1522 1522 HGrSystem.Data.Canvas, 104, 1); 1523 1523 end; 1524 1524 Brush.Color := $000000; 1525 FillRect(Rect( x + pos + abs(Growth), y, x + max, y+ 7));1525 FillRect(Rect(X + Pos + abs(Growth), Y, X + Max, Y + 7)); 1526 1526 Brush.Style := bsClear; 1527 1527 end; … … 1530 1530 // pos and growth are relative to max, set size independent 1531 1531 procedure PaintRelativeProgressBar(ca: TCanvas; 1532 Kind, x, y, size, pos, Growth, max: Integer; IndicateComplete: Boolean;1532 Kind, X, Y, size, Pos, Growth, Max: Integer; IndicateComplete: Boolean; 1533 1533 T: TTexture); 1534 1534 begin 1535 1535 if Growth > 0 then 1536 PaintProgressBar(ca, Kind, x, y, pos * size div max,1537 (Growth * size + max div 2) div max, size, T)1536 PaintProgressBar(ca, Kind, X, Y, Pos * size div Max, 1537 (Growth * size + Max div 2) div Max, size, T) 1538 1538 else 1539 PaintProgressBar(ca, Kind, x, y, pos * size div max,1540 (Growth * size - max div 2) div max, size, T);1541 if IndicateComplete and ( pos + Growth >= max) then1542 Sprite(ca, HGrSystem, x + size - 10, y- 7, 23, 16, 1, 129);1539 PaintProgressBar(ca, Kind, X, Y, Pos * size div Max, 1540 (Growth * size - Max div 2) div Max, size, T); 1541 if IndicateComplete and (Pos + Growth >= Max) then 1542 Sprite(ca, HGrSystem, X + size - 10, Y - 7, 23, 16, 1, 129); 1543 1543 end; 1544 1544 … … 1610 1610 procedure DarkenImage(Bitmap: TBitmap; Change: Integer); 1611 1611 var 1612 x, y: integer;1612 X, Y: Integer; 1613 1613 PicturePixel: TPixelPointer; 1614 1614 begin 1615 1615 Bitmap.BeginUpdate; 1616 1616 PicturePixel := PixelPointer(Bitmap); 1617 for y:= 0 to ScaleToNative(Bitmap.Height) - 1 do begin1618 for x:= 0 to ScaleToNative(Bitmap.Width) - 1 do begin1617 for Y := 0 to ScaleToNative(Bitmap.Height) - 1 do begin 1618 for X := 0 to ScaleToNative(Bitmap.Width) - 1 do begin 1619 1619 PicturePixel.Pixel^.B := Max(PicturePixel.Pixel^.B - Change, 0); 1620 1620 PicturePixel.Pixel^.G := Max(PicturePixel.Pixel^.G - Change, 0); … … 1662 1662 Section: TFontType; 1663 1663 FontScript: TextFile; 1664 Size: integer;1664 Size: Integer; 1665 1665 S: string; 1666 I: integer;1667 P: integer;1666 I: Integer; 1667 P: Integer; 1668 1668 begin 1669 1669 Section := ftNormal; … … 1672 1672 Reset(FontScript); 1673 1673 while not Eof(FontScript) do begin 1674 ReadLn(FontScript, s);1675 if s<> '' then1676 if s[1] = '#' then begin1677 s := TrimRight(s);1678 if s= '#SMALL' then Section := ftSmall1679 else if s= '#TINY' then Section := ftTiny1680 else if s= '#CAPTION' then Section := ftCaption1681 else if s= '#BUTTON' then Section := ftButton1674 ReadLn(FontScript, S); 1675 if S <> '' then 1676 if S[1] = '#' then begin 1677 S := TrimRight(S); 1678 if S = '#SMALL' then Section := ftSmall 1679 else if S = '#TINY' then Section := ftTiny 1680 else if S = '#CAPTION' then Section := ftCaption 1681 else if S = '#BUTTON' then Section := ftButton 1682 1682 else Section := ftNormal; 1683 1683 end else begin 1684 p := Pos(',', s);1685 if p> 0 then begin1686 UniFont[section].Name := Trim(Copy( s, 1, p- 1));1684 P := Pos(',', S); 1685 if P > 0 then begin 1686 UniFont[section].Name := Trim(Copy(S, 1, P - 1)); 1687 1687 Size := 0; 1688 for i := p + 1 to Length(s) do1689 case s[i] of1688 for I := P + 1 to Length(S) do 1689 case S[I] of 1690 1690 '0' .. '9': 1691 Size := Size * 10 + Byte( s[i]) - 48;1691 Size := Size * 10 + Byte(S[I]) - 48; 1692 1692 'B', 'b': 1693 1693 UniFont[section].Style := UniFont[section].Style + [fsBold];
Note:
See TracChangeset
for help on using the changeset viewer.