internal void Default() { MeasureDim = 1.0; PicWidth = 3.0; PicHeight = 1.2; PicDepth = 0.05; float w = 1000 / 5; float h0 = 1000 / 3; float h1 = 1000 / 4; float y0 = h0; float y1 = (h0 - h1) / 2 + y0; Box0 = new AR_PersectiveBox(w, y1, y0, w, h1, h0); Box1 = new AR_PersectiveBox(w * 3, y0, y1, w, h0, h1); MainImagePath = null; PictureImagePath = null; Path = null; M0 = null; M1 = null; M2 = null; PicCorner = null; Aux0 = null; ShadowOffset = new PointD(-10, 10); BlurAmount = 10; ShadowBorder = 5; ShadowOpacity = 100; }
private void _drawBox(Graphics graphics, AR_PersectiveBox box, TooltipContainer ttC) { List <PointF> drawPt = new List <PointF>(); foreach (var item in box.Points) { drawPt.Add(_data2screen(item)); } Pen pen = new Pen(Color.SkyBlue); pen.DashStyle = DashStyle.Dot; graphics.DrawLine(Pens.LightBlue, drawPt[0], drawPt[1]); graphics.DrawLine(Pens.LightBlue, drawPt[2], drawPt[3]); graphics.DrawLine(pen, drawPt[1], drawPt[2]); graphics.DrawLine(pen, drawPt[0], drawPt[3]); if (box.VanishingPoint != null) { var vp = _data2screen(box.VanishingPoint); graphics.DrawLine(pen, vp, drawPt[0]); graphics.DrawLine(pen, vp, drawPt[1]); graphics.DrawLine(pen, vp, drawPt[2]); graphics.DrawLine(pen, vp, drawPt[3]); } int idx = -1; foreach (var item in drawPt) { idx++; RectangleF rect = new RectangleF(item.X - 2, item.Y - 2, 5f, 5f); graphics.DrawRectangle(Pens.DodgerBlue, rect); rect.Inflate(10, 10); ttC.Add(rect, null, idx); } }
private void _drawTransBox(Graphics graphics, AR_PersectiveBox box) { if (box.TransPoints == null) { return; } List <PointF> drawPt = new List <PointF>(); foreach (var item in box.TransPoints) { drawPt.Add(_data2screen(item)); } graphics.DrawPolygon(Pens.Yellow, drawPt.ToArray()); }
private void Dbuffer_MouseUp(object sender, MouseEventArgs e) { pbActive = null; activeIdx = -1; auxActive = null; moveWholePic = false; moveShadow = false; if (settings.M2 != null) { settings.M1 = new PointD(settings.M2.X, settings.M2.Y); } _geometryUpdate(); dbuffer.Refresh(); }
private void _transformBox(AR_PersectiveBox box) { List <PointD> tmp = new List <PointD>(); for (int i = 0; i < 4; i++) { var pt = box.Points[i]; tmp.Add(transformPoint(pt)); } box.TransPoints = tmp.ToArray(); if (box.VanishingPoint != null) { var trvp = new PointD(box.VanishingPoint.X, box.VanishingPoint.Y); box.TransVanishingPoint = transformPoint(trvp); } else { box.TransVanishingPoint = null; } }
private void Dbuffer_MouseDown(object sender, MouseEventArgs e) { fineControl = false; moveWholePic = false; moveShadow = false; startX = e.X; startY = e.Y; fcX = mX = vX = e.X; fcY = mY = vY = e.Y; if (ChartLib.ChartViewer.IsModifierHeld(Keys.Control)) { moveShadow = true; toolStripButtonSHADOW.Checked = true; startShadowX = settings.ShadowOffset.X; startShadowY = settings.ShadowOffset.Y; return; } //{ // settings.Aux0 = new PointD(x, y); // _geometryUpdate(); // dbuffer.Refresh(); //} //else if (settings.PicCorner != null) { startPt = _data2screen(settings.PicCorner); } object data; data = ttC0.GetDataAtPointer(e); if (data != null) { pbActive = settings.Box0; activeIdx = (int)data; return; } data = ttC1.GetDataAtPointer(e); if (data != null) { pbActive = settings.Box1; activeIdx = (int)data; return; } data = ttcA.GetDataAtPointer(e); if (data != null) { auxActive = data as PointD; moveWholePic = (settings.PicCorner == auxActive); return; } // nothing else, initialite the pic if (settings.PicCorner == null) { double x = scrolledDoubleBuffer1.Screen2dataX(e.X); double y = scrolledDoubleBuffer1.Screen2dataY(e.Y); settings.PicCorner = new PointD(x, y); startPt = _data2screen(settings.PicCorner); moveWholePic = true; } }