I'm trying to run some slightly-modified code from an MSDN article as part of a school project. The goal is to use a colormatrix to recolor a bitmap in a picture box. Here's my code:
float[][] colorMatrixElements = {
new float[] {rScale, 0, 0, 0},
new float[] {0, gScale, 0, 0},
new float[] {0, 0, bScale, 0},
new float[] {0, 0, 0, 1}};
ColorMatrix colorMatrix = new ColorMatrix(colorMatrixElements);
where rScale, gScale, and bScale are floats with values from 0.0f to 1. The original MSDN article is here: https://msdn.microsoft.com/en-us/library/6tf7sa87%28v=vs.110%29.aspx
When it gets down to the last line, "ColorMatrix colorMatrix = new... " my code hits a runtime error. In the debugger, I get colorMatrixElements as a float[4][]. As if it's not a 4x4 array. Did I botch something in my copy-paste job, or am I just not understanding how C# handles 2D arrays?
Thanks for the help.