Skip to content

Commit

Permalink
improve doc comments on Image
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornregnell committed Jun 11, 2024
1 parent 2b33e63 commit 9419136
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/scala/introprog/Image.scala
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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

0 comments on commit 9419136

Please sign in to comment.