GrabSprite()

Syntax

Result = GrabSprite(#Sprite, x, y, Width, Height [, Flags])
Description
Grabs the screen content from the area x, y, Width, Height and creates a new sprite.

Parameters

#Sprite A number to identify the new grabbed sprite. #PB_Any can be used to auto-generate this number.
x, y The position in the screen used to start the grab (in pixels).
Width, Height The size of the grab (in pixels).
Flags (optional) It can be a combination of the following values (with the '|' operator):
  #PB_Sprite_PixelCollision: Add special information to handle pixel collision through SpritePixelCollision().
  #PB_Sprite_AlphaBlending : Sprite is created with per pixel alpha-channel support, needed for DisplayTransparentSprite(). The default transparent color
                             set with TransparentSpriteColor() is automatically applied.

Return value

Nonzero if the sprite has been grabbed, zero otherwise. If #PB_Any was used for the #Sprite parameter then the generated number is returned on success.

Remarks

GrabSprite() should be always called outside a StartDrawing() : StopDrawing() block.
The transparent sprite color is automatically applied when using AlphaBlending flag.

Supported OS

All

<- FreeSprite() - Sprite Index - InitSprite() ->