public override void Draw(SharpGL.OpenGL gl) { if ( _trail > 1) { for ( int t = 0; t<_trail;t++ ) { PointFloat trailPos = GetPosition(); PointFloat vel = GetVelocity(); PointFloat dit = new PointFloat(trailPos.x - vel.x*t, trailPos.y - vel.y*t); PointFloat[] pointData = RenderLogics.RectPoint(dit, GetSize(), GetRotation()); GetTexture().UseTexure(gl); gl.Begin(OpenGL.GL_QUADS); byte[] col = GetColor(); gl.Color(col[0], col[1], col[2]); gl.TexCoord(0, 0); gl.Vertex(pointData[1].x, pointData[1].y); gl.TexCoord(0, 1); gl.Vertex(pointData[0].x, pointData[0].y); gl.TexCoord(1, 1); gl.Vertex(pointData[3].x, pointData[3].y); gl.TexCoord(1, 0); gl.Vertex(pointData[2].x, pointData[2].y); gl.End(); } } base.Draw(gl); }
public static List <PointFloat[][]> stringToCorner(string[] lines) { var res = new List <PointFloat[][]>(); while (lines.Length > 0) { int len = Convert.ToInt32(lines[0]); var curLines = new PointFloat[len][]; res.Add(curLines); for (int i = 0; i < len; i++) { var line = lines[i + 1]; var segs = line.Split(' '); var pts = new List <PointFloat>(); foreach (var seg in segs) { if (seg.Trim() == "") { continue; } var ps = seg.Split(','); pts.Add(new PointFloat(Convert.ToSingle(ps[0]), Convert.ToSingle(ps[1]))); } curLines[i] = pts.ToArray(); } lines = lines.Skip(len + 1).ToArray(); } return(res); }
public override void Draw(SharpGL.OpenGL gl) { if (_trail > 1) { for (int t = 0; t < _trail; t++) { PointFloat trailPos = GetPosition(); PointFloat vel = GetVelocity(); PointFloat dit = new PointFloat(trailPos.x - vel.x * t, trailPos.y - vel.y * t); PointFloat[] pointData = RenderLogics.RectPoint(dit, GetSize(), GetRotation()); GetTexture().UseTexure(gl); gl.Begin(OpenGL.GL_QUADS); byte[] col = GetColor(); gl.Color(col[0], col[1], col[2]); gl.TexCoord(0, 0); gl.Vertex(pointData[1].x, pointData[1].y); gl.TexCoord(0, 1); gl.Vertex(pointData[0].x, pointData[0].y); gl.TexCoord(1, 1); gl.Vertex(pointData[3].x, pointData[3].y); gl.TexCoord(1, 0); gl.Vertex(pointData[2].x, pointData[2].y); gl.End(); } } base.Draw(gl); }
private void RenderSelection(IDrawingContext dc, float scale, PointFloat offset, SelectionRenderParameters renderParams, Result <IGeometry> lazyGeometry, IBrush interiorBrush, IBrush outlineBrush, IStrokeStyle outlineStrokeStyle, AntialiasMode antialiasMode) { using (dc.UseScaleTransform(scale, scale, MatrixMultiplyOrder.Prepend)) { using (dc.UseTranslateTransform(offset.X, offset.Y, MatrixMultiplyOrder.Prepend)) { if (renderParams.IsInteriorFilled && (interiorBrush != null)) { using (dc.UseAntialiasMode(AntialiasMode.Aliased)) { dc.FillGeometry(lazyGeometry.Value, interiorBrush, null); } } if (renderParams.IsOutlineEnabled && (outlineBrush != null)) { float strokeWidth = this.outlineStrokeWidthPx / scale; using (dc.UseAntialiasMode(antialiasMode)) { using (dc.UseTranslateTransform(0.5f, 0.5f, MatrixMultiplyOrder.Append)) { dc.DrawGeometry(lazyGeometry.Value, outlineBrush, strokeWidth, outlineStrokeStyle); } } } } } }
/// <summary> /// Initializes a new instance of the <see cref="Living"/> base class. /// </summary> /// <param name="health"></param> /// <param name="movementSpeed"></param> protected Living(int health, float movementSpeed, Point location) { this.Health = new Util.Attribute32(health); this.Movement = new AttributeFloat(movementSpeed); Living.LivingCreated(this, new LivingEventArg(this, location)); this.MapLocation = location; this.ScreenLocation = new PointFloat(location.X, location.Y); }
public PointDescriptionFloat(PointFloat point, PointFloat unitTangentVector, int endSegment, int endFigure, float lengthToEndSegment) { this.point = point; this.unitTangentVector = unitTangentVector; this.endSegment = endSegment; this.endFigure = endFigure; this.lengthToEndSegment = lengthToEndSegment; }
private PointFloat MoveBackward(PointFloat vel) { float xAdd = (float)Math.Sin((double)GetRotation()); float yAdd = (float)Math.Cos((double)GetRotation()); vel.x = vel.x + (-xAdd - vel.x) / 100; vel.y = vel.y + (-yAdd - vel.y) / 100; return(vel); }
private PointFloat MoveForward(PointFloat vel) { float xAdd = (float)Math.Sin((double)GetRotation()); float yAdd = (float)Math.Cos((double)GetRotation()); vel.x = vel.x + (xAdd - vel.x) / 100; vel.y = vel.y + (yAdd - vel.y) / 100; engineFirePar.Blow(0.4f, 2, false); return(vel); }
static PointFloat[] convertToPF(PointF[] p) { var res = new PointFloat[p.Length]; for (int i = 0; i < p.Length; i++) { res[i] = new PointFloat(p[i].X, p[i].Y); } return(res); }
public TimedCannon(float posx, float posy, int[] times) { _times = times.ToList(); _color = new byte[3] { (byte)r.Next(255), (byte)r.Next(255), (byte)r.Next(255) }; _pos = new PointFloat(posx, posy); _firePar.SetLifeTime(3, 6); _firePar.SetPhysics(false); _firePar.SetSpread(0.5f); _firePar.SetSize(0.1f,0.1f); _firePar.SetRandomSpeed(true,0.5f); _firePar.SetColor(255, 255, 100); }
private ShowNodesEventParameter CreateShowNodesEventParameter(PointFloat pnt, bool singleSelect, DiagramShape currentShape) { var para = new ShowNodesEventParameter(); para.MouseClickPoint = pnt; para.Application = Application; para.CreateShape = (x) => { var rst = new DiagramShapeEx(SDLDiagramShapes.Procedure, x.X, x.Y, x.Width, x.Height); rst.Image = x.GetImage(); _diagram.Items.Add(rst); _diagram.SelectItem(rst); return(rst); }; para.ObjectSpace = _os; para.SelectedForms = _diagram.Items.OfType <DiagramShape>().Select(x => (x.Tag as IFlowNode)).ToArray(); para.Shape = currentShape; para.SingleSelect = singleSelect; para.UpdateShape = (node, shape) => { var s = shape as DiagramShape; s.Content = node.Caption; s.Tag = node; }; para.DoShowNavigationItem = (x) => { var snc = Application.MainWindow.GetController <SubSystemNavigationController>(); var sname = x.Split('/'); if (sname.Length > 3) { snc.NavigationToSystem(sname[3]); } var ctrl = Application.MainWindow.GetController <ShowNavigationItemController>().ShowNavigationItemAction; var toItem = FindChoiceActionItemByModelPath(ctrl.Items, x); ctrl.SelectedItem = toItem; ctrl.DoExecute(toItem); //ctrl.FindItemByIdPath() }; if (currentShape != null) { para.SelectedNode = currentShape.Tag as IFlowNode; } para.DeletSelectedNode = () => { _diagram.DeleteSelectedItems(); }; para.ViewParameter = new ShowViewParameters(); Flow.ShowNodesView(para); return(para); }
public TimedCannon(float posx, float posy, int[] times) { _times = times.ToList(); _color = new byte[3] { (byte)r.Next(255), (byte)r.Next(255), (byte)r.Next(255) }; _pos = new PointFloat(posx, posy); _firePar.SetLifeTime(3, 6); _firePar.SetPhysics(false); _firePar.SetSpread(0.5f); _firePar.SetSize(0.1f, 0.1f); _firePar.SetRandomSpeed(true, 0.5f); _firePar.SetColor(255, 255, 100); }
/// <summary> /// Rotates the bitmap by the specified angle. /// </summary> /// <param name="b">Bitmap</param> /// <param name="point">Float point</param> /// <param name="angle">Angle in degrees</param> /// <returns>Bitmap</returns> public static Bitmap Rotate(this Bitmap b, PointFloat point, float angle) { Bitmap bmp = new Bitmap(b.Width, b.Height); bmp.SetResolution(b.HorizontalResolution, b.VerticalResolution); Graphics graphics = Graphics.FromImage(bmp); graphics.InterpolationMode = InterpolationMode.HighQualityBilinear; graphics.TranslateTransform(point.X, point.Y); graphics.RotateTransform(angle); graphics.TranslateTransform(-point.X, -point.Y); graphics.DrawImage(b, new PointF(0, 0)); graphics.Dispose(); return(bmp); }
private LineSlop GetEpLineABC(PointFloat pts, PointSide side, GMatrix f) { if (side == PointSide.Right) { f = f.tranpose(); } var gm = f.dot(new GMatrix(new double[3, 1] { { pts.X }, { pts.Y }, { 1 } })); var ms = gm.storage; var a = ms[0][0]; var b = ms[1][0]; var c = ms[2][0]; return(new LineSlop(a, b, c)); }
public override void Draw(OpenGL gl) { PointFloat _size = GetSize(); PointFloat[] pointData = RenderLogics.RectPoint(GetPosition(), _size, GetRotation()); byte[] color = GetColor(); GetTexture().UseTexure(gl); gl.Begin(OpenGL.GL_QUADS); gl.Color(color[0], color[1], color[2]); gl.TexCoord(0, 0); gl.Vertex(pointData[1].x, pointData[1].y); gl.TexCoord(0, 1); gl.Vertex(pointData[0].x, pointData[0].y); gl.TexCoord(1, 1); gl.Vertex(pointData[3].x, pointData[3].y); gl.TexCoord(1, 0); gl.Vertex(pointData[2].x, pointData[2].y); gl.End(); }
public override void Update(GameSettings settings) { _dir.x = 0; _dir.y = 0; PointFloat selfPos = GetPosition(); foreach (GameObject obj in TomatoMainEngine.GameObjects) { if (obj.Type == Type && obj != this) { PointFloat objPos = obj.GetPosition(); float x = selfPos.x - objPos.x; float y = selfPos.y - objPos.y; float h = -(float)Math.Atan2(x, y); h = h + GetVelocity().GetSpeed() * 2; _dir = _dir - Helpers.PhysicsAndPositions.GetDirection(h); } } float x0 = selfPos.x; float y0 = selfPos.y; float h0 = -(float)Math.Atan2(x0, y0); h0 = h0 + GetVelocity().GetSpeed() * 2; _dir = _dir - Helpers.PhysicsAndPositions.GetDirection(h0); SetVelocityAdd(_dir / 500); _fire.SetPos(GetPosition()); _fire.Blow(0.03f, 4, false); if (_timer < 0) { SetVelocityAdd(Helpers.PhysicsAndPositions.GetDirection(GetRotation()) / 10.0f); _timer = 900; } _timer--; if (ControlKeys.IsKeyDown("e")) { SetVelocityAdd(Helpers.PhysicsAndPositions.GetDirection(GetRotation()) / 10.0f); } base.Update(settings); }
public override void Update(GameSettings settings) { PointFloat vel = GetVelocity(); float rotV = GetRotationVelocity(); rotV = rotV - (rotV / 50); if (ControlKeys.IsKeyDown("s")) { vel = MoveBackward(vel); } if (ControlKeys.IsKeyDown("w")) { vel = MoveForward(vel); //Console.WriteLine(GetPosition().x + " " + GetPosition().y); } if (ControlKeys.IsKeyDown("d")) { rotV = rotV + (0.05f - rotV); } if (ControlKeys.IsKeyDown("a")) { rotV = rotV + (-0.05f - rotV); } if (ControlKeys.IsKeyDown("e")) { gun.SetPos(Helpers.PhysicsAndPositions.OffsetPosition(GetPosition(), 2.0f, GetRotation() + (float)Math.PI * 0.5f)); gun.SetRot(GetRotation()); gun.SetSpread(Helpers.PhysicsAndPositions.PI * 2); gun.SetLifeTime(100, 200); gun.Blow(1f, 100, false); } SetVelocity(vel); SetRotationVelocity(rotV); base.Update(settings); engineFirePar.SetPos(Helpers.PhysicsAndPositions.OffsetPosition(GetPosition(), 1.0f, GetRotation() + (float)Math.PI * 1.5f)); engineFirePar.SetRot(GetRotation() + 3.14f); CamController.SetPos(GetPosition()); }
public FireWork(PointFloat pos, byte[] color) : base("FireWork") { SetTexture("bullet"); float velx = (float)(r.NextDouble() - 0.5); float vely = (float)(r.NextDouble()) + 3.0f; SetVelocity(velx / 10f, vely / 6.0f); EnablePhysics(false); SetStaticObject(false); SetSize(0.2f, 0.2f); SetPos(pos); _explosion.SetRandomSpeed(true, 0.01f); _explosion.SetSpread(Helpers.PhysicsAndPositions.PI * 2); _explosion.SetLifeTime(30, 100); _explosion.SetPhysics(false); _color = color; _smoke.SetSize(0.05f, 0.05f); _smoke.SetPhysics(false); _smoke.SetSpread(1f); SetRotationVelocity((float)r.Next(20, 60) / 100f); time = r.Next(50, 100); SoundPool.PlaySound("lauch"); }
public FireWork(PointFloat pos, byte[] color) : base("FireWork") { SetTexture("bullet"); float velx = (float)( r.NextDouble() -0.5); float vely = (float)( r.NextDouble() ) + 3.0f; SetVelocity(velx / 10f, vely / 6.0f); EnablePhysics(false); SetStaticObject(false); SetSize(0.2f,0.2f); SetPos(pos); _explosion.SetRandomSpeed(true,0.01f); _explosion.SetSpread(Helpers.PhysicsAndPositions.PI * 2); _explosion.SetLifeTime(30,100); _explosion.SetPhysics(false); _color = color; _smoke.SetSize(0.05f,0.05f); _smoke.SetPhysics(false); _smoke.SetSpread(1f); SetRotationVelocity( (float)r.Next(20, 60) / 100f ); time = r.Next(50,100); SoundPool.PlaySound("lauch"); }
public override void Update(GameSettings settings) { _dir.x = 0; _dir.y = 0; PointFloat selfPos = GetPosition(); foreach(GameObject obj in TomatoMainEngine.GameObjects){ if(obj.Type == Type && obj != this){ PointFloat objPos = obj.GetPosition(); float x = selfPos.x - objPos.x; float y = selfPos.y - objPos.y; float h = -(float)Math.Atan2(x, y); h = h + GetVelocity().GetSpeed() * 2; _dir = _dir - Helpers.PhysicsAndPositions.GetDirection(h); } } float x0 = selfPos.x; float y0 = selfPos.y; float h0 = -(float)Math.Atan2(x0, y0); h0 = h0 + GetVelocity().GetSpeed() * 2; _dir = _dir - Helpers.PhysicsAndPositions.GetDirection(h0); SetVelocityAdd(_dir / 500); _fire.SetPos(GetPosition()); _fire.Blow(0.03f,4, false); if (_timer < 0) { SetVelocityAdd(Helpers.PhysicsAndPositions.GetDirection(GetRotation()) / 10.0f); _timer = 900; } _timer--; if(ControlKeys.IsKeyDown("e")){ SetVelocityAdd(Helpers.PhysicsAndPositions.GetDirection(GetRotation()) / 10.0f); } base.Update(settings); }
private void DrawEpl(Mat img, LineSlop m, MCvScalar clr, PointFloat rpts) { var a = m.a; var b = m.b; var c = m.c; //Console.WriteLine(m); if (Math.Abs(a) > Math.Abs(b)) { Func <System.Drawing.Point, System.Drawing.Point> fixv = vv => { //vv.X = Math.Abs(vv.X); return(vv); }; Func <int, System.Drawing.Point> toX = y => new System.Drawing.Point((int)((-c - (b * y)) / a), y); var p1 = fixv(toX(0)); var p2 = fixv(toX(img.Height)); var sum = (rpts.X * a) + (rpts.Y * b) + c; //Console.WriteLine($"Drawinga {p1.X},{p1.Y} {p2.X},{p2.Y} {sum}"); CvInvoke.Line(img, p1, p2, clr, 2); } else { Func <System.Drawing.Point, System.Drawing.Point> fixv = vv => { //vv.Y = Math.Abs(vv.Y); return(vv); }; Func <int, System.Drawing.Point> toY = x => new System.Drawing.Point(x, (int)((-c - (a * x)) / b)); var p1 = fixv(toY(0)); var p2 = fixv(toY(img.Width)); var sum = (rpts.X * a) + (rpts.Y * b) + c; CvInvoke.Line(img, p1, p2, clr, 2); //Console.WriteLine($"Drawingb {p1.X},{p1.Y} {p2.X},{p2.Y} {sum}"); } }
public static PointFloat OffsetPosition(PointFloat pos, float distance, float angle) { _pointfloat.x = pos.x + ( (float)Math.Cos(-angle) * -distance ); _pointfloat.y = pos.y + ( (float)Math.Sin(-angle) * -distance ); return _pointfloat; }
public void SetPos(PointFloat pos) { _pos.x = pos.x; _pos.y = pos.y; }
public bool FillContainsPoint(PointFloat point, Matrix3x2Float?worldTransform, float?flatteningTolerance) => base.innerRefT.FillContainsPoint(point, worldTransform, flatteningTolerance);
public void DrawLine(PointFloat point0, PointFloat point1, IBrush brush, float strokeWidth, IStrokeStyle strokeStyle) { base.innerRefT.DrawLine(point0, point1, brush, strokeWidth, strokeStyle); }
private PointFloat MoveBackward(PointFloat vel) { float xAdd = (float)Math.Sin((double)GetRotation()); float yAdd = (float)Math.Cos((double)GetRotation()); vel.x = vel.x + ( -xAdd - vel.x )/100; vel.y = vel.y + ( -yAdd - vel.y )/100; return vel; }
public void SetPosAdd(PointFloat add) { _pos.x = _pos.x + add.x; _pos.y = _pos.y + add.y; }
public void SetSize(PointFloat size) { _size.x = size.x; _size.y = size.y; }
public void BeginFigure(PointFloat startPoint, FigureBegin figureBegin) { base.innerRefT.BeginFigure(startPoint, figureBegin); }
public static float GetSpeed(PointFloat vel) { return (float)Math.Pow(vel.x + vel.y,2); }
public MainWindow() { InitializeComponent(); var al = new List <PointFloat>(); var ar = new List <PointFloat>(); List <StereoPoints> allPts = new List <StereoPoints>(); PointFloat imgSize = null; foreach (var iii in images) { var left = CvInvoke.Imread($"{imageDir}\\Left_{iii}.jpg"); imgSize = new PointFloat(left.Width, left.Height); var right = CvInvoke.Imread($"{imageDir}\\Right_{iii}.jpg"); var corl = convertToPF(netCvLib.calib3d.Calib.findConers(left.ToImage <Gray, Byte>())); al.AddRange(corl); var corr = convertToPF(netCvLib.calib3d.Calib.findConers(right.ToImage <Gray, Byte>())); ar.AddRange(corr); allPts.Add(new StereoPoints { Left = corl, Right = corr }); File.WriteAllLines($"{imageDir}\\Left_{iii}.txt", cornerToString(corl)); File.WriteAllLines($"{imageDir}\\Right_{iii}.txt", cornerToString(corr)); var ff = com.veda.LinearAlg.Calib.CalcFundm((corl), (corr)); //Console.WriteLine(ff); } Console.WriteLine("F"); F = com.veda.LinearAlg.Calib.CalcFundm(al.ToArray(), ar.ToArray()); Console.WriteLine(F); calres = CalibRect.Rectify(allPts, imgSize); Console.WriteLine("Callres"); Console.WriteLine(calres.F); Console.WriteLine(calres.el.X.ToString("0.00") + " " + calres.el.Y.ToString("0.00")); Console.WriteLine(calres.LeftIntrinics); Console.WriteLine(calres.RightIntrinics); Console.WriteLine(calres.H1); Console.WriteLine(calres.H2); Console.WriteLine("E"); Console.WriteLine(calres.E); var rtl = calres.GetRT(calres.E); Console.WriteLine("RT from left"); Console.WriteLine(rtl.R); Console.WriteLine(rtl.T); who = 0; imgSelFunc(); for (int i = 0; i < cbs.Length; i++) { var cb = new CheckBox(); cb.Name = "chkEpl_" + i; cb.IsChecked = false; cb.Checked += Cb_Checked; cb.Unchecked += Cb_Checked; cbs[i] = cb; onChecks[i] = false; } foreach (var cb in cbs) { stkEpoles.Children.Add(cb); } }
protected void convertToPdfButton_Click(object sender, EventArgs e) { // Get the server IP and port String serverIP = textBoxServerIP.Text; uint serverPort = uint.Parse(textBoxServerPort.Text); // Create a HTML to PDF converter object with default settings HtmlToPdfConverter htmlToPdfConverter = new HtmlToPdfConverter(serverIP, serverPort); // Set optional service password if (textBoxServicePassword.Text.Length > 0) { htmlToPdfConverter.ServicePassword = textBoxServicePassword.Text; } // Set license key received after purchase to use the converter in licensed mode // Leave it not set to use the converter in demo mode htmlToPdfConverter.LicenseKey = "4W9+bn19bn5ue2B+bn1/YH98YHd3d3c="; // Set an adddional delay in seconds to wait for JavaScript or AJAX calls after page load completed // Set this property to 0 if you don't need to wait for such asynchcronous operations to finish htmlToPdfConverter.ConversionDelay = 2; // Convert a HTML page to a PDF document object Document pdfDocument = htmlToPdfConverter.ConvertUrlToPdfDocumentObject(urlTextBox.Text); int goToPageNumber = int.Parse(pageNumberTextBox.Text); // Get destination PDF page PdfPage goToPage = pdfDocument.GetPage(goToPageNumber - 1); // Get the destination point in PDF page float goToX = float.Parse(xLocationTextBox.Text); float goToY = float.Parse(yLocationTextBox.Text); PointFloat goToLocation = new PointFloat(goToX, goToY); // Get the destination view mode DestinationViewMode viewMode = SelectedViewMode(); // Create the destination in PDF document ExplicitDestination goToDestination = new ExplicitDestination(goToPage, goToLocation, viewMode); // Set the zoom level when the destination is displayed if (viewMode == DestinationViewMode.XYZ) { goToDestination.ZoomPercentage = int.Parse(zoomLevelTextBox.Text); } // Set the document Go To open action pdfDocument.OpenAction = new PdfActionGoTo(goToDestination); // Save the PDF document in a memory buffer byte[] outPdfBuffer = pdfDocument.Save(); // Send the PDF as response to browser // Set response content type Response.AddHeader("Content-Type", "application/pdf"); // Instruct the browser to open the PDF file as an attachment or inline Response.AddHeader("Content-Disposition", String.Format("attachment; filename=Set_Initial_Zoom_Level.pdf; size={0}", outPdfBuffer.Length.ToString())); // Write the PDF document buffer to HTTP response Response.BinaryWrite(outPdfBuffer); // End the HTTP response and stop the current page processing Response.End(); }
protected void createPdfButton_Click(object sender, EventArgs e) { // Get the server IP and port String serverIP = textBoxServerIP.Text; uint serverPort = uint.Parse(textBoxServerPort.Text); // Create a PDF document Document pdfDocument = new Document(serverIP, serverPort); // Set optional service password if (textBoxServicePassword.Text.Length > 0) { pdfDocument.ServicePassword = textBoxServicePassword.Text; } // Set license key received after purchase to use the converter in licensed mode // Leave it not set to use the converter in demo mode pdfDocument.LicenseKey = "4W9+bn19bn5ue2B+bn1/YH98YHd3d3c="; // The titles font used to mark various sections of the PDF document PdfFont titleFont = new PdfFont("Times New Roman", 12, true); titleFont.Bold = true; // Create a PDF page in PDF document PdfPage pdfPage = pdfDocument.AddPage(); // Line Elements // Add section title TextElement titleTextElement = new TextElement(5, 5, "Line Elements", titleFont); titleTextElement.ForeColor = RgbColor.Black; pdfPage.AddElement(titleTextElement); // Add a line with default properties LineElement lineElement = new LineElement(0, 0, 50, 0); pdfDocument.AddElement(lineElement, 10); // Add a bold line LineElement boldLineElement = new LineElement(0, 0, 50, 0); boldLineElement.LineStyle.LineWidth = 3; pdfDocument.AddElement(boldLineElement, 10, true, false, 0, true, false); // Add dotted line LineElement dottedLineElement = new LineElement(0, 0, 50, 0); dottedLineElement.LineStyle.LineDashStyle = LineDashStyle.Dot; dottedLineElement.ForeColor = RgbColor.Green; pdfDocument.AddElement(dottedLineElement, 10, true, false, 0, true, false); // Add a dashed line LineElement dashedLineElement = new LineElement(0, 0, 50, 0); dashedLineElement.LineStyle.LineDashStyle = LineDashStyle.Dash; dashedLineElement.ForeColor = RgbColor.Green; pdfDocument.AddElement(dashedLineElement, 10, true, false, 0, true, false); // Add a dash-dot-dot line LineElement dashDotDotLineElement = new LineElement(0, 0, 50, 0); dashDotDotLineElement.LineStyle.LineDashStyle = LineDashStyle.DashDotDot; dashDotDotLineElement.ForeColor = RgbColor.Green; pdfDocument.AddElement(dashDotDotLineElement, 10, true, false, 0, true, false); // Add a bold line with rounded cap style LineElement roundCapBoldLine = new LineElement(0, 0, 50, 0); roundCapBoldLine.LineStyle.LineWidth = 5; roundCapBoldLine.LineStyle.LineCapStyle = LineCapStyle.RoundCap; roundCapBoldLine.ForeColor = RgbColor.Blue; pdfDocument.AddElement(roundCapBoldLine, 10, true, false, 0, true, false); // Add a bold line with projecting square cap style LineElement projectingSquareCapBoldLine = new LineElement(0, 0, 50, 0); projectingSquareCapBoldLine.LineStyle.LineWidth = 5; projectingSquareCapBoldLine.LineStyle.LineCapStyle = LineCapStyle.ProjectingSquareCap; projectingSquareCapBoldLine.ForeColor = RgbColor.Blue; pdfDocument.AddElement(projectingSquareCapBoldLine, 10, true, false, 0, true, false); // Add a bold line with projecting butt cap style LineElement buttCapBoldLine = new LineElement(0, 0, 50, 0); buttCapBoldLine.LineStyle.LineWidth = 5; buttCapBoldLine.LineStyle.LineCapStyle = LineCapStyle.ButtCap; buttCapBoldLine.ForeColor = RgbColor.Blue; pdfDocument.AddElement(buttCapBoldLine, 10, true, false, 0, true, false); // Line Join Styles // Add section title titleTextElement = new TextElement(0, 0, "Line Join and Cap Styles", titleFont); titleTextElement.ForeColor = RgbColor.Black; pdfDocument.AddElement(titleTextElement, 5, false, 10, true); // Add graphic path with miter join line style PathElement miterJoinPath = new PathElement(new PointFloat(0, 50)); // Add path lines miterJoinPath.AddLineSegment(new PointFloat(25, 0)); miterJoinPath.AddLineSegment(new PointFloat(50, 50)); // Set path style miterJoinPath.LineStyle.LineWidth = 5; miterJoinPath.LineStyle.LineCapStyle = LineCapStyle.ProjectingSquareCap; miterJoinPath.LineStyle.LineJoinStyle = LineJoinStyle.MiterJoin; miterJoinPath.ForeColor = RgbColor.Coral; pdfDocument.AddElement(miterJoinPath, 5, false, 10, true); // Add graphic path with round join line style PathElement roundJoinPath = new PathElement(new PointFloat(0, 50)); // Add path lines roundJoinPath.AddLineSegment(new PointFloat(25, 0)); roundJoinPath.AddLineSegment(new PointFloat(50, 50)); // Set path style roundJoinPath.LineStyle.LineWidth = 5; roundJoinPath.LineStyle.LineCapStyle = LineCapStyle.RoundCap; roundJoinPath.LineStyle.LineJoinStyle = LineJoinStyle.RoundJoin; roundJoinPath.ForeColor = RgbColor.Coral; pdfDocument.AddElement(roundJoinPath, 20, true, false, 0, true, false); // Add graphic path with bevel join line style PathElement bevelJoinPath = new PathElement(new PointFloat(0, 50)); // Add lines to path bevelJoinPath.AddLineSegment(new PointFloat(25, 0)); bevelJoinPath.AddLineSegment(new PointFloat(50, 50)); // Set path style bevelJoinPath.LineStyle.LineWidth = 5; bevelJoinPath.LineStyle.LineCapStyle = LineCapStyle.ButtCap; bevelJoinPath.LineStyle.LineJoinStyle = LineJoinStyle.BevelJoin; bevelJoinPath.ForeColor = RgbColor.Coral; // Add element to document pdfDocument.AddElement(bevelJoinPath, 20, true, false, 0, true, false); // Add a polygon with miter join line style PointFloat[] polygonPoints = new PointFloat[] { new PointFloat(0, 50), new PointFloat(25, 0), new PointFloat(50, 50) }; PolygonElement miterJoinPolygon = new PolygonElement(polygonPoints); // Set polygon style miterJoinPolygon.LineStyle.LineWidth = 5; miterJoinPolygon.LineStyle.LineJoinStyle = LineJoinStyle.MiterJoin; miterJoinPolygon.ForeColor = RgbColor.Green; miterJoinPolygon.BackColor = RgbColor.AliceBlue; pdfDocument.AddElement(miterJoinPolygon, 20, true, false, 0, true, false); // Add a polygon with round join line style polygonPoints = new PointFloat[] { new PointFloat(0, 50), new PointFloat(25, 0), new PointFloat(50, 50) }; PolygonElement roundJoinPolygon = new PolygonElement(polygonPoints); // Set polygon style roundJoinPolygon.LineStyle.LineWidth = 5; roundJoinPolygon.LineStyle.LineJoinStyle = LineJoinStyle.RoundJoin; roundJoinPolygon.ForeColor = RgbColor.Green; roundJoinPolygon.BackColor = RgbColor.Blue; pdfDocument.AddElement(roundJoinPolygon, 20, true, false, 0, true, false); // Add a polygon with bevel join line style polygonPoints = new PointFloat[] { new PointFloat(0, 50), new PointFloat(25, 0), new PointFloat(50, 50) }; PolygonElement bevelJoinPolygon = new PolygonElement(polygonPoints); // Set polygon style bevelJoinPolygon.LineStyle.LineWidth = 5; bevelJoinPolygon.LineStyle.LineJoinStyle = LineJoinStyle.BevelJoin; bevelJoinPolygon.ForeColor = RgbColor.Green; bevelJoinPolygon.BackColor = RgbColor.Blue; pdfDocument.AddElement(bevelJoinPolygon, 20, true, false, 0, true, false); // Add a Graphics Path Element // Add section title titleTextElement = new TextElement(0, 0, "Path Elements", titleFont); titleTextElement.ForeColor = RgbColor.Black; pdfDocument.AddElement(titleTextElement, 5, false, 10, true); // Create the path PathElement graphicsPath = new PathElement(new PointFloat(0, 0)); // Add line and Bezier curve segments graphicsPath.AddLineSegment(new PointFloat(50, 50)); graphicsPath.AddBezierCurveSegment(new PointFloat(100, 0), new PointFloat(200, 100), new PointFloat(250, 50)); graphicsPath.AddLineSegment(new PointFloat(300, 0)); // Close path graphicsPath.ClosePath = true; // Set path style graphicsPath.LineStyle.LineWidth = 3; graphicsPath.LineStyle.LineJoinStyle = LineJoinStyle.MiterJoin; graphicsPath.LineStyle.LineCapStyle = LineCapStyle.RoundCap; graphicsPath.ForeColor = RgbColor.Green; //graphicsPath.BackColor = Color.Green; graphicsPath.Gradient = new GradientColor(GradientDirection.Vertical, RgbColor.LightGreen, RgbColor.Blue); // Add element to document pdfDocument.AddElement(graphicsPath, 5, false, 10, true); // Add Circle Elements // Add section title titleTextElement = new TextElement(0, 0, "Circle Elements", titleFont); titleTextElement.ForeColor = RgbColor.Black; pdfDocument.AddElement(titleTextElement, 5, false, 10, true); // Add a Circle Element with default settings CircleElement circleElement = new CircleElement(30, 30, 30); pdfDocument.AddElement(circleElement, 10); // Add dotted circle element CircleElement dottedCircleElement = new CircleElement(30, 30, 30); dottedCircleElement.ForeColor = RgbColor.Green; dottedCircleElement.LineStyle.LineDashStyle = LineDashStyle.Dot; pdfDocument.AddElement(dottedCircleElement, 10, true, false, 0, true, false); // Add a disc CircleElement discElement = new CircleElement(30, 30, 30); discElement.ForeColor = RgbColor.Green; discElement.BackColor = RgbColor.LightGray; pdfDocument.AddElement(discElement, 10, true, false, 0, true, false); // Add disc with bold border CircleElement discWithBoldBorder = new CircleElement(30, 30, 30); discWithBoldBorder.LineStyle.LineWidth = 5; discWithBoldBorder.BackColor = RgbColor.Coral; discWithBoldBorder.ForeColor = RgbColor.Blue; pdfDocument.AddElement(discWithBoldBorder, 10, true, false, 0, true, false); // Add colored disc with bold border for (int i = 30; i > 0; i = i - 3) { CircleElement coloredDisc = new CircleElement(30, 30, i); coloredDisc.LineStyle.LineWidth = 3; switch ((i / 3) % 7) { case 0: coloredDisc.BackColor = RgbColor.Red; break; case 1: coloredDisc.BackColor = RgbColor.Orange; break; case 2: coloredDisc.BackColor = RgbColor.Yellow; break; case 3: coloredDisc.BackColor = RgbColor.Green; break; case 4: coloredDisc.BackColor = RgbColor.Blue; break; case 5: coloredDisc.BackColor = RgbColor.Indigo; break; case 6: coloredDisc.BackColor = RgbColor.Violet; break; default: break; } if (i == 30) { pdfDocument.AddElement(coloredDisc, 10, true, false, 0, true, false); } else { pdfDocument.AddElement(coloredDisc, 3, true, true, 3, true, false); } } // Add a doughnut CircleElement exteriorNoBorderDisc = new CircleElement(30, 30, 30); exteriorNoBorderDisc.BackColor = RgbColor.Coral; pdfDocument.AddElement(exteriorNoBorderDisc, 40, true, false, -30, true, false); CircleElement interiorNoBorderDisc = new CircleElement(30, 30, 15); interiorNoBorderDisc.BackColor = RgbColor.White; pdfDocument.AddElement(interiorNoBorderDisc, 15, true, true, 15, true, false); // Add a simple disc CircleElement simpleDisc = new CircleElement(30, 30, 30); simpleDisc.BackColor = RgbColor.Green; pdfDocument.AddElement(simpleDisc, 25, true, false, -15, true, false); // Add Ellipse Elements // Add section title titleTextElement = new TextElement(0, 0, "Ellipse Elements", titleFont); titleTextElement.ForeColor = RgbColor.Black; pdfDocument.AddElement(titleTextElement, 5, false, 10, true); // Add an Ellipse Element with default settings EllipseElement ellipseElement = new EllipseElement(50, 30, 50, 30); pdfDocument.AddElement(ellipseElement, 5, false, 10, true); // Add an Ellipse Element with background color and line color EllipseElement ellipseWithBackgroundAndBorder = new EllipseElement(50, 30, 50, 30); ellipseWithBackgroundAndBorder.BackColor = RgbColor.LightGray; ellipseWithBackgroundAndBorder.ForeColor = RgbColor.Green; pdfDocument.AddElement(ellipseWithBackgroundAndBorder, 10, true, false, 0, true, false); // Create an ellipse from multiple Ellipse Arc Elements EllipseArcElement ellipseArcElement1 = new EllipseArcElement(0, 0, 100, 60, 0, 100); ellipseArcElement1.ForeColor = RgbColor.Coral; ellipseArcElement1.LineStyle.LineWidth = 3; pdfDocument.AddElement(ellipseArcElement1, 10, true, false, 0, true, false); EllipseArcElement ellipseArcElement2 = new EllipseArcElement(0, 0, 100, 60, 100, 100); ellipseArcElement2.ForeColor = RgbColor.Blue; ellipseArcElement2.LineStyle.LineWidth = 3; pdfDocument.AddElement(ellipseArcElement2, 0, true, true, 0, true, false); EllipseArcElement ellipseArcElement3 = new EllipseArcElement(0, 0, 100, 60, 180, 100); ellipseArcElement3.ForeColor = RgbColor.Green; ellipseArcElement3.LineStyle.LineWidth = 3; pdfDocument.AddElement(ellipseArcElement3, 0, true, true, 0, true, false); EllipseArcElement ellipseArcElement4 = new EllipseArcElement(0, 0, 100, 60, 270, 100); ellipseArcElement4.ForeColor = RgbColor.Violet; ellipseArcElement4.LineStyle.LineWidth = 3; pdfDocument.AddElement(ellipseArcElement4, 0, true, true, 0, true, false); // Create an ellipse from multiple Ellipse Slice Elements EllipseSliceElement ellipseSliceElement1 = new EllipseSliceElement(0, 0, 100, 60, 0, 90); ellipseSliceElement1.BackColor = RgbColor.Coral; pdfDocument.AddElement(ellipseSliceElement1, 10, true, false, 0, true, false); EllipseSliceElement ellipseSliceElement2 = new EllipseSliceElement(0, 0, 100, 60, 90, 90); ellipseSliceElement2.BackColor = RgbColor.Blue; pdfDocument.AddElement(ellipseSliceElement2, 0, true, true, 0, true, false); EllipseSliceElement ellipseSliceElement3 = new EllipseSliceElement(0, 0, 100, 60, 180, 90); ellipseSliceElement3.BackColor = RgbColor.Green; pdfDocument.AddElement(ellipseSliceElement3, 0, true, true, 0, true, false); EllipseSliceElement ellipseSliceElement4 = new EllipseSliceElement(0, 0, 100, 60, 270, 90); ellipseSliceElement4.BackColor = RgbColor.Violet; pdfDocument.AddElement(ellipseSliceElement4, 0, true, true, 0, true, false); // Add an Ellipse Element with background EllipseElement ellipseWithBackground = new EllipseElement(0, 0, 50, 30); ellipseWithBackground.BackColor = RgbColor.Green; pdfDocument.AddElement(ellipseWithBackground, 10, true, false, 0, true, false); // Add Rectangle Elements // Add section title titleTextElement = new TextElement(0, 0, "Rectangle Elements", titleFont); titleTextElement.ForeColor = RgbColor.Black; pdfDocument.AddElement(titleTextElement, 5, false, 10, true); // Add a Rectangle Element with default settings RectangleElement rectangleElement = new RectangleElement(0, 0, 100, 60); pdfDocument.AddElement(rectangleElement, 10); // Add a Rectangle Element with background color and dotted line RectangleElement rectangleElementWithDottedLine = new RectangleElement(0, 0, 100, 60); rectangleElementWithDottedLine.BackColor = RgbColor.LightGray; rectangleElementWithDottedLine.ForeColor = RgbColor.Green; rectangleElementWithDottedLine.LineStyle.LineDashStyle = LineDashStyle.Dot; pdfDocument.AddElement(rectangleElementWithDottedLine, 10, true, false, 0, true, false); // Add a Rectangle Element with background color without border RectangleElement rectangleElementWithoutBorder = new RectangleElement(0, 0, 100, 60); rectangleElementWithoutBorder.BackColor = RgbColor.Green; pdfDocument.AddElement(rectangleElementWithoutBorder, 10, true, false, 0, true, false); // Add a Rectangle Element with background color, bold border line and rounded corners RectangleElement rectangleElementWithRoundedCorners = new RectangleElement(0, 0, 100, 60); rectangleElementWithRoundedCorners.BackColor = RgbColor.Coral; rectangleElementWithRoundedCorners.ForeColor = RgbColor.Blue; rectangleElementWithRoundedCorners.LineStyle.LineWidth = 5; rectangleElementWithRoundedCorners.LineStyle.LineJoinStyle = LineJoinStyle.RoundJoin; pdfDocument.AddElement(rectangleElementWithRoundedCorners, 10, true, false, 0, true, false); // Add Polygon Elements // Add section title titleTextElement = new TextElement(0, 0, "Polygon Elements", titleFont); titleTextElement.ForeColor = RgbColor.Black; pdfDocument.AddElement(titleTextElement, 5, false, 10, true); PointFloat[] polygonElementPoints = new PointFloat[] { new PointFloat(0, 50), new PointFloat(50, 0), new PointFloat(100, 50), new PointFloat(50, 100) }; // Add a Polygon Element with default settings PolygonElement polygonElement = new PolygonElement(polygonElementPoints); pdfDocument.AddElement(polygonElement, 10); polygonElementPoints = new PointFloat[] { new PointFloat(0, 50), new PointFloat(50, 0), new PointFloat(100, 50), new PointFloat(50, 100) }; // Add a Polygon Element with background color and border polygonElement = new PolygonElement(polygonElementPoints); polygonElement.BackColor = RgbColor.LightGray; polygonElement.ForeColor = RgbColor.Green; polygonElement.LineStyle.LineDashStyle = LineDashStyle.Dot; pdfDocument.AddElement(polygonElement, 10, true, false, 0, true, false); polygonElementPoints = new PointFloat[] { new PointFloat(0, 50), new PointFloat(50, 0), new PointFloat(100, 50), new PointFloat(50, 100) }; // Add a Polygon Element with background color polygonElement = new PolygonElement(polygonElementPoints); polygonElement.BackColor = RgbColor.Green; pdfDocument.AddElement(polygonElement, 10, true, false, 0, true, false); PointFloat[] polyFillPoints = new PointFloat[] { new PointFloat(0, 50), new PointFloat(50, 0), new PointFloat(100, 50), new PointFloat(50, 100) }; // Add a Polygon Element with background color and rounded line joins PolygonElement polygonElementWithBackgruondColorAndBorder = new PolygonElement(polyFillPoints); polygonElementWithBackgruondColorAndBorder.ForeColor = RgbColor.Blue; polygonElementWithBackgruondColorAndBorder.BackColor = RgbColor.Coral; polygonElementWithBackgruondColorAndBorder.LineStyle.LineWidth = 5; polygonElementWithBackgruondColorAndBorder.LineStyle.LineCapStyle = LineCapStyle.RoundCap; polygonElementWithBackgruondColorAndBorder.LineStyle.LineJoinStyle = LineJoinStyle.RoundJoin; pdfDocument.AddElement(polygonElementWithBackgruondColorAndBorder, 10, true, false, 0, true, false); // Add Bezier Curve Elements // Add section title titleTextElement = new TextElement(0, 0, "Bezier Curve Elements", titleFont); titleTextElement.ForeColor = RgbColor.Black; pdfDocument.AddElement(titleTextElement, 5, false, 10, true); // Add a Bezier Curve Element with normal style BezierCurveElement bezierCurveElement = new BezierCurveElement(0, 50, 50, 0, 100, 100, 150, 50); bezierCurveElement.ForeColor = RgbColor.Blue; bezierCurveElement.LineStyle.LineWidth = 3; pdfDocument.AddElement(bezierCurveElement, 10); // Add a Bezier Curve Element with dotted line using the controlling points above bezierCurveElement = new BezierCurveElement(0, 50, 50, 0, 100, 100, 150, 50); bezierCurveElement.ForeColor = RgbColor.Green; bezierCurveElement.LineStyle.LineDashStyle = LineDashStyle.Dot; bezierCurveElement.LineStyle.LineWidth = 1; pdfDocument.AddElement(bezierCurveElement, 30, true, false, 0, true, false); // Mark the points controlling the Bezier curve CircleElement controlPoint1 = new CircleElement(0, 0, 10); controlPoint1.BackColor = RgbColor.Violet; controlPoint1.Opacity = 75; pdfDocument.AddElement(controlPoint1, -10, true, true, 40, true, false); CircleElement controlPoint2 = new CircleElement(0, 0, 10); controlPoint2.BackColor = RgbColor.Violet; pdfDocument.AddElement(controlPoint2, 50, true, true, -50, true, false); CircleElement controlPoint3 = new CircleElement(0, 0, 10); controlPoint3.BackColor = RgbColor.Violet; pdfDocument.AddElement(controlPoint3, 50, true, true, 100, true, false); CircleElement controlPoint4 = new CircleElement(0, 0, 10); controlPoint4.BackColor = RgbColor.Violet; pdfDocument.AddElement(controlPoint4, 50, true, true, -50, true, false); // Save the PDF document in a memory buffer byte[] outPdfBuffer = pdfDocument.Save(); // Send the PDF as response to browser // Set response content type Response.AddHeader("Content-Type", "application/pdf"); // Instruct the browser to open the PDF file as an attachment or inline Response.AddHeader("Content-Disposition", String.Format("attachment; filename=Graphic_Elements.pdf; size={0}", outPdfBuffer.Length.ToString())); // Write the PDF document buffer to HTTP response Response.BinaryWrite(outPdfBuffer); // End the HTTP response and stop the current page processing Response.End(); }
private PointFloat MoveForward(PointFloat vel) { float xAdd = (float)Math.Sin((double)GetRotation()); float yAdd = (float)Math.Cos((double)GetRotation()); vel.x = vel.x + ( xAdd - vel.x )/100; vel.y = vel.y + ( yAdd - vel.y )/100; engineFirePar.Blow(0.4f, 2, false); return vel; }
private ShowNodesEventParameter CreateShowNodesEventParameter(PointFloat pnt,bool singleSelect,DiagramShape currentShape) { var para = new ShowNodesEventParameter(); para.MouseClickPoint = pnt; para.Application = Application; para.CreateShape = (x) => { var rst = new DiagramShapeEx(SDLDiagramShapes.Procedure, x.X, x.Y, x.Width, x.Height); rst.Image = x.GetImage(); _diagram.Items.Add(rst); _diagram.SelectItem(rst); return rst; }; para.ObjectSpace = _os; para.SelectedForms = _diagram.Items.OfType<DiagramShape>().Select(x => (x.Tag as IFlowNode)).ToArray(); para.Shape = currentShape; para.SingleSelect = singleSelect; para.UpdateShape = (node, shape) => { var s = shape as DiagramShape; s.Content = node.Caption; s.Tag = node; }; para.DoShowNavigationItem = (x) => { var snc = Application.MainWindow.GetController<SubSystemNavigationController>(); var sname = x.Split('/'); if (sname.Length > 3) snc.NavigationToSystem(sname[3]); var ctrl = Application.MainWindow.GetController<ShowNavigationItemController>().ShowNavigationItemAction; var toItem = FindChoiceActionItemByModelPath(ctrl.Items, x); ctrl.SelectedItem = toItem; ctrl.DoExecute(toItem); //ctrl.FindItemByIdPath() }; if (currentShape != null) para.SelectedNode = currentShape.Tag as IFlowNode; para.DeletSelectedNode = () => { _diagram.DeleteSelectedItems(); }; para.ViewParameter = new ShowViewParameters(); Flow.ShowNodesView(para); return para; }
public void DrawTextLayout(PointFloat origin, ITextLayout textLayout, IBrush defaultForegroundBrush, DrawTextOptions options) { base.innerRefT.DrawTextLayout(origin, textLayout, defaultForegroundBrush, options); }
public HitTestTextPositionResult(PointFloat point, PaintDotNet.DirectWrite.HitTestMetrics hitTestMetrics) { this.point = point; this.hitTestMetrics = hitTestMetrics; }
public bool StrokeContainsPoint(PointFloat point, float strokeWidth, IStrokeStyle strokeStyle, Matrix3x2Float?worldTransform, float?flatteningTolerance) => base.innerRefT.StrokeContainsPoint(point, strokeWidth, strokeStyle, worldTransform, flatteningTolerance);
private void RedrawOnBackgroundThread() { if (base.CheckAccess()) { ExceptionUtil.ThrowInvalidOperationException(); } if (this.redrawThreadFactory == null) { this.redrawThreadFactory = new Direct2DFactory(Direct2DFactoryType.MultiThreaded, DebugLevel.None); } if ((this.redrawThreadGeometryCache == null) || (this.redrawThreadGeometryCache.SelectionSnapshot != this.redrawRenderParams.SelectionSnapshot)) { DisposableUtil.Free <SelectionGeometryCache>(ref this.redrawThreadGeometryCache); this.redrawThreadGeometryCache = new SelectionGeometryCache(this.redrawThreadFactory, this.redrawRenderParams.SelectionSnapshot); } double scaleRatio = this.redrawRenderParams.ScaleRatio; PointDouble location = this.redrawRenderParams.ViewportCanvasBounds.Location; SizeDouble viewportSize = this.redrawRenderParams.ViewportSize; SizeInt32 num5 = SizeDouble.Ceiling(viewportSize); RectDouble b = RectDouble.Inflate(CanvasCoordinateConversions.ConvertExtentToViewport(CanvasCoordinateConversions.ConvertCanvasToExtent(this.redrawRenderParams.SelectionSnapshot.GeometryList.Value.Bounds, scaleRatio), scaleRatio, location), (double)this.outlineStrokeWidthPx, (double)this.outlineStrokeWidthPx); RectDouble a = new RectDouble(PointDouble.Zero, viewportSize); RectDouble renderViewportBounds = RectDouble.Intersect(a, b); RectInt32 viewportRect = renderViewportBounds.Int32Bound; RectDouble extentRect = CanvasCoordinateConversions.ConvertViewportToExtent(viewportRect, scaleRatio, location); RectDouble renderCanvasBounds = CanvasCoordinateConversions.ConvertExtentToCanvas(extentRect, scaleRatio); if (!viewportRect.HasPositiveArea) { base.SyncContext.Post((SendOrPostCallback)(_ => this.EndRedraw(renderViewportBounds, RectFloat.Zero, null, null))); } else { IBitmap <ColorAlpha8> interiorMask; float scale; PointFloat offset; Result <IGeometry> lazyGeometry; IBitmap <ColorAlpha8>[] dashedOutlineMasks; RectFloat maskSourceRect; SelectionSnapshot selectionSnapshot = this.redrawRenderParams.SelectionSnapshot; SelectionGeometryCache redrawThreadGeometryCache = this.redrawThreadGeometryCache; bool flag = this.redrawRenderParams.SelectionRenderingQuality == SelectionRenderingQuality.Aliased; if (!flag) { lazyGeometry = redrawThreadGeometryCache.Geometry; } else { bool flag3 = selectionSnapshot.IsRectilinear.Value; bool flag4 = selectionSnapshot.IsPixelated.Value; if (flag3 & flag4) { lazyGeometry = redrawThreadGeometryCache.Geometry; } else { lazyGeometry = redrawThreadGeometryCache.PixelatedGeometry; } } bool flag2 = !flag && this.redrawRenderParams.IsOutlineAntialiased; AntialiasMode antialiasMode = ((flag || !flag2) || selectionSnapshot.IsRectilinear.Value) ? AntialiasMode.Aliased : AntialiasMode.PerPrimitive; if (this.CanContinueRedrawing(null, null)) { scale = (float)this.redrawRenderParams.ScaleRatio; float x = -((float)renderCanvasBounds.X); float y = -((float)renderCanvasBounds.Y); offset = new PointFloat(x, y); interiorMask = BitmapAllocator.Alpha8.Allocate(viewportRect.Size, AllocationOptions.ZeroFillNotRequired); try { RetryManager.RunMemorySensitiveOperation(delegate { using (IDrawingContext context = DrawingContext.FromBitmap(this.redrawThreadFactory, interiorMask)) { context.Clear(null); IBrush interiorBrush = context.GetCachedOrCreateResource <IBrush>(whiteBrush); this.RenderSelection(context, scale, offset, this.redrawRenderParams, lazyGeometry, interiorBrush, null, null, antialiasMode); } }); } catch (OutOfMemoryException) { } if (this.CanContinueRedrawing(interiorMask, null)) { int num15; dashedOutlineMasks = new IBitmap <ColorAlpha8> [SelectionCanvasLayer.DashLength]; for (int i = 0; i < dashedOutlineMasks.Length; i = num15) { if ((!this.redrawRenderParams.IsOutlineAnimated && (i != 0)) && (i != (SelectionCanvasLayer.DashLength / 2))) { dashedOutlineMasks[i] = null; } else { dashedOutlineMasks[i] = BitmapAllocator.Alpha8.Allocate(viewportRect.Size, AllocationOptions.ZeroFillNotRequired); try { RetryManager.RunMemorySensitiveOperation(delegate { using (IDrawingContext context = DrawingContext.FromBitmap(this.redrawThreadFactory, dashedOutlineMasks[i])) { context.Clear(null); StrokeStyle resourceSource = SelectionCanvasLayer.GetDashedStrokeStyle(i); IStrokeStyle outlineStrokeStyle = context.GetCachedOrCreateResource <IStrokeStyle>(resourceSource); IBrush cachedOrCreateResource = context.GetCachedOrCreateResource <IBrush>(whiteBrush); this.RenderSelection(context, scale, offset, this.redrawRenderParams, lazyGeometry, null, cachedOrCreateResource, outlineStrokeStyle, antialiasMode); } }); } catch (OutOfMemoryException) { } if (!this.CanContinueRedrawing(interiorMask, dashedOutlineMasks)) { return; } } num15 = i + 1; } maskSourceRect = new RectFloat(PointFloat.Zero, interiorMask.Size); base.SyncContext.Post(_ => this.EndRedraw(renderCanvasBounds, maskSourceRect, interiorMask, dashedOutlineMasks), null); } } } }