Changeset 210 for branches/highdpi/LocalPlayer/TechTree.pas
- Timestamp:
- May 9, 2020, 4:02:07 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/LocalPlayer/TechTree.pas
r193 r210 5 5 6 6 uses 7 ScreenTools, Messg, LCLIntf, LCLType, Messages, SysUtils, Classes, Graphics,8 Controls, Forms, ButtonB ase, ButtonB, DrawDlg, UDpiControls;7 UDpiControls, ScreenTools, LCLIntf, LCLType, SysUtils, Classes, Graphics, 8 Controls, Forms, ButtonB, DrawDlg; 9 9 10 10 type … … 30 30 TechTreeDlg: TTechTreeDlg; 31 31 32 32 33 implementation 33 34 … … 77 78 X, w: Integer; 78 79 begin 79 with Canvas do 80 begin 80 with Canvas do begin 81 81 // black border 82 82 brush.color := $000000; … … 107 107 -BlackBorder - yOffset, Paper); 108 108 end; 109 DpiBit Blt(Canvas.Handle, max(BlackBorder, BlackBorder + xOffset),109 DpiBitCanvas(Canvas, max(BlackBorder, BlackBorder + xOffset), 110 110 max(BlackBorder, BlackBorder + yOffset), 111 111 min(Image.width, min(Image.width + xOffset, … … 113 113 ), min(Image.height, min(Image.height + yOffset, 114 114 min(ClientHeight - 2 * BlackBorder, ClientHeight - 2 * BlackBorder - 115 yOffset))), Image.Canvas .Handle, max(0, -xOffset),116 max(0, -yOffset) , SRCCOPY);115 yOffset))), Image.Canvas, max(0, -xOffset), 116 max(0, -yOffset)); 117 117 end; 118 118 119 119 procedure TTechTreeDlg.FormShow(Sender: TObject); 120 120 var 121 X, Y, ad , TexWidth, TexHeight: Integer;121 X, Y, ad: Integer; 122 122 s: string; 123 SrcPixel, DstPixel: TPixelPointer; 124 begin 125 if Image = nil then126 begin123 const 124 TransparentColor = $7F007F; 125 begin 126 if Image = nil then begin 127 127 Image := TDpiBitmap.Create; 128 128 Image.PixelFormat := pf24bit; 129 129 LoadGraphicFile(Image, HomeDir + 'Help' + DirectorySeparator + 'AdvTree.png', gfNoGamma); 130 130 131 with Image.Canvas do 132 begin 131 with Image.Canvas do begin 133 132 // write advance names 134 133 Font.Assign(UniFont[ftSmall]); … … 146 145 TextOut(xStart + X * xPitch + 2, yStart + Y * yPitch, s); 147 146 Pixels[xStart + X * xPitch + 10, yStart + Y * yPitch - 1] 148 := $7F007F;147 := TransparentColor; 149 148 end 150 149 end; … … 161 160 end; 162 161 163 // texturize background 164 Image.BeginUpdate; 165 TexWidth := Paper.Width; 166 TexHeight := Paper.Height; 167 DstPixel.Init(Image); 168 SrcPixel.Init(Paper); 169 for Y := 0 to Image.Height - 1 do begin 170 for X := 0 to Image.Width - 1 do begin 171 if (DstPixel.Pixel^.ARGB and $FFFFFF) = $7F007F then begin // transparent 172 SrcPixel.SetXY(X mod TexWidth, Y mod TexHeight); 173 DstPixel.Pixel^.B := SrcPixel.Pixel^.B; 174 DstPixel.Pixel^.G := SrcPixel.Pixel^.G; 175 DstPixel.Pixel^.R := SrcPixel.Pixel^.R; 176 end; 177 DstPixel.NextPixel; 178 end; 179 DstPixel.NextLine; 180 end; 181 Image.EndUpdate; 162 Texturize(Image, Paper, TransparentColor); 182 163 end; 183 164 … … 204 185 xDown := X; 205 186 yDown := Y; 206 end 187 end; 207 188 end; 208 189 … … 234 215 235 216 SmartInvalidate; 236 end 217 end; 237 218 end; 238 219 … … 246 227 procedure TTechTreeDlg.CloseBtnClick(Sender: TObject); 247 228 begin 248 Close ();229 Close; 249 230 end; 250 231
Note:
See TracChangeset
for help on using the changeset viewer.