Render Window Overlays

<< Click to Display Table of Contents >>

Navigation:  XStream® HDVR® SDK > Implementation Concepts > Rendering Concepts > Rendering Images >

Render Window Overlays

Previous pageReturn to chapter overviewNext page

C++ C++ Java Java .NET .NET

Summary

 

A common feature of XStream® HDVR® based applications is use of overlay lines and text. These can be used to indicate cross sections through the volume that are rendered in other windows (as in Linked Orthogonal MRP Views and Linded Oblique MPR Views) or for drawing a path through the volume (as used in the Curved MPR, Curved Reformat, and Vessel Trace features). Text can also be used for Annotations or labeling of dataset features. This section provides code examples for line and text drawing in Microsoft MFC, Microsoft .NET, and Java Swing.

 

Microsoft MFC (C++)

 

Drawing in MFC is accomplished using the drawing functions provided by the CPaintDC class in the OnPaint() handler function. Line and text drawing is accomplished using the CPaintDC drawing methods. A simplified version of this code is shown below.

 

void CClientAppDlg::OnPaint() {

 

   // Create a CPaintDC object.

   CPaintDC cdc(this);

 

   // Create and select a pen for line drawing.

   CPen red_pen(PS_SOLID, 3, RGB(255,0,0));

   CPen *pOldPen SelectObject(red_pen);

   cdc.SelectObject(&red_pen);

 

   // Draw a line.

   cdc.MoveTo(0, 0);

   cdc.LineTo(80,20);

 

   // Draw some text.

   cdc.DrawText(CString("Text"), &staticRect, DT_CENTER );

}

 

Microsoft .NET (C# / .NET)

 

Drawing in .NET is accomplished using the drawing functions provided by the System.Drawing.Graphics class in the Form's Paint event handler. Line and text drawing is accomplished using methods in the System.Drawing.Graphics class, as shown below.

 

private void Form1_Paint(object sender, PaintEventArgs e) {

         

   // Select a pen and draw a line.

   e.Graphics.DrawLine(Pens.Red, new Point(0, 0), new Point(100, 100));

 

   // Draw some text.

   e.Graphics.DrawString("Text", font, Brushes.White, new Point(0,0));

}

 

Java Swing (Java)