// Get a color matrix from the current map intensity value. Can return null if intensity is 1.0. ColorMatrix ComputeColorMatrix() { if (mapIntensity < 0.99F) { float[][] colorMatrixElements = { new float[] { (float)mapIntensity, 0, 0, 0, 0 }, new float[] { 0, (float)mapIntensity, 0, 0, 0 }, new float[] { 0, 0, (float)mapIntensity, 0, 0 }, new float[] { 0, 0, 0, 1, 0 }, new float[] { (float)(1 - mapIntensity), (float)(1 - mapIntensity), (float)(1 - mapIntensity), 0, 1 } }; ColorMatrix colorMatrix = new ColorMatrix(colorMatrixElements); return(colorMatrix); } else { return(null); // full intensity. } }
// Get a color matrix from the current map intensity value. Can return null if intensity is 1.0. ColorMatrix ComputeColorMatrix() { if (mapIntensity < 0.99F) { float[][] colorMatrixElements = { new float[] {(float)mapIntensity, 0, 0, 0, 0}, new float[] {0, (float)mapIntensity, 0, 0, 0}, new float[] {0, 0, (float)mapIntensity, 0, 0}, new float[] {0, 0, 0, 1, 0}, new float[] {(float) (1-mapIntensity), (float) (1-mapIntensity), (float) (1-mapIntensity), 0, 1}}; ColorMatrix colorMatrix = new ColorMatrix(colorMatrixElements); return colorMatrix; } else return null; // full intensity. }