Пример #1
0
        private static void DisplayClock(Ssd1306 ssd1306)
        {
            Console.WriteLine("Display clock");
            var fontSize = 25;
            var font     = "DejaVu Sans";
            var fontsys  = SystemFonts.CreateFont(font, fontSize, FontStyle.Italic);
            var y        = 0;

            foreach (var i in Enumerable.Range(0, 100))
            {
                using (Image <Rgba32> image = new Image <Rgba32>(128, 32))
                {
                    image.Mutate(ctx => ctx
                                 .Fill(Rgba32.Black)
                                 .DrawText(DateTime.Now.ToString("HH:mm:ss"), fontsys, Rgba32.White,
                                           new SixLabors.Primitives.PointF(0, y)));

                    using (Image <Gray16> image_t = image.CloneAs <Gray16>())
                    {
                        ssd1306.DisplayImage(image_t);
                    }

                    y++;
                    if (y >= image.Height)
                    {
                        y = 0;
                    }

                    Thread.Sleep(100);
                }
            }
        }
 private static void SendImages(Ssd1306 device)
 {
     foreach (var image_name in Directory.GetFiles(".", "*.bmp").OrderBy(f => f))
     {
         using (Image <Gray16> image = Image.Load <Gray16>(image_name))
         {
             device.DisplayImage(image);
             Thread.Sleep(1000);
         }
     }
 }
Пример #3
0
 private static void DisplayImages(Ssd1306 ssd1306)
 {
     Console.WriteLine("Display Images");
     foreach (var image_name in Directory.GetFiles("images", "*.bmp").OrderBy(f => f))
     {
         using (Image <Gray16> image = Image.Load <Gray16>(image_name))
         {
             ssd1306.DisplayImage(image);
             Thread.Sleep(1000);
         }
     }
 }