add functionality to flip drawing horizontally
This commit is contained in:
@@ -32,4 +32,14 @@ struct
|
||||
fun makeEmpty maxSide =
|
||||
Vector.tabulate (maxSide, fn _ =>
|
||||
Vector.tabulate (maxSide, fn _ => emptyPixel))
|
||||
|
||||
fun flipHorizontally (xAxis: t) =
|
||||
Vector.mapi
|
||||
(fn (xIdx, yAxis) =>
|
||||
let
|
||||
val flippedXIdx = Vector.length xAxis - 1 - xIdx
|
||||
val flippedYAxis = Vector.sub (xAxis, flippedXIdx)
|
||||
in
|
||||
Vector.mapi (fn (yIdx, _) => Vector.sub (flippedYAxis, yIdx)) yAxis
|
||||
end) xAxis
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user