ImageMaskColour
ImageMaskColour ImageNumber, TransparentColour
 
Parameters:

    ImageNumber = The Index of the image that you wish to set the tranparent colour of
    TransparentColour = The RGB value of this images transparent coloure
Returns: NONE
 

      ImageMaskColour allows the user to select an RGB colour to be treated as the transparent (see through) part of an image. Images can be drawn (via DrawImage,DrawRotatedImage, Sprites etc) either as solid or transparent. When drawing images in solid mode, every pixel within the image is drawn. However, when transparent mode is selected, only pixels that do not match the images Mask Colour are drawn.



FACTS:


     * When an image it created/loaded the ImageMaskColour will default to black. RGB(0,0,0)

     * The PlayBASIC sprite engine includes special rendering modes for images that use a black mask colour (ARGB(0,0,0,0))




Mini Tutorial:


  
; First Create a image, colour it blue and draw a red circle on it..
  size = 200
  MyImage=NewImage(Size,Size)
  RenderToImage MyImage
  Cls RGB(0,0,255)
  CircleC Size/2,Size/2,size/2,1,RGB(255,0,0)
  
; Set the Images Mask Colour (it's transparent colour) to Rgb(0,0,255) blue
  ImageMaskColour MyImage,RGB(0,0,255)
  
; redirect all drawing to the Screen
  RenderToScreen
  
; Clear the Screen to a greeny colour
  Cls RGB(30,50,40)
  
;  Draw this image as a solid image.
  DrawImage MyImage,100,100,0
  
; Draw this image filtering out the mask colour, so those pixels
; appear transparent (see through)
  DrawImage MyImage,100+size+50,100,1
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  
  


 
Related Info: DrawAlphaImage | DrawImage | DrawRotatedImage | DrawSprite | GetImageMaskColour :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com