Ignore:
Timestamp:
Jun 23, 2019, 9:12:54 PM (5 years ago)
Author:
chronos
Message:
  • Modified: Improved scaling support.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/Packages/DpiControls/UDpiControls.pas

    r178 r179  
    258258  public
    259259    VclCanvas: TCanvas;
     260    procedure StretchDraw(const DestRect: TRect; SrcGraphic: TDpiGraphic); virtual;
    260261    procedure FrameRect(Rect: TRect);
    261262    procedure Rectangle(X1, Y1, X2, Y2: Integer);
     
    709710procedure Register;
    710711function DpiBitBlt(DestDC: HDC; X, Y, Width, Height: Integer; SrcDC: HDC; XSrc, YSrc: Integer; Rop: DWORD): Boolean;
     712function DpiCreateRectRgn(X1, Y1, X2, Y2: Integer): HRGN;
     713function ScaleToVcl(Value: Integer): Integer;
     714function ScaleFromVcl(Value: Integer): Integer;
     715function ScalePointToVcl(Value: TPoint): TPoint;
     716function ScalePointFromVcl(Value: TPoint): TPoint;
     717function ScaleSizeToVcl(Value: TSize): TSize;
     718function ScaleSizeFromVcl(Value: TSize): TSize;
     719function ScaleRectToVcl(Value: TRect): TRect;
     720function ScaleRectFromVcl(Value: TRect): TRect;
    711721
    712722
     
    723733  RegisterProjectFileDescriptor(DpiFormFileDesc);
    724734  RegisterComponents('DpiControls', [TDpiButton, TDpiImage, TDpiPaintBox, TDpiListBox]);
     735end;
     736
     737function DpiCreateRectRgn(X1, Y1, X2, Y2: Integer): HRGN;
     738begin
     739  Result := CreateRectRgn(ScaleToVcl(X1), ScaleToVcl(Y1), ScaleToVcl(X2),
     740    ScaleToVcl(Y2));
    725741end;
    726742
     
    14651481end;
    14661482
     1483procedure TDpiCanvas.StretchDraw(const DestRect: TRect; SrcGraphic: TDpiGraphic
     1484  );
     1485begin
     1486  GetVclCanvas.StretchDraw(ScaleRectToVcl(DestRect), SrcGraphic.GetVclGraphic);
     1487end;
     1488
    14671489procedure TDpiCanvas.FrameRect(Rect: TRect);
    14681490begin
Note: See TracChangeset for help on using the changeset viewer.