MpatCopy()函数

Synopsis

Copy a pattern matching model to an image buffer.

Format

void MpatCopy(ModelId, DestImageBufId, CopyMode)

MIL_ID ModelId; Model identifier
MIL_ID DestImageBufId; Destination image buffer identifier
long CopyMode; Copy mode to use

This function copies the specified model to the specified image buffer, starting at the top-left corner of the buffer. Once the model is copied to the destination buffer, it can then be displayed (if the destination buffer is displayable).

The ModelId parameter specifies the identifier of the model that you want copied to the image buffer.

The DestImageBufId parameter specifies the identifier of the destination image buffer in which to place the model. You must ensure that the buffer is at least as large as the model.

The CopyMode parameter specifies how the model will be copied.

  • Set this parameter to M_DEFAULT to copy the original model to the destination buffer. That is, the model as it was first defined before any “don’t care” pixels where associated with it (see MpatSetDontCare).
  • Set this parameter to M_DONT_CARE to copy only the “don’t care” pixels of the model to the destination buffer. When copied, these pixels are given the value zero. To give these pixels a value other than zero, add this value to the M_DONT_CARE copy mode. Note, when using the M_DONT_CARE copy mode, any pixels value other than the “don’t care” pixels in the destination image buffer will not be overwritten.

If M_CLEAR_BACKGROUND is combined with M_DONT_CARE, pixels in the resulting destination buffer that are not “don’t care” pixels will be cleared to zero. The following example demonstrates how to copy “don’t care” pixels as value 255 and set the other pixels in the destination buffer to zero.

MpatCopy(ModelId, ImageBufId, M_DONT_CARE | 255 | M_CLEAR_BACKGROUND)

By making two calls to this function, one in which M_DEFAULT is used as the copy mode and the other in which M_DONT_CARE is used, it is possible to achieve the effect of overlaying the “don’t care” pixels onto the original model.

See also

MpatSetDontCare