Utility class providing helper methods for common image-related operations in JavaFX.
More...
|
| BackgroundImage | createBackgroundImage (Image resizedImage) |
| | Creates a JavaFX BackgroundImage from the provided image.
|
| |
| ImageMeta | getImageMeta (File file) |
| | Reads image metadata (width, height) and calculates the scale factor needed to resize the image so it fits within a predefined grid pane area (3 times the visual width and height), without fully loading the image in memory.
|
| |
| Color | intToColor (int colorValue) |
| | Converts a 32-bit integer color value in the format 0xRRGGBBAA into a JavaFX Color object.
|
| |
| boolean | isValidImage (File file) |
| | Determines if the given file has a supported image extension.
|
| |
Utility class providing helper methods for common image-related operations in JavaFX.
Includes support for:
-
Converting 32-bit integer colors to JavaFX
Color
-
Validating image file formats
-
Calculating scale factors to resize images to fit layout constraints
-
Creating
BackgroundImage instances with custom layout properties
All methods throw IllegalArgumentException when passed null arguments.
This class is not instantiable and is intended to be used statically.
◆ createBackgroundImage()
| BackgroundImage fr.softsf.sudokufx.common.util.ImageUtils.createBackgroundImage |
( |
Image | resizedImage | ) |
|
Creates a JavaFX BackgroundImage from the provided image.
The background image is centered, non-repeating, and sized to one-third of the original image's width and height.
- Parameters
-
| resizedImage | the image to use as the background; must not be null |
- Returns
- a
BackgroundImage configured with the given image
- Exceptions
-
| IllegalArgumentException | if resizedImage is null |
◆ getImageMeta()
| ImageMeta fr.softsf.sudokufx.common.util.ImageUtils.getImageMeta |
( |
File | file | ) |
|
Reads image metadata (width, height) and calculates the scale factor needed to resize the image so it fits within a predefined grid pane area (3 times the visual width and height), without fully loading the image in memory.
- Parameters
-
| file | the image file; must not be null |
- Returns
- ImageMeta containing width, height and scaleFactor
- Exceptions
-
| IllegalArgumentException | if file is null, cannot be opened as image stream, has unsupported format, invalid structure, or zero dimensions |
| UncheckedIOException | if an I/O error occurs while reading the image file |
◆ intToColor()
| Color fr.softsf.sudokufx.common.util.ImageUtils.intToColor |
( |
int | colorValue | ) |
|
Converts a 32-bit integer color value in the format 0xRRGGBBAA into a JavaFX Color object.
- Parameters
-
| colorValue | The color as an integer in hexadecimal format (0xRRGGBBAA). |
- Returns
- A
Color instance representing the given color and alpha.
◆ isValidImage()
| boolean fr.softsf.sudokufx.common.util.ImageUtils.isValidImage |
( |
File | file | ) |
|
Determines if the given file has a supported image extension.
Accepted formats: JPG, JPEG, PNG, BMP (case-insensitive).
- Parameters
-
| file | the file to check; must not be null |
- Returns
true if the file has a valid image extension; false otherwise
- Exceptions
-
| IllegalArgumentException | if file is null |
◆ ALPHA_NORMALIZATION
| final double fr.softsf.sudokufx.common.util.ImageUtils.ALPHA_NORMALIZATION = 255.0 |
|
staticprivate |
◆ ALPHA_SHIFT
| final int fr.softsf.sudokufx.common.util.ImageUtils.ALPHA_SHIFT = 0 |
|
staticprivate |
◆ BLUE_SHIFT
| final int fr.softsf.sudokufx.common.util.ImageUtils.BLUE_SHIFT = 8 |
|
staticprivate |
◆ BYTE_MASK
| final int fr.softsf.sudokufx.common.util.ImageUtils.BYTE_MASK = 0xFF |
|
staticprivate |
◆ GREEN_SHIFT
| final int fr.softsf.sudokufx.common.util.ImageUtils.GREEN_SHIFT = 16 |
|
staticprivate |
◆ LOG
| final Logger fr.softsf.sudokufx.common.util.ImageUtils.LOG = LoggerFactory.getLogger(ImageUtils.class) |
|
staticprivate |
◆ RED_SHIFT
| final int fr.softsf.sudokufx.common.util.ImageUtils.RED_SHIFT = 24 |
|
staticprivate |
The documentation for this class was generated from the following file: