/// <summary> /// /// </summary> /// <param name="dc"></param> /// <param name="rectangle"></param> /// <param name="dx"></param> /// <param name="dy"></param> /// <param name="db"></param> /// <param name="r"></param> public void Draw(object dc, XRectangle rectangle, double dx, double dy, ImmutableArray <ShapeProperty> db, Record r) { var _dc = dc as DrawingContext; Brush brush = ToSolidBrush(rectangle.Style.Fill); Pen pen = ToPen(rectangle.Style, _scaleToPage); var rect = CreateRect( rectangle.TopLeft, rectangle.BottomRight, dx, dy); DrawRectangleInternal( _dc, brush, pen, rectangle.IsStroked, rectangle.IsFilled, ref rect); if (rectangle.IsGrid) { DrawGridInternal( _dc, pen, ref rect, rectangle.OffsetX, rectangle.OffsetY, rectangle.CellWidth, rectangle.CellHeight, true); } // TODO: brush.Dispose(); // TODO: pen.Dispose(); }
/// <summary> /// Initialize new instance of <see cref="RectangleSelection"/> class. /// </summary> /// <param name="layer">The selection shapes layer.</param> /// <param name="shape">The selected shape.</param> /// <param name="style">The selection shapes style.</param> /// <param name="point">The selection point shape.</param> public RectangleSelection(XLayer layer, XRectangle shape, ShapeStyle style, BaseShape point) { _layer = layer; _rectangle = shape; _style = style; _point = point; }
public XRectangle CreateRectangle(double thickness, double x, double y, double width, double height, bool isFilled, ArgbColor stroke, ArgbColor fill) { var strokeBrush = ToSolidColorBrush(stroke); var fillBrush = ToSolidColorBrush(fill); strokeBrush.Freeze(); fillBrush.Freeze(); var rectangle = new Rectangle() { Fill = isFilled ? fillBrush : TransparentBrush, Stroke = strokeBrush, StrokeThickness = thickness, StrokeStartLineCap = PenLineCap.Round, StrokeEndLineCap = PenLineCap.Round, Width = width, Height = height }; Canvas.SetLeft(rectangle, x); Canvas.SetTop(rectangle, y); var xrectangle = new XRectangle(rectangle); return(xrectangle); }
/// <summary> /// Creates a new instance of the <see cref="XContainer"/> class. /// </summary> /// <param name="factory">The project factory.</param> /// <param name="project">The new container owner project.</param> /// <param name="name">The new container name.</param> /// <returns>The new instance of the <see cref="XContainer"/>.</returns> private XContainer CreateGridTemplate(IProjectFactory factory, XProject project, string name) { var template = factory.GetTemplate(project, name); var style = project .StyleLibraries.FirstOrDefault(g => g.Name == "Template") .Items.FirstOrDefault(s => s.Name == "Grid"); var layer = template.Layers.FirstOrDefault(); var builder = layer.Shapes.ToBuilder(); var grid = XRectangle.Create( 0, 0, template.Width, template.Height, style, project.Options.PointShape); grid.IsStroked = true; grid.IsFilled = false; grid.IsGrid = true; grid.OffsetX = 30.0; grid.OffsetY = 30.0; grid.CellWidth = 30.0; grid.CellHeight = 30.0; grid.State.Flags &= ~ShapeStateFlags.Printable; builder.Add(grid); layer.Shapes = builder.ToImmutable(); return(template); }
public static bool OnDrawLast( XSpriteBatch __instance, ref XTexture2D?texture, ref XRectangle destinationRectangle, ref XRectangle?sourceRectangle, ref XColor color, float rotation, ref XVector2 origin, ref SpriteEffects effects, ref float layerDepth, ref ManagedTexture2D?__state ) { if (!Config.IsEnabled) { return(true); } return(__instance.OnDraw( texture: ref texture, destination: ref destinationRectangle, source: ref sourceRectangle, color: ref color, rotation: rotation, origin: ref origin, effects: ref effects, layerDepth: ref layerDepth, __state: ref __state )); }
public int GetDistanceSquaredToArea(XPoint2 pnt, RMArea area, int minDist) { Debug.Assert(area.Built, "GetDistanceSquaredToArea() does not work for unbuilt areas"); XRectangle range = area.ActiveArea; range.RestrictToWithin(new XRectangle(pnt.X, pnt.Y, 1, 1)); range.Inflate(minDist); int minDist2 = int.MaxValue; for (int x = range.Left; x < range.Right; ++x) { for (int y = range.Top; y < range.Bottom; ++y) { int dx = x - pnt.X, dy = y - pnt.Y; int dist2 = dx * dx + dy * dy; if (dist2 > minDist * minDist) { continue; } if (Map[x, y] == area) { if (dist2 < minDist2) { minDist2 = dist2; } } } } return(minDist2); }
/// <summary> /// <para>Subtract an explicitly-specified rectangle from /// this region.</para> /// </summary> /// /// <param name="x"> /// <para>The X co-ordinate of the top-left corner of the rectangle.</para> /// </param> /// /// <param name="y"> /// <para>The Y co-ordinate of the top-left corner of the rectangle.</para> /// </param> /// /// <param name="width"> /// <para>The width of the rectangle.</para> /// </param> /// /// <param name="height"> /// <para>The height of the rectangle.</para> /// </param> /// /// <exception cref="T:Xsharp.XException"> /// <para>Raised if the rectangle co-ordinates are out of range.</para> /// </exception> /// /// <remarks> /// <para>If this region has been disposed, then it will be re-created /// with its initial contents set to empty.</para> /// </remarks> public void Subtract(int x, int y, int width, int height) { lock (typeof(Region)) { if (region == IntPtr.Zero) { region = Xlib.XCreateRegion(); if (region == IntPtr.Zero) { Display.OutOfMemory(); } } else { XRectangle xrect = new XRectangle(x, y, width, height); IntPtr reg = Xlib.XCreateRegion(); if (reg == IntPtr.Zero) { Display.OutOfMemory(); } Xlib.XUnionRectWithRegion(ref xrect, reg, reg); Xlib.XSubtractRegion(region, reg, region); Xlib.XDestroyRegion(reg); } } }
public void AddArea(XPoint2 pos, int size, float coherence) { EnsureMaps(1); var map = Maps[0]; int fringe = (int)Math.Round( (size * (1 - coherence)) ); XRectangle range = new XRectangle(pos.X, pos.Y, 0, 0). Inflate(size + fringe). RestrictToWithin( new XRectangle(0, 0, sizeX, sizeY) ); range = new XRectangle(0, 0, sizeX, sizeY); List <TerrainType> types = new List <TerrainType>(); float noiseRnd = pos.X + pos.Y * 10; for (int x = range.Left; x < range.Right; ++x) { for (int y = range.Top; y < range.Bottom; ++y) { int dist2 = (x - pos.X) * (x - pos.X) + (y - pos.Y) * (y - pos.Y); float noise = SimplexNoise.simplex_noise_2octaves( (float)x / (size + 2), noiseRnd, (float)y / (size + 2) ) / 2 - 0.5f; map[x, y] = (1 - (float)Math.Sqrt(dist2) / size) + (noise - 0.5f) * (1 - coherence) * 2; } } }
/// <summary> /// <para>Intersect a rectangle with this region.</para> /// </summary> /// /// <param name="rect"> /// <para>The rectangle to intersect with this region.</para> /// </param> /// /// <exception cref="T:Xsharp.XException"> /// <para>Raised if the rectangle co-ordinates are out of range.</para> /// </exception> /// /// <remarks> /// <para>If this region has been disposed, then it will be re-created /// with its initial contents set to empty.</para> /// </remarks> public void Intersect(Rectangle rect) { lock (typeof(Region)) { if (region == IntPtr.Zero) { region = Xlib.XCreateRegion(); if (region == IntPtr.Zero) { Display.OutOfMemory(); } } else { IntPtr reg = Xlib.XCreateRegion(); if (reg == IntPtr.Zero) { Display.OutOfMemory(); } XRectangle xrect = new XRectangle (rect.x, rect.y, rect.width, rect.height); Xlib.XUnionRectWithRegion(ref xrect, reg, reg); Xlib.XIntersectRegion(reg, region, region); Xlib.XDestroyRegion(reg); } } }
private static bool ForwardDraw( XSpriteBatch @this, XTexture2D?texture, XRectangle destinationRectangle, XColor color, XRectangle?sourceRectangle = null, float rotation = 0f, XVector2?origin = null, SpriteEffects effects = SpriteEffects.None, float layerDepth = 0f ) { if (!Config.IsEnabled) { return(true); } @this.Draw( texture: texture, destinationRectangle: destinationRectangle, sourceRectangle: sourceRectangle, color: color, rotation: rotation, origin: origin ?? XVector2.Zero, effects: effects, layerDepth: layerDepth ); return(false); }
/// <inheritdoc/> public override void Draw(object dc, XRectangle rectangle, double dx, double dy, ImmutableArray <XProperty> db, XRecord r) { var _dc = dc as AM.DrawingContext; AM.IBrush brush = ToBrush(rectangle.Style.Fill); AM.Pen pen = ToPen(rectangle.Style, _scaleToPage); var rect = CreateRect(rectangle.TopLeft, rectangle.BottomRight, dx, dy); DrawRectangleInternal( _dc, brush, pen, rectangle.IsStroked, rectangle.IsFilled, ref rect); if (rectangle.IsGrid) { DrawGridInternal( _dc, pen, ref rect, rectangle.OffsetX, rectangle.OffsetY, rectangle.CellWidth, rectangle.CellHeight, true); } }
protected override void OnPaint(PaintEventArgs e) { var g = e.Graphics; var brushBack = new SolidBrush((over ^ Active) ? OverBack : DefaultBack); var penFore = new Pen((over ^ Active) ? OverFore : DefaultFore, BorderWidth); var brushFore = new SolidBrush((over ^ Active) ? OverFore : DefaultFore); var points = XRectangle.Generate(0, 0, Width, Height, BorderWidth); g.FillRectangle(brushBack, 0, 0, Width, Height); if ((Mask & 0x08) > 0) { g.DrawLine(penFore, points[0].X, 0, points[1].X, Height); } if ((Mask & 0x04) > 0) { g.DrawLine(penFore, 0, points[1].Y, Width, points[2].Y); } if ((Mask & 0x02) > 0) { g.DrawLine(penFore, points[2].X, 0, points[3].X, Height); } if ((Mask & 0x01) > 0) { g.DrawLine(penFore, 0, points[0].Y, Width, points[3].Y); } g.DrawString(Text, TextFont, brushFore, (int)BorderWidth + TextPadding, (int)BorderWidth + TextPadding); }
public void MoveDelta(double dx, double dy, XRectangle rectangle) { double left = _blockHelper.GetLeft(rectangle) + dx; double top = _blockHelper.GetTop(rectangle) + dy; _blockHelper.SetLeft(rectangle, left); _blockHelper.SetTop(rectangle, top); }
public void Reset() { if (TempRectangle != null) { _state.OverlaySheet.Remove(TempRectangle); TempRectangle = null; } }
/// <summary> /// /// </summary> /// <param name="dc"></param> /// <param name="rectangle"></param> /// <param name="dx"></param> /// <param name="dy"></param> /// <param name="db"></param> /// <param name="r"></param> public void Draw(object dc, XRectangle rectangle, double dx, double dy, ImmutableArray <ShapeProperty> db, Record r) { var _dc = dc as DrawingContext; var style = rectangle.Style; if (style == null) { return; } double thickness = style.Thickness / _state.Zoom; double half = thickness / 2.0; Tuple <Brush, Pen> cache = null; Brush fill; Pen stroke; if (_enableStyleCache && _styleCache.TryGetValue(style, out cache)) { fill = cache.Item1; stroke = cache.Item2; } else { fill = CreateBrush(style.Fill); stroke = CreatePen(style, thickness); if (_enableStyleCache) { _styleCache.Add(style, Tuple.Create(fill, stroke)); } } var rect = CreateRect( rectangle.TopLeft, rectangle.BottomRight, dx, dy); DrawRectangleInternal( _dc, half, fill, stroke, rectangle.IsStroked, rectangle.IsFilled, ref rect); if (rectangle.IsGrid) { DrawGridInternal( _dc, half, stroke, ref rect, rectangle.OffsetX, rectangle.OffsetY, rectangle.CellWidth, rectangle.CellHeight, true); } }
/// <inheritdoc/> public override void LeftDown(double x, double y) { base.LeftDown(x, y); double sx = _editor.Project.Options.SnapToGrid ? ProjectEditor.Snap(x, _editor.Project.Options.SnapX) : x; double sy = _editor.Project.Options.SnapToGrid ? ProjectEditor.Snap(y, _editor.Project.Options.SnapY) : y; switch (_currentState) { case ToolState.None: { var style = _editor.Project.CurrentStyleLibrary.Selected; _rectangle = XRectangle.Create( sx, sy, _editor.Project.Options.CloneStyle ? style.Clone() : style, _editor.Project.Options.PointShape, _editor.Project.Options.DefaultIsStroked, _editor.Project.Options.DefaultIsFilled); var result = _editor.TryToGetConnectionPoint(sx, sy); if (result != null) { _rectangle.TopLeft = result; } _editor.Project.CurrentContainer.WorkingLayer.Shapes = _editor.Project.CurrentContainer.WorkingLayer.Shapes.Add(_rectangle); _editor.Project.CurrentContainer.WorkingLayer.Invalidate(); ToStateOne(); Move(_rectangle); _currentState = ToolState.One; _editor.CancelAvailable = true; } break; case ToolState.One: { if (_rectangle != null) { _rectangle.BottomRight.X = sx; _rectangle.BottomRight.Y = sy; var result = _editor.TryToGetConnectionPoint(sx, sy); if (result != null) { _rectangle.BottomRight = result; } _editor.Project.CurrentContainer.WorkingLayer.Shapes = _editor.Project.CurrentContainer.WorkingLayer.Shapes.Remove(_rectangle); Remove(); Finalize(_rectangle); _editor.Project.AddShape(_editor.Project.CurrentContainer.CurrentLayer, _rectangle); _currentState = ToolState.None; _editor.CancelAvailable = false; } } break; } }
public static bool OnDraw(XSpriteBatch __instance, XTexture2D?texture, XRectangle destinationRectangle, XColor color) { return(ForwardDraw( @this: __instance, texture: texture, destinationRectangle: destinationRectangle, color: color )); }
/// <summary> /// Get the bounding rectangle for <see cref="XRectangle"/> shape. /// </summary> /// <param name="rectangle"></param> /// <param name="dx"></param> /// <param name="dy"></param> /// <returns></returns> public static Rect2 GetRectangleBounds(XRectangle rectangle, double dx, double dy) { return(Rect2.FromPoints( rectangle.TopLeft.X, rectangle.TopLeft.Y, rectangle.BottomRight.X, rectangle.BottomRight.Y, dx, dy)); }
private Rect2 GetRectangleBounds(XRectangle rectangle) { var bounds = new Rect2( rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height); return(bounds); }
public void Init(ImmutablePoint p) { double x = _itemController.Snap(p.X, _state.Options.SnapSize); double y = _itemController.Snap(p.Y, _state.Options.SnapSize); SelectionStartPoint = new ImmutablePoint(x, y); TempRectangle = _blockFactory.CreateRectangle(_state.Options.LineThickness / _state.ZoomController.Zoom, x, y, 0.0, 0.0, false, ArgbColors.Black, ArgbColors.Transparent); _state.OverlaySheet.Add(TempRectangle); _state.OverlaySheet.Capture(); }
/// <summary> /// Transfer selection state to <see cref="ToolState.One"/>. /// </summary> public void ToStateOne() { _helperRectangle = XRectangle.Create(0, 0, _style, null); _topLeftHelperPoint = XPoint.Create(0, 0, _point); _bottomRightHelperPoint = XPoint.Create(0, 0, _point); _layer.Shapes = _layer.Shapes.Add(_helperRectangle); _layer.Shapes = _layer.Shapes.Add(_topLeftHelperPoint); _layer.Shapes = _layer.Shapes.Add(_bottomRightHelperPoint); }
public ItemRectangle Serialize(XRectangle rectangle) { return(new ItemRectangle() { Id = rectangle.Id, X = _blockHelper.GetLeft(rectangle), Y = _blockHelper.GetTop(rectangle), Width = _blockHelper.GetWidth(rectangle), Height = _blockHelper.GetHeight(rectangle), IsFilled = _blockHelper.IsTransparent(rectangle), Stroke = _blockHelper.GetStroke(rectangle), Fill = _blockHelper.GetFill(rectangle) }); }
/// <inheritdoc/> XRectangle IShapeFactory.Rectangle(XPoint topLeft, XPoint bottomRight, bool isStroked, bool isFilled, string text) { var style = _editor.Project.CurrentStyleLibrary.Selected; var rectangle = XRectangle.Create( topLeft, bottomRight, _editor.Project.Options.CloneStyle ? style.Clone() : style, _editor.Project.Options.PointShape, isStroked, isFilled, text); _editor.Project.AddShape(_editor.Project.CurrentContainer.CurrentLayer, rectangle); return(rectangle); }
/// <inheritdoc/> XRectangle IShapeFactory.Rectangle(double x1, double y1, double x2, double y2, bool isStroked, bool isFilled, string text) { var style = _editor.Project.CurrentStyleLibrary.Selected; var rectangle = XRectangle.Create( x1, y1, x2, y2, _editor.Project.Options.CloneStyle ? style.Clone() : style, _editor.Project.Options.PointShape, isStroked, isFilled, text); _editor.Project.AddShape(_editor.Project.CurrentContainer.CurrentLayer, rectangle); return(rectangle); }
private IRectangle ReadRectangle() { var rectangle = new XRectangle() { Id = _reader.ReadInt32(), Point1 = ReadPoint(), Point2 = ReadPoint(), Stroke = ReadColor(), StrokeThickness = _reader.ReadDouble(), Fill = ReadColor() }; _natives.Add(rectangle.Id, rectangle); return(rectangle); }
public void BlurArea(int amount) { if (amount == 0) { return; } var map = Map; int sizeX = Map.GetLength(0), sizeY = Map.GetLength(1); Node[,] newMap = new Node[sizeX, sizeY]; XRectangle range = activeArea. Inflate(1). RestrictToWithin(new XRectangle(0, 0, sizeX, sizeY)); for (int x = range.Left; x < range.Right; ++x) { for (int y = range.Top; y < range.Bottom; ++y) { float ave = 0, cnt = 0; for (int dx = -amount; dx <= amount; ++dx) { for (int dy = -amount; dy <= amount; ++dy) { if (dx * dx + dy * dy > amount * amount) { continue; } float weight = 1 - //(float)Math.Sqrt ((float)(dx * dx + dy * dy) / (amount * amount)); int px = x + dx, py = y + dy; if (px >= 0 && py >= 0 && px < sizeX && py < sizeY) { ave += (map[px, py].Weight < 0 ? -1 : 0) * weight; cnt += weight; } } } newMap[x, y].Weight = ave / cnt; if (newMap[x, y].Weight < -0.5f) { Debug.Assert(activeArea.Contains(new XPoint2(x, y)), "A blurred area should never be larger than the previous area (in terms of bounding box)"); } } } activeArea = range; Map = newMap; }
/// <summary> /// <para>Union an explicitly-specified rectangle with this region.</para> /// </summary> /// /// <param name="x"> /// <para>The X co-ordinate of the top-left corner of the rectangle.</para> /// </param> /// /// <param name="y"> /// <para>The Y co-ordinate of the top-left corner of the rectangle.</para> /// </param> /// /// <param name="width"> /// <para>The width of the rectangle.</para> /// </param> /// /// <param name="height"> /// <para>The height of the rectangle.</para> /// </param> /// /// <exception cref="T:Xsharp.XException"> /// <para>Raised if the rectangle co-ordinates are out of range.</para> /// </exception> /// /// <remarks> /// <para>If this region has been disposed, then it will be re-created /// with its initial contents set to the rectangle.</para> /// </remarks> public void Union(int x, int y, int width, int height) { lock (typeof(Region)) { XRectangle xrect = new XRectangle(x, y, width, height); if (region == IntPtr.Zero) { region = Xlib.XCreateRegion(); if (region == IntPtr.Zero) { Display.OutOfMemory(); } } Xlib.XUnionRectWithRegion(ref xrect, region, region); } }
public void WithAreaTiles(Action <XPoint2, int> onTile) { var map = Maps[0]; XRectangle range = new XRectangle(0, 0, sizeX, sizeY); for (int x = range.Left; x < range.Right; ++x) { for (int y = range.Top; y < range.Bottom; ++y) { float weight = map[x, y]; //if (weight > 0) { onTile(new XPoint2(x, y), (int)(weight * 20)); } } } }
/// <summary> /// /// </summary> /// <param name="gfx"></param> /// <param name="rectangle"></param> /// <param name="dx"></param> /// <param name="dy"></param> /// <param name="db"></param> /// <param name="r"></param> public void Draw(object gfx, XRectangle rectangle, double dx, double dy, ImmutableArray <ShapeProperty> db, Record r) { var _gfx = gfx as Graphics; Brush brush = ToSolidBrush(rectangle.Style.Fill); Pen pen = ToPen(rectangle.Style, _scaleToPage); var rect = CreateRect( rectangle.TopLeft, rectangle.BottomRight, dx, dy); if (rectangle.IsFilled) { _gfx.FillRectangle( brush, _scaleToPage(rect.X), _scaleToPage(rect.Y), _scaleToPage(rect.Width), _scaleToPage(rect.Height)); } if (rectangle.IsStroked) { _gfx.DrawRectangle( pen, _scaleToPage(rect.X), _scaleToPage(rect.Y), _scaleToPage(rect.Width), _scaleToPage(rect.Height)); } if (rectangle.IsGrid) { DrawGridInternal( _gfx, pen, ref rect, rectangle.OffsetX, rectangle.OffsetY, rectangle.CellWidth, rectangle.CellHeight, true); } brush.Dispose(); pen.Dispose(); }
public void WithAreaTiles(Action <XPoint2, int> onTile) { var map = Map; XRectangle range = activeArea; for (int x = range.Left; x < range.Right; ++x) { for (int y = range.Top; y < range.Bottom; ++y) { float weight = map[x, y].Weight; if (weight < -0.5f) { onTile(new XPoint2(x, y), 10);//(int)(-weight * 20)); } } } }
public IRectangle CreateRectangle() { var rectangle = new XRectangle() { Point1 = new XPoint(0.0, 0.0), Point2 = new XPoint(0.0, 0.0), Stroke = new XColor(0xFF, 0x00, 0x00, 0x00), StrokeThickness = 2.0, Fill = new XColor(0x00, 0xFF, 0xFF, 0xFF) }; rectangle.Point1.Connected.Add(rectangle); rectangle.Point2.Connected.Add(rectangle); return rectangle; }
public MatrixTransformCExample() { var btn = new IHTMLButton("+"); { var r = new XRectangle(); r.Element.style.SetLocation(400, 50); r.Content.style.SetSize(400, 100); r.Element.style.Opacity = 0.3; } { var r = new XRectangle { Text = "center" }; r.Element.style.SetLocation(400, 50); r.Content.style.SetSize(400, 100); var angle = 22; // rotate at top left r.ApplyMatrix(0, 0, angle.DegreesToRadians(), 0, 0); btn.onclick += delegate { angle += 5; r.ApplyMatrix(0, 0, angle.DegreesToRadians(), 0, 0); }; } { var r = new XRectangle { Text = "center offset to left" }; r.Element.style.SetLocation(400, 50); r.Content.style.SetSize(400, 100); r.Content.style.backgroundColor = "blue"; var angle = 22; // rotate at top left r.ApplyMatrix(0, 0, angle.DegreesToRadians(), -400, 0); btn.onclick += delegate { angle += 5; r.ApplyMatrix(0, 0, angle.DegreesToRadians(), -400, 0); }; } { var r = new XRectangle(); r.Element.style.SetLocation(400, 200); r.Content.style.SetSize(400, 100); r.Element.style.Opacity = 0.3; } { var r = new XRectangle { Text = "left top" }; r.Element.style.SetLocation(400, 200); r.Content.style.SetSize(400, 100); var angle = 22; // rotate at center r.ApplyMatrix(-200, -50, angle.DegreesToRadians(), 0, 0); btn.onclick += delegate { angle += 5; r.ApplyMatrix(-200, -50, angle.DegreesToRadians(), 0, 0); }; } { var r = new XRectangle(); r.Element.style.SetLocation(400, 550); r.Content.style.SetSize(400, 100); r.Element.style.Opacity = 0.3; } { var r = new XRectangle { Text = "right bottom" }; r.Element.style.SetLocation(400, 550); r.Content.style.SetSize(400, 100); var angle = 22; // rotate at center r.ApplyMatrix(200, 50, angle.DegreesToRadians(), 0, 0); btn.onclick += delegate { angle += 5; r.ApplyMatrix(200, 50, angle.DegreesToRadians(), 0, 0); }; } { var r = new XRectangle { Text = "right bottom offset right" }; r.Content.style.backgroundColor = "blue"; r.Element.style.SetLocation(400, 550); r.Content.style.SetSize(400, 100); var angle = 22; // rotate at center r.ApplyMatrix(200, 50, angle.DegreesToRadians(), 400, 0); btn.onclick += delegate { angle += 5; r.ApplyMatrix(200, 50, angle.DegreesToRadians(), 400, 0); }; } btn.AttachToDocument(); btn.style.SetLocation(32, 32); }
private IRectangle ReadRectangle() { var rectangle = new XRectangle() { Id = _reader.ReadInt32(), Point1 = ReadPoint(), Point2 = ReadPoint(), Stroke = ReadColor(), StrokeThickness = _reader.ReadDouble(), Fill = ReadColor() }; _natives.Add(rectangle.Id, rectangle); return rectangle; }