Skip to content

Commit

Permalink
fix vertical space
Browse files Browse the repository at this point in the history
  • Loading branch information
bjornregnell committed Jun 11, 2024
1 parent c02ec38 commit 2b33e63
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/main/scala/introprog/Image.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ object Image:
Image(BufferedImage(width, height, BufferedImage.TYPE_INT_RGB))



class Image (val underlying: java.awt.image.BufferedImage):
import java.awt.Color
import java.awt.image.BufferedImage


/** Get color of pixel at `(x, y)`.*/
def apply(x: Int, y: Int): Color = Color(underlying.getRGB(x, y))
Expand All @@ -31,7 +29,6 @@ class Image (val underlying: java.awt.image.BufferedImage):
update(x, y, f(x, y))
this


/** Extract and return image pixels. */
def toMatrix: Array[Array[Color]] =
val xs: Array[Array[Color]] = Array.ofDim(width, height)
Expand Down Expand Up @@ -63,8 +60,9 @@ class Image (val underlying: java.awt.image.BufferedImage):
bi.createGraphics().drawImage(underlying, 0, 0, width, height, null)
Image(bi)


val hasAlpha = underlying.getColorModel.hasAlpha

val height = underlying.getHeight

val width = underlying.getWidth

0 comments on commit 2b33e63

Please sign in to comment.