SpriteReplacementColour sets the sprites colours replacement colour. This is used when drawing sprites using the any of the colour replacement modes. During rendering any pixels within the sprites image that match the colour replace key colour, will be replacemed with this replacement colour.
FACTS:
* SpriteReplacementColour is only used when the sprites drawmode is set to a colour replacement mode.
Mini Tutorial:
This example manually creates a simple image then uses this image to show how to replace the colour replace key colour with a replacement colour.
; Create image #1, of size 100x, 100y CreateImage 1,100,100 ; Tell PB to redirect all drawing to the image RenderToImage 1 ; Draw a blue circle CircleC 50,50,50,1,RGB(0,0,255) ; Draw a purple circle in the middle that we'll replace real time CircleC 50,50,20,1,RGB(255,0,255) ; Get PB to Convert this image to an FX buffer PrepareFXImage 1 ; Tell PB to direct all drawing back to the screen RenderToScreen ; Create Sprite #1 CreateSprite 1 ; Set This sprite to use Image #1 SpriteImage 1,1 ; Center the Sprite handles CenterSpriteHandle 1 ; Position The sprite in the middle of the screen PositionSprite 1,GetScreenWidth()/2,GetScreenHeight()/2 ; Set the Colour replace KEU CVOlour (the colour to filter out) ; Were setting the COlour replace filter to screen out the ; Purple colour SpriteColourReplaceKey 1, RGB(255,0,255) ; Set the Replacement Colour to WHITE. So when the replacemode ; is turned on, any pixels in the purple colour will be replaced ; with this colour during rendering. SpriteReplacementColour 1, RGB(255,255,255) ; Start the Do/loop Do ; Clear the screen to a dark re colour Cls $550000 ; Display the Instructions for the user Print "Press Space to Toggle Colour Replacement mode)" ; Check if the space key is pressed If SpaceKey()=true ; if the space key is pressed ; Set this sprites drawing mode to rotated & Colour Replace SpriteDrawMode 1, 2+16384 Print "Colour Replaced Draw Mode" Else ; if the space key is NOT pressed ; Set this sprites drawing mode to rotated SpriteDrawMode 1, 2 Print "Normal Rotated Draw Mode" EndIf ; Turn the Sprite slowly TurnSprite 1,1 ; Draw the Sprite DrawSprite 1 ; Show the user the screen Sync ;loop back to the previous DO statement Loop |
|