Ignore:
Timestamp:
Apr 17, 2019, 10:42:18 AM (5 years ago)
Author:
chronos
Message:
  • Modified: Updated Graphics32 library.
Location:
GraphicTest/Packages/Graphics32
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • GraphicTest/Packages/Graphics32

    • Property svn:ignore set to
      lib
  • GraphicTest/Packages/Graphics32/GR32_Backends_LCL_Win.pas

    r450 r522  
    4242  {$IFDEF LCLWin32} Windows, {$ENDIF} LCLIntf, LCLType, Types, Controls,
    4343  SysUtils, Classes, Graphics, GR32, GR32_Backends, GR32_Backends_Generic,
    44   GR32_Containers, GR32_Image;
     44  GR32_Containers, GR32_Image, GR32_Paths;
    4545
    4646type
     
    5151  TLCLBackend = class(TCustomBackend, IPaintSupport,
    5252    IBitmapContextSupport, IDeviceContextSupport,
    53     ITextSupport, IFontSupport, ICanvasSupport)
     53    ITextSupport, IFontSupport, ITextToPathSupport, ICanvasSupport)
    5454  private
    5555    procedure FontChangedHandler(Sender: TObject);
     
    104104
    105105    { 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;
    110110
    111111    procedure TextoutW(X, Y: Integer; const Text: Widestring); overload;
     
    123123    property Font: TFont read GetFont write SetFont;
    124124    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;
    125130
    126131    { ICanvasSupport }
     
    182187implementation
    183188
     189uses
     190  GR32_Text_LCL_Win;
     191
    184192var
    185193  StockFont: HFONT;
     
    293301end;
    294302
    295 function TLCLBackend.TextExtent(const Text: String): TSize;
     303function TLCLBackend.TextExtent(const Text: string): TSize;
    296304var
    297305  DC: HDC;
     
    342350end;
    343351
    344 procedure TLCLBackend.Textout(X, Y: Integer; const Text: String);
     352procedure TLCLBackend.Textout(X, Y: Integer; const Text: string);
    345353var
    346354  Extent: TSize;
     
    360368end;
    361369
    362 procedure TLCLBackend.TextoutW(X, Y: Integer; const Text: WideString);
     370procedure TLCLBackend.TextoutW(X, Y: Integer; const Text: Widestring);
    363371var
    364372  Extent: TSize;
     
    378386end;
    379387
    380 procedure TLCLBackend.TextoutW(X, Y: Integer; const ClipRect: TRect;
    381   const Text: Widestring);
     388procedure TLCLBackend.TextoutW(X, Y: Integer; const ClipRect: TRect; const Text: Widestring);
    382389var
    383390  Extent: TSize;
     
    386393
    387394  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);
    390396
    391397  Extent := TextExtentW(Text);
     
    393399end;
    394400
    395 procedure TLCLBackend.Textout(X, Y: Integer; const ClipRect: TRect;
    396   const Text: String);
     401procedure TLCLBackend.Textout(X, Y: Integer; const ClipRect: TRect; const Text: string);
    397402var
    398403  Extent: TSize;
     
    407412end;
    408413
    409 procedure TLCLBackend.TextoutW(var DstRect: TRect; const Flags: Cardinal;
    410   const Text: Widestring);
     414procedure TLCLBackend.TextoutW(var DstRect: TRect; const Flags: Cardinal; const Text: Widestring);
    411415begin
    412416  UpdateFont;
     
    435439end;
    436440
    437 procedure TLCLBackend.Textout(var DstRect: TRect; const Flags: Cardinal;
    438   const Text: String);
     441procedure TLCLBackend.TextToPath(Path: TCustomPath; const X, Y: TFloat;
     442  const Text: WideString);
     443var
     444  R: TFloatRect;
     445begin
     446  R := FloatRect(X, Y, X, Y);
     447  GR32_Text_LCL_Win.TextToPath(Font.Handle, Path, R, Text, 0);
     448end;
     449
     450procedure TLCLBackend.TextToPath(Path: TCustomPath; const DstRect: TFloatRect;
     451  const Text: WideString; Flags: Cardinal);
     452begin
     453  GR32_Text_LCL_Win.TextToPath(Font.Handle, Path, DstRect, Text, Flags);
     454end;
     455
     456function TLCLBackend.MeasureText(const DstRect: TFloatRect;
     457  const Text: WideString; Flags: Cardinal): TFloatRect;
     458begin
     459  Result := GR32_Text_LCL_Win.MeasureText(Font.Handle, DstRect, Text, Flags);
     460end;
     461
     462procedure TLCLBackend.Textout(var DstRect: TRect; const Flags: Cardinal; const Text: string);
    439463begin
    440464  UpdateFont;
     
    703727procedure TLCLMemoryBackend.DrawTo(hDst: HDC; DstX, DstY: Integer);
    704728var
    705   Bitmap        : HBITMAP;
    706   DeviceContext : HDC;
    707   Buffer        : Pointer;
    708   OldObject     : HGDIOBJ;
     729  Bitmap: HBITMAP;
     730  DeviceContext: HDC;
     731  Buffer: Pointer;
     732  OldObject: HGDIOBJ;
    709733begin
    710734  {$IFDEF LCLWin32}
     
    746770procedure TLCLMemoryBackend.DrawTo(hDst: HDC; const DstRect, SrcRect: TRect);
    747771var
    748   Bitmap        : HBITMAP;
    749   DeviceContext : HDC;
    750   Buffer        : Pointer;
    751   OldObject     : HGDIOBJ;
     772  Bitmap: HBITMAP;
     773  DeviceContext: HDC;
     774  Buffer: Pointer;
     775  OldObject: HGDIOBJ;
    752776begin
    753777  {$IFDEF LCLWin32}
     
    761785    if DeviceContext <> 0 then
    762786    try
     787      Buffer := nil;
    763788      Bitmap := CreateDIBSection(DeviceContext, FBitmapInfo, DIB_RGB_COLORS,
    764789        Buffer, 0, 0);
Note: See TracChangeset for help on using the changeset viewer.