//====================================================================== void LayerTest2() { layer = new Layer(); vi1 = new View(); vi2 = new View(); vi3 = new View(); tl1 = new TextLabel(); tl2 = new TextLabel(); tl3 = new TextLabel(); tb1 = new ToggleButton(); tb2 = new ToggleButton(); tb3 = new ToggleButton(); vi1.Add(vi3); vi1.Add(tl1); vi1.Add(tl2); vi3.Add(tb1); vi3.Add(tb2); vi2.Add(tl3); layer.Add(vi1); layer.Add(vi2); layer.Add(tb3); Window.Instance.AddLayer(layer); }
//public void CreateToolBarView() //{ // mToolBarView = new View(); // mToolBarView.Name = "TOOLBAR"; // mToolBarView.BackgroundImage = TOOLBAR_IMAGE; // mToolBarView.ParentOrigin = ParentOrigin.TopCenter; // mToolBarView.PivotPoint = PivotPoint.TopCenter; // mToolBarView.PositionUsesPivotPoint = true; // mToolBarView.WidthResizePolicy = ResizePolicyType.FillToParent; // mToolBarView.Size2D = new Size2D(0, 80); // Window.Instance.Add(mToolBarView); // mToolBarView.RaiseToTop(); // mTitle = new TextLabel(); // mTitle.ParentOrigin = ParentOrigin.TopLeft; // mTitle.PivotPoint = PivotPoint.TopLeft; // mTitle.PositionUsesPivotPoint = true; // mTitle.PointSize = 10.0f; // mTitle.WidthResizePolicy = ResizePolicyType.FillToParent; // mTitle.HeightResizePolicy = ResizePolicyType.FillToParent; // mTitle.Text = APPLICATION_TITLE; // mTitle.VerticalAlignment = VerticalAlignment.Center; // mTitle.HorizontalAlignment = HorizontalAlignment.Center; // mToolBarView.Add(mTitle); //} private void CreateToolBarLayer() { mToolBarLayer = new Layer(); mToolBarLayer.Name = "TOOLBAR"; //mToolBarLayer.BackgroundImage = TOOLBAR_IMAGE; //mToolBarLayer.PositionUsesPivotPoint = true; mToolBarLayer.SetAnchorPoint(PivotPoint.TopCenter); mToolBarLayer.SetParentOrigin(ParentOrigin.TopCenter); mToolBarLayer.SetResizePolicy(ResizePolicyType.FillToParent, DimensionType.Width); mToolBarLayer.SetSize(0, 80); Window.Instance.AddLayer(mToolBarLayer); mToolBarLayer.RaiseToTop(); mToolBarBackground = new ImageView(); mToolBarBackground.ParentOrigin = ParentOrigin.TopLeft; mToolBarBackground.PivotPoint = PivotPoint.TopLeft; mToolBarBackground.PositionUsesPivotPoint = true; mToolBarBackground.WidthResizePolicy = ResizePolicyType.FillToParent; mToolBarBackground.HeightResizePolicy = ResizePolicyType.FillToParent; mToolBarBackground.ResourceUrl = TOOLBAR_IMAGE; mToolBarLayer.Add(mToolBarBackground); mTitle = new TextLabel(); mTitle.ParentOrigin = ParentOrigin.TopLeft; mTitle.PivotPoint = PivotPoint.TopLeft; mTitle.PositionUsesPivotPoint = true; mTitle.PointSize = 10.0f; mTitle.WidthResizePolicy = ResizePolicyType.FillToParent; mTitle.HeightResizePolicy = ResizePolicyType.FillToParent; mTitle.Text = APPLICATION_TITLE; mTitle.VerticalAlignment = VerticalAlignment.Center; mTitle.HorizontalAlignment = HorizontalAlignment.Center; mToolBarLayer.Add(mTitle); }
public void Activate() { window = NUIApplication.GetDefaultWindow(); defaultLayer = window.GetDefaultLayer(); window.TouchEvent += OnRiveWindowTouchEvent; // Load RiveAnimation File rav = new RiveAnimationView(Tizen.Applications.Application.Current.DirectoryInfo.Resource + "rive/flame-and-spark.riv") { Size = new Size(720, 720), }; // Enable RiveAnimation and Play rav.EnableAnimation("idle", true); rav.Play(); playButton = new Button() { Size = new Size(200, 100), Position = new Position(0, 0), Text = "Play" }; playButton.Clicked += (object source, ClickedEventArgs args) => { rav.Play(); }; defaultLayer.Add(rav); defaultLayer.Add(playButton); }
public SectorRenderer(Application application, Level level, Sector sector) { this.application = application; this.level = level; this.sector = sector; Layer layer = new Layer(); foreach (IDrawableLayer IDrawableLayer in sector.GetObjects(typeof(IDrawableLayer))) { Node node = IDrawableLayer.GetSceneGraphNode(); if (IDrawableLayer is Tilemap) //Special handling for tilemaps { node = new TilemapNode((Tilemap)IDrawableLayer, level.Tileset); } ColorNode colorNode = new ColorNode(node, new Color(1f, 1f, 1f, 1f), true); layer.Add(IDrawableLayer.Layer, colorNode); colors[IDrawableLayer] = colorNode; } objectsNode = new NodeWithChilds(); objectsColorNode = new ColorNode(objectsNode, new Color(1f, 1f, 1f, 1f)); layer.Add(1, objectsColorNode); foreach (IObject Object in sector.GetObjects(typeof(IObject))) { Node node = Object.GetSceneGraphNode(); if (node != null) { objectsNode.AddChild(node); } } // fill remaining place with one color sectorFill = new SceneGraph.Rectangle(); sectorFill.Fill = true; ColorNode color = new ColorNode(sectorFill, new Drawing.Color(0.4f, 0.3f, 0.4f)); layer.Add(-10000, color); // draw border around sector... sectorBBox = new SceneGraph.Rectangle(); sectorBBox.Fill = false; color = new ColorNode(sectorBBox, new Drawing.Color(1, 0.3f, 1)); layer.Add(1000, color); // draw border around selected layer... color = new ColorNode(new TilemapBorder(application), new Drawing.Color(1, 1, 0)); layer.Add(1001, color); OnSizeChanged(sector); this.SceneGraphRoot = layer; sector.ObjectAdded += OnObjectAdded; sector.ObjectRemoved += OnObjectRemoved; sector.SizeChanged += OnSizeChanged; application.TilemapChanged += OnTilemapChanged; //TODO: It should be possible to iterate over all (currently present?) types that implements ILayer.. How? FieldOrProperty.AnyFieldChanged += OnFieldChanged; }
private void m_BtnAdd1_Click(object sender, EventArgs e) { m_poster.Text.Content = "第一個訊息"; m_poster.Text.Color = Color.Black; m_poster.BackColor = Color.Green; m_poster.Size = new Size(250, 40); m_poster.Location = new Point(10, 10); m_layer.Add(m_poster); }
static public void Run() { Scene SpriteEditorScene = new Scene(); Layer GUI = new Layer(); SpriteEditorScene.Add(GUI); var border = new GameObject(); border.color = ConsoleColor.White; border.position.Set(0, 16); border.width = 17; border.height = 1; var border2 = new GameObject(); border2.color = ConsoleColor.White; border2.position.Set(16, 0); border2.width = 1; border2.height = 16; GUI.Add(border); GUI.Add(border2); var cursor = new GameObject(); cursor.width = 2; cursor.height = 2; cursor.position.Set(2, 2); cursor.color = ConsoleColor.Red; GUI.Add(cursor); while (true) { var key = Console.ReadKey().Key; if (key == ConsoleKey.LeftArrow) { cursor.position.x--; } if (key == ConsoleKey.RightArrow) { cursor.position.x++; } if (key == ConsoleKey.UpArrow) { cursor.position.y--; } if (key == ConsoleKey.DownArrow) { cursor.position.y++; } SpriteEditorScene.Render(); } }
private void PrepareMap(Symbol symbol) { _map.Clear(); Layer layer = new Layer("__swatch", LayerType.Acetate); switch (symbol.GetType().Name) { case "SimplePolygonSymbol": case "GradientFillSymbol": case "RasterFillSymbol": double minx = _margin + 0.4999; double miny = _margin + 0.4999; double maxx = _width - _margin - 0.4999; double maxy = _height - _margin - 0.4999; IPolygon polygon = new Polygon(new LinearRing(new Coordinate[] { new Coordinate(minx, miny), new Coordinate(minx, maxy), new Coordinate(maxx, maxy), new Coordinate(maxx, miny), new Coordinate(minx, miny) })); layer.Add(polygon, symbol); break; case "SimpleLineSymbol": case "HashLineSymbol": ILineString lineString = new LineString(new Coordinate[] { new Coordinate(_margin, _height / 2), new Coordinate(_width - _margin - 1, _height / 2) }); layer.Add(lineString, symbol); break; case "SimpleMarkerSymbol": case "TrueTypeMarkerSymbol": case "RasterMarkerSymbol": IPoint p = new NetTopologySuite.Geometries.Point(_width / 2, _height / 2); layer.Add(p, symbol); break; } _map.BackgroundColor = BackgroundColor; if (layer.Objects != null) { _map.AddLayer(layer); } }
static void Main(string[] args) { SpiralLab.Core.Initialize(); #region create entities var doc1 = new DocumentDefault("Unnamed"); var layer = new Layer("default"); doc1.Layers.Add(layer); layer.Add(new Line(0, 10, 20, 20)); layer.Add(new Circle(0, 0, 10)); layer.Add(new Spiral(-20.0f, 0.0f, 0.5f, 2.0f, 5, true)); #endregion Console.WriteLine("press any key to save ..."); Console.ReadKey(false); string filename = "default.sirius"; var ds = new DocumentSerializer(); ds.Save(doc1, filename); Console.WriteLine("press any key to open ..."); Console.ReadKey(false); var doc2 = DocumentSerializer.OpenSirius(filename); Console.WriteLine("press any key to rtc initialize ..."); Console.ReadKey(false); #region initialize RTC IRtc rtc = new RtcVirtual(0); ///가상 rtc 제어기 생성 //IRtc rtc = new Rtc5(0); ///rtc 5 제어기 생성 double fov = 60.0; /// scanner field of view : 60mm double kfactor = Math.Pow(2, 20) / fov; /// k factor (bits/mm) = 2^20 / fov rtc.Initialize(kfactor, LaserMode.Yag1, "cor_1to1.ct5"); /// 스캐너 보정 파일 지정 : correction file rtc.CtlFrequency(50 * 1000, 2); /// laser frequency : 50KHz, pulse width : 2usec rtc.CtlSpeed(100, 100); /// default jump and mark speed : 100mm/s rtc.CtlDelay(10, 100, 200, 200, 0); /// scanner and laser delays #endregion #region initialize Laser (virtial) ILaser laser = new LaserVirtual(0, "virtual", 20); #endregion Console.WriteLine("press any key to laser processing ...WARNING !!! LASER EMISSION"); Console.ReadKey(false); DoBegin(laser, rtc, doc2); Console.WriteLine("press any key to terminate program"); Console.ReadKey(false); }
public bool ReadDrawing(string fileName, Stream fileStream, out Drawing drawing, out ViewPort viewPort) { var layer = new Layer("step"); var file = StepFile.Load(fileStream); foreach (var item in file.GetTopLevelItems()) { switch (item.ItemType) { case StepItemType.Circle: { var stepCircle = (StepCircle)item; var center = ToPoint(stepCircle.Position.Location); var normal = stepCircle.Position is StepAxis2Placement3D ? ToVector(((StepAxis2Placement3D)stepCircle.Position).Axis) : Vector.ZAxis; var circle = new Circle(center, stepCircle.Radius, normal); layer = layer.Add(circle); break; } case StepItemType.EdgeCurve: { layer = layer.Add(ToEntity((StepEdge)item)); break; } case StepItemType.Line: { var line = ToLine((StepLine)item); layer = layer.Add(line); break; } case StepItemType.OrientedEdge: { var orientedEdge = (StepOrientedEdge)item; layer = layer.Add(ToEntity(orientedEdge.EdgeElement)); break; } } } drawing = new Drawing().Add(layer); viewPort = null; return(true); }
public Task <ReadDrawingResult> ReadDrawing(string fileName, Stream fileStream, Func <string, Task <byte[]> > contentResolver) { var layer = new Layer("step"); var file = StepFile.Load(fileStream); foreach (var item in file.GetTopLevelItems()) { switch (item.ItemType) { case StepItemType.Circle: { var stepCircle = (StepCircle)item; var center = ToPoint(stepCircle.Position.Location); var normal = stepCircle.Position is StepAxis2Placement3D ? ToVector(((StepAxis2Placement3D)stepCircle.Position).Axis) : Vector.ZAxis; var circle = new Circle(center, stepCircle.Radius, normal); layer = layer.Add(circle); break; } case StepItemType.EdgeCurve: { layer = layer.Add(ToEntity((StepEdge)item)); break; } case StepItemType.Line: { var line = ToLine((StepLine)item); layer = layer.Add(line); break; } case StepItemType.OrientedEdge: { var orientedEdge = (StepOrientedEdge)item; layer = layer.Add(ToEntity(orientedEdge.EdgeElement)); break; } } } var drawing = new Drawing().Add(layer); return(Task.FromResult(ReadDrawingResult.Succeeded(drawing, null))); }
void IRequireDataSourceUpdates.Add(IChartRenderContext icrc, int startAt, IList items) { if (CategoryAxis == null || ValueAxis == null) { return; } if (BindPaths == null || !BindPaths.IsValid) { return; } var recycler = new Recycler <Path, SeriesItemState>(new List <Path>(), CreatePath); var reproc = IncrementalAdd <SeriesItemState>(startAt, items, ItemState, (ix, item) => { var valuex = BindPaths.CategoryFor(item, ix); // add requested item var istate = ElementPipeline(ix, valuex, item, recycler, BindPaths); return(istate); }, (rpc, istate) => { istate.Shift(rpc, BindPaths, CategoryAxis, UpdateGeometry); }); ReconfigureLimits(); // finish up Layer.Add(recycler.Created); Dirty = false; RaiseItemsUpdated(ItemUpdates, icrc, NotifyCollectionChangedAction.Add, startAt, reproc); }
/// <summary> Moves any ILayer from layer to layer when ZPos is changed. </summary> private void OnFieldChanged(object Object, FieldOrProperty field, object oldValue) { if (!(Object is IGameObject && sector.Contains((IGameObject)Object))) //return, if it's not (GameObject in our sector) { return; } if (Object is IDrawableLayer && field.Name == "Layer") //filter for ILayer.Layer { Layer layer = (Layer)SceneGraphRoot; ILayer ILayer = (ILayer)Object; ColorNode color = colors[ILayer]; int oldLayer = (int)oldValue; layer.Remove(oldLayer, color); layer.Add(ILayer.Layer, color); QueueDraw(); } PropertyPropertiesAttribute propertyProperties = (PropertyPropertiesAttribute) field.GetCustomAttribute(typeof(PropertyPropertiesAttribute)); if (propertyProperties != null && propertyProperties.RedrawOnChange) //Every property that affects appearance is marked using this attribute { QueueDraw(); } }
public override void Initialize() { if (Level.current is Editor) { return; } Level.current.backgroundColor = new Color(0, 0, 0); this._parallax = new ParallaxBackground("background/rocksUnderground", 0.0f, 0.0f, 3); float speed = 0.8f * this._speedMult; float distance = 0.8f; for (int yPos = 0; yPos < 10; ++yPos) { this._parallax.AddZone(yPos, distance, speed); } this._parallax.AddZone(10, 0.85f, speed); this._parallax.AddZone(11, 0.9f, speed); this._parallax.AddZone(19, 0.9f, speed); this._parallax.AddZone(20, 0.85f, speed); this._parallax.restrictBottom = false; for (int index = 0; index < 11; ++index) { this._parallax.AddZone(21 + index, distance, speed); } this._parallax.depth = new Depth(-0.9f); this._parallax.layer = new Layer("PARALLAX2", 110, new Camera(0.0f, 0.0f, 320f, 200f)); Layer.Add(this._parallax.layer); Level.Add((Thing)this._parallax); }
void IRequireDataSourceUpdates.Add(IChartRenderContext icrc, int startAt, IList items) { if (CategoryAxis == null || ValueAxis == null) { return; } if (BindPaths == null || !BindPaths.IsValid) { return; } var recycler = new Recycler <Path, ItemState <Path> >(CreatePath); var reproc = IncrementalAdd <ItemState <Path> >(startAt, items, ItemState, (ix, item) => { var valuey = BindPaths.ValueFor(item); // short-circuit if it's NaN if (double.IsNaN(valuey)) { return(null); } var valuex = BindPaths.CategoryFor(item, ix); // add requested item var istate = ElementPipeline(ix, valuex, valuey, item, recycler, BindPaths); return(istate); }, (rpc, istate) => { istate.Shift(rpc, BindPaths, CategoryAxis, null); // NO geometry update; done in later stages of render pipeline }); ReconfigureLimits(); // finish up Layer.Add(recycler.Created); Dirty = false; RaiseItemsUpdated(ItemUpdates, icrc, NotifyCollectionChangedAction.Add, startAt, reproc); }
void IRequireDataSourceUpdates.Add(IChartRenderContext icrc, int startAt, IList items) { if (CategoryAxis == null || ValueAxis == null) { return; } if (BindPaths == null || !BindPaths.IsValid) { return; } var recycler = new Recycler <Path, ItemState <Path> >(new List <Path>(), CreatePath); var reproc = IncrementalAdd <ItemState <Path> >(startAt, items, ItemState, (ix, item) => { var valueO = BindPaths.OpenFor(item); var valueH = BindPaths.HighFor(item); var valueL = BindPaths.LowFor(item); var valueC = BindPaths.CloseFor(item); // short-circuit if it's NaN if (double.IsNaN(valueO) || double.IsNaN(valueH) || double.IsNaN(valueL) || double.IsNaN(valueC)) { return(null); } var valuex = BindPaths.CategoryFor(item, ix); // add requested item var istate = ElementPipeline(ix, valuex, valueO, valueH, valueL, valueC, item, recycler, BindPaths.bvl); return(istate); }, (rpc, istate) => { istate.Shift(rpc, BindPaths, CategoryAxis, UpdateGeometry); }); ReconfigureLimits(); // finish up Layer.Add(recycler.Created); Dirty = false; RaiseItemsUpdated(ItemUpdates, icrc, NotifyCollectionChangedAction.Add, startAt, reproc); }
private void Initialize() { Layout = new AbsoluteLayout(); WidthSpecification = LayoutParamPolicies.WrapContent; HeightSpecification = LayoutParamPolicies.WrapContent; BackgroundColor = Color.Transparent; // Menu is added to Anchor so Menu should exclude layouting because // if Anchor has Layout, then Menu is displayed at an incorrect position. ExcludeLayouting = true; Content = CreateDefaultContent(); if (styleApplied && (menuStyle != null)) { Content.ApplyStyle(menuStyle.Content); } Scrim = CreateDefaultScrim(); menuItemGroup = new MenuItemGroup(); layer = new Layer(); layer.Add(this); }
private void OnObjectAdded(Sector sector, IGameObject Object) { if (Object is IObject) { IObject iObject = (IObject)Object; Node node = iObject.GetSceneGraphNode(); if (node != null) { objectsNode.AddChild(node); } } Layer layer = (Layer)SceneGraphRoot; if (Object is Tilemap) { Tilemap tilemap = (Tilemap)Object; Node tnode = new TilemapNode(tilemap, level.Tileset); ColorNode colorNode = new ColorNode(tnode, new Color(1f, 1f, 1f, 1f)); layer.Add(tilemap.ZPos, colorNode); LogManager.Log(LogLevel.Debug, "Adding tilemap color: {0}", Object.GetHashCode()); colors[tilemap] = colorNode; } if (Object is Background) { Background background = (Background)Object; Node mynode = background.GetSceneGraphNode(); if (mynode != null) { backgroundNode.AddChild(mynode); } } }
public bool ReadDrawing(string fileName, Stream fileStream, out Drawing drawing, out ViewPort viewPort) { var file = IgesFile.Load(fileStream); var layer = new Layer("igs"); foreach (var entity in file.Entities) { var cadEntity = entity.ToEntity(); if (cadEntity != null) { layer = layer.Add(cadEntity); } } drawing = new Drawing( new DrawingSettings(fileName, UnitFormat.Architectural, 8), new ReadOnlyTree <string, Layer>().Insert(layer.Name, layer), layer.Name, file.Author); drawing.Tag = file; viewPort = null; // auto-set it later return(true); }
public void DoActionTest() { string myUrl = resourcePath + "/images/gallery-0.jpg"; imageView1 = new ImageView(); imageView1.ResourceUrl = myUrl; imageView1.Position2D = new Position2D(100, 100); imageView1.Size2D = new Size2D(200, 200); defaultLayer.Add(imageView1); imageView2 = new ImageView(); imageView2.ResourceUrl = myUrl; imageView2.Position2D = new Position2D(500, 100); imageView2.Size2D = new Size2D(400, 400); defaultLayer.Add(imageView2); }
protected override void Shape(T item) { var x = Positions.X.Map(item); var y = Positions.Y.Map(item); var width = Selectors.Width(item); var strip = new VStrip { X = x, Y = y, Width = width }; if (OnClick != null) { strip.OnClick = e => OnClick(item, e); } if (OnMouseOver != null) { strip.OnMouseOver = e => OnMouseOver(item, e); } if (OnMouseOut != null) { strip.OnMouseOut = e => OnMouseOut(item, e); } Layer.Add(strip); Positions.X.Position.Shape(x, x + width); Positions.Y.Position.Shape(y, y); }
protected override void Shape(T item, bool flip) { var color = Aesthetic.Fill; if (Aesthetics.Color != null) { color = Aesthetics.Color.Map(item); if (string.IsNullOrEmpty(color)) { return; } } var radius = Aesthetic.Radius; if (Aesthetics.Size != null) { radius = Aesthetics.Size.Map(item); if (radius <= 0) { return; } } var x = Positions.X.Map(item); var y = Positions.Y.Map(item); var circle = new Circle { Classes = animation ? "animate" : string.Empty, X = x, Y = y, Aesthetic = new Elements.Circle { Radius = radius, Fill = color, Alpha = Aesthetic.Alpha } }; if (OnClick != null) { circle.OnClick = e => OnClick(item, e); } if (OnMouseOver != null) { circle.OnMouseOver = e => OnMouseOver(item, e); } if (OnMouseOut != null) { circle.OnMouseOut = e => OnMouseOut(item, e); } Layer.Add(circle); Positions.X.Position.Shape(x, x); Positions.Y.Position.Shape(y, y); }
public override void Initialize() { if (Level.current is Editor) { return; } Level.current.backgroundColor = new Color(0, 0, 0); this._parallax = new ParallaxBackground("background/underground", 0.0f, 0.0f, 5); float speed = 0.9f * this._speedMult; float distance = 0.99f; this._parallax.AddZone(0, distance, speed); this._parallax.AddZone(1, distance, speed); this._parallax.AddZone(2, distance, speed); this._parallax.AddZone(3, distance, speed); this._parallax.AddZone(4, distance, speed); this._parallax.AddZone(5, distance, speed); this._parallax.AddZone(6, distance, speed); this._parallax.AddZone(7, distance, speed); this._parallax.AddZone(8, distance, speed); this._parallax.AddZone(9, distance, speed); this._parallax.AddZone(10, distance, speed); Level.Add((Thing)this._parallax); this._parallax.x -= 340f; this._parallax.restrictBottom = false; this._parallax.depth = new Depth(-0.9f); this._parallax.layer = new Layer("PARALLAX3", 115, new Camera(0.0f, 0.0f, 320f, 200f)); Layer.Add(this._parallax.layer); Level.Add((Thing)this._parallax); }
private void addSeveralLayersAndViews(Window win) { for (int i = 0; i < maxNumViewNLayer; i++) { var root = new View() { Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical, Padding = new Extents(10, 10, 10, 10), }, BackgroundColor = new Color((float)rand.Next(100, 255) / 255.0f, (float)rand.Next(100, 255) / 255.0f, (float)rand.Next(100, 255) / 255.0f, 0.6f), WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, }; for (int j = 0; j < maxNumViewNLayer; j++) { var child = new View() { BackgroundColor = new Color((float)rand.Next(100, 255) / 255.0f, (float)rand.Next(100, 255) / 255.0f, (float)rand.Next(100, 255) / 255.0f, 0.6f), WidthSpecification = LayoutParamPolicies.MatchParent, }; root.Add(child); } var layer = new Layer(); layer.Add(root); win.AddLayer(layer); } }
public async Task test() { //await Task.Delay(500); tlog.prt($"### START test : HeghtResizePolicy is changed by setting Size2D.Width \n"); window = NUIApplication.GetDefaultWindow(); layer = window.GetDefaultLayer(); window.TouchEvent += Window_TouchEvent; window.KeyEvent += Window_KeyEvent; root = new View() { Size = new Size(500, 500), Position = new Position(50, 50), BackgroundColor = Color.White, }; layer.Add(root); view1 = new View() { Size = new Size(100, 100), BackgroundColor = Color.Cyan, MaximumSize = new Size2D(1000, 1000), }; root.Add(view1); }
public void LayerRemove() { tlog.Debug(tag, $"LayerRemove START"); var testingTarget = new Layer(); Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <Layer>(testingTarget, "Should return Layer instance."); try { using (View view = new View()) { testingTarget.Add(view); testingTarget.Remove(view); } } catch (Exception e) { tlog.Error(tag, "Caught Exception" + e.ToString()); LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); Assert.Fail("Caught Exception" + e.ToString()); } testingTarget.Dispose(); tlog.Debug(tag, $"LayerRemove END (OK)"); }
protected override void Shape(T item) { var x = Positions.X.Map(item); var volume = Positions.Volume.Map(item); Func <MouseEventArgs, Task> onmouseover = null; if (OnMouseOver != null) { onmouseover = e => OnMouseOver(item, e); } Func <MouseEventArgs, Task> onmouseout = null; if (OnMouseOut != null) { onmouseout = e => OnMouseOut(item, e); } var rectangle = rectanglePool.Get(); rectangle.X = x - 0.45; rectangle.Y = 0; rectangle.Width = 0.9; rectangle.Height = volume; rectangle.Aesthetic = Aesthetic; rectangle.OnMouseOver = onmouseover; rectangle.OnMouseOut = onmouseout; Layer.Add(rectangle); Positions.X.Position.Shape(x - 0.45, x + 0.45); Positions.Volume.Position.Shape(0, volume); }
private void ImageDisposeTest() { Layer layer = new Layer(); layer.RaiseToTop(); Window.Instance.AddLayer(layer); image = new ImageView(); image.ResourceUrl = resourcePath + "/images/application-icon-0.png"; image.Size2D = new Size2D(333, 333); image.ParentOrigin = ParentOrigin.Center; image.PivotPoint = PivotPoint.Center; image.PositionUsesPivotPoint = true; image.Position = new Position(0, 0, 0); layer.Add(image); timer = new Timer(1000); timer.Tick += Timer_Tick; timer.Start(); ani = new Animation(); ani.AnimateTo(image, "Scale", new Size(2.0f, 2.0f, 2.0f), 0, 3000); ani.AnimateTo(image, "Scale", new Size(1.0f, 1.0f, 1.0f), 3000, 6000); ani.Finished += Ani_Finished; ani.Play(); }
static void Main(string[] args) { Network network = new Network(); Layer layer2 = new Layer(); Layer layer3 = new Layer(); Node node1 = new Node(2); Node node2 = new Node(2); Node node3 = new Node(2); layer2.Add(node1); layer2.Add(node2); layer3.Add(node3); network.Add(layer2); network.Add(layer3); Dictionary<Signal, Signal> trainingSet = new Dictionary<Signal, Signal>(); Signal signalFF = new Signal(); Signal signalFT = new Signal(); Signal signalTF = new Signal(); Signal signalTT = new Signal(); Signal signalF = new Signal(); Signal signalT = new Signal(); signalFF.Add(0.0); signalFF.Add(0.0); signalFT.Add(0.0); signalFT.Add(1.0); signalTF.Add(1.0); signalTF.Add(0.0); signalTT.Add(1.0); signalTT.Add(1.0); signalF.Add(0.0); signalT.Add(1.0); trainingSet.Add(signalFF, signalF); trainingSet.Add(signalFT, signalT); trainingSet.Add(signalTF, signalT); trainingSet.Add(signalTT, signalF); network.Train(trainingSet); Console.WriteLine("OutputFF: " + signalFF * network); Console.WriteLine("OutputFT: " + signalFT * network); Console.WriteLine("OutputTF: " + signalTF * network); Console.WriteLine("OutputTT: " + signalTT * network); Console.ReadLine(); }
public override void Draw() { Layer.SetColour(WhiteColour); Layer.Add(x0, y0, Tool_Up); Layer.SetColour(BlackColour); Layer.Add(x0 + 1, y0 + 1, icon); Layer.SetColour(WhiteColour); }
public void Activate() { window = NUIApplication.GetDefaultWindow(); defaultLayer = window.GetDefaultLayer(); rav = new Tizen.NUI.Extension.RiveAnimationView(Tizen.Applications.Application.Current.DirectoryInfo.Resource + "rive/music.riv") { Size = new Size(500, 500), ParentOrigin = ParentOrigin.Center, PivotPoint = PivotPoint.Center, PositionUsesPivotPoint = true, }; rav.Play(); playButton = new Button() { Size = new Size(200, 100), Position = new Position(0, 0), Text = "Start Music" }; playButton.Clicked += (object source, ClickedEventArgs args) => { rav.EnableAnimation("Loop", true); rav.EnableAnimation("Start", true); rav.EnableAnimation("Stop", false); }; stopButton = new Button() { Size = new Size(200, 100), Position = new Position(200, 0), Text = "Stop Music" }; stopButton.Clicked += (object source, ClickedEventArgs args) => { rav.EnableAnimation("Loop", false); rav.EnableAnimation("Start", false); rav.EnableAnimation("Stop", true); }; defaultLayer.Add(rav); defaultLayer.Add(playButton); defaultLayer.Add(stopButton); }
void IDataSourceRenderer.Postamble(object state) { var st = state as RenderState_Heatmap <ItemState <Path>, Path>; ItemState = st.itemstate; Layer.Remove(st.recycler.Unused); Layer.Add(st.recycler.Created); Dirty = false; }