You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Images.kt file, fun Image.map(overlay: Image, f: (Pixel, Pixel) -> Pixel): Image combines overlay and this to produce a new Image using the function f to map pixels from the two images. The call, as of now, will fail if overlay width or height is smaller than this.
I'm not sure what the expected (most intuitive?) behaviour should be. It appears we have the following options:
Resize overlay to match this
Use overlay "as is", then the returned image size has the highest width / height of the two (e.g. max(this.width, overlay.width)). Non-existent pixels are substituted with transparent color pixels.
Suggestions are welcome.
The text was updated successfully, but these errors were encountered:
I think, another option it is to add to map function third parameter (let's say mapType enum), which will define the type of mapping:
STRICT - as it is;
CENTER - overlay will be applied to center of the image;
HORIZONTAL_FILL - overlay will be resized without change of proportions to match width of the image;
VERTICAL_FILL - same as horizontal, though with height matching;
STRETCH - resize overlay to fully fit the image;
STRETCH_PROPORTINAL - resize to fully fit the image, saving proprtions;
TILE - tile overlay over image;
well, maybe it is better to have them as different functions.
In Images.kt file,
fun Image.map(overlay: Image, f: (Pixel, Pixel) -> Pixel): Image
combinesoverlay
andthis
to produce a newImage
using the functionf
to map pixels from the two images. The call, as of now, will fail ifoverlay
width or height is smaller thanthis
.I'm not sure what the expected (most intuitive?) behaviour should be. It appears we have the following options:
overlay
to matchthis
overlay
"as is", then the returned image size has the highest width / height of the two (e.g.max(this.width, overlay.width)
). Non-existent pixels are substituted with transparent color pixels.Suggestions are welcome.
The text was updated successfully, but these errors were encountered: