public Board(string character) { InitializePhotoshop(); backgroundImage = new Background(psApp, psDoc, canvasW, canvasH, character, 4, 1); squareLayer = psDoc.ArtLayers.Add(); squareLayer.Name = "squares"; squareLayer.Opacity = 32; blockLayer = psDoc.ArtLayers.Add(); blockLayer.Name = "blocks"; boardW = numSquaresX * (squareSize + squareSpacing) - squareSpacing; boardH = numSquaresY * (squareSize + squareSpacing) - squareSpacing; boardX = (canvasW - boardW) / 2; boardY = (canvasH - boardH) / 2; squares = new Square[numSquaresX][]; for (int i = 0; i < numSquaresX; ++i) { squares[i] = new Square[numSquaresY]; for (int j = 0; j < numSquaresY; ++j) { squares[i][j] = new Square(); } } disappearingRowsAnimationCtr = new int[squares[0].Length]; for (int i = 0; i < disappearingRowsAnimationCtr.Length; ++i) { disappearingRowsAnimationCtr[i] = -1; } }
private void LinkingLayes() // Page 40 { Document docref = appRef.Documents.Add(); ArtLayer layer1Ref = docref.ArtLayers.Add(); ArtLayer layer2Ref = docref.ArtLayers.Add(); layer1Ref.Link(layer2Ref); }
private void DuplicateAndPlaceLayer() // Page 39 { Document docref = appRef.Documents.Add(); appRef.ActiveDocument.ArtLayers.Add(); LayerSet layerSetRef = docref.LayerSets.Add(); ArtLayer layerRef = docref.ArtLayers[1].Duplicate(layerSetRef, 2); }
private void CreateTextLayer(Document docRef, string texLayerName, string MyText) // Page 41 { ArtLayer newLayerRef = docRef.ArtLayers.Add(); newLayerRef.Kind = PsLayerKind.psTextLayer; newLayerRef.Name = texLayerName; TextItem textItemRef = docRef.ArtLayers[texLayerName].TextItem; textItemRef.Contents = MyText; textItemRef.Justification = PsJustification.psRight; }
private void CreateLayerSet() // page 38 { appRef.Documents.Add(); appRef.ActiveDocument.ArtLayers.Add(); ArtLayer layerRef = appRef.ActiveDocument.Layers[1]; // Create a new layer set LayerSet newLayerSetRef = appRef.ActiveDocument.LayerSets.Add(); // Move the new layer to after the first layer newLayerSetRef.Move(newLayerSetRef, PsElementPlacement.psPlaceAfter); }
public ArtLayer Generate(CommonInfo info) { var result = new ArtLayer(info.Size); foreach (var point in info.Size.EachPoint()) { info.Position = point; result.grid.SetCell(point, info.Fill.Fill(info)); } return(result); }
private void HelloWorld() // page 19 { // Modified from Page 19 of Script PsUnits originalRulerUnits = appRef.Preferences.RulerUnits; appRef.Preferences.RulerUnits = PsUnits.psInches; Document docRef = appRef.Documents.Add(2, 4); ArtLayer artLayerRef = docRef.ArtLayers.Add(); artLayerRef.Kind = PsLayerKind.psTextLayer; //Normal Layer TextItem textItemRef = artLayerRef.TextItem; textItemRef.Contents = "Hello World"; appRef.Preferences.RulerUnits = originalRulerUnits; }
private void CreateArtLayer() // Page 37 { // This is akin to creating a new layer and first determining the layer type Document docref = appRef.Documents.Add(); ArtLayer layerObj = appRef.ActiveDocument.ArtLayers.Add(); layerObj.Name = "MyBlendLayer"; layerObj.BlendMode = PsBlendMode.psNormalBlend; appRef.ActiveDocument.Selection.SelectAll(); SolidColor ColorObj = new SolidColor(); // Color to be used with the fill command ColorObj.RGB.Red = 255; ColorObj.RGB.Green = 0; ColorObj.RGB.Blue = 0; // fill selection appRef.ActiveDocument.Selection.Fill(ColorObj); }
public ArtLayer Filter(ArtLayer input) { var result = new ArtLayer(input.size); var buffer = new Grid <ArtColor>(input.size); var center = new Coord(input.size.row.FloorDivide(2), input.size.col.FloorDivide(2)); foreach (var C in input.size.EachPoint()) { var distance = C.Difference(center); var avg = Math.Max((distance.row + distance.col).FloorDivide(2), 1); var factor = Math.Sqrt(avg) / avg; //var factor = new Coord((int)(Math.Floor(Math.Sqrt(factor.row))), (int)(Math.Floor(Math.Sqrt(factor.col)))); var fisheye = C.Between(center, factor); buffer.SetCell(C, input.grid.GetCell(fisheye)); } result.grid = buffer; return(result); }
public ArtLayer Filter(ArtLayer input) { var result = new ArtLayer(input.size); var buffer = new Grid <ArtColor>(input.size); foreach (var C in input.size.EachPoint()) { var neighbors = new List <Coord>(); if (C.row > 0) { neighbors.Add(C.Plus(new Coord(-1, 0))); } if (C.row < input.size.row - 1) { neighbors.Add(C.Plus(new Coord(1, 0))); } if (C.col > 0) { neighbors.Add(C.Plus(new Coord(0, -1))); } if (C.col < input.size.col - 1) { neighbors.Add(C.Plus(new Coord(0, 1))); } List <ArtColor> neighborColors = new List <ArtColor>(); foreach (var n in neighbors) { neighborColors.Add(input.grid.GetCell(n)); } int red = neighborColors.Select(z => z.red).Cast <int>().Sum() / neighborColors.Count(); int green = neighborColors.Select(z => z.green).Cast <int>().Sum() / neighborColors.Count(); int blue = neighborColors.Select(z => z.blue).Sum() / neighborColors.Count(); buffer.SetCell(C, new ArtColor(red, green, blue)); } result.grid = buffer; return(result); }
public ArtLayer Generate(CommonInfo _Info) { Info = _Info; var result = new ArtLayer(Info.Size); var curve = HilbertCurve.GenerateHilbertCurve(HilbertIterationsRequired()); // inflate curve to gridSize (this could be a grid method eventually) var temp = new Grid <bool>(curve.gridSize.Times(Info.PatternScale)); foreach (Cell <bool> C in curve.EachCell()) { bool value = curve.GetCell(C.loc); foreach (var C2 in Methods.EachPoint(new Coord(Info.PatternScale))) { temp.SetCell(C.loc.Times(Info.PatternScale).Plus(C2), value); } } curve = temp; curve = curve.Crop(new Coord(0, 0), Info.Size); foreach (var cell in curve.EachCell()) { if (cell.value == true) { Info.Phase = 0; } else { Info.Phase = 1; } Info.Position = cell.loc; ArtColor color = Info.Fill.Fill(Info); result.grid.SetCell(cell.loc, color); } return(result); }
private void ApplyGaussianBlur(Document docRef, int radius) { ArtLayer myLayer = docRef.ActiveLayer; myLayer.ApplyGaussianBlur(radius); }
public LayerView(ArtLayer layer, string iconName) { Layer = layer; Icon = Resources.Load <Texture>(iconName); }