Skip to content

Proposal: Add MutateAsync() support. #2465

Answered by tocsoft
icanhasjonas asked this question in Ideas
Discussion options

You must be logged in to vote

could you not just use this pattern instead? just call Mutate(..) multiple times.

using var resultImage = new Image<Abgr32>(1024, 1024, new Abgr32());
var graphicsOptions = new GraphicsOptions {
    AlphaCompositionMode = PixelAlphaCompositionMode.SrcOver,
};
foreach( var model in assetLayers ) {
    await using var stream = await _httpClient.GetStreamAsync(assetModel.ImageUrl);
    using var layer = await Image.LoadAsync(stream);
    resultImage.Mutate(x => x.DrawImage(layer, new Point(0, 0), graphicsOptions))
}

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@tocsoft
Comment options

Answer selected by icanhasjonas
@icanhasjonas
Comment options

@icanhasjonas
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
3 participants