Go to Google Code Home
Google SketchUp SkpReader C++ API Documentation (Labs)

Public Member Functions | Properties

ISkpTextureWriter Interface Reference

A utility class that will write out texture files. More...

Inheritance diagram for ISkpTextureWriter:
ISkpTextureWriter2

List of all members.

Public Member Functions

HRESULT LoadFace ([in] ISkpFace *pFace,[in] BOOL bFront,[out, retval]long *pHandle)
 Load a particular ISkpFace into the texture writer.
HRESULT LoadImage ([in] ISkpImage *pImage,[out, retval]long *pHandle)
 Load a particular ISkpImage into the texture writer.
HRESULT LoadComponentInstance ([in] ISkpComponentInstance *pComponentInstance,[out, retval]long *pHandle)
 Load a particular ISkpComponentInstance into the texture writer.
HRESULT GetTextureHandleFromFace ([in]ISkpFace *pFace,[in]BOOL bFront,[out, retval]long *pVal)
 Retrieves the texture handle for the given face and side of the face.
HRESULT GetTextureHandleFromComponentInstance ([in]ISkpComponentInstance *pInst,[out, retval]long *pVal)
 Retrieves the texture handle for the given component instance.
HRESULT GetTextureHandleFromImage ([in]ISkpImage *pInst,[out, retval]long *pVal)
 Retrieves the texture handle for the given image.
HRESULT GetTextureFile ([in]long textureHandle,[out, retval]BSTR *pFileName)
 Retrieves the texture file associated with the texture handle provided.
HRESULT WriteAllTextures ([in]BSTR directoryName,[in]BOOL use83)
 Writes all the textures to the given directory name.
HRESULT WriteTextureFileFromFace ([in]ISkpFace *pFace,[in] BOOL bFront,[in]BSTR fileName)
 Writes the texture associated with the given face/side to the file of the given name.
HRESULT WriteTextureFileFromComponentInstance ([in]ISkpComponentInstance *pComponentInstance,[in]BSTR fileName)
 Writes the texture associated with the given ComponentInstance to the file of the given name.
HRESULT WriteTextureFileFromImage ([in]ISkpImage *pImage,[in]BSTR fileName)
 Writes the texture associated with the given Image to the file of the given name.
HRESULT WriteTextureFileFromHandle ([in]long textureHandle,[in]BSTR fileName)
 Writes the texture associated with the given handle to the file of the given name.
HRESULT WriteTextureFileFromHandleOptimize ([in]long textureHandle,[in]BSTR fileName,[in]long optimize)
 Writes the texture associated with the given handle to the file of the given name.

Properties

long Count [get]
 The number of textures that have been computed.

Detailed Description

A utility class that will write out texture files.

This object will write either individual texture files for each face, or write all the texture files for the loaded faces into a specified directory.


Member Function Documentation

HRESULT ISkpTextureWriter::GetTextureFile ( [in] long  textureHandle,
[out, retval] BSTR *  pFileName 
)

Retrieves the texture file associated with the texture handle provided.

The given textureHandle must correspond to a handle returned from the ISkpTextureWriter::LoadFace call on this same texture writer. Any other handle results in E_FAIL as a return value.

This method should only be called after ISkpTextureWriter::WriteAllTextures has been called. Otherwise, the file names will be empty.

Parameters:
textureHandle The valid handle for the face/side desired.
Return values:
pFileName The name of the file where the texture was written.
Returns:
S_OK : if successful
E_POINTER : if any of the required parameters are NULL
S_FALSE : indicates that the given face was not loaded into the writer
E_FAIL : internal errors or the given textureHandle was not valid.
HRESULT ISkpTextureWriter::GetTextureHandleFromComponentInstance ( [in] ISkpComponentInstance pInst,
[out, retval] long *  pVal 
)

Retrieves the texture handle for the given component instance.

The component instance must have been previously loaded into the writer via the ISkpTextureWriter::LoadComponentInstance method call.

