GradientImageSource Class

An image source that generates pixels based on a gradient.

Inheritance Hierarchy

System..::..Object  Nokia.Graphics.Imaging..::..GradientImageSource

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


public sealed class GradientImageSource : IClosable, 
	IImageProvider, IImageSize, __IGradientImageSourcePublicNonVirtuals
Visual Basic
Public NotInheritable Class GradientImageSource 
	Implements IClosable, IImageProvider, IImageSize, __IGradientImageSourcePublicNonVirtuals
Visual C++
public ref class GradientImageSource sealed : IClosable, 
	IImageProvider, IImageSize, __IGradientImageSourcePublicNonVirtuals



This sample renders a simple gradient to screen without any effects.

private async Task ShowGradientImageTask()
    var colorStops = new[]
        new GradientStop {Color = Color.FromArgb(255, 255, 0, 0), Offset = 0.0},
        new GradientStop {Color = Color.FromArgb(255, 255, 200, 255), Offset = 1.0} 

    var gradient = new LinearGradient(new Windows.Foundation.Point(0, 0), new Windows.Foundation.Point(0, 1), colorStops);
    var size = new Windows.Foundation.Size((int)ImageControl.ActualWidth, (int)ImageControl.ActualHeight);

    using (var source = new GradientImageSource(size, gradient))
        // 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(source, target))
            // Render the image
            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

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.