/// a method to write the image data to the texture. protected void WriteUserTexture() { // the size of the target data int i = XRes * YRes - 1; // the array which holds the image UInt16MapData imageData = m_metaData.GetLabelMap(); // loop over the target array (x and y). for (int y = 0; y < YRes; ++y) { for (int x = 0; x < XRes; ++x, i--) // the position is from end to start because of difference in coordinate systems { // we transform the RGB24Pixel data (Received from the image) to a Color. int pixel = imageData[x * m_factor, y *m_factor]; if (pixel == 0) { m_mapPixels[i] = m_backgroundColor; } else { int ind = pixel % UserColors.Count; m_mapPixels[i] = UserColors[ind]; } } } m_mapTexture.SetPixels(m_mapPixels); m_mapTexture.Apply(); }
protected void WriteUserTexture() { int i = XRes * YRes - 1; UInt16MapData imageData = m_metaData.GetLabelMap(); for (int y = 0; y < YRes; y++) { for (int x = 0; x < XRes; x++, i--) { int piexl = imageData[x * m_factor, y *m_factor]; //testPixel=piexl; if (piexl == 0) { m_mapPixels[i] = m_backgroundColor; } else { int ind = piexl % UserColor.Count; m_mapPixels[i] = UserColor[ind]; } } } m_mapTexture.SetPixels(m_mapPixels); m_mapTexture.Apply(); }