Picture.OpenVector

From Xojo Documentation

Method

Picture.OpenVector(vectorFile as FolderItem) As Picture

Supported for all project types and targets.

Opens the passed FolderItem to be read as a vector Picture.

Notes

It will do its best to convert a PICT file (on macOS) or an .emf file (Windows) to a Picture composed of Object2D objects. The original file may contain elements that do not have an equivalent Object2D object. This method will do its best to map these objects, but there may be some loss of information, depending on the characteristics of the original file. PICTs support unrotated Rectangles, Lines, Ellipses, RoundRects, Polygons, Text, Pixmaps, and Arcs.

.emf files support unrotated Rectangles, Lines, Ellipses, RoundRects, Polygons, Text, Pixmaps and Arcs.

.emf files are displayed as actual size. For the most part this is huge; you probably will want to scale them down before viewing (pic1.objects.scale = scalingFactor). We find that a scale factor of 0.045 is a good value.

Example

The following example opens an ancient PICT file as a Picture. The image/x-pict file type has been added using the File Types Editor.

Var f As New FolderItem

f = FolderItem.ShowOpenFileDialog("image/x-pict")
Var p As Picture

p = Picture.OpenVector(f)
If p <> Nil Then
MessageBox(p.ImageCount.ToString)
Else
MessageBox("Open failed!")
End If