From 9419136498e8cb10c0ecf8be4d9a84e0b58e938c Mon Sep 17 00:00:00 2001 From: bjornregnell Date: Tue, 11 Jun 2024 19:41:37 +0200 Subject: [PATCH] improve doc comments on Image --- src/main/scala/introprog/Image.scala | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/scala/introprog/Image.scala b/src/main/scala/introprog/Image.scala index 553acfc..47295c9 100644 --- a/src/main/scala/introprog/Image.scala +++ b/src/main/scala/introprog/Image.scala @@ -1,13 +1,13 @@ package introprog - +/** Companion object to create Image instances */ object Image: import java.awt.image.BufferedImage /** Create new empty Image with specified dimensions `(width, height)`*/ def ofDim(width: Int, height: Int) = Image(BufferedImage(width, height, BufferedImage.TYPE_INT_RGB)) - +/** Image represents pixel arrays backed by underlying java.awtimage.BufferedImage */ class Image (val underlying: java.awt.image.BufferedImage): import java.awt.Color import java.awt.image.BufferedImage @@ -59,10 +59,13 @@ class Image (val underlying: java.awt.image.BufferedImage): val bi = BufferedImage(width, height, imageType) bi.createGraphics().drawImage(underlying, 0, 0, width, height, null) Image(bi) - + + /** Test if alpha channel is supperted. */ val hasAlpha = underlying.getColorModel.hasAlpha + /** The height of this image. */ val height = underlying.getHeight + /** The width of this image. */ val width = underlying.getWidth \ No newline at end of file