Using the 2D Picture Control

The 2D picture control includes a set of drawing instructions for displaying pictures that can contain lines, circles, text, and other types of graphic shapes. Because you have pixel-level control over the 2D picture control, you can create nearly any graphics object. Use the 2D picture control and the graphics VIs instead of a graphics application to create, modify, and view graphics in LabVIEW.

Note��You also can use the 3D picture control to display graphical representations of objects in 3D scenes. You can set characteristics of the 3D scene such as the style and location of a light source and how a user-controlled camera interacts with the 3D scene.

The 2D picture control has a pixel-based coordinate system in which the origin (0, 0) is the pixel located at the top left corner of the control. The horizontal (x) component of a coordinate increases toward the right, and the vertical ( y) coordinate increases toward the bottom.

If a picture is too large for the 2D picture control that displays it, LabVIEW crops the picture so you can see only the pixels that fit within the display region of the control. Use the Positioning tool to resize the control and run the VI again to view the entire picture. You also can display vertical and horizontal scroll bars for a 2D picture control so you can view the pixels that do not fit within the display region of the control. Right-click the control and select Visible Items�Scrollbar from the shortcut menu to display scroll bars for the control.

You can use VI Server properties in the Picture class to modify the 2D picture control programmatically, such as to change the size of the 2D picture control or the picture area in the control.

When you place a 2D picture control on the front panel, it appears as a blank rectangular area, and a corresponding terminal, shown as follows, appears on the block diagram.

To display an image in a 2D picture control, you must write an image to the control programmatically. You cannot copy an image to the clipboard and paste it into the 2D picture control. You can use the Picture Functions VIs to specify a set of drawing instructions. Each VI takes a set of inputs that describes a drawing instruction. Based on these inputs, the VI creates a compact description of these specifications that you pass to the 2D picture control for display.

By default, the 2D picture control clears its display before drawing an image. If you want the 2D picture control to draw the new image over the previous image, right-click the control and remove the checkmark next to the Erase First shortcut menu item.