Exemplo n.º 1
0
 public LedMatrixRenderer(
     int width,
     int height,
     int brightness,
     int ledMultiplexing,
     int ledScanmode,
     int ledPwmLsbNanoSeconds,
     int ledPwmBits,
     int ledPwmDither,
     string ledPixelMapper,
     bool drawBorder = true
     )
 {
     _borderWidth = drawBorder ? 1 : 0;
     _matrix      = new RGBLedMatrix.RGBLedMatrix(new RGBLedMatrixOptions
     {
         Rows              = height,
         Cols              = width,
         Brightness        = brightness,
         PwmLsbNanoseconds = ledPwmLsbNanoSeconds,
         Multiplexing      = ledMultiplexing,
         ScanMode          = ledScanmode,
         PwmBits           = ledPwmBits,
         PwmDitherBits     = ledPwmDither,
         PixelMapperConfig = ledPixelMapper
     });
     _canvas = _matrix.CreateOffscreenCanvas();
 }
Exemplo n.º 2
0
 public DebugRenderer(int rows, int cols, int brightness)
 {
     _matrix = new RGBLedMatrix.RGBLedMatrix(new RGBLedMatrixOptions {
         PwmLsbNanoseconds = 200, Rows = rows, Cols = cols, Brightness = brightness,
     });
     _canvas = _matrix.CreateOffscreenCanvas();
 }
Exemplo n.º 3
0
        bool Process(Image <Rgba32> currentImage)
        {
            lock (currentImage)
            {
                for (int y = 0; y < canvas.Height; y++)
                {
                    Span <Rgba32> rowSpan = currentImage.GetPixelRowSpan(y);

                    for (int x = 0; x < canvas.Width; x++)
                    {
                        Rgba32 pixel = rowSpan[x];

                        canvas.SetPixel(x, y, new rpi_rgb_led_matrix_sharp.Color(pixel.R, pixel.G, pixel.B));
                    }
                }

                canvas = matrix.SwapOnVsync(canvas);
            }

            return(true);
        }
Exemplo n.º 4
0
        public Renderer(bool noRender = false)
        {
            this.NoRender = noRender;
            RGBLedMatrixOptions ledMatrixOptions = new RGBLedMatrixOptions();

            ledMatrixOptions.Cols         = 32;
            ledMatrixOptions.Rows         = 32;
            ledMatrixOptions.GpioSlowdown = 2;

            if (!NoRender)
            {
                matrix = new RGBLedMatrix(ledMatrixOptions);
                canvas = matrix.CreateOffscreenCanvas();
                Console.WriteLine("Matrix and Canvas initalized");
            }

            updateTimer.Elapsed += new ElapsedEventHandler(_OnUpdate);
            updateTimer.Interval = 16;

            _thread = new Thread(new ThreadStart(Render));
        }
Exemplo n.º 5
0
 public LEDPIProcessorKit() : base()
 {
     canvas    = matrix.CreateOffscreenCanvas();
     processor = Process;
 }
Exemplo n.º 6
0
 public DigitRenderer(RGBLedCanvas canvas, int numDigits)
 {
     _canvas    = canvas;
     _numDigits = numDigits;
 }