Exemplo n.º 1
0
        private void SetupPixelGrid()
        {
            if (StringCount < 2)
            {
                return;
            }
            preview.Data = new VixenPreviewData();
            preview.LoadBackground();
            preview.BackgroundAlpha = 0;
            displayItem             = new DisplayItem();
            PreviewPixelGrid grid = new PreviewPixelGrid(new PreviewPoint(10, 10), null, 1);

            grid.StringType      = PreviewBaseShape.StringTypes.Pixel;
            grid.StringCount     = StringCount;
            grid.LightsPerString = PixelsPerString();
            grid.PixelSize       = Data.PixelSize;
            grid.PixelColor      = Color.White;
            grid.Top             = 10;
            grid.Left            = 10;
            grid.BottomRight.X   = preview.Width - 10;
            grid.BottomRight.Y   = preview.Height - 10;
            grid.Layout();
            displayItem.Shape = grid;

            preview.AddDisplayItem(displayItem);
        }
Exemplo n.º 2
0
        private void timerRender_Tick(object sender, EventArgs e)
        {
            effect.RenderNextEffect(Data.CurrentEffect);
            int stringCount = StringCount;

            if (displayItem != null && displayItem.Shape != null)
            {
                if (displayItem.Shape is PreviewMegaTree)
                {
                    PreviewMegaTree tree = displayItem.Shape as PreviewMegaTree;
                    for (int stringNum = 0; stringNum < stringCount; stringNum++)
                    {
                        PreviewBaseShape treeString = tree._strings[stringNum];
                        for (int pixelNum = 0; pixelNum < treeString.Pixels.Count; pixelNum++)
                        {
                            treeString.Pixels[pixelNum].PixelColor = effect.Pixels[stringNum][pixelNum];
                        }
                    }
                }
                if (displayItem.Shape is PreviewPixelGrid)
                {
                    PreviewPixelGrid grid = displayItem.Shape as PreviewPixelGrid;
                    for (int stringNum = 0; stringNum < stringCount; stringNum++)
                    {
                        PreviewBaseShape gridString = grid._strings[stringNum];
                        for (int pixelNum = 0; pixelNum < gridString.Pixels.Count; pixelNum++)
                        {
                            gridString.Pixels[pixelNum].PixelColor = effect.Pixels[stringNum][pixelNum];
                        }
                    }
                }
                else if (displayItem.Shape is PreviewArch)
                {
                    PreviewArch arch = displayItem.Shape as PreviewArch;
                    for (int pixelNum = 0; pixelNum < arch.PixelCount; pixelNum++)
                    {
                        arch.Pixels[pixelNum].PixelColor = effect.Pixels[0][pixelNum];
                    }
                }
                else if (displayItem.Shape is PreviewLine)
                {
                    PreviewLine line = displayItem.Shape as PreviewLine;
                    for (int pixelNum = 0; pixelNum < line.PixelCount; pixelNum++)
                    {
                        line.Pixels[pixelNum].PixelColor = effect.Pixels[0][pixelNum];
                    }
                }
            }
            preview.RenderInForeground();
        }