×

SplitToneFilter Class

Applies a given color to pixels with luminance values within a specified range, while retaining some luminance information.

Inheritance Hierarchy

System..::..Object  Nokia.Graphics.Imaging..::..SplitToneFilter

Namespace: Nokia.Graphics.ImagingAssembly: Nokia.Graphics.Imaging (in Nokia.Graphics.Imaging.dll) Version: 255.255.255.255

Syntax

C#
public sealed class SplitToneFilter : IFilter, 
	__ISplitToneFilterPublicNonVirtuals
Visual Basic
Public NotInheritable Class SplitToneFilter 
	Implements IFilter, __ISplitToneFilterPublicNonVirtuals
Visual C++
public ref class SplitToneFilter sealed : IFilter, 
	__ISplitToneFilterPublicNonVirtuals

Examples

C#

This sample takes CameraCaptureTask result photo and applies a filter to it.

async void CaptureTask_Completed(object sender, PhotoResult e)
{
    // Create a source to read the image from PhotoResult stream
    using (var source = new StreamImageSource(e.ChosenPhoto))
    {
        // Create effect collection with the source stream
        using (var filters = new FilterEffect(source))
        {
            var list = new List<SplitToneRange> {
                new SplitToneRange(100, 150, Windows.UI.Color.FromArgb(255, 155, 145, 138)),
                new SplitToneRange(160, 169, Windows.UI.Color.FromArgb(255, 155, 230, 142)),
                new SplitToneRange(170, 172, Windows.UI.Color.FromArgb(255, 155, 130, 49)),
                new SplitToneRange(175, 180, Windows.UI.Color.FromArgb(255, 255, 245, 238))
            };
            // Initialize the filter
            var sampleFilter = new SplitToneFilter(list);

            // Add the filter to the FilterEffect collection
            filters.Filters = new IFilter[] { sampleFilter };

            // Create a target where the filtered image will be rendered to
            var target = new WriteableBitmap((int)ImageControl.ActualWidth, (int)ImageControl.ActualHeight);

            // Create a new renderer which outputs WriteableBitmaps
            using (var renderer = new WriteableBitmapRenderer(filters, target))
            {
                // Render the image with the filter(s)
                await renderer.RenderAsync();

                // Set the output image to Image control as a source
                ImageControl.Source = target;
            }
        }
    }
}
Visual Basic


Visual C++



Last updated 19 June 2014

Back to top

×