VCOM:VectorWorks:ISDK::WriteMaterialImageFile

From Vectorworks Developer
Jump to navigation Jump to search

.SDK|SDK ..SDK:Types|SDK Types ..VCOM:VCOM (Vectorworks Component Object Model)|VCOM Basics ..VCOM:Class Reference|VCOM Class Reference

Description

namespace VectorWorks

Member of VCOM:VectorWorks:ISDK

Writes a material containing an image into an image file. 'type' should be 'JPEG' or 'PNGf'. Returns true if the call was successful.

virtual bool WriteMaterialImageFile(
IFileIdentifier* pFileID,
MCObjectHandle hMaterial,
long type,
long shaderFamily)

Parameters

pFileID IFileIdentifier* File identifier to the file that is to be created with the image.
hMaterial MCObjectHandle Handle to kMaterialNode object. This object contains the kImageDefNode in it's AUX list.
long type The type of the output file. The type is FourCharCode: 'JPEG' for jpg image; 'PNGf' for png image;
long shaderFamily The shader family which image is to be exported. Normally that would be (kShaderFamily_Color = 1). For all families constants see Remarks below.

Return Value

On error returns: false

Remarks

The color families constants are:

typedef enum {
    kShaderFamily_Undefined = 0,
    kShaderFamily_Color = 1,
    kShaderFamily_Reflectivity = 2,
    kShaderFamily_Transparency = 3,
    kShaderFamily_Bump = 4,
    kShaderFamily_Background = 5,
    kShaderFamily_Foreground = 6,
    kShaderFamily_Sketch = 7,
    kShaderFamily_MaterialOption = 8
} ShaderFamily;

You can obtain the material handle if you have InternalIndex to the material:

InternalIndex   matRef    = ...;

MCObjectHandle  hMaterial = gSDK->InternalIndexToHandle( matRef );

gSDK->WriteMaterialImageFile( pFileID, hMaterial, 'JPEG', kShaderFamily_Color );

Version

Availability: from Vectorworks 2009