LightImage
LightImage ImageNumber, Xpos, Ypos, Brightness, FallOffRate#
 
Parameters:

    ImageNumber = The Index of the image that you wish to light
    Xpos = The X origin from where the light source is placed
    Ypos = The Y origin from where the light source is placed
    Brightness = The Brightness (at the center) of the illumination
    FallOffRate# = The rate the brightness falls away from the
Returns: NONE
 

      LightImage will illuminate the pixels of an image. The way it works is that each pixel is illuminated according to it's position to the lights origin point, which is considered to be the light source. If you set the lights origin to the center of the image, it creates a nice a shaded half sphere style effect.



FACTS:


      * LightImage is a computationally heavy operation, as such, it's not intended for real time use on large images.

 
Example Source: Download This Example
; ==================
;  LightIMage
; ==================
  
; Create image #1
  Size=255
  CreateImage 1,Size,Size
  
  
; redirect rendering to this image
  RenderToImage 1
  
  
; clear this image with a random colour
  Cls RndRGB()
  
  
; Draw some random stuff on the image
  For lp =0 To 10
     CircleC Rnd(size),Rnd(size),RndRange(5,10),1,RndRGB()
  Next
  
  
; Copy image #1 to image #2
  CopyImage 1,2
  
; Direct all draw to the screen
  RenderToScreen
  
; clear the screen
  Cls RGB(25,30,40)
  
  X=140
  y=100
  
; Draw the original image
  Text x,y,"original image"
  DrawImage 1,x,y+20,1
  
; Draw the second copy of image shaded.
  Text x+size+10,y,"Shaded Image"
  LightImage 2,Size/2,size/2,200,1
  DrawImage 2,x+size+10,y+20,1
  
  
; Display the Screen and wait for key to be pressed
  Sync
  WaitKey
  
  
 
Related Info: BlurImage | FadeImage | RGBmaskImage | ScrollImage :
 


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