private void DrawCoordinatesystem(TIS.Imaging.OverlayBitmap ob) { // Calculate the center of the video image. int Col = icImagingControl1.ImageWidth / 2; int Row = icImagingControl1.ImageHeight / 2; Font OldFont = ob.Font; ob.Font = new Font("Arial", 8); ob.DrawLine(Color.Gray, Col, 0, Col, icImagingControl1.ImageHeight); ob.DrawLine(Color.Gray, 0, Row, icImagingControl1.ImageWidth, Row); for (int i = 0; i < Row; i += 20) { ob.DrawLine(Color.Gray, Col - 5, Row - i, Col + 5, Row - i); ob.DrawLine(Color.Gray, Col - 5, Row + i, Col + 5, Row + i); if (i > 0) { ob.DrawText(Color.Gray, Col + 10, Row - i - 7, string.Format("{0}", i / 10)); ob.DrawText(Color.Gray, Col + 10, Row + i - 7, string.Format("{0}", -i / 10)); } } for (int i = 0; i < Col; i += 20) { ob.DrawLine(Color.Gray, Col - i, Row - 5, Col - i, Row + 5); ob.DrawLine(Color.Gray, Col + i, Row - 5, Col + i, Row + 5); if (i > 0) { ob.DrawText(Color.Gray, Col + i - 5, Row - 17, string.Format("{0}", i / 10)); ob.DrawText(Color.Gray, Col - i - 10, Row - 17, string.Format("{0}", -i / 10)); } } ob.Font = OldFont; }
private void SetupOverlay(TIS.Imaging.OverlayBitmap ob) { // Enable the overlay bitmap for drawing. ob.Enable = true; // Set magenta as dropout color. ob.DropOutColor = Color.Magenta; // Fill the overlay bitmap with the dropout color. ob.Fill(ob.DropOutColor); // Print text in red. ob.FontTransparent = true; ob.DrawText(Color.Gray, 10, 10, "Graph Measurement"); }
private void SetOverlay() { IcCam.LiveCaptureContinuous = true; TIS.Imaging.OverlayBitmap ob = IcCam.OverlayBitmapAtPath[PathPositions.Display]; // Enable the overlay bitmap for drawing. ob.Enable = true; // Set magenta as dropout color. ob.DropOutColor = Color.Magenta; // Fill the overlay bitmap with the dropout color. ob.Fill(ob.DropOutColor); ob.FontTransparent = true; ob.DrawText(Color.Red, 10, 10, "Copyright trademark incorporated all rights reserved"); ob.DrawFrameRect(Color.Red, IcCam.Width / 2 - 40, IcCam.Height / 2 - 40, IcCam.Width / 2 + 40, IcCam.Height / 2 + 40); ob.DrawLine(Color.Red, IcCam.Width / 2, IcCam.Height / 2 - 40, IcCam.Width / 2, 0); ob.DrawLine(Color.Red, IcCam.Width / 2, IcCam.Height / 2 + 40, IcCam.Width / 2, IcCam.Height); ob.DrawLine(Color.Red, 0, IcCam.Height / 2, IcCam.Width / 2 - 40, IcCam.Height / 2); ob.DrawLine(Color.Red, IcCam.Width / 2 + 40, IcCam.Height / 2, IcCam.Width, IcCam.Height / 2); ob.DrawLine(Color.Red, IcCam.Width / 2 - 10, IcCam.Height / 2, IcCam.Width / 2 + 10, IcCam.Height / 2); ob.DrawLine(Color.Red, IcCam.Width / 2, IcCam.Height / 2 + 10, IcCam.Width / 2, IcCam.Height / 2 - 10); }
private void icImagingControl1_OverlayUpdate(object sender, TIS.Imaging.ICImagingControl.OverlayUpdateEventArgs e) { TIS.Imaging.OverlayBitmap ob = e.overlay; int lineIndex = m_sink.FrameCount % 25; if (lineIndex == 0) { ob.DrawSolidRect(ob.DropOutColor, 10, icImagingControl1.ImageHeight - 70, 62, icImagingControl1.ImageHeight - 9); } /*ob.DrawLine(Color.Black, lineIndex * 2 + 10, * icImagingControl1.ImageHeight - 10, * lineIndex * 2 + 10, * icImagingControl1.ImageHeight - 10 - lineIndex);*/ // Print the current frame number: // Set the background color to the current dropout color // and make the font opaque. ob.FontBackColor = ob.DropOutColor; ob.FontTransparent = false; // Save the current font. Font OldFont = ob.Font; // Draw the text. ob.Font = new Font("Arial", 8); ob.DrawSolidRect(ob.DropOutColor, 0, 0, 1031, 774); if (CoordinatesystemFlag == true) { //DrawCoordinatesystem(icImagingControl1.OverlayBitmapAtPath[PathPositions.Device]); } ob.DrawText(Color.Black, textBox1.Location.X, textBox1.Location.Y, textBox1.Text); ob.DrawText(Color.Black, textBox2.Location.X, textBox2.Location.Y, textBox2.Text); ob.DrawText(Color.Black, textBox3.Location.X, textBox3.Location.Y, textBox3.Text); ob.DrawText(Color.Black, textBox4.Location.X, textBox4.Location.Y, textBox4.Text); ob.DrawText(Color.Black, textBox5.Location.X, textBox5.Location.Y, textBox5.Text); if ((textBox1.Text == "") || (textBox2.Text == "")) { ob.DrawSolidRect(ob.DropOutColor, 0, 0, 1031, 774); if (CoordinatesystemFlag == true) { //DrawCoordinatesystem(icImagingControl1.OverlayBitmapAtPath[PathPositions.Device]); } } else { if (cycle.Checked == true) { ob.DrawFrameEllipse(Color.Black, textBox1.Location.X, textBox1.Location.Y, textBox2.Location.X, textBox2.Location.Y); ob.DrawFrameRect(Color.Black, textBox1.Location.X, textBox1.Location.Y, textBox2.Location.X, textBox2.Location.Y); } else { ob.DrawLine(Color.Black, textBox1.Location.X, textBox1.Location.Y, textBox2.Location.X, textBox2.Location.Y); if (textBox3.Text != "") { if (segment.Checked == true) { } else if (triangle.Checked == true) { ob.DrawLine(Color.Black, textBox1.Location.X, textBox1.Location.Y, textBox3.Location.X, textBox3.Location.Y); ob.DrawLine(Color.Black, textBox2.Location.X, textBox2.Location.Y, textBox3.Location.X, textBox3.Location.Y); } else if (quadrilateral.Checked == true && textBox4.Text != "") { ob.DrawLine(Color.Black, textBox1.Location.X, textBox1.Location.Y, textBox4.Location.X, textBox4.Location.Y); ob.DrawLine(Color.Black, textBox2.Location.X, textBox2.Location.Y, textBox3.Location.X, textBox3.Location.Y); ob.DrawLine(Color.Black, textBox3.Location.X, textBox3.Location.Y, textBox4.Location.X, textBox4.Location.Y); } } } } // Restore the previously used font. ob.Font = OldFont; }