Parameters:
pInst The Component Instance to load.
Return values:
pVal The handle of the texture.
Returns:
S_OK : if successful
E_POINTER : if any of the required parameters are NULL
S_FALSE : indicates that the given face was not loaded into the writer
E_FAIL : internal errors
HRESULT ISkpTextureWriter::GetTextureHandleFromFace ( [in] ISkpFace pFace,
[in] BOOL  bFront,
[out, retval] long *  pVal 
)

Retrieves the texture handle for the given face and side of the face.

The face must have been previously loaded into the writer via the ISkpTextureWriter::LoadFace method call.

Parameters:
pFace The face to load.
bFront TRUE iff the texture on the front of the face is to be computed, FALSE if the back of the face is to be used.
Return values:
pVal The handle of the texture.
Returns:
S_OK : if successful
E_POINTER : if any of the required parameters are NULL
S_FALSE : indicates that the given face was not loaded into the writer
E_FAIL : internal errors
HRESULT ISkpTextureWriter::GetTextureHandleFromImage ( [in] ISkpImage pInst,
[out, retval] long *  pVal 
)

Retrieves the texture handle for the given image.

The image must have been previously loaded into the writer via the ISkpTextureWriter::LoadImage method call.

Parameters:
pInst The Component Instance to load.
Return values:
pVal The handle of the texture.
Returns:
S_OK : if successful
E_POINTER : if any of the required parameters are NULL
S_FALSE : indicates that the given face was not loaded into the writer
E_FAIL : internal errors
HRESULT ISkpTextureWriter::LoadComponentInstance ( [in] ISkpComponentInstance pComponentInstance,
[out, retval] long *  pHandle 
)

Load a particular ISkpComponentInstance into the texture writer.

When a component instance is loaded into the texture writer, the writer determines the appropriate texture that must be associated with this instance, taking into account perspective distortion, etc.

This method does not iterate over the faces within the component instance. It is only used to cover the cases where a material may have been applied to a component.

The return value is the handle that this texture can use to reference the computed texture. If the handle value is <= 0 then no corresponding texture has been found. Such handles are considered invalid in other calls to the texture writer.

Parameters:
pComponentInstance The Component Instance to load.
Return values:
pHandle The handle of the texture.
Returns:
S_OK : if successful
E_POINTER : if any of the required parameters are NULL
E_FAIL : internal errors
HRESULT ISkpTextureWriter::LoadFace ( [in] ISkpFace pFace,
[in] BOOL  bFront,
[out, retval] long *  pHandle 
)

Load a particular ISkpFace into the texture writer.

When a face is loaded into the texture writer, the writer determines the appropriate texture that must be associated with this face, taking into account whether it's the front or back of the face of interest, perspective distortion, etc.

The return value is the handle that this texture can use to reference the computed texture. If the handle value is <= 0 then no corresponding texture has been found. Such handles are considered invalid in other calls to the texture writer.

Parameters:
pFace The face to load.
bFront TRUE iff the texture on the front of the face is to be computed, FALSE if the back of the face is to be used.
Return values:
pHandle The handle of the texture.
Returns:
S_OK : if successful
E_POINTER : if any of the required parameters are NULL
E_FAIL : internal errors
HRESULT ISkpTextureWriter::LoadImage ( [in] ISkpImage pImage,
[out, retval] long *  pHandle 
)

Load a particular ISkpImage into the texture writer.

When a Image is loaded into the texture writer, the writer determines the appropriate texture that must be associated with this Image, taking into account perspective distortion, etc.

The return value is the handle that this texture can use to reference the computed texture. If the handle value is <= 0 then no corresponding texture has been found. Such handles are considered invalid in other calls to the texture writer.

Parameters:
pImage The Image to load.
Return values:
pHandle The handle of the texture.
Returns:
S_OK : if successful
E_POINTER : if any of the required parameters are NULL
E_FAIL : internal errors
HRESULT ISkpTextureWriter::WriteAllTextures ( [in] BSTR  directoryName,
[in] BOOL  use83 
)

Writes all the textures to the given directory name.

This method will write all the computed textures associated with faces that have been loaded via the ISkpTextureWriter::LoadFace method to the directory specified. If the use83 flag is TRUE, then the file names will be mangled to 8.3 format, which is required for some file formats.

The given directory must correspond to a directory that exists on the file system. This method will fail if the directory name does not match an existing directory.

