-
Notifications
You must be signed in to change notification settings - Fork 0
/
CustomEffect.cs
35 lines (28 loc) · 1.12 KB
/
CustomEffect.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
Note: This is an entry in the Nokia Original Imaging Effect Wiki Challenge 2014Q2. This application demonstrates the implementation of real-time red filter using Nokia Imaging SDK.
* Developer: Manojit Ghosh
*/
using Nokia.Graphics.Imaging;
namespace RealtimeFilterDemo
{
public class CustomEffect : CustomEffectBase
{
public CustomEffect(IImageProvider source) : base(source)
{
}
protected override void OnProcess(PixelRegion sourcePixelRegion, PixelRegion targetPixelRegion)
{
var sourcePixels = sourcePixelRegion.ImagePixels;
var targetPixels = targetPixelRegion.ImagePixels;
sourcePixelRegion.ForEachRow((index, width, position) =>
{
for (int x = 0; x < width; ++x, ++index)
{
// the only supported color format is ColorFormat.Bgra8888
uint pixel = sourcePixels[index]&0xffff0000; //Green & Blue components are removed using Bitwise-AND operator
targetPixels[index] = pixel;
}
});
}
}
}