FolderItem.OpenAsVectorPicture

From Xojo Documentation

Method

FolderItem.OpenAsVectorPicture() As Picture

Supported for all project types and targets.

Opens the 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.

Dim f As New FolderItem

f = GetOpenFolderItem("image/x-pict")
Dim p As Picture

p = f.OpenAsVectorPicture
If p <> Nil Then
MsgBox(Str(p.ImageCount))
Else
MsgBox("Open failed!")
End If