public override ColorBgra GetGradientValue(double lerp, uint pixelId) { int num3; double num4; uint h = pixelId * 0x5bd1e995; h ^= h >> 0x18; h *= 0x5bd1e995; h ^= this.ditherSeed; h ^= h >> 13; h *= 0x5bd1e995; h ^= h >> 15; int num2 = ((int)h) & 0xfffffff; if (!this.ditherB) { num4 = 0.0; } else { h = GradientBlender <ColorBgra> .XorShift(h); num3 = ((int)h) & 0xfffffff; num4 = (num2 - num3) * 3.7252903123397019E-09; num2 = num3; } double num5 = DoubleUtil.ClampToByte(((this.startB + (this.diffB * lerp)) + num4) + 0.5); if (!this.ditherG) { num4 = 0.0; } else { h = GradientBlender <ColorBgra> .XorShift(h); num3 = ((int)h) & 0xfffffff; num4 = (num2 - num3) * 3.7252903123397019E-09; num2 = num3; } double num6 = DoubleUtil.ClampToByte(((this.startG + (this.diffG * lerp)) + num4) + 0.5); if (!this.ditherR) { num4 = 0.0; } else { num3 = ((int)GradientBlender <ColorBgra> .XorShift(h)) & 0xfffffff; num4 = (num2 - num3) * 3.7252903123397019E-09; num2 = num3; } double num7 = DoubleUtil.ClampToByte(((this.startR + (this.diffR * lerp)) + num4) + 0.5); return(ColorBgra.FromBgra((byte)num5, (byte)num6, (byte)num7, 0xff)); }
private static byte GetMaskValue(byte tolerance, byte distance) { if (tolerance == 0xff) { return(0xff); } byte num = (byte)Math.Max(0, distance - tolerance); byte num2 = (byte)(0xff - tolerance); double d = ((double)num) / ((double)num2); double num4 = 1.0 - d; double num5 = Math.Sqrt(num4); double num6 = Math.Sqrt(d); double num7 = 1.0 - num6; double num8 = 255.0 * num7; return(DoubleUtil.ClampToByte(Math.Round(num8, MidpointRounding.AwayFromZero))); }
public override ColorAlpha8 GetGradientValue(double lerp, uint pixelId) { double num; if (!this.ditherA) { num = 0.0; } else { uint h = pixelId * 0x5bd1e995; h ^= h >> 0x18; h *= 0x5bd1e995; h ^= this.ditherSeed; h ^= h >> 13; h *= 0x5bd1e995; h ^= h >> 15; int num3 = ((int)h) & 0xfffffff; int num4 = ((int)GradientBlender <ColorAlpha8> .XorShift(h)) & 0xfffffff; num = (num3 - num4) * 3.7252903123397019E-09; } return(new ColorAlpha8(DoubleUtil.ClampToByte(((this.startAlpha + (this.diffAlpha * lerp)) + num) + 0.5))); }
public override ColorBgra GetGradientValue(double lerp, uint pixelId) { int num8; double num9; double num = this.startA + (this.diffA * lerp); if (num == 0.0) { return(ColorBgra.TransparentBlack); } double num2 = 1.0 / num; double num3 = (this.startB + (this.diffB * lerp)) * num2; double num4 = (this.startG + (this.diffG * lerp)) * num2; double num5 = (this.startR + (this.diffR * lerp)) * num2; uint h = pixelId * 0x5bd1e995; h ^= h >> 0x18; h *= 0x5bd1e995; h ^= this.ditherSeed; h ^= h >> 13; h *= 0x5bd1e995; h ^= h >> 15; int num7 = ((int)h) & 0xfffffff; if (!this.ditherB) { num9 = 0.0; } else { h = GradientBlender <ColorBgra> .XorShift(h); num8 = ((int)h) & 0xfffffff; num9 = (num7 - num8) * 3.7252903123397019E-09; num7 = num8; } num3 = DoubleUtil.ClampToByte((num3 + num9) + 0.5); if (!this.ditherG) { num9 = 0.0; } else { h = GradientBlender <ColorBgra> .XorShift(h); num8 = ((int)h) & 0xfffffff; num9 = (num7 - num8) * 3.7252903123397019E-09; num7 = num8; } num4 = DoubleUtil.ClampToByte((num4 + num9) + 0.5); if (!this.ditherR) { num9 = 0.0; } else { h = GradientBlender <ColorBgra> .XorShift(h); num8 = ((int)h) & 0xfffffff; num9 = (num7 - num8) * 3.7252903123397019E-09; num7 = num8; } num5 = DoubleUtil.ClampToByte((num5 + num9) + 0.5); if (!this.ditherA) { num9 = 0.0; } else { num8 = ((int)GradientBlender <ColorBgra> .XorShift(h)) & 0x3fffffff; num9 = (num7 - num8) * 3.7252903123397019E-09; num7 = num8; } num = DoubleUtil.ClampToByte((num + num9) + 0.5); return(ColorBgra.FromBgra((byte)num3, (byte)num4, (byte)num5, (byte)num)); }