public async Task DrawMaskAsync() { using (var g = new GraphicsService()) { var d = new CardDetails(Context.Account, Context.User); using (Bitmap card = g.DrawCard(d, PaletteType.GammaGreen)) { using (var factory = new TextFactory()) { Grid <float> mask = ImageHelper.GetOpacityMask(card); var pixels = new Grid <Color>(card.Size, new ImmutableColor(0, 0, 0, 255)); // TODO: Make ImmutableColor.Empty values pixels.SetEachValue((x, y) => ImmutableColor.Blend(new ImmutableColor(0, 0, 0, 255), new ImmutableColor(255, 255, 255, 255), mask.GetValue(x, y))); using (Bitmap masked = ImageHelper.CreateRgbBitmap(pixels.Values)) await Context.Channel.SendImageAsync(masked, $"../tmp/{Context.User.Id}_card_mask.png"); } } } }