Skip to content

Commit

Permalink
Add Kdoc to the image utility
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisTraub committed Feb 24, 2025
1 parent 80c2e9c commit 558db9c
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -24,4 +36,4 @@ object ImageTools {
throw RuntimeException(e)
}
}
}
}

0 comments on commit 558db9c

Please sign in to comment.