GetSpritePitch

Top  Previous  Next

Syntax

UINT = GetSpritePitch(sprite as POINTER)

Description

Returns the sprites pitch, or bytes per line, of the internal surface used by the sprites image.

Parameters

sprite - Sprite pointer returned by LoadSprite.

Return value

The pitch of the sprite.

Remarks

Used for direct memory access of the sprites buffer. Sprite must be locked first with LockSprite before using this command.

See Also: LOADSPRITE, LOCKSPRITE, UNLOCKSPRITE, GETSPRITEPOINTER

Example usage

DEF pBuffer as POINTER
sprite1 = LOADSPRITE(GETSTARTPATH+"bug.bmp",0,0,3)
LOCKSPRITE sprite1
pitch = GETSPRITEPITCH sprite1
pBuffer = GETSPRITEPOINTER sprite1
'Change the first pixel of the sprite to red
#<UINT>pBuffer = RGBToScreen(RGB(255,0,0))
'Change the first pixel on the next line to green
pBuffer += pitch
#<UINT>pBuffer = RGBToScreen(RGB(0,255,0))
UNLOCKSPRITE sprite1