L_LVKRN_API L_INT L_VecLoadFile(pszFile, pVector, pLoadOptions, pFileInfo)
Loads an image from a file into a vector handle. The file can be any supported file format, compressed or uncompressed.
Character string that contains the name of the file to load.
Pointer to a vector handle referencing the loaded image.
Reserved for future use. Pass NULL.
Pointer to a FILEINFO structure. This structure may contain file information used in loading an image, or it may be updated with information about the file being loaded.
If nothing is known about the file, pass NULL for this parameter, or declare a variable of type FILEINFO and set the FILEINFO.Flags to 0, then pass the address of the FILEINFO structure in this parameter. In this case, if the address of a FILEINFO structure is passed, the FILEINFO structure will be updated with the results of L_FileInfo.
If only the file type is known, set pFileInfo.Format to the file type and set pFileInfo.Flags to FILEINFO_ONLYFORMATVALID. This can also be done if L_FileInfo has been called previously, but values that affect the size of the image loaded have been changed (for example, by calling L_SetPCDResolution or L_SetWMFResolution). In this case the FILEINFO structure pointed to by pFileInfo will be updated with the results of L_FileInfo.
If L_FileInfo has been called prior to calling this function, and no changes have been made to the contents of the structure filled by L_FileInfo, then the address of the filled FILEINFO structure can be passed for this parameter. In this case, the FILEINFO.Flags member should be set to FILEINFO_INFOVALID. The L_FileInfo function will set the FILEINFO.Flags to FILEINFO_INFOVALID. In this case the load will be faster since this function does not have to query the file filters for the file type.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Loads a vector image into a vector handle. The file can be any supported vector file format.
The function will initialize the vector handle and allocate the storage necessary to hold the vector image.
Since the function allocates storage to hold the image, it is up to you to free this storage by calling L_VecFree.
You should never pass an uninitialized FILEINFO structure to this function.
Required DLLs and Libraries
This example loads a vector image.
L_LTVKRNTEX_API L_INT VecLoadFileExample(L_VOID)
{
VECTORHANDLE LeadVector; /* Vector handle to hold the loaded image. */
L_INT nRet; /* Return value. */
/* Load the vector image. */
nRet = L_VecLoadFile(MAKE_IMAGE_PATH(TEXT("random.dxf")), &LeadVector, NULL, NULL );
if( nRet != SUCCESS )
/* There was an error loading the vector image. */
MessageBox( NULL, TEXT("Could not load file!"), TEXT("Error"), 0 );
L_VecFree(&LeadVector);
return nRet;
}