Example #1
0
        void InitScene(LedBadgeLib.BadgeCaps device)
        {
            if (m_messageScene != null && m_messageScene.Queue.Device == device)
            {
                return;
            }

            FrameBuffer = new WriteableBitmap(device.Width, device.Height, 96, 96, PixelFormats.Gray8, null);
            RaiseProperyChanged("FrameBuffer");

            m_messageScene = new LedBadgeLib.MessageQueueVisual(device);
            m_messageScene.GetTransition = (a, b) =>
            {
                return(new LedBadgeLib.SlidingTransition(device, a, b, LedBadgeLib.SlidingDirection.Left, LedBadgeLib.Easing.None, 60, 0));
            };
            m_messageScene.GetDisplay = e =>
            {
                if (e.Element is LedBadgeLib.WpfVisual && ((LedBadgeLib.WpfVisual)e.Element).Element is Image)
                {
                    return(new LedBadgeLib.SlidingPosition2D(device, e, 1, 1, LedBadgeLib.Easing.Both, 30, 0, 0));
                }
                else
                {
                    return(new LedBadgeLib.SlidingPosition(device, e, LedBadgeLib.SlidingDirection.Left, LedBadgeLib.Easing.None, 60, 0));
                }
            };
            m_messageScene.ExhaustedQueue = (q, lastItem) =>
            {
                Dispatcher.InvokeAsync(() =>
                                       q.Enqueue(LedBadgeLib.WPF.MakeQueuedItem(device, LedBadgeLib.WPF.MakeSingleLineItem(device, ""))));
                return(true);
            };
        }
Example #2
0
        void TestScroll(LedBadgeLib.BadgeCaps device, MemoryStream commands)
        {
            LedBadgeLib.BadgeCommands.CreateCopyRect(commands, LedBadgeLib.Target.FrontBuffer, LedBadgeLib.Target.BackBuffer, 0, 0, (byte)(device.WidthInBlocks - 1), (byte)(device.Height - 1), 1, 1);
            LedBadgeLib.BadgeCommands.CreateCopyRect(commands, LedBadgeLib.Target.FrontBuffer, LedBadgeLib.Target.BackBuffer, 0, (byte)(device.Height - 1), (byte)(device.WidthInBlocks - 1), 1, 1, 0);
            LedBadgeLib.BadgeCommands.CreateCopyRect(commands, LedBadgeLib.Target.FrontBuffer, LedBadgeLib.Target.BackBuffer, (byte)(device.WidthInBlocks - 1), 0, 1, (byte)(device.Height - 1), 0, 1);
            LedBadgeLib.BadgeCommands.CreateCopyRect(commands, LedBadgeLib.Target.FrontBuffer, LedBadgeLib.Target.BackBuffer, (byte)(device.WidthInBlocks - 1), (byte)(device.Height - 1), 1, 1, 0, 0);

            LedBadgeLib.BadgeCommands.CreateSwap(commands, false, 0);
        }
Example #3
0
        void TestPattern(LedBadgeLib.BadgeCaps device, MemoryStream commands)
        {
            int bufferSize;

            LedBadgeLib.BadgeCommands.CreateWriteRect(commands, LedBadgeLib.Target.BackBuffer, LedBadgeLib.PixelFormat.TwoBits, 0, 0, (byte)device.WidthInBlocks, 2, out bufferSize);
            for (int i = 0; i < bufferSize; i += 2)
            {
                commands.WriteByte(0x33);
                commands.WriteByte(0x55);
            }

            LedBadgeLib.BadgeCommands.CreateFillRect(commands, LedBadgeLib.Target.BackBuffer, 0, 2, 1, 4, new LedBadgeLib.Pix2x8(0x0000));
            LedBadgeLib.BadgeCommands.CreateFillRect(commands, LedBadgeLib.Target.BackBuffer, 1, 2, 1, 4, new LedBadgeLib.Pix2x8(0x00FF));
            LedBadgeLib.BadgeCommands.CreateFillRect(commands, LedBadgeLib.Target.BackBuffer, 2, 2, 1, 4, new LedBadgeLib.Pix2x8(0xFF00));
            LedBadgeLib.BadgeCommands.CreateFillRect(commands, LedBadgeLib.Target.BackBuffer, 3, 2, 1, 4, new LedBadgeLib.Pix2x8(0xFFFF));

            LedBadgeLib.BadgeCommands.CreateCopyRect(commands, LedBadgeLib.Target.BackBuffer, LedBadgeLib.Target.BackBuffer, 0, 0, 0, 6, (byte)device.WidthInBlocks, 6);

            LedBadgeLib.BadgeCommands.CreateSwap(commands, false, 0);
        }