From 558db9c7189b3d64b86c61dcdb3174d8bdb1b449 Mon Sep 17 00:00:00 2001 From: Dennis Traub Date: Mon, 24 Feb 2025 12:53:25 +0100 Subject: [PATCH] Add Kdoc to the image utility --- .../com/example/bedrockruntime/libs/ImageTools.kt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/kotlin/services/bedrock-runtime/src/main/kotlin/com/example/bedrockruntime/libs/ImageTools.kt b/kotlin/services/bedrock-runtime/src/main/kotlin/com/example/bedrockruntime/libs/ImageTools.kt index 4e1c6bcd9e6..98f9a72750e 100644 --- a/kotlin/services/bedrock-runtime/src/main/kotlin/com/example/bedrockruntime/libs/ImageTools.kt +++ b/kotlin/services/bedrock-runtime/src/main/kotlin/com/example/bedrockruntime/libs/ImageTools.kt @@ -10,7 +10,19 @@ import javax.swing.ImageIcon import javax.swing.JFrame import javax.swing.JLabel +/** + * Utility object for handling image-related operations. + */ object ImageTools { + /** + * Displays a byte array as an image in a new window. + * + * Creates a new JFrame window that displays the image represented by the provided byte array. + * The window will close the application when closed (EXIT_ON_CLOSE). + * + * @param imageData The image data as a byte array + * @throws RuntimeException if there is an error reading the image data + */ fun displayImage(imageData: ByteArray) { try { val image = ImageIO.read(ByteArrayInputStream(imageData)) @@ -24,4 +36,4 @@ object ImageTools { throw RuntimeException(e) } } -} \ No newline at end of file +}