CopyImage Data Member Function

Copies bytes from a source <Image> object to a destination <Image> object. This is a 'safe' wrapper around memcpy(). Non-zero indicates success, zero indicates failure. The most common cause of failure is providing byte coordinates that go out of range for either the source <Image> object or destination <Image> object. For example, given a destination <Image> object that is 32 pixels high by 32 pixels wide with 4 bytes per pixel, we have a total by count of 4096 bytes. We can only write from byte 0 to byte 4095, but if we set the start byte to 4000 and try to write 1025 bytes into the destination <Image> object, the internal call to memcpy() would result in a crash. In this case, the function will fail after performing bounds-checking on the input values and memcpy() will never be called.

Prototype

int32 CopyImage( Image p_oDestination, int32 p_nDestStartIndex, Image p_oSourceImage, int32 p_nSourceStartIndex, int32 p_nCount )

Parameters

Parameter Type Parameter Name Documentation
<Image>p_oDestinationA pointer to the destination <Image> object.
int32p_nDestStartIndexThe index, in byte coordinates such as 0, 1, 512, in the destination <Image> object at which to start receiving data.
<Image>p_oSourceImageA pointer to the source <Image> object.
int32p_nSourceStartIndexThe index, in byte coordinates such as 0, 1, 512, in the source <Image> object at which to start copying data.
int32p_nCountThe number of bytes to copy from the source <Image> object into the destination <Image> object.

Examples

Copy Text To Clipboard

None published. Please look for an example in the Scenome Scripting Language code base.