RgbMixerFilter Class
Maps a linear combination of all input color channels onto each output color channel so that c_out = f(a_in, r_in, g_in, b_in).


Namespace: Lumia.Imaging.Adjustments
Assembly: Lumia.Imaging (in Lumia.Imaging.dll) Version: 255.255.255.255
In practice that means the resulting color is calculated from 16 curves following the equation:
a_out = sat (Alpha.Alpha[a_in] + Red.Alpha[r_in] + Green.Alpha[g_in] + Blue.Alpha[b_in])
r_out = sat (Alpha.Red[a_in] + Red.Red[r_in] + Green.Red[g_in] + Blue.Red[b_in])
g_out = sat (Alpha.Green[a_in] + Red.Green[r_in] + Green.Green[g_in] + Blue.Green[b_in])
b_out = sat (Alpha.Blue[a_in] + Red.Blue[r_in] + Green.Blue[g_in] + Blue.Blue[b_in])Unused curves can be set to null.
using (var filterEffect = new FilterEffect(source)) { // Initialize the filter and add the filter to the FilterEffect collection var filter = new RgbMixerFilter(); #region Alpha Output filter.Alpha.Alpha.SetPoint(0, 0); filter.Alpha.Alpha.SetPoint(255, 255); filter.Red.Alpha.SetPoint(0, 0); filter.Red.Alpha.SetPoint(255, 0); filter.Green.Alpha.SetPoint(0, 0); filter.Green.Alpha.SetPoint(255, 0); filter.Blue.Alpha.SetPoint(0, 0); filter.Blue.Alpha.SetPoint(255, 0); #endregion #region Red Output filter.Alpha.Red.SetPoint(0, 0); filter.Alpha.Red.SetPoint(255, 0); filter.Red.Red.SetPoint(0, 0); filter.Red.Red.SetPoint(255, 128); filter.Blue.Red.SetPoint(0, 0); filter.Blue.Red.SetPoint(255, 0); filter.Green.Red.SetPoint(0, 0); filter.Green.Red.SetPoint(255, 128); #endregion #region Green Output filter.Alpha.Green.SetPoint(0, 0); filter.Alpha.Green.SetPoint(255, 0); filter.Red.Green.SetPoint(0, 0); filter.Red.Green.SetPoint(255, 128); filter.Green.Green.SetPoint(0, 0); filter.Green.Green.SetPoint(255, 0); filter.Blue.Green.SetPoint(0, 0); filter.Blue.Green.SetPoint(255, 128); #endregion #region Blue Output filter.Alpha.Blue.SetPoint(0, 0); filter.Alpha.Blue.SetPoint(255, 0); filter.Red.Blue.SetPoint(0, 0); filter.Red.Blue.SetPoint(255, 0); filter.Green.Blue.SetPoint(0, 0); filter.Green.Blue.SetPoint(255, 128); filter.Blue.Blue.SetPoint(0, 0); filter.Blue.Blue.SetPoint(255, 128); #endregion filterEffect.Filters = new IFilter[] { filter }; // Create a target where the filtered image will be rendered to var target = new WriteableBitmap(width, height); // Create a new renderer which outputs WriteableBitmaps using (var renderer = new WriteableBitmapRenderer(filterEffect, target)) { // Render the image with the filter(s) await renderer.RenderAsync(); // Set the output image to Image control as a source ImageControl.Source = target; } await SaveEffectAsync(filterEffect, "RgbMixerFilter.jpg", outputImageSize); }
Show: