Pinta.ImageManipulation.Effects.BrightnessContrastEffect.Render C# (CSharp) Method

Render() protected method

protected Render ( ColorBgra src, ColorBgra dst, int length ) : void
src ColorBgra
dst ColorBgra
length int
return void
		protected override unsafe void Render (ColorBgra* src, ColorBgra* dst, int length)
		{
			var srcRowPtr = src;
			var dstRowPtr = dst;
			var dstRowEndPtr = dstRowPtr + length;

			if (divide == 0) {
				while (dstRowPtr < dstRowEndPtr) {
					var col = *srcRowPtr;
					var i = col.GetIntensityByte ();
					uint c = rgbTable[i];
					dstRowPtr->Bgra = (col.Bgra & 0xff000000) | c | (c << 8) | (c << 16);

					++dstRowPtr;
					++srcRowPtr;
				}
			} else {
				while (dstRowPtr < dstRowEndPtr) {
					var col = *srcRowPtr;
					var i = col.GetIntensityByte ();
					var shiftIndex = i * 256;

					col.R = rgbTable[shiftIndex + col.R];
					col.G = rgbTable[shiftIndex + col.G];
					col.B = rgbTable[shiftIndex + col.B];

					*dstRowPtr = col;
					++dstRowPtr;
					++srcRowPtr;
				}
			}
		}

Usage Example

		public void BrightnessContrastEffect2 ()
		{
			var src = GetSourceImage ("input.png");

			var effect = new BrightnessContrastEffect (80, 20);
			effect.Render (src);

			Compare (src, "brightnesscontrast2.png");
		}
All Usage Examples Of Pinta.ImageManipulation.Effects.BrightnessContrastEffect::Render