public override void Render(DrawBatch drawBatch, float zoomFactor) { if (IsDisposed) return; InitializeResources(drawBatch.GraphicsDevice); Vector2 center = new Vector2((int)(_data.Center.X * zoomFactor), (int)(_data.Center.Y * zoomFactor)); float size = _data.Size; Rectangle rect = new Rectangle((int)(center.X - size), (int)(center.Y - size), (int)(size * 2), (int)(size * 2)); if (FillGlow != null) drawBatch.FillRectangle(FillGlow, new Rectangle(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2)); if (Fill != null) drawBatch.FillRectangle(Fill, rect); if (OutlineGlow != null) drawBatch.DrawRectangle(OutlineGlow, rect); if (Outline != null) { if (Outline is PrimitivePen) drawBatch.DrawPrimitiveRectangle(Outline, rect); else drawBatch.DrawRectangle(Outline, rect); } }
public override void Render(DrawBatch drawBatch, float zoomFactor) { if (IsDisposed) return; InitializeResources(drawBatch.GraphicsDevice); Rectangle rect = new Rectangle( (int)(Math.Min(_data.Start.X, _data.End.X) * zoomFactor), (int)(Math.Min(_data.Start.Y, _data.End.Y) * zoomFactor), (int)(Math.Abs(_data.End.X - _data.Start.X) * zoomFactor), (int)(Math.Abs(_data.End.Y - _data.Start.Y) * zoomFactor) ); if (FillGlow != null) drawBatch.FillRectangle(FillGlow, new Rectangle(rect.X - 1, rect.Y - 1, rect.Width + 2, rect.Height + 2)); if (Fill != null) drawBatch.FillRectangle(Fill, rect); if (OutlineGlow != null) drawBatch.DrawRectangle(OutlineGlow, rect); if (Outline != null) { if (Outline is PrimitivePen) drawBatch.DrawPrimitiveRectangle(Outline, rect); else drawBatch.DrawRectangle(Outline, rect); } }
public override void Draw(DrawBatch drawBatch) { drawBatch.FillRectangle(Brush.Green, new CCRect(50, 50, 200, 100)); drawBatch.FillCircle(Brush.Blue, new CCVector2(350, 100), 50); drawBatch.FillCircle(Brush.Blue, new CCVector2(500, 100), 50, 16); drawBatch.FillPath(Brush.Gray, StarPoints(new CCVector2(150, 300), 8, 100, 50, 0, false)); drawBatch.FillRectangle(Brush.Green, new CCRect(300, 250, 200, 100), (float)Math.PI / 4f); }
public override void Draw (DrawBatch drawBatch) { drawBatch.FillRectangle(_brush1, new Rectangle(50, 50, 200, 100)); drawBatch.FillRectangle(_brush2, new Rectangle(50, 175, 200, 100)); drawBatch.FillRectangle(_brush3, new Rectangle(50, 300, 200, 100)); drawBatch.FillRectangle(_brush4, new Rectangle(50, 425, 200, 100)); drawBatch.FillCircle(_brush5, new Vector2(350, 100), 50); drawBatch.FillCircle(_brush6, new Vector2(350, 225), 50); }
public override void Draw(DrawBatch drawBatch) { var center = VisibleBoundsWorldspace.Center - new CCPoint(150,150); //drawBatch.FillRectangle(Brush.Gray, new CCVector2(200, 15), 300, 300); drawBatch.FillRectangle(Brush.Gray, center, 300, 300); drawBatch.DrawCache(_cache); }
private void RenderPartialRow(DrawBatch drawBatch, float zoomFactor, int x1, int x2, int y) { Rectangle rect = new Rectangle( (int)((x1 + _data.Offset.X) * _data.TileWidth * zoomFactor), (int)((y + _data.Offset.Y) * _data.TileHeight * zoomFactor), (int)((x2 - x1 + 1) * _data.TileWidth * zoomFactor), (int)(_data.TileHeight * zoomFactor) ); drawBatch.FillRectangle(Fill, rect); }
public override void Draw (DrawBatch drawBatch) { drawBatch.FillRectangle(Brush.Gray, new Vector2(200, 15), 300, 300); drawBatch.DrawCache(_cache); }
public override void Draw(DrawBatch drawBatch) { drawBatch.FillRectangle(_brush1, new CCRect(50, 50, 200, 100)); drawBatch.FillRectangle(_brush2, new CCRect(50, 175, 200, 100)); drawBatch.FillRectangle(_brush3, new CCRect(50, 300, 200, 100)); drawBatch.FillRectangle(_brush4, new CCRect(50, 425, 200, 100)); drawBatch.FillCircle(_brush5, new CCVector2(350, 100), 50); drawBatch.FillCircle(_brush6, new CCVector2(350, 225), 50); drawBatch.FillCircle(mirrorBrush, new CCVector2(350, 600), 50); drawBatch.FillRectangle(repeatBrush, new CCRect(50, 550, 200, 100)); }
private void DrawObjectAction(DrawBatch drawBatch) { if (_sourceImage == null) return; drawBatch.GraphicsDevice.ScissorRectangle = Xna.Rectangle.Empty; if (_objectBrush == null) _objectBrush = new TextureBrush(_sourceImage.CreateTexture(_drawControl.GraphicsDevice)) { OwnsTexture = true }; if (_maskPen == null) _maskPen = new Pen(new CheckerBrush(_drawControl.GraphicsDevice, Xna.Color.Black, Xna.Color.White, 4, .75f), true); int originX = (_drawControl.Width - _sourceImage.Width) / 2; int originY = (_drawControl.Height - _sourceImage.Height) / 2; _objectBrush.Transform = Xna.Matrix.CreateTranslation(-(float)originX / _sourceImage.Width, -(float)originY / _sourceImage.Height, 0); drawBatch.Begin(); drawBatch.FillRectangle(_objectBrush, new Xna.Rectangle(originX, originY, _sourceImage.Width, _sourceImage.Height)); drawBatch.DrawRectangle(_maskPen, new Microsoft.Xna.Framework.Rectangle( originX - 1 + (_maskLeft ?? 0) + (_originX ?? 0), originY - 1 + (_maskTop ?? 0) + (_originY ?? 0), 1 + (_maskRight - _maskLeft) ?? 0, 1 + (_maskBottom - _maskTop) ?? 0)); drawBatch.FillCircle(Brush.White, new Xna.Vector2(originX + _originX ?? 0, originY + _originY ?? 0), 4, 12); drawBatch.FillCircle(Brush.Black, new Xna.Vector2(originX + _originX ?? 0, originY + _originY ?? 0), 3, 12); drawBatch.End(); }