Class GUIHelper
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.util.GUIHelper
-
public final class GUIHelper extends Object
-
-
Field Summary
Fields Modifier and Type Field Description static org.eclipse.swt.graphics.Color
COLOR_BLACK
static org.eclipse.swt.graphics.Color
COLOR_BLUE
static org.eclipse.swt.graphics.Color
COLOR_DARK_GRAY
static org.eclipse.swt.graphics.Color
COLOR_GRAY
static org.eclipse.swt.graphics.Color
COLOR_GREEN
static org.eclipse.swt.graphics.Color
COLOR_LIST_BACKGROUND
static org.eclipse.swt.graphics.Color
COLOR_LIST_FOREGROUND
static org.eclipse.swt.graphics.Color
COLOR_LIST_SELECTION
static org.eclipse.swt.graphics.Color
COLOR_LIST_SELECTION_TEXT
static org.eclipse.swt.graphics.Color
COLOR_RED
static org.eclipse.swt.graphics.Color
COLOR_TITLE_INACTIVE_BACKGROUND
static org.eclipse.swt.graphics.Color
COLOR_WHITE
static org.eclipse.swt.graphics.Color
COLOR_WIDGET_BACKGROUND
static org.eclipse.swt.graphics.Color
COLOR_WIDGET_BORDER
static org.eclipse.swt.graphics.Color
COLOR_WIDGET_DARK_SHADOW
static org.eclipse.swt.graphics.Color
COLOR_WIDGET_FOREGROUND
static org.eclipse.swt.graphics.Color
COLOR_WIDGET_HIGHLIGHT_SHADOW
static org.eclipse.swt.graphics.Color
COLOR_WIDGET_LIGHT_SHADOW
static org.eclipse.swt.graphics.Color
COLOR_WIDGET_NORMAL_SHADOW
static org.eclipse.swt.graphics.Color
COLOR_YELLOW
static int
DEFAULT_ANTIALIAS
static org.eclipse.swt.graphics.Font
DEFAULT_FONT
static int
DEFAULT_MIN_DISPLAY_SIZE
static int
DEFAULT_RESIZE_HANDLE_SIZE
static int
DEFAULT_TEXT_ANTIALIAS
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.eclipse.swt.graphics.RGB
blend(org.eclipse.swt.graphics.RGB val1, org.eclipse.swt.graphics.RGB val2)
Blend the two colour values returning a value that is halfway between them.static int
convertHorizontalDpiToPixel(int dpi)
Converts the given DPI scaled value to a pixel value using the factor for the horizontal DPI.static int
convertHorizontalDpiToPixel(int dpi, boolean forDisplayDPI)
Converts the given DPI scaled value to a pixel value using the factor for the horizontal DPI.static int
convertHorizontalDpiToPixel(int dpi, IConfigRegistry configRegistry)
Default method to convert the given amount of horizontal dots per inch to a pixel value.static int
convertHorizontalPixelToDpi(int pixel)
Converts the given amount of pixels to a DPI scaled value using the factor for the horizontal DPI value.static int
convertHorizontalPixelToDpi(int pixel, boolean forDisplayDPI)
Converts the given amount of pixels to a DPI scaled value using the factor for the horizontal DPI value.static int
convertHorizontalPixelToDpi(int pixel, IConfigRegistry configRegistry)
Default method to convert the given amount of pixels to a horizontal dots per inch value.static int
convertVerticalDpiToPixel(int dpi)
Converts the given DPI scaled value to a pixel value using the factor for the vertical DPI.static int
convertVerticalDpiToPixel(int dpi, boolean forDisplayDPI)
Converts the given DPI scaled value to a pixel value using the factor for the vertical DPI.static int
convertVerticalDpiToPixel(int dpi, IConfigRegistry configRegistry)
Default method to convert the given amount of vertical dots per inch to pixel.static int
convertVerticalPixelToDpi(int pixel)
Converts the given amount of pixels to a DPI scaled value using the factor for the vertical DPI.static int
convertVerticalPixelToDpi(int pixel, boolean forDisplayDPI)
Converts the given amount of pixels to a DPI scaled value using the factor for the vertical DPI.static int
convertVerticalPixelToDpi(int pixel, IConfigRegistry configRegistry)
Default method to convert the given amount of pixels to a vertical dots per inch value.static org.eclipse.swt.graphics.Color
getColor(int red, int green, int blue)
static org.eclipse.swt.graphics.Color
getColor(String key)
static org.eclipse.swt.graphics.Color
getColor(org.eclipse.swt.graphics.RGB rgb)
static org.eclipse.swt.graphics.Image
getDisplayImage(String imageName)
Returns theImage
representation of a NatTable internal image resource.static org.eclipse.swt.graphics.Image
getDisplayImageByURL(String key, URL url)
This method returns theImage
that is registered for the given key.static org.eclipse.swt.graphics.Image
getDisplayImageByURL(URL url)
This method extracts the base filename out of the givenURL
and uses it as key to search for theImage
in theImageRegistry
.static float
getDpiFactor(int dpi)
Returns the factor for scaling calculations of pixels regarding the DPI.static int
getDpiX()
static int
getDpiX(boolean displayDPI)
Returns the horizontal dots per inch configured locally.static int
getDpiY()
static int
getDpiY(boolean displayDPI)
Returns the vertical dots per inch configured locally.static org.eclipse.swt.graphics.Font
getFont(String key)
static org.eclipse.swt.graphics.Font
getFont(org.eclipse.swt.graphics.FontData... fontDatas)
static org.eclipse.swt.graphics.Image
getImage(String imageName)
Returns theImage
representation of a NatTable internal image resource.static org.eclipse.swt.graphics.Image
getImage(String imageName, boolean considerScaling, boolean forDisplayDPI)
Returns theImage
representation of a NatTable internal image resource.static org.eclipse.swt.graphics.Image
getImageByURL(String key, URL url)
This method returns theImage
that is registered for the given key.static org.eclipse.swt.graphics.Image
getImageByURL(String key, URL url, boolean considerScaling, boolean forDisplayDPI)
This method returns theImage
that is registered for the given key.static org.eclipse.swt.graphics.Image
getImageByURL(URL url)
This method extracts the base filename out of the givenURL
and uses it as key to search for theImage
in theImageRegistry
.static org.eclipse.jface.resource.ImageDescriptor
getImageDescriptor(String imageName)
Returns theImageDescriptor
for a NatTable internal image resource.static URL
getInternalImageUrl(String imageName)
Searches for the image with the given filename in the NatTable internal image resource folder with file extensions .png and .gif.static URL
getInternalImageUrl(String imageName, boolean needScaling)
Searches for the image with the given filename in the NatTable internal image resource folder with file extensions .png and .gif.static URL
getInternalImageUrl(String imageName, boolean needScaling, boolean forDisplayDPI)
Searches for the image with the given filename in the NatTable internal image resource folder with file extensions .png and .gif.static org.eclipse.swt.graphics.Font
getScaledFont(org.eclipse.swt.graphics.Font font, float fontScalingFactor)
Return a scaled version of the configured font if font scaling is needed.static String
getScalingImageSuffix()
static String
getScalingImageSuffix(boolean forDisplayDPI)
static String
getSequenceNumber()
static boolean
needScaling()
static boolean
needScaling(boolean forDisplay)
static void
setDpi(int x, int y)
Set the dpi values that are used for image scaling.
-
-
-
Field Detail
-
COLOR_GRAY
public static final org.eclipse.swt.graphics.Color COLOR_GRAY
-
COLOR_WHITE
public static final org.eclipse.swt.graphics.Color COLOR_WHITE
-
COLOR_DARK_GRAY
public static final org.eclipse.swt.graphics.Color COLOR_DARK_GRAY
-
COLOR_BLACK
public static final org.eclipse.swt.graphics.Color COLOR_BLACK
-
COLOR_BLUE
public static final org.eclipse.swt.graphics.Color COLOR_BLUE
-
COLOR_RED
public static final org.eclipse.swt.graphics.Color COLOR_RED
-
COLOR_YELLOW
public static final org.eclipse.swt.graphics.Color COLOR_YELLOW
-
COLOR_GREEN
public static final org.eclipse.swt.graphics.Color COLOR_GREEN
-
COLOR_LIST_BACKGROUND
public static final org.eclipse.swt.graphics.Color COLOR_LIST_BACKGROUND
-
COLOR_LIST_FOREGROUND
public static final org.eclipse.swt.graphics.Color COLOR_LIST_FOREGROUND
-
COLOR_LIST_SELECTION
public static final org.eclipse.swt.graphics.Color COLOR_LIST_SELECTION
-
COLOR_LIST_SELECTION_TEXT
public static final org.eclipse.swt.graphics.Color COLOR_LIST_SELECTION_TEXT
-
COLOR_WIDGET_BACKGROUND
public static final org.eclipse.swt.graphics.Color COLOR_WIDGET_BACKGROUND
-
COLOR_WIDGET_FOREGROUND
public static final org.eclipse.swt.graphics.Color COLOR_WIDGET_FOREGROUND
-
COLOR_TITLE_INACTIVE_BACKGROUND
public static final org.eclipse.swt.graphics.Color COLOR_TITLE_INACTIVE_BACKGROUND
-
COLOR_WIDGET_BORDER
public static final org.eclipse.swt.graphics.Color COLOR_WIDGET_BORDER
-
COLOR_WIDGET_DARK_SHADOW
public static final org.eclipse.swt.graphics.Color COLOR_WIDGET_DARK_SHADOW
-
COLOR_WIDGET_LIGHT_SHADOW
public static final org.eclipse.swt.graphics.Color COLOR_WIDGET_LIGHT_SHADOW
-
COLOR_WIDGET_NORMAL_SHADOW
public static final org.eclipse.swt.graphics.Color COLOR_WIDGET_NORMAL_SHADOW
-
COLOR_WIDGET_HIGHLIGHT_SHADOW
public static final org.eclipse.swt.graphics.Color COLOR_WIDGET_HIGHLIGHT_SHADOW
-
DEFAULT_FONT
public static final org.eclipse.swt.graphics.Font DEFAULT_FONT
-
DEFAULT_RESIZE_HANDLE_SIZE
public static final int DEFAULT_RESIZE_HANDLE_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_MIN_DISPLAY_SIZE
public static final int DEFAULT_MIN_DISPLAY_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_ANTIALIAS
public static final int DEFAULT_ANTIALIAS
- See Also:
- Constant Field Values
-
DEFAULT_TEXT_ANTIALIAS
public static final int DEFAULT_TEXT_ANTIALIAS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getColor
public static org.eclipse.swt.graphics.Color getColor(org.eclipse.swt.graphics.RGB rgb)
-
getColor
public static org.eclipse.swt.graphics.Color getColor(int red, int green, int blue)
-
getColor
public static org.eclipse.swt.graphics.Color getColor(String key)
-
getFont
public static org.eclipse.swt.graphics.Font getFont(org.eclipse.swt.graphics.FontData... fontDatas)
-
getFont
public static org.eclipse.swt.graphics.Font getFont(String key)
-
getScaledFont
public static org.eclipse.swt.graphics.Font getScaledFont(org.eclipse.swt.graphics.Font font, float fontScalingFactor)
Return a scaled version of the configured font if font scaling is needed. If no font scaling is needed, the given font is returned.- Parameters:
font
- The font to scale.- Returns:
- The font with the updated height if font scaling is needed, otherwise the given font.
- Since:
- 2.0
-
getImageByURL
public static org.eclipse.swt.graphics.Image getImageByURL(URL url)
This method extracts the base filename out of the givenURL
and uses it as key to search for theImage
in theImageRegistry
. If theImage
is not yet present it will create theImage
instance and register it automatically. On creating and registering it will respect dpi scaling.- Parameters:
url
- TheURL
of the image for initial loading.- Returns:
- The
Image
representation of an image external to NatTable. - See Also:
getImageByURL(String, URL)
-
getImageByURL
public static org.eclipse.swt.graphics.Image getImageByURL(String key, URL url)
This method returns theImage
that is registered for the given key. If there is noImage
registered for that key already, it will create and register theImage
that can be loaded by the givenURL
.This method returns an
Image
that matches the dpi settings. If the dpi of an axis is bigger than 96 it will search for an image for the bigger dpi. For this the filenames need to carry the dpi information.For example if you request checkbox.png this method will search for a scaled version relative to the requested image. The following will give an example on the scaled files:
- checkbox.png
- checkbox_120_120.png
- checkbox_128_128.png
- checkbox_144_144.png
- checkbox_192_192.png
- checkbox_288_288.png
If the matching scaled version is not found, it will automatically upscale the base image.
Note: If you want to get the image later again you can directly use
JFaceResources.getImage(key)
.- Parameters:
key
- The key under which the resource is registered in the image registry.url
- TheURL
of the image for initial loading.- Returns:
- The
Image
representation of an image external to NatTable.
-
getDisplayImageByURL
public static org.eclipse.swt.graphics.Image getDisplayImageByURL(URL url)
This method extracts the base filename out of the givenURL
and uses it as key to search for theImage
in theImageRegistry
. If theImage
is not yet present it will create theImage
instance and register it automatically. On creating and registering it will respect display dpi scaling.- Parameters:
url
- TheURL
of the image for initial loading.- Returns:
- The
Image
representation of an image external to NatTable. - Since:
- 2.0
- See Also:
getImageByURL(String, URL)
-
getDisplayImageByURL
public static org.eclipse.swt.graphics.Image getDisplayImageByURL(String key, URL url)
This method returns theImage
that is registered for the given key. If there is noImage
registered for that key already, it will create and register theImage
that can be loaded by the givenURL
.This method returns an
Image
that matches the display dpi settings. If the dpi of an axis is bigger than 96 it will search for an image for the bigger dpi. For this the filenames need to carry the dpi information.For example if you request checkbox.png this method will search for a scaled version relative to the requested image. The following will give an example on the scaled files:
- checkbox.png
- checkbox_120_120.png
- checkbox_128_128.png
- checkbox_144_144.png
- checkbox_192_192.png
- checkbox_288_288.png
If the matching scaled version is not found, it will automatically upscale the base image.
Note: If you want to get the image later again you can directly use
JFaceResources.getImage(key)
.- Parameters:
key
- The key under which the resource is registered in the image registry.url
- TheURL
of the image for initial loading.- Returns:
- The
Image
representation of an image external to NatTable. - Since:
- 2.0
-
getImageByURL
public static org.eclipse.swt.graphics.Image getImageByURL(String key, URL url, boolean considerScaling, boolean forDisplayDPI)
This method returns theImage
that is registered for the given key. If there is noImage
registered for that key already, it will create and register theImage
that can be loaded by the givenURL
.This method returns an
Image
that matches the dpi settings. If the dpi of an axis is bigger than 96 it will search for an image for the bigger dpi. For this the filenames need to carry the dpi information.For example if you request checkbox.png this method will search for a scaled version relative to the requested image. The following will give an example on the scaled files:
- checkbox.png
- checkbox_120_120.png
- checkbox_128_128.png
- checkbox_144_144.png
- checkbox_192_192.png
- checkbox_288_288.png
If the matching scaled version is not found, it will automatically upscale the base image.
Note: If you want to get the image later again you can directly use
JFaceResources.getImage(key)
.- Parameters:
key
- The key under which the resource is registered in the image registry.url
- TheURL
of the image for initial loading.considerScaling
-true
if image scaling according to the scaling settings should be performed,false
if only the existing file should be considered without scaling.forDisplayDPI
- Whether the display DPI or the configured DPI should be considered.- Returns:
- The
Image
representation of an image external to NatTable. - Since:
- 2.0
-
getImage
public static org.eclipse.swt.graphics.Image getImage(String imageName)
Returns theImage
representation of a NatTable internal image resource. Will handle scaling if needed.For upscaling this method checks whether there is a upscaled version of the image available, otherwise it will upscale the existing image and store that in the registry for further use.
- Parameters:
imageName
- The filename of the image (without extension).- Returns:
- The
Image
representation of the internal NatTable image resource ornull
if there is no image found for the given name at the internal image resource location.
-
getDisplayImage
public static org.eclipse.swt.graphics.Image getDisplayImage(String imageName)
Returns theImage
representation of a NatTable internal image resource. Will apply scaling for the current display scaling factor if needed.For upscaling this method checks whether there is a upscaled version of the image available, otherwise it will upscale the existing image and store that in the registry for further use.
- Parameters:
imageName
- The filename of the image (without extension).- Returns:
- The
Image
representation of the internal NatTable image resource ornull
if there is no image found for the given name at the internal image resource location. - Since:
- 2.0
-
getImage
public static org.eclipse.swt.graphics.Image getImage(String imageName, boolean considerScaling, boolean forDisplayDPI)
Returns theImage
representation of a NatTable internal image resource.For upscaling this method checks whether there is a upscaled version of the image available, otherwise it will upscale the existing image and store that in the registry for further use.
- Parameters:
imageName
- The filename of the image (without extension).considerScaling
-true
if image scaling according to the scaling settings should be performed,false
if only the existing file should be considered without scaling.forDisplayDPI
- Whether the display DPI or the configured DPI should be considered.- Returns:
- The
Image
representation of the internal NatTable image resource ornull
if there is no image found for the given name at the internal image resource location. - Since:
- 2.0
-
getImageDescriptor
public static org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(String imageName)
Returns theImageDescriptor
for a NatTable internal image resource.- Parameters:
imageName
- The filename of the image (without extension).- Returns:
- The
ImageDescriptor
of the internal NatTable image resource ornull
if there is no image found for the given name at the internal image resource location.
-
getInternalImageUrl
public static URL getInternalImageUrl(String imageName)
Searches for the image with the given filename in the NatTable internal image resource folder with file extensions .png and .gif.- Parameters:
imageName
- The filename of the image (without extension)- Returns:
- The URL of the internal NatTable image or
null
if there is no image found for the given name at the internal image resource location. - Since:
- 1.5
-
getInternalImageUrl
public static URL getInternalImageUrl(String imageName, boolean needScaling)
Searches for the image with the given filename in the NatTable internal image resource folder with file extensions .png and .gif.- Parameters:
imageName
- The filename of the image (without extension).needScaling
-true
in case the scaled version is requested,false
if the original version is requested.- Returns:
- The URL of the internal NatTable image or
null
if there is no image found for the given name at the internal image resource location. - Since:
- 1.5
-
getInternalImageUrl
public static URL getInternalImageUrl(String imageName, boolean needScaling, boolean forDisplayDPI)
Searches for the image with the given filename in the NatTable internal image resource folder with file extensions .png and .gif.- Parameters:
imageName
- The filename of the image (without extension)needScaling
-true
in case the scaled version is requested,false
if the original version is requested.forDisplayDPI
- Whether the display DPI or the configured DPI should be considered.- Returns:
- The URL of the internal NatTable image or
null
if there is no image found for the given name at the internal image resource location. - Since:
- 2.0
-
getSequenceNumber
public static String getSequenceNumber()
-
blend
public static org.eclipse.swt.graphics.RGB blend(org.eclipse.swt.graphics.RGB val1, org.eclipse.swt.graphics.RGB val2)
Blend the two colour values returning a value that is halfway between them.- Parameters:
val1
- the first valueval2
- the second value- Returns:
- the blended colour
-
getDpiFactor
public static float getDpiFactor(int dpi)
Returns the factor for scaling calculations of pixels regarding the DPI.- Parameters:
dpi
- The DPI for which the factor is requested.- Returns:
- The factor for dpi scaling calculations.
-
setDpi
public static void setDpi(int x, int y)
Set the dpi values that are used for image scaling.- Parameters:
x
- The horizontal dots per inch.y
- The vertical dots per inch.- Since:
- 2.0
-
needScaling
public static boolean needScaling()
- Returns:
true
if either the horizontal or the vertical DPI value is bigger than 96.
-
needScaling
public static boolean needScaling(boolean forDisplay)
- Parameters:
forDisplay
- if the check should be performed against the display scaling or the configured scaling.- Returns:
true
if either the horizontal or the vertical DPI value is bigger than 96.- Since:
- 2.0
-
getDpiX
public static int getDpiX()
- Returns:
- The horizontal dots per inch.
-
getDpiX
public static int getDpiX(boolean displayDPI)
Returns the horizontal dots per inch configured locally. If no local dpi configuration is set, it falls back to the display dpi.- Parameters:
displayDPI
- If the display dpi should be returned always.- Returns:
- The horizontal dots per inch.
- Since:
- 2.0
-
getDpiY
public static int getDpiY()
- Returns:
- The vertical dots per inch.
-
getDpiY
public static int getDpiY(boolean displayDPI)
Returns the vertical dots per inch configured locally. If no local dpi configuration is set, it falls back to the display dpi.- Parameters:
displayDPI
- If the display dpi should be returned always.- Returns:
- The vertical dots per inch.
- Since:
- 2.0
-
getScalingImageSuffix
public static String getScalingImageSuffix()
- Returns:
- The suffix that is used to mark an image as upscaled image.
-
getScalingImageSuffix
public static String getScalingImageSuffix(boolean forDisplayDPI)
- Parameters:
forDisplayDPI
- Whether the display DPI or the configured DPI should be considered.- Returns:
- The suffix that is used to mark an image as upscaled image.
- Since:
- 2.0
-
convertHorizontalPixelToDpi
public static int convertHorizontalPixelToDpi(int pixel)
Converts the given amount of pixels to a DPI scaled value using the factor for the horizontal DPI value.- Parameters:
pixel
- the amount of pixels to convert.- Returns:
- The converted pixels.
-
convertHorizontalPixelToDpi
public static int convertHorizontalPixelToDpi(int pixel, boolean forDisplayDPI)
Converts the given amount of pixels to a DPI scaled value using the factor for the horizontal DPI value.- Parameters:
pixel
- the amount of pixels to convert.forDisplayDPI
- Whether the display DPI or the configured DPI should be considered.- Returns:
- The converted pixels.
- Since:
- 2.0
-
convertHorizontalDpiToPixel
public static int convertHorizontalDpiToPixel(int dpi)
Converts the given DPI scaled value to a pixel value using the factor for the horizontal DPI.- Parameters:
dpi
- the DPI value to convert.- Returns:
- The pixel value related to the given DPI
-
convertHorizontalDpiToPixel
public static int convertHorizontalDpiToPixel(int dpi, boolean forDisplayDPI)
Converts the given DPI scaled value to a pixel value using the factor for the horizontal DPI.- Parameters:
dpi
- the DPI value to convert.forDisplayDPI
- Whether the display DPI or the configured DPI should be considered.- Returns:
- The pixel value related to the given DPI
- Since:
- 2.0
-
convertVerticalPixelToDpi
public static int convertVerticalPixelToDpi(int pixel)
Converts the given amount of pixels to a DPI scaled value using the factor for the vertical DPI.- Parameters:
pixel
- the amount of pixels to convert.- Returns:
- The converted pixels.
-
convertVerticalPixelToDpi
public static int convertVerticalPixelToDpi(int pixel, boolean forDisplayDPI)
Converts the given amount of pixels to a DPI scaled value using the factor for the vertical DPI.- Parameters:
pixel
- the amount of pixels to convert.forDisplayDPI
- Whether the display DPI or the configured DPI should be considered.- Returns:
- The converted pixels.
- Since:
- 2.0
-
convertVerticalDpiToPixel
public static int convertVerticalDpiToPixel(int dpi)
Converts the given DPI scaled value to a pixel value using the factor for the vertical DPI.- Parameters:
dpi
- the DPI value to convert.- Returns:
- The pixel value related to the given DPI
-
convertVerticalDpiToPixel
public static int convertVerticalDpiToPixel(int dpi, boolean forDisplayDPI)
Converts the given DPI scaled value to a pixel value using the factor for the vertical DPI.- Parameters:
dpi
- the DPI value to convert.forDisplayDPI
- Whether the display DPI or the configured DPI should be considered.- Returns:
- The pixel value related to the given DPI
- Since:
- 2.0
-
convertHorizontalPixelToDpi
public static int convertHorizontalPixelToDpi(int pixel, IConfigRegistry configRegistry)
Default method to convert the given amount of pixels to a horizontal dots per inch value. The conversion is performed on theIDpiConverter
registered viaNatTableConfigAttributes.HORIZONTAL_DPI_CONVERTER
. If no converter is registered, a fallback toconvertHorizontalPixelToDpi(int)
is used.- Parameters:
pixel
- The pixel value to convert to dpi.configRegistry
- TheIConfigRegistry
to get theIDpiConverter
.- Returns:
- The dpi converted value.
- Since:
- 2.0
-
convertHorizontalDpiToPixel
public static int convertHorizontalDpiToPixel(int dpi, IConfigRegistry configRegistry)
Default method to convert the given amount of horizontal dots per inch to a pixel value. The conversion is performed on theIDpiConverter
registered viaNatTableConfigAttributes.HORIZONTAL_DPI_CONVERTER
. If no converter is registered, a fallback toconvertHorizontalDpiToPixel(int)
is used.- Parameters:
dpi
- The dpi value to convert to pixel.configRegistry
- TheIConfigRegistry
to get theIDpiConverter
.- Returns:
- The converted value.
- Since:
- 2.0
-
convertVerticalPixelToDpi
public static int convertVerticalPixelToDpi(int pixel, IConfigRegistry configRegistry)
Default method to convert the given amount of pixels to a vertical dots per inch value. The conversion is performed on theIDpiConverter
registered viaNatTableConfigAttributes.VERTICAL_DPI_CONVERTER
. If no converter is registered, a fallback toconvertVerticalPixelToDpi(int)
is used.- Parameters:
pixel
- The pixel value to convert to dpi.configRegistry
- TheIConfigRegistry
to get theIDpiConverter
.- Returns:
- The dpi converted value.
- Since:
- 2.0
-
convertVerticalDpiToPixel
public static int convertVerticalDpiToPixel(int dpi, IConfigRegistry configRegistry)
Default method to convert the given amount of vertical dots per inch to pixel. The conversion is performed on theIDpiConverter
registered viaNatTableConfigAttributes.VERTICAL_DPI_CONVERTER
. If no converter is registered, a fallback toconvertVerticalDpiToPixel(int)
is used.- Parameters:
dpi
- The dpi value to convert to pixel.configRegistry
- TheIConfigRegistry
to get theIDpiConverter
.- Returns:
- The converted value.
- Since:
- 2.0
-
-