×

ImageFusionFilter Class

Inserts an image on the current image with a separately defined alpha mask.

Inheritance Hierarchy

System..::..Object  Nokia.Graphics.Imaging..::..ImageFusionFilter

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

Syntax

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

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))
        {
            ImageFusionFilter sampleFilter;

            // Create a plain red image
            using (var colorSource = new ColorImageSource(new Windows.Foundation.Size(768, 1280), Windows.UI.Color.FromArgb(255, 255, 0, 0)))
            {
                // Read a mask image file
                const string imageFile = @"Assets\mask.jpg";
                var file = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(imageFile);
                var maskSource = new StorageFileImageSource(file);

                // Initialize the filter
                sampleFilter = new ImageFusionFilter(colorSource, maskSource, false);
            }

            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

×