# HG changeset patch # User sam # Date 1724675952 -25200 # Node ID edb0b650fc5fd04aade157bf8cb3f64911c99cf0 # Parent 34ae5835bfa87ec2a7691cf9961a60aaa89e35ce add: allow adding single images to image array diff -r 34ae5835bfa8 -r edb0b650fc5f semicongine/image.nim --- a/semicongine/image.nim Mon Aug 26 18:51:25 2024 +0700 +++ b/semicongine/image.nim Mon Aug 26 19:39:12 2024 +0700 @@ -105,6 +105,15 @@ loadImageData[T](loadResource_intern(path, package = package).readAll()) result = Image[T](width: width, height: height, data: data) +proc addImage*[T: PixelType](imageArray: var ImageArray[T], image: sink Image[T]) = + assert image.width == imageArray.width, + "Image needs to have same dimension as ImageArray to be added" + assert image.height == imageArray.height, + "Image needs to have same dimension as ImageArray to be added" + + inc image.nLayers + imageArray.data.add image.data + proc loadImageArray*[T: PixelType]( paths: openArray[string], package = DEFAULT_PACKAGE ): ImageArray[T] =