public Circle(int radius, int x, int y, IDrawAPI drawAPI) { base.drawAPI = drawAPI; this.radius = radius; this.x = x; this.y = y; }
public Circle(int x, int y, int radius, IDrawAPI drawAPI) : base(drawAPI) { _x = x; _y = y; _radius = radius; }
public Circle(int x, int y, int radius, IDrawAPI drawApi) : base(drawApi) { base._drawAPI = drawApi; this._X = x; this._Y = y; this._radius = radius; }
public override void Draw(IDrawAPI drawAPI) { if (drawAPI is VertexBatch v) { if (paddingBorderInfo == null) { paddingBorderInfo = Border.GetPaddingBorderDrawInfo(v.primitiveType, position, width, height, roundCorner, paddingColor, quality); } if (borderColor != default && borderInfo == null) { borderInfo = Border.GetBorderDrawInfo(PrimitiveType.LineStrip, position, width, height, roundCorner, borderColor, quality); borderInfo.primitiveType = PrimitiveType.LineStrip; } if (shadowColor != default) { for (int i = 0; i < 6 / shadowDepth; i++) { v.Draw(paddingBorderInfo.Transform(delegate(int z, Vertex v) { return(new Vertex(v.Position.XY() + new Vector2(0, i * 2), shadowColor * 0.05f)); })); } } v.Draw(paddingBorderInfo); font?.DrawString(v, text, position + new Vector2(width, height) / 2, textColor, CenterType.MiddleCenter, textScale); if (highLightTimer != 0) { v.Draw(paddingBorderInfo.Transform(delegate(int z, Vertex v) { return(new Vertex(v.Position, highLightColor * 0.2f * highLightTimer)); })); } if (rippleTimer > 0) { Ripple.DrawRound(v, (int)Helper.Lerp(2 * width + height, 0, 3 + rippleTimer * 0.75f, 4), position, ripplePos, width, height, Color.Transparent.LerpTo(rippleColor, rippleTimer, 1), roundCorner, 1, quality * 3); } rippleTimer *= 0.95f; if (rippleTimer < 0.01f) { rippleTimer = 0; } if (borderInfo != null) { v.Draw(borderInfo); } } }
static void Main() { Form form = new Form(); form.Width = 800; form.Height = 600; DrawingBoard.Init(form); form.Show(); //DrawingBoard.Draw(); //Использование абстрактной фабрики IFigureFactory figureFactory = LoadFactory(); for (int i = 0; i < 20; i++) { IDrawAPI circle = figureFactory.GetFigure("CircleFigure"); circle.DrawAt(random.Next(0, DrawingBoard.Width - MAXWIDTHOFFSET), random.Next(TEXTOFFSET, DrawingBoard.Height - MAXHEIGTHOFFSET)); } for (int i = 0; i < 20; i++) { IDrawAPI circle = figureFactory.GetFigure("SquareFigure"); circle.DrawAt(random.Next(0, DrawingBoard.Width - MAXWIDTHOFFSET), random.Next(TEXTOFFSET, DrawingBoard.Height - MAXHEIGTHOFFSET)); } for (int i = 0; i < 20; i++) { IDrawAPI circle = figureFactory.GetFigure("RectangleFigure"); circle.DrawAt(random.Next(0, DrawingBoard.Width - MAXWIDTHOFFSET), random.Next(TEXTOFFSET, DrawingBoard.Height - MAXHEIGTHOFFSET)); } DrawingBoard.Buffer.Graphics.DrawString($"Circle instances:{CircleFigure.ObjectCounter}" + $"\nSquare instances:{SquareFigure.ObjectCounter}" + $"\nRectangle instances:{RectangleFigure.ObjectCounter}", SystemFonts.DefaultFont, Brushes.White, 0, 0); DrawingBoard.Draw(); Application.Run(form); }
protected Shape(IDrawAPI api) { this.dap = api; }
public BridgeCircle(int x, int y, int radius, IDrawAPI drawAPI) : base(drawAPI) { this.x = x; this.y = y; this.radius = radius; }
protected Shape(IDrawAPI draw) { drawAPI = draw; }
protected Shape(IDrawAPI draw) { this.drawApi = draw; }
protected Shape(IDrawAPI drawAPI) { this.drawAPI = drawAPI; }
public Circle(int radius, int x, int y, IDrawAPI drawAPI) : base(drawAPI) { this.radius = radius; this.x = x; this.y = y; }
public Shape(IDrawAPI drawAPI) { this.DrawAPI = drawAPI; }
public Circle(int _x, int _y, int _radius, IDrawAPI drawAPI) : base(drawAPI) { x = _x; y = _y; radius = _radius; }
protected IShape(IDrawAPI drawAPI) { m_drawAPI = drawAPI; }
public Circle(int x, int y, int radius, IDrawAPI drowAPI) : base(drowAPI) { this.X = x; this.Y = y; this.Radius = radius; }
private void button2_Click(object sender, EventArgs e) { IDrawAPI rectangle = FigureFactory.GetFigure("Rectangle"); rectangle.GetFigure(GetRandom(200), GetRandom(200), GetRandom(200), GetRandom(200), PictureBox); }
private void button1_Click(object sender, EventArgs e) { IDrawAPI circle = FigureFactory.GetFigure("Circle"); circle.GetFigure(GetRandom(200), GetRandom(200), GetRandom(200), PictureBox); }
public Shape(IDrawAPI drawAPI) { _drawAPI = drawAPI; }
protected AbstractShape_抽象图形(IDrawAPI drawAPI) { this.drawAPI = drawAPI; }
public Circle(IDrawAPI api) : base(api) { }
public virtual void Draw(IDrawAPI drawAPI) { States[currentState].Draw(drawAPI); }
public BridgeShape(IDrawAPI drawAPI) { this.drawAPI = drawAPI; }
/// <summary> /// 需要手动调用的绘制 /// </summary> /// <param name="drawAPI">绘制接口</param> public virtual void Draw(IDrawAPI drawAPI) { }
protected Shape(IDrawAPI drawApi) { DrawApi = drawApi; }
protected Shape(IDrawAPI drawApi) { _drawAPI = drawApi; }
/// <summary> /// 通过IDrawAPI绘制文字 /// </summary> public void DrawString(IDrawAPI spriteBatch, string text, Vector2 position) { DrawString(spriteBatch, text, position, Color.White, default, new Vector2(1, 1));
public CircleEx(int x, int y, int radius, IDrawAPI drawapi) : base(drawapi) { this.x = x; this.y = y; this.radius = radius; }
public Circle(IDrawAPI api, int x, int i, int radius) : base(api) { this.x = x; this.y = i; this.radius = radius; }