MbufChild1d()函数

Synopsis

Allocate a 1D child data buffer.

Format

MIL_ID MbufChild1d(ParentBufId, OffX, SizeX, BufIdPtr)

MIL_ID ParentBufId; Parent buffer identifier
long OffX; X pixel offset relative to parent buffer
long SizeX; Child buffer width
MIL_ID *BufIdPtr; Storage location for child buffer identifier

Description

This function allocates a one-dimensional child data buffer from the specified, previously allocated parent data buffer. The child buffer is not allocated its own memory space; it remains part of the parent buffer. Therefore, any modification to the child buffer affects the parent and vice versa. Note, a parent buffer can have several child buffers.

A child buffer is considered a data buffer in its own right, and can be used in the same circumstances as its parent buffer. A child buffer inherits its type and attributes from the parent buffer.

When this buffer is no longer required, it can be released, using MbufFree.

The ParentBufId parameter specifies the identifier of the parent buffer.

The OffX parameter specifies the offset of the child buffer in relation to the parent buffer starting coordinate. The offset must be within the width of the parent buffer.

The SizeX parameter specifies the width of the child buffer, starting from the specified offset OffX.

The BufIdPtr parameter specifies the address of the variable in which the child buffer identifier is to be written. Since the MbufChild1d function also returns the child buffer identifier, you can set this parameter to M_NULL. If allocation fails, M_NULL is written as the identifier.

Note, allocating a one-dimensional child buffer from a multi-band parent buffer will create a multi-band child buffer consisting of one-dimensional data in each color band.

Returned value

The returned value is the child buffer identifier. If allocation fails, M_NULL is returned.

See also

MbufChild2d, MbufChildColor, MbufFree