LuciadCPillar C# 2024.1.04
Luciad.Input.ScreenDistance Class Reference

This class is used to represent distances between screen locations. More...

Inheritance diagram for Luciad.Input.ScreenDistance:

Public Member Functions

 ScreenDistance (double distance, Luciad.Input.ScreenDistanceUnit unit)
 Explicit constructor taking a distance value and a unit. More...
 
double AsMillimeters (double dpi, double displayScale)
 Converting value method which returns the distance value as a double, expressed in millimeters. More...
 
double AsPixels (double dpi, double displayScale)
 Converting value method which returns the distance value as a double, expressed in device independent pixels. More...
 
void Dispose ()
 

Static Public Member Functions

static Luciad.Input.ScreenDistance Millimeters (double millimeters)
 Utility factory method for constructing a ScreenDistance expressed in millimeters. More...
 
static Luciad.Input.ScreenDistance Pixels (double pixels)
 Utility factory method for constructing a ScreenDistance expressed in device independent pixels. More...
 

Properties

Luciad.Input.ScreenDistanceUnit Unit [get]
 The screen distance unit. More...
 
double Value [get]
 The screen distance value, as a double. More...
 

Detailed Description

This class is used to represent distances between screen locations.

It consists of a unit (expressed as a ScreenDistanceUnit) and the distance value.

This class contains utility methods for converting distance values from millimeters to pixels or vice-versa, by taking DPI and display scale into account (see ScreenDistance#asPixels and ScreenDistance#asMillimeters).

Related article: Support high-resolution (HiDPI) displays.

Since
2022.0

Constructor & Destructor Documentation

◆ ScreenDistance()

Luciad.Input.ScreenDistance.ScreenDistance ( double  distance,
Luciad.Input.ScreenDistanceUnit  unit 
)
inline

Explicit constructor taking a distance value and a unit.

Parameters
distancethe distance, expressed in the chosen unit.
uniteither ScreenDistanceUnit.Pixels or ScreenDistanceUnit.Millimeters.

Member Function Documentation

◆ AsMillimeters()

double Luciad.Input.ScreenDistance.AsMillimeters ( double  dpi,
double  displayScale 
)
inline

Converting value method which returns the distance value as a double, expressed in millimeters.

In order to make any possible conversion from device independent pixels to millimeters, the display DPI and display scale must be provided. If the stored unit is ScreenDistanceUnit.Millimeters, the currently stored value is returned.

Parameters
dpithe display density in dots per inch
displayScalethe display scale
Returns
the screen distance in millimeters, as a double.

◆ AsPixels()

double Luciad.Input.ScreenDistance.AsPixels ( double  dpi,
double  displayScale 
)
inline

Converting value method which returns the distance value as a double, expressed in device independent pixels.

In order to make any possible conversion from millimeters to pixels, the display DPI and display scale must be provided. If the stored unit is ScreenDistanceUnit.Pixels, the currently stored value is returned.

Parameters
dpithe display density in dots per inch
displayScalethe display scale
Returns
the screen distance in device independent pixels, as a double.

◆ Dispose()

void Luciad.Input.ScreenDistance.Dispose ( )
inline

◆ Millimeters()

static Luciad.Input.ScreenDistance Luciad.Input.ScreenDistance.Millimeters ( double  millimeters)
inlinestatic

Utility factory method for constructing a ScreenDistance expressed in millimeters.

Parameters
millimetersthe distance in millimeters.
Returns
a ScreenDistance instance taking the passed value and expressed in millimeters.

◆ Pixels()

static Luciad.Input.ScreenDistance Luciad.Input.ScreenDistance.Pixels ( double  pixels)
inlinestatic

Utility factory method for constructing a ScreenDistance expressed in device independent pixels.

Parameters
pixelsthe distance in device independent pixels.
Returns
a ScreenDistance instance taking the passed value and expressed in device independent pixels.

Property Documentation

◆ Unit

Luciad.Input.ScreenDistanceUnit Luciad.Input.ScreenDistance.Unit
get

The screen distance unit.

[get]

Returns the screen distance unit.

◆ Value

double Luciad.Input.ScreenDistance.Value
get

The screen distance value, as a double.

[get]

Returns the screen distance value, as a double.