Package com.luciad.drawing
Class ImageIcon
java.lang.Object
com.luciad.drawing.ImageIcon
Helper class for loading JPEG or PNG files.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class -
Method Summary
-
Method Details
-
create
Create anIIconfrom a PNG or JPEG file.Will throw a RuntimeError if the file does not contain any valid data or if the file format could not be recognized.
It accepts icon files with following naming convention.
- The base icon at display scale 1 is named
<name>.<ext>where<ext>is PNG or JPEG. - The icon at display scale
fis named<name>@<f>x.<ext>.fis typically a value like 2 or 4. See the article on high DPI for additional information.
- Parameters:
filePath- a file path- Returns:
- an
IIconfrom a PNG or JPEG file - Throws:
RuntimeException- if the file does not contain any valid data or if the file format could not be recognized.
- The base icon at display scale 1 is named
-
toIcon
Converts anImageto an Icon.The used display scale is 1. The anchor point of the icon is at the center of the image.
- Parameters:
image- theImageto convert.- Returns:
- the
IIcon. - Throws:
NullPointerException- when passing anullvalue.- Since:
- 2023.1
-
newBuilder
Creates a Builder which allows to construct anIIconbased on 1 or more images.- Returns:
- the builder.
- Since:
- 2023.1
-