Functions for TRVUnits conversion

<< Click to display table of contents >>

Functions for TRVUnits conversion

unit [VCL/FMX] RVFuncs / fmxRVFuncs;

function RV_UnitsPerInch(Units: TRVUnits;

  Control: TControl): TRVLengthoverload;
function RV_UnitsPerInch(Units: TRVUnits;

  PixelsPerInch: Integer): TRVLengthoverload;

 

function RV_UnitsToTwips(Value: TRVLength; Units: TRVUnits;
  Control: TControl): Integer; overloadinline;
function RV_UnitsToTwips(Value: TRVLength; Units: TRVUnits;
  PixelsPerInch: Integer): Integer; overload; inline;

 

function RV_UnitsToEMU(Value: TRVLength; Units: TRVUnits;
  Control: TControl): Integer; overloadinline;
function RV_UnitsToEMU(Value: TRVLength; Units: TRVUnits;
  PixelsPerInch: Integer): Integer; overload; inline;

 

function RV_UnitsToPixels(Value: TRVLength; Units: TRVUnits;
  Control: TControl): Integer; overload; inline;
function RV_UnitsToPixels(Value: TRVLength; Units: TRVUnits;
  PixelsPerInch: Integer): TRVCoordoverload; inline;

 

function RV_TwipsToUnits(Value: Integer; Units: TRVUnits;
  Control: TControl): TRVLengthoverloadinline;
function RV_TwipsToUnits(Value: Integer; Units: TRVUnits;
  PixelsPerInch: Integer): TRVLengthoverload; inline;

 

function RV_EMUToUnits(Value: Integer; Units: TRVUnits;
  Control: TControl): TRVLengthoverload; inline;
function RV_EMUToUnits(Value: Integer; Units: TRVUnits;
  PixelsPerInch: Integer): TRVLengthoverload; inline;

 

function RV_UnitsToUnits(Value: TRVLength

  OldUnits, NewUnits: TRVUnits;
  Control: TControl): TRVLengthoverload; inline;
function RV_UnitsToUnits(Value: TRVLength;

  OldUnits, NewUnits: TRVUnits;
  PixelsPerInch: Integer): TRVLengthoverload; inline;

RV_UnitsPerInch returns the amount of Units in 1 inch.

RV_UnitsToTwips converts Value from Units to twips.

RV_UnitsToEMU converts Value from Units to EMU.

RV_UnitsToPixels converts Value from Units to pixels.

RV_TwipsToUnits converts Value from twips to Units.

RV_EMUToUnits converts Value from EMU to Units.

RV_UnitsToUnits converts Value from OldUnits to NewUnits.

There are two versions of each of these methods. The first of them has Control parameter, the second of them has PixelsPerInch. These parameters are used when converting to/from pixels.

For methods with PixelsPerInch parameter, 1 pixel = 1/PixelsPerInch of an inch.

For methods with Control parameter, “pixels per inch” value is determined from Control using the following rules:

if value of the global variable RichViewPixelsPerInch is positive, it is used (Control is ignored); otherwise

if the application supports multiple monitors having different pixel depth (Delphi 10.1+), DPI of the monitor that contains the form that contains Control is used; otherwise

Screen.PixelsPerInch is used (Control is ignored)

See also

Units of measurement in TRichView