From 16e6e514728ce555cd6d372f5756dd2cb4082118 Mon Sep 17 00:00:00 2001 From: LordBaryhobal Date: Mon, 4 Dec 2023 15:31:27 +0100 Subject: [PATCH] task 2 --- src/imagefilters/ImageFilters.scala | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/imagefilters/ImageFilters.scala b/src/imagefilters/ImageFilters.scala index a412260..18c71c1 100644 --- a/src/imagefilters/ImageFilters.scala +++ b/src/imagefilters/ImageFilters.scala @@ -6,8 +6,14 @@ package imagefilters object ImageFilters { def duplicate(a: Array[Array[Int]]): Array[Array[Int]] = { - - /* TODO: Write your code hereunder */ - return Array.empty + val height: Int = a.length + val width: Int = if (height == 0) 0 else a(0).length + val res: Array[Array[Int]] = Array.ofDim(height, width) + for (y: Int <- 0 until height) { + for (x: Int <- 0 until width) { + res(y)(x) = a(y)(x) + } + } + return res } }