Changeset 522 for GraphicTest/Packages/Graphics32/GR32_Backends_LCL_Win.pas
- Timestamp:
- Apr 17, 2019, 10:42:18 AM (5 years ago)
- Location:
- GraphicTest/Packages/Graphics32
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GraphicTest/Packages/Graphics32
-
Property svn:ignore
set to
lib
-
Property svn:ignore
set to
-
GraphicTest/Packages/Graphics32/GR32_Backends_LCL_Win.pas
r450 r522 42 42 {$IFDEF LCLWin32} Windows, {$ENDIF} LCLIntf, LCLType, Types, Controls, 43 43 SysUtils, Classes, Graphics, GR32, GR32_Backends, GR32_Backends_Generic, 44 GR32_Containers, GR32_Image ;44 GR32_Containers, GR32_Image, GR32_Paths; 45 45 46 46 type … … 51 51 TLCLBackend = class(TCustomBackend, IPaintSupport, 52 52 IBitmapContextSupport, IDeviceContextSupport, 53 ITextSupport, IFontSupport, I CanvasSupport)53 ITextSupport, IFontSupport, ITextToPathSupport, ICanvasSupport) 54 54 private 55 55 procedure FontChangedHandler(Sender: TObject); … … 104 104 105 105 { ITextSupport } 106 procedure Textout(X, Y: Integer; const Text: String); overload;107 procedure Textout(X, Y: Integer; const ClipRect: TRect; const Text: String); overload;108 procedure Textout(var DstRect: TRect; const Flags: Cardinal; const Text: String); overload;109 function TextExtent(const Text: String): TSize;106 procedure Textout(X, Y: Integer; const Text: string); overload; 107 procedure Textout(X, Y: Integer; const ClipRect: TRect; const Text: string); overload; 108 procedure Textout(var DstRect: TRect; const Flags: Cardinal; const Text: string); overload; 109 function TextExtent(const Text: string): TSize; 110 110 111 111 procedure TextoutW(X, Y: Integer; const Text: Widestring); overload; … … 123 123 property Font: TFont read GetFont write SetFont; 124 124 property OnFontChange: TNotifyEvent read FOnFontChange write FOnFontChange; 125 126 { ITextToPathSupport } 127 procedure TextToPath(Path: TCustomPath; const X, Y: TFloat; const Text: WideString); overload; 128 procedure TextToPath(Path: TCustomPath; const DstRect: TFloatRect; const Text: WideString; Flags: Cardinal); overload; 129 function MeasureText(const DstRect: TFloatRect; const Text: WideString; Flags: Cardinal): TFloatRect; 125 130 126 131 { ICanvasSupport } … … 182 187 implementation 183 188 189 uses 190 GR32_Text_LCL_Win; 191 184 192 var 185 193 StockFont: HFONT; … … 293 301 end; 294 302 295 function TLCLBackend.TextExtent(const Text: String): TSize;303 function TLCLBackend.TextExtent(const Text: string): TSize; 296 304 var 297 305 DC: HDC; … … 342 350 end; 343 351 344 procedure TLCLBackend.Textout(X, Y: Integer; const Text: String);352 procedure TLCLBackend.Textout(X, Y: Integer; const Text: string); 345 353 var 346 354 Extent: TSize; … … 360 368 end; 361 369 362 procedure TLCLBackend.TextoutW(X, Y: Integer; const Text: Wide String);370 procedure TLCLBackend.TextoutW(X, Y: Integer; const Text: Widestring); 363 371 var 364 372 Extent: TSize; … … 378 386 end; 379 387 380 procedure TLCLBackend.TextoutW(X, Y: Integer; const ClipRect: TRect; 381 const Text: Widestring); 388 procedure TLCLBackend.TextoutW(X, Y: Integer; const ClipRect: TRect; const Text: Widestring); 382 389 var 383 390 Extent: TSize; … … 386 393 387 394 if not FOwner.MeasuringMode then 388 ExtTextoutW(Handle, X, Y, ETO_CLIPPED, @ClipRect, PWideChar(Text), 389 Length(Text), nil); 395 ExtTextoutW(Handle, X, Y, ETO_CLIPPED, @ClipRect, PWideChar(Text), Length(Text), nil); 390 396 391 397 Extent := TextExtentW(Text); … … 393 399 end; 394 400 395 procedure TLCLBackend.Textout(X, Y: Integer; const ClipRect: TRect; 396 const Text: String); 401 procedure TLCLBackend.Textout(X, Y: Integer; const ClipRect: TRect; const Text: string); 397 402 var 398 403 Extent: TSize; … … 407 412 end; 408 413 409 procedure TLCLBackend.TextoutW(var DstRect: TRect; const Flags: Cardinal; 410 const Text: Widestring); 414 procedure TLCLBackend.TextoutW(var DstRect: TRect; const Flags: Cardinal; const Text: Widestring); 411 415 begin 412 416 UpdateFont; … … 435 439 end; 436 440 437 procedure TLCLBackend.Textout(var DstRect: TRect; const Flags: Cardinal; 438 const Text: String); 441 procedure TLCLBackend.TextToPath(Path: TCustomPath; const X, Y: TFloat; 442 const Text: WideString); 443 var 444 R: TFloatRect; 445 begin 446 R := FloatRect(X, Y, X, Y); 447 GR32_Text_LCL_Win.TextToPath(Font.Handle, Path, R, Text, 0); 448 end; 449 450 procedure TLCLBackend.TextToPath(Path: TCustomPath; const DstRect: TFloatRect; 451 const Text: WideString; Flags: Cardinal); 452 begin 453 GR32_Text_LCL_Win.TextToPath(Font.Handle, Path, DstRect, Text, Flags); 454 end; 455 456 function TLCLBackend.MeasureText(const DstRect: TFloatRect; 457 const Text: WideString; Flags: Cardinal): TFloatRect; 458 begin 459 Result := GR32_Text_LCL_Win.MeasureText(Font.Handle, DstRect, Text, Flags); 460 end; 461 462 procedure TLCLBackend.Textout(var DstRect: TRect; const Flags: Cardinal; const Text: string); 439 463 begin 440 464 UpdateFont; … … 703 727 procedure TLCLMemoryBackend.DrawTo(hDst: HDC; DstX, DstY: Integer); 704 728 var 705 Bitmap 706 DeviceContext 707 Buffer 708 OldObject 729 Bitmap: HBITMAP; 730 DeviceContext: HDC; 731 Buffer: Pointer; 732 OldObject: HGDIOBJ; 709 733 begin 710 734 {$IFDEF LCLWin32} … … 746 770 procedure TLCLMemoryBackend.DrawTo(hDst: HDC; const DstRect, SrcRect: TRect); 747 771 var 748 Bitmap 749 DeviceContext 750 Buffer 751 OldObject 772 Bitmap: HBITMAP; 773 DeviceContext: HDC; 774 Buffer: Pointer; 775 OldObject: HGDIOBJ; 752 776 begin 753 777 {$IFDEF LCLWin32} … … 761 785 if DeviceContext <> 0 then 762 786 try 787 Buffer := nil; 763 788 Bitmap := CreateDIBSection(DeviceContext, FBitmapInfo, DIB_RGB_COLORS, 764 789 Buffer, 0, 0);
Note:
See TracChangeset
for help on using the changeset viewer.