Changeset 179 for branches/highdpi/Packages/CevoComponents/ScreenTools.pas
- Timestamp:
- Jun 23, 2019, 9:12:54 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/Packages/CevoComponents/ScreenTools.pas
r178 r179 441 441 end; 442 442 443 procedure ResizeBitmap(Bitmap: TDpiBitmap; const NewWidth, NewHeight: Integer); 444 var 445 Buffer: TDpiBitmap; 446 begin 447 Buffer := TDpiBitmap.Create; 448 try 449 Buffer.SetSize(NewWidth, NewHeight); 450 Buffer.Canvas.StretchDraw(Rect(0, 0, NewWidth, NewHeight), Bitmap); 451 Bitmap.SetSize(NewWidth, NewHeight); 452 Bitmap.Canvas.Draw(0, 0, Buffer); 453 finally 454 Buffer.Free; 455 end; 456 end; 457 443 458 function LoadGraphicFile(bmp: TDpiBitmap; Path: string; Options: Integer): Boolean; 444 459 var … … 453 468 try 454 469 jtex.LoadFromFile(Path); 470 ResizeBitmap(jtex, ScaleToVcl(jtex.Width), ScaleToVcl(jtex.Height)); 455 471 except 456 472 Result := False; … … 471 487 try 472 488 Png.LoadFromFile(Path); 489 ResizeBitmap(Png, ScaleToVcl(Png.Width), ScaleToVcl(Png.Height)); 473 490 except 474 491 Result := False; … … 494 511 try 495 512 bmp.LoadFromFile(Path); 513 ResizeBitmap(bmp, ScaleToVcl(bmp.Width), ScaleToVcl(bmp.Height)); 496 514 except 497 515 Result := False; … … 580 598 procedure Dump(dst: TDpiBitmap; HGr, xDst, yDst, Width, Height, xGr, yGr: integer); 581 599 begin 582 BitBlt(dst.Canvas.Handle, xDst, yDst, Width, Height,600 DpiBitBlt(dst.Canvas.Handle, xDst, yDst, Width, Height, 583 601 GrExt[HGr].Data.Canvas.Handle, xGr, yGr, SRCCOPY); 584 602 end; … … 764 782 procedure Sprite(Canvas: TDpiCanvas; HGr, xDst, yDst, Width, Height, xGr, yGr: integer); 765 783 begin 766 BitBlt(Canvas.Handle, xDst, yDst, Width, Height,784 DpiBitBlt(Canvas.Handle, xDst, yDst, Width, Height, 767 785 GrExt[HGr].Mask.Canvas.Handle, xGr, yGr, SRCAND); 768 BitBlt(Canvas.Handle, xDst, yDst, Width, Height,786 DpiBitBlt(Canvas.Handle, xDst, yDst, Width, Height, 769 787 GrExt[HGr].Data.Canvas.Handle, xGr, yGr, SRCPAINT); 770 788 end; … … 772 790 procedure Sprite(dst: TDpiBitmap; HGr, xDst, yDst, Width, Height, xGr, yGr: integer); 773 791 begin 774 BitBlt(dst.Canvas.Handle, xDst, yDst, Width, Height,792 DpiBitBlt(dst.Canvas.Handle, xDst, yDst, Width, Height, 775 793 GrExt[HGr].Mask.Canvas.Handle, xGr, yGr, SRCAND); 776 BitBlt(dst.Canvas.Handle, xDst, yDst, Width, Height,794 DpiBitBlt(dst.Canvas.Handle, xDst, yDst, Width, Height, 777 795 GrExt[HGr].Data.Canvas.Handle, xGr, yGr, SRCPAINT); 778 796 end; … … 866 884 end else 867 885 Frame(ca, x - 1, y - 1, x + Width, y + Height, $000000, $000000); 868 BitBlt(ca.Handle, x, y, Width, Height, Src.Canvas.Handle, xSrc, ySrc,886 DpiBitBlt(ca.Handle, x, y, Width, Height, Src.Canvas.Handle, xSrc, ySrc, 869 887 SRCCOPY); 870 888 end; … … 947 965 $FF * intensity div $FF shl 16; 948 966 end; 949 BitBlt(GrExt[HGrSystem].Mask.Canvas.Handle, 77, 47, 10, 10,967 DpiBitBlt(GrExt[HGrSystem].Mask.Canvas.Handle, 77, 47, 10, 10, 950 968 GrExt[HGrSystem].Mask.Canvas.Handle, 66, 47, SRCCOPY); 951 969 end; … … 955 973 Assert((Left + xOffset >= 0) and (Left + xOffset + Width <= wMainTexture) and 956 974 (Top + yOffset >= 0) and (Top + yOffset + Height <= hMainTexture)); 957 BitBlt(ca.Handle, Left, Top, Width, Height, MainTexture.Image.Canvas.Handle,975 DpiBitBlt(ca.Handle, Left, Top, Width, Height, MainTexture.Image.Canvas.Handle, 958 976 Left + xOffset, Top + yOffset, SRCCOPY); 959 977 end; … … 977 995 begin 978 996 for I := 0 to (x1 - xm) div wMainTexture - 1 do 979 BitBlt(ca.Handle, xm + I * wMainTexture, y0, wMainTexture, y1 - y0,997 DpiBitBlt(ca.Handle, xm + I * wMainTexture, y0, wMainTexture, y1 - y0, 980 998 MainTexture.Image.Canvas.Handle, 0, hMainTexture div 2 + Band(I) * 981 999 (y1 - y0), SRCCOPY); 982 BitBlt(ca.Handle, xm + ((x1 - xm) div wMainTexture) * wMainTexture, y0,1000 DpiBitBlt(ca.Handle, xm + ((x1 - xm) div wMainTexture) * wMainTexture, y0, 983 1001 x1 - (xm + ((x1 - xm) div wMainTexture) * wMainTexture), y1 - y0, 984 1002 MainTexture.Image.Canvas.Handle, 0, hMainTexture div 2 + Band( 985 1003 (x1 - xm) div wMainTexture) * (y1 - y0), SRCCOPY); 986 1004 for I := 0 to (xm - x0) div wMainTexture - 1 do 987 BitBlt(ca.Handle, xm - (I + 1) * wMainTexture, y0, wMainTexture, y1 - y0,1005 DpiBitBlt(ca.Handle, xm - (I + 1) * wMainTexture, y0, wMainTexture, y1 - y0, 988 1006 MainTexture.Image.Canvas.Handle, 0, hMainTexture div 2 + 989 1007 Band(-I - 1) * (y1 - y0), SRCCOPY); 990 BitBlt(ca.Handle, x0, y0, xm - ((xm - x0) div wMainTexture) *1008 DpiBitBlt(ca.Handle, x0, y0, xm - ((xm - x0) div wMainTexture) * 991 1009 wMainTexture - x0, y1 - y0, MainTexture.Image.Canvas.Handle, 992 1010 ((xm - x0) div wMainTexture + 1) * wMainTexture - (xm - x0), … … 1021 1039 if x1cut < 0 then 1022 1040 x1cut := 0; 1023 BitBlt(ca.Handle, x * Texture.Width + x0cut - xOffset,1041 DpiBitBlt(ca.Handle, x * Texture.Width + x0cut - xOffset, 1024 1042 y * Texture.Height + y0cut - yOffset, Texture.Width - x0cut - x1cut, 1025 1043 Texture.Height - y0cut - y1cut, Texture.Canvas.Handle, x0cut, … … 1043 1061 procedure Corner(ca: TDpiCanvas; x, y, Kind: Integer; const T: TTexture); 1044 1062 begin 1045 { BitBlt(ca.Handle,x,y,8,8,GrExt[T.HGr].Mask.Canvas.Handle,1063 { DpiBitBlt(ca.Handle,x,y,8,8,GrExt[T.HGr].Mask.Canvas.Handle, 1046 1064 T.xGr+29+Kind*9,T.yGr+89,SRCAND); 1047 BitBlt(ca.Handle,x,y,8,8,GrExt[T.HGr].Data.Canvas.Handle,1065 DpiBitBlt(ca.Handle,x,y,8,8,GrExt[T.HGr].Data.Canvas.Handle, 1048 1066 T.xGr+29+Kind*9,T.yGr+89,SRCPAINT); } 1049 1067 end; … … 1053 1071 procedure PaintIcon(x, y, Kind: Integer); 1054 1072 begin 1055 BitBlt(ca.Handle, x, y + 6, 10, 10, GrExt[HGrSystem].Mask.Canvas.Handle,1073 DpiBitBlt(ca.Handle, x, y + 6, 10, 10, GrExt[HGrSystem].Mask.Canvas.Handle, 1056 1074 66 + Kind mod 11 * 11, 115 + Kind div 11 * 11, SRCAND); 1057 BitBlt(ca.Handle, x, y + 6, 10, 10, GrExt[HGrSystem].Data.Canvas.Handle,1075 DpiBitBlt(ca.Handle, x, y + 6, 10, 10, GrExt[HGrSystem].Data.Canvas.Handle, 1058 1076 66 + Kind mod 11 * 11, 115 + Kind div 11 * 11, SRCPAINT); 1059 1077 end; … … 1277 1295 for i := 0 to val mod 10 - 1 do 1278 1296 begin 1279 BitBlt(Handle, xIcon + 4 + i * (14 * ld div sd), yIcon + 2 + 1, 14,1297 DpiBitBlt(Handle, xIcon + 4 + i * (14 * ld div sd), yIcon + 2 + 1, 14, 1280 1298 14, GrExt[HGrSystem].Mask.Canvas.Handle, 67 + Kind mod 8 * 15, 1281 1299 70 + Kind div 8 * 15, SRCAND); … … 1285 1303 for i := 0 to val div 10 - 1 do 1286 1304 begin 1287 BitBlt(dst.Canvas.Handle, xIcon + 4 + (val mod 10) *1305 DpiBitBlt(dst.Canvas.Handle, xIcon + 4 + (val mod 10) * 1288 1306 (14 * ld div sd) + i * (14 * ld div sd), yIcon + 3, 14, 14, 1289 1307 GrExt[HGrSystem].Mask.Canvas.Handle, 67 + 7 mod 8 * 15, … … 1310 1328 for i := 0 to val div 10 - 1 do 1311 1329 begin 1312 BitBlt(Handle, xIcon + 4 + i * (14 * ld div sd), yIcon + 3, 14, 14,1330 DpiBitBlt(Handle, xIcon + 4 + i * (14 * ld div sd), yIcon + 3, 14, 14, 1313 1331 GrExt[HGrSystem].Mask.Canvas.Handle, 67 + Kind mod 8 * 15, 1314 1332 70 + Kind div 8 * 15, SRCAND); … … 1318 1336 for i := 0 to val mod 10 - 1 do 1319 1337 begin 1320 BitBlt(dst.Canvas.Handle, xIcon + 4 + (val div 10) *1338 DpiBitBlt(dst.Canvas.Handle, xIcon + 4 + (val div 10) * 1321 1339 (14 * ld div sd) + i * (10 * ld div sd), yIcon + 7, 10, 10, 1322 1340 GrExt[HGrSystem].Mask.Canvas.Handle, 66 + Kind mod 11 * 11, … … 1355 1373 begin 1356 1374 for i := 0 to pos div 8 - 1 do 1357 BitBlt(Handle, x + i * 8, y, 8, 7,1375 DpiBitBlt(Handle, x + i * 8, y, 8, 7, 1358 1376 GrExt[HGrSystem].Data.Canvas.Handle, 104, 9 + 8 * Kind, SRCCOPY); 1359 BitBlt(Handle, x + 8 * (pos div 8), y, pos - 8 * (pos div 8), 7,1377 DpiBitBlt(Handle, x + 8 * (pos div 8), y, pos - 8 * (pos div 8), 7, 1360 1378 GrExt[HGrSystem].Data.Canvas.Handle, 104, 9 + 8 * Kind, SRCCOPY); 1361 1379 if Growth > 0 then 1362 1380 begin 1363 1381 for i := 0 to Growth div 8 - 1 do 1364 BitBlt(Handle, x + pos + i * 8, y, 8, 7,1382 DpiBitBlt(Handle, x + pos + i * 8, y, 8, 7, 1365 1383 GrExt[HGrSystem].Data.Canvas.Handle, 112, 9 + 8 * Kind, SRCCOPY); 1366 BitBlt(Handle, x + pos + 8 * (Growth div 8), y,1384 DpiBitBlt(Handle, x + pos + 8 * (Growth div 8), y, 1367 1385 Growth - 8 * (Growth div 8), 7, GrExt[HGrSystem].Data.Canvas.Handle, 1368 1386 112, 9 + 8 * Kind, SRCCOPY); … … 1371 1389 begin 1372 1390 for i := 0 to -Growth div 8 - 1 do 1373 BitBlt(Handle, x + pos + i * 8, y, 8, 7,1391 DpiBitBlt(Handle, x + pos + i * 8, y, 8, 7, 1374 1392 GrExt[HGrSystem].Data.Canvas.Handle, 104, 1, SRCCOPY); 1375 BitBlt(Handle, x + pos + 8 * (-Growth div 8), y, -Growth -1393 DpiBitBlt(Handle, x + pos + 8 * (-Growth div 8), y, -Growth - 1376 1394 8 * (-Growth div 8), 7, 1377 1395 GrExt[HGrSystem].Data.Canvas.Handle, 104, 1, SRCCOPY); … … 1404 1422 ImageOp_BCC(LogoBuffer, Templates, 0, 0, 1, 1, wLogo, hLogo, 1405 1423 clLight, clShade); 1406 BitBlt(ca.Handle, x, y, wLogo, hLogo, LogoBuffer.Canvas.Handle, 0,1424 DpiBitBlt(ca.Handle, x, y, wLogo, hLogo, LogoBuffer.Canvas.Handle, 0, 1407 1425 0, SRCCOPY); 1408 1426 end;
Note:
See TracChangeset
for help on using the changeset viewer.