@OpenApiAll
public class RetinaUtilities
extends java.lang.Object
Constructor and Description |
---|
RetinaUtilities() |
Modifier and Type | Method and Description |
---|---|
static java.awt.Cursor |
createCursor(javax.swing.Icon icon,
java.awt.Point pt,
java.lang.String cursorName)
Creates a cursor from a given icon.
|
static ScalableImageIcon |
createIcon(java.awt.Image image)
Create retina friendly image icon from a given image.
|
static java.awt.image.BufferedImage |
createImage(int width,
int height,
int type)
Create retina friendly buffered image if retina is enabled.
|
static java.awt.Image |
createMultiResolutionImage(byte[] smallIconData,
byte[] largeIconData)
Create a multi resolution friendly image from a pair of given images - small (regular) and large one.
|
static java.awt.Image |
createMultiResolutionImage(java.awt.image.RenderedImage smallImage,
java.awt.image.RenderedImage largeImage)
Create a multi resolution friendly image from a pair of given images - small (regular) and large one.
|
static int |
getRetinaScaling()
Retrieve retina scaling factor from a default screen device.
|
static boolean |
isMultiResolutionToolkitImage(java.awt.Image image) |
static boolean |
isRetinaScalingDefined() |
static void |
paintRetinaImage(java.awt.Image img,
java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
Paint given retina image on the graphics.
|
static double |
scaleDown(double size)
Scale given size by retina factor.
|
static double |
scaleUp(double size)
Scale size
|
static int |
scaleUp(int size)
Scale given size by retina factor.
|
static java.awt.Image |
toMultiResolutionImage(javax.swing.Icon smallIcon,
javax.swing.Icon largeIcon)
Create a multi resolution friendly image from a pair of given icons - small (regular) and large one.
|
public static boolean isRetinaScalingDefined()
public static int getRetinaScaling()
GraphicsEnvironment.getDefaultScreenDevice()
public static int scaleUp(int size)
size
- sizepublic static double scaleUp(double size)
size
- sizepublic static double scaleDown(double size)
size
- sizepublic static java.awt.image.BufferedImage createImage(int width, int height, int type)
width
- widthheight
- heighttype
- image typepublic static ScalableImageIcon createIcon(java.awt.Image image)
image
- imageRetinaImageIcon
public static java.awt.Cursor createCursor(javax.swing.Icon icon, java.awt.Point pt, java.lang.String cursorName)
icon
- the given iconpt
- the hot pointcursorName
- the cursor nametoMultiResolutionImage(javax.swing.Icon, javax.swing.Icon)
public static void paintRetinaImage(java.awt.Image img, @CheckForNull java.awt.Component c, java.awt.Graphics g, int x, int y)
img
- imagec
- componentg
- graphicsx
- xy
- ypublic static java.awt.Image createMultiResolutionImage(java.awt.image.RenderedImage smallImage, java.awt.image.RenderedImage largeImage)
smallImage
- small imagelargeImage
- large iconisMultiResolutionToolkitImage(java.awt.Image)
public static java.awt.Image createMultiResolutionImage(byte[] smallIconData, byte[] largeIconData)
smallIconData
- small image datalargeIconData
- large image dataisMultiResolutionToolkitImage(java.awt.Image)
public static java.awt.Image toMultiResolutionImage(javax.swing.Icon smallIcon, @CheckForNull javax.swing.Icon largeIcon)
smallIcon
- small iconlargeIcon
- large iconisMultiResolutionToolkitImage(java.awt.Image)
public static boolean isMultiResolutionToolkitImage(java.awt.Image image)
image
- image