Beispiel #1
0
 private void SetData(ObserverData data)
 {
     try
     {
         Image = m_painter.Paint(data);
     }
     catch (Exception ex)
     {
         Log.Warn(ex, "Observer with {@observerDefinition} received invalid data from Core", Definition);
     }
 }
Beispiel #2
0
        public Image Paint(ObserverData data)  // TODO(Premek): Support dimensions.
        {
            var image = new Bitmap(data.FloatData.Length, 1);

            data.FloatData.EachWithIndex((index, value) =>
            {
                byte byteValue = (byte)(value * 255);  // TODO(Premek): More robust conversion.

                image.SetPixel(index, 0, Color.FromArgb(255, byteValue, byteValue, byteValue));
            });

            return(image);
        }
Beispiel #3
0
        public Image Paint(ObserverData data)
        {
            var dimensions = m_metadataReader.GetImageDimensions(data.Metadata, data.FloatData.Length);

            var image = new Bitmap(dimensions.Width, dimensions.Height);

            data.FloatData.EachWithIndex((index, value) =>
            {
                float scaledValue = m_valueScaler.ScaleValue(value);

                image.SetPixel(index % dimensions.Width, index / dimensions.Width, GetPixelColor(scaledValue));
            });

            return(image);
        }