formZ SDK | 4.0 Call Back Reference | Surface Style Representation

fz_srep_cbak_col_rndr_texture

Description

Renders a color,transparency or bump pattern into a texture map of a given size. The texture map can be returned in a memory buffer of bytes or can be written to an image file. To return the texture map in memory, the bytes parameter must be passed as non NULL. A bump map may be generated as a height map (single channel grayscale) or a normal map (rgb values representing the x, y and z component of the disturbed surface normal)
For color and bump (normal map) textures :
The bytes storage must be allocated by calling code to res * res * 3 bytes. Pixel color is stored as unsigned char r g b components. i.e. 255, 255, 255 is white, 0, 0, 0 is black.
For transparency textures :
The bytes storage must be allocated by calling code to res * res bytes. Pixel transparency is stored as unsigned char . i.e. 255 is opaque (white), 0 is transparent (black).
For bump (height map) textures :
The bytes storage must be allocated by calling code to res * res bytes. Pixel displacement is stored as an unsigned char. i.e. from 255 (white) to 0 (black).
Pixels are stored in row major order with the top left pixel of the texture in the first three bytes. To write the texture map to file, the floc parameter must be passed as non NULL and must contain a valid file name and file directory. The format reference id parameter, ffmt_id, must identify a file format that is capable of writing a bitmap image.

Plugin Prototype

fzrt_error_td fz_srep_cbak_col_rndr_texture(

fzrt_int

windex,

fz_rmtl_ptr

rmtl,

void *

srep_data,

fzrt_int

res,

fzrt_int

num_tiles,

unsigned char *

bytes,

fzrt_floc_ptr

floc,

fz_ffmt_ref_td

ffmt_id )

Parameters

windex [Input]

project window index

rmtl [Input]

the surface style to which the srep belongs

srep_data [Input]

The source Surface Style Representation data.

res [Input]

The desired resolution of the texture.

num_tiles [Input]

The number of times the pattern is repeated horizontally and vertically.

bytes [Input, Optional]

If passed in as non NULL, the is the pre allocated byte storage

floc [Input, Optional]

If passed in as non NULL (and bytes is passed as NULL), the is file name and location for the saved texture

ffmt_id [Input, Optional]

If the texture is written to file, this is the id of the image format

Returns

Error codes

Availability

7.0.0.0

Function Set

fz_srep_cbak_fset


Defined in

fz_srep_api.h