Parameters:
directoryName The name of the directory.
use83 TRUE if the file names should be of the 8.3 format.
Returns:
S_OK : if successful
E_POINTER : if any of the required parameters are NULL
E_FAIL : internal errors
HRESULT ISkpTextureWriter::WriteTextureFileFromComponentInstance ( [in] ISkpComponentInstance pComponentInstance,
[in] BSTR  fileName 
)

Writes the texture associated with the given ComponentInstance to the file of the given name.

If the given file name contains a directory specification that does not exist on the file system, the method will fail.

The ComponentInstance must have a texture associated with it, or the method will fail.

This method will overwrite any existing file.

Parameters:
pComponentInstance Instance The Component Instance whose texture is to be written.
fileName The name of the file where the texture should be written.
Returns:
S_OK : if successful
E_POINTER : if any of the required parameters are NULL
E_FAIL : internal errors
HRESULT ISkpTextureWriter::WriteTextureFileFromFace ( [in] ISkpFace pFace,
[in] BOOL  bFront,
[in] BSTR  fileName 
)

Writes the texture associated with the given face/side to the file of the given name.

If the given file name contains a directory specification that does not exist on the file system, the method will fail.

The face must have a texture associated with it, or the method will fail.

This method will overwrite any existing file.

Parameters:
pFace The face whose texture is to be written.
bFront TRUE iff the front face is to be written, FALSE if the back face is desired.
fileName The name of the file where the texture should be written.
Returns:
S_OK : if successful
E_POINTER : if any of the required parameters are NULL
E_FAIL : internal errors
HRESULT ISkpTextureWriter::WriteTextureFileFromHandle ( [in] long  textureHandle,
[in] BSTR  fileName 
)

Writes the texture associated with the given handle to the file of the given name.

If the given file name contains a directory specification that does not exist on the file system, the method will fail.

The face must have a texture associated with it, or the method will fail.

This method will overwrite any existing file.

The provided handle must be > 0 and must correspond to a face/side that was loaded into the texture writer via the ISkpTextureWriter::LoadFace method.

Parameters:
textureHandle The valid handle for the face/side desired.
fileName The name of the file where the texture should be written.
Returns:
S_OK : if successful
E_POINTER : if any of the required parameters are NULL
E_FAIL : internal errors or the given textureHandle was not valid.
HRESULT ISkpTextureWriter::WriteTextureFileFromHandleOptimize ( [in] long  textureHandle,
[in] BSTR  fileName,
[in] long  optimize 
)

Writes the texture associated with the given handle to the file of the given name.

If the given file name contains a directory specification that does not exist on the file system, the method will fail.

The face must have a texture associated with it, or the method will fail.

This method will overwrite any existing file.

The provided handle must be > 0 and must correspond to a face/side that was loaded into the texture writer via the ISkpTextureWriter::LoadFace method.

Parameters:
textureHandle The valid handle for the face/side desired.
fileName The name of the file where the texture should be written.
optimize Whether or not the texture should be optimized to a power of 2.
Returns:
S_OK : if successful
E_POINTER : if any of the required parameters are NULL
E_FAIL : internal errors or the given textureHandle was not valid.
HRESULT ISkpTextureWriter::WriteTextureFileFromImage ( [in] ISkpImage pImage,
[in] BSTR  fileName 
)

Writes the texture associated with the given Image to the file of the given name.

If the given file name contains a directory specification that does not exist on the file system, the method will fail.

The Image must have a texture associated with it, or the method will fail.

This method will overwrite any existing file.

Parameters:
pImage The Image whose texture is to be written.
fileName The name of the file where the texture should be written.
Returns:
S_OK : if successful
E_POINTER : if any of the required parameters are NULL
E_FAIL : internal errors

Property Documentation

long ISkpTextureWriter::Count [get]

The number of textures that have been computed.

This count is less than or equal to the number of faces that have been loaded via the ISkpTextureWriter::LoadFace method.

Return values:
pVal the number of textures in this writer.
Returns:
S_OK : if successful
E_POINTER : if any of the required parameters are NULL
E_FAIL : internal errors

©2010 Google - Google Home - About Google