public override void Match(PreviewBaseShape matchShape) { PreviewPixelGrid shape = (matchShape as PreviewPixelGrid); PixelSize = shape.PixelSize; StringOrientation = shape.StringOrientation; _bottomRight.X = _topLeft.X + (shape._bottomRight.X - shape._topLeft.X); _bottomRight.Y = _topLeft.Y + (shape._bottomRight.Y - shape.TopRight.Y); Layout(); }
public override object Clone() { PreviewPixelGrid newGrid = (PreviewPixelGrid)this.MemberwiseClone(); newGrid._strings = new List <PreviewBaseShape>(); foreach (PreviewBaseShape line in _strings) { PreviewBaseShape newLine = (PreviewLine)line.Clone(); newGrid._strings.Add(newLine); } newGrid._topLeft = new PreviewPoint(_topLeft); newGrid._bottomRight = new PreviewPoint(_bottomRight); return(newGrid); }
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; if (Data.StringOrienation == NutcrackerEffects.StringOrientations.Horizontal) { grid.StringOrientation = PreviewPixelGrid.StringOrientations.Horizontal; grid.BottomRight = new Point(Math.Min(StringCount * Data.PixelSize * 2, preview.Width - 10), preview.Width - 10); ; grid.BottomLeft.Y = Math.Min(StringCount * Data.PixelSize * 2, preview.Width - 10); grid.BottomRight = new Point(Math.Min(grid.LightsPerString * Data.PixelSize * 2, preview.Width - 10), preview.Width - 10); grid.Left = Math.Max( (preview.Width - 10 - (grid.LightsPerString * Data.PixelSize * 2))/2 , 10); } else { grid.BottomRight = new Point(preview.Width-10,preview.Height-10); } grid.Layout(); displayItem.Shape = grid; preview.AddDisplayItem(displayItem); }
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); 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); }