'
'                           ___________________________________________
'         _______ _ _ _     \___           ___________________________/
'    /\  (_______) (_) |       /  //  //  /  
'   /  \  _  __  | |_| | _    /  //  //  / << version 0.86 alpha test >>
'  / /\ \| |(__| | | | || \  /  //  //  /  For FreeBASIC (v0.20b or later).
' | |__| | |     | | | |_) )/  //  //  /     
' |_|  |_|_|     |_|_|____//  //  //  /   Original Development by
'  _______________________/  //  //  /___ Adigun Azikiwe Polack for Aura Flow.
' /_____________________________________/
'
'  A  u  r  a      F  l  o  w      L  i  b  r  a  r  y      3
'_________________________________________________________________________
'
' (c)2005-2016 Adigun Azikiwe Polack/Aura Flow.  All Rights Reserved.
'
'
'
'   _____ __             _____      __    __   __  ___          __      __   
'  / ___// /_____ ______/ __(_)__  / /___/ /  /  |/  /___  ____/ /_  __/ /__ 
'  \__ \/ __/ __ `/ ___/ /_/ / _ \/ / __  /  / /|_/ / __ \/ __  / / / / / _ \
' ___/ / /_/ /_/ / /  / __/ /  __/ / /_/ /  / /  / / /_/ / /_/ / /_/ / /  __/
'/____/\__/\__,_/_/  /_/ /_/\___/_/\__,_/  /_/  /_/\____/\__,_/\__,_/_/\___/ 
'                                                                            
'
'_________________________________________________________________________
'                        ----- N O T I C E -----
'_________________________________________________________________________
' The following is this piece of source code to this version of AFlib III.
' You are free to look at it to give you some inspiring ideas in your own
' programming in FreeBASIC, but you are *never* to even change or adjust
' any of this source code whatsoever in any way, shape, or form at all.
' EVER.  ;)
'
' The reason for this is to ensure that all of the routines in this source
' code are working as properly as they should in FreeBASIC v0.20b or
' newer.  That is all.
'
' With that said, do enjoy the library and be inspired even more
' greatly than ever!!!  (^-^)//
'_________________________________________________________________________



'$profile
'$stop_scan

#include once "fbgfx.bi"
ScreenControl(FB.SET_DRIVER_NAME, "GDI")

'---------------------------------------------------------------------
' Special Thanks to Mysoft for this Percent defining command here!!!
'---------------------------------------------------------------------
#define Percent3(A,B,P,M) ((A)+(((B)-(A))/(M))*(P))
'---------------------------------------------------------------------

Dim Shared as Double AF3_StarMovement_Y(10000), AF3_StarMovement_X(10000), _
                     AF3_FadePos_of_the_Star(10000), AF3_FadeCtrl_of_the_Star(10000), _
                     AF3_Color_of_the_Star(10000), AF3_Brightness_Color_of_the_Star(10000), _
                     AF3_Glowing_Color_of_the_Star(10000), AF3_Size_of_the_Star(10000)



Declare Sub AFlibIII_StarInit ( Byval Star_mul_setup as Integer )

Declare Sub AFlibIII_StarMotion ( Byval Star_mul as Integer, _
                                  Byval Star_color as Integer, _
                                  Byval Star_render_mode as Integer, _
                                  Byval Star_fadespeed_alpha as Integer, _
                                  Byval buffer as any ptr = 0 )

Declare Sub AFlibIII_StarMotion_add ( Byval Star_mul as Integer, _
                                      Byval Star_color as Integer, _
                                      Byval Star_render_mode as Integer, _
                                      Byval Star_fadespeed_add as Integer, _
                                      Byval buffer as any ptr = 0 )

Declare Sub AFlibIII_StarMotion_thick ( Byval Star_mul as Integer, _
                                        Byval Star_color_from as Integer, _
                                        Byval Star_color_to as Integer, _
                                        Byval Star_size as Integer, _
                                        Byval Star_dark_glow_level as Integer, _
                                        Byval buffer as any ptr = 0 )

Declare Sub AFlibIII_StarMotionColors ( Byval Star_mul as Integer, _
                                        Byval Star_flicker_switch as Integer, _
                                        Byval Star_render_mode as Integer, _
                                        Byval Star_fadespeed_alpha as Integer, _
                                        Byval buffer as any ptr = 0 )

Declare Sub AFlibIII_StarMotionColors_add ( Byval Star_mul as Integer, _
                                            Byval Star_flicker_switch as Integer, _
                                            Byval Star_render_mode as Integer, _
                                            Byval Star_fadespeed_add as Integer, _
                                            Byval buffer as any ptr = 0 )

Declare Sub AFlibIII_StarMotionColors_thick ( Byval Star_mul as Integer, _
                                              Byval Star_flicker_switch as Integer, _
                                              Byval Star_size as Integer, _
                                              Byval Star_dark_glow_level as Integer, _
                                              Byval buffer as any ptr = 0 )

Declare Sub AFlibIII_StarMotion_ranged ( Byval Star_mul_start as Integer, _
                                         Byval Star_mul_end as Integer, _
                                         Byval Star_color as Integer, _
                                         Byval Star_render_mode as Integer, _
                                         Byval Star_fadespeed_alpha as Integer, _
                                         Byval buffer as any ptr = 0 )

Declare Sub AFlibIII_StarMotion_ranged_add ( Byval Star_mul_start as Integer, _
                                             Byval Star_mul_end as Integer, _
                                             Byval Star_color as Integer, _
                                             Byval Star_render_mode as Integer, _
                                             Byval Star_fadespeed_add as Integer, _
                                             Byval buffer as any ptr = 0 )

Declare Sub AFlibIII_StarMotion_ranged_thick ( Byval Star_mul_start as Integer, _
                                               Byval Star_mul_end as Integer, _
                                               Byval Star_color_from as Integer, _
                                               Byval Star_color_to as Integer, _
                                               Byval Star_size as Integer, _
                                               Byval Star_dark_glow_level as Integer, _
                                               Byval buffer as any ptr = 0 )

Declare Sub AFlibIII_StarMotionColors_ranged ( Byval Star_mul_start as Integer, _
                                               Byval Star_mul_end as Integer, _
                                               Byval Star_flicker_switch as Integer, _
                                               Byval Star_render_mode as Integer, _
                                               Byval Star_fadespeed_alpha as Integer, _
                                               Byval buffer as any ptr = 0 )

Declare Sub AFlibIII_StarMotionColors_ranged_add ( Byval Star_mul_start as Integer, _
                                                   Byval Star_mul_end as Integer, _
                                                   Byval Star_flicker_switch as Integer, _
                                                   Byval Star_render_mode as Integer, _
                                                   Byval Star_fadespeed_add as Integer, _
                                                   Byval buffer as any ptr = 0 )

Declare Sub AFlibIII_StarMotionColors_ranged_thick ( Byval Star_mul_start as Integer, _
                                                     Byval Star_mul_end as Integer, _
                                                     Byval Star_flicker_switch as Integer, _
                                                     Byval Star_size as Integer, _
                                                     Byval Star_dark_glow_level as Integer, _
                                                     Byval buffer as any ptr = 0 )

Declare Sub AFlibIII_StarMove ( Byval Star_mul as Integer, _
                                Byval Star_dir as Integer, _
                                Byval Star_speed as Single )

Declare Sub AFlibIII_StarMove_ranged ( Byval Star_mul_start as Integer, _
                                       Byval Star_mul_end as Integer, _
                                       Byval Star_dir as Integer, _
                                       Byval Star_speed as Single )

Declare Sub AFlibIII_StarMove_angle ( Byval Star_mul as Integer, _
                                      Byval Star_angle as Double, _
                                      Byval Star_speed as Double )

Declare Sub AFlibIII_StarMove_ranged_angle ( Byval Star_mul_start as Integer, _
                                             Byval Star_mul_end as Integer, _
                                             Byval Star_angle as Double, _
                                             Byval Star_speed as Double )


Declare Sub Private5_Pixel ( byval sx as integer, byval sy as integer, byval col as integer, _
                             byval alpha_blend as integer, byval buffer as Any Ptr = 0 )

Declare Sub Private5_Pixel_add ( byval sx as integer, byval sy as integer, _
                                 byval col as integer, byval add_blend as integer, _
                                 byval buffer as Any Ptr = 0 )

Declare Sub Private5_SubPixel ( byval sx as single, byval sy as single, _
                                byval col as integer, byval alpha_blend as integer, _
                                byval buffer as Any Ptr = 0 )

Declare Sub Private5_SubPixel_add ( byval sx as single, byval sy as single, _
                                    byval col as integer, byval add_blend as integer, _
                                    byval buffer as Any Ptr = 0 )
                                    
Declare Function star_r_component(Byval c As Integer) As Integer
Declare Function star_g_component(Byval c As Integer) As Integer
Declare Function star_b_component(Byval c As Integer) As Integer

Declare Sub Private5_Globe_solid ( Byval Xcenter as Single, Byval Ycenter as Single, _
                                   Byval radius as Single, Byval size as Single, _
                                   Byval col_from as Integer, Byval col_to as Integer, _
                                   Byval col_blend as Integer, Byval buffer as any ptr = 0 )



'__________________________________________________________________________
Sub AFlibIII_StarInit ( Byval Star_mul_setup as Integer )

Dim as Integer stx, Gfx_horiz, Gfx_vert
ScreenInfo Gfx_horiz, Gfx_vert

If Star_mul_setup < 0 then Star_mul_setup = 0
If Star_mul_setup > 10000 then Star_mul_setup = 10000

For stx as Integer = 0 TO Star_mul_setup
  AF3_StarMovement_Y(stx) = int(rnd(1) * (Gfx_vert + 20)) + 1: AF3_StarMovement_X(stx) = int(rnd(1) * (Gfx_horiz + 20)) + 10
  AF3_StarMovement_Y(stx) = int(rnd(1) * (Gfx_vert + 20)) + 1: AF3_StarMovement_X(stx) = int(rnd(1) * (Gfx_horiz + 20)) + 10
  AF3_FadePos_of_the_Star(stx) = int(rnd(1) * 255) + 1: AF3_FadeCtrl_of_the_Star(stx) = int(rnd(1) * 10) - 5
  AF3_Brightness_Color_of_the_Star(stx) = int(rnd(1) * &hffffff) + 1
  AF3_Glowing_Color_of_the_Star(stx) = int(rnd(1) * &hffffff) + 1
  AF3_Color_of_the_Star(stx) = int(rnd(1) * &hffffff) + 1
Next

End Sub


'__________________________________________________________________________
Sub AFlibIII_StarMotion ( Byval Star_mul as Integer, _
                          Byval Star_color as Integer, _
                          Byval Star_render_mode as Integer, _
                          Byval Star_fadespeed_alpha as Integer, _
                          Byval buffer as any ptr = 0 )

Dim Rn as Integer, stx as Single

If Star_mul > 10000 then Star_mul = 10000
If Star_mul < 0 then Star_mul = 0

For Rn = 0 TO Star_mul
  AF3_Color_of_the_Star(Rn) = Star_color 
  If Star_fadespeed_alpha = -1 then
    AF3_FadePos_of_the_Star(Rn) = int(rnd(1) * 255) + 1
  else
    If AF3_FadeCtrl_of_the_Star(Rn) > 0 then
      AF3_FadePos_of_the_Star(Rn) += 1
      If AF3_FadePos_of_the_Star(Rn) > 255 then
        AF3_FadePos_of_the_Star(Rn) = 255
        AF3_FadeCtrl_of_the_Star(Rn) = 0
      end if
    else
      AF3_FadePos_of_the_Star(Rn) -= 1
      If AF3_FadePos_of_the_Star(Rn) < 0 then
        AF3_FadePos_of_the_Star(Rn) = 0
        AF3_FadeCtrl_of_the_Star(Rn) = 1
      end if
    end if
  end if
Next

For stx = 0 TO Star_mul
  If Star_render_mode > 0 or Star_render_mode = -1 then
    Private5_SubPixel AF3_StarMovement_X(stx), AF3_StarMovement_Y(stx), AF3_Color_of_the_Star(stx), AF3_FadePos_of_the_Star(stx), buffer
  else
    Private5_Pixel AF3_StarMovement_X(stx), AF3_StarMovement_Y(stx), AF3_Color_of_the_Star(stx), AF3_FadePos_of_the_Star(stx), buffer
  End if
Next

End Sub


'__________________________________________________________________________
Sub AFlibIII_StarMotion_add ( Byval Star_mul as Integer, _
                              Byval Star_color as Integer, _
                              Byval Star_render_mode as Integer, _
                              Byval Star_fadespeed_add as Integer, _
                              Byval buffer as any ptr = 0 )

Dim Rn as Integer, stx as Single

If Star_mul > 10000 then Star_mul = 10000
If Star_mul < 0 then Star_mul = 0

For Rn = 0 TO Star_mul
  AF3_Color_of_the_Star(Rn) = Star_color 
  If Star_fadespeed_add = -1 then
    AF3_FadePos_of_the_Star(Rn) = int(rnd(1) * 255) + 1
  else
    If AF3_FadeCtrl_of_the_Star(Rn) > 0 then
      AF3_FadePos_of_the_Star(Rn) += 1
      If AF3_FadePos_of_the_Star(Rn) > 255 then
        AF3_FadePos_of_the_Star(Rn) = 255
        AF3_FadeCtrl_of_the_Star(Rn) = 0
      end if
    else
      AF3_FadePos_of_the_Star(Rn) -= 1
      If AF3_FadePos_of_the_Star(Rn) < 0 then
        AF3_FadePos_of_the_Star(Rn) = 0
        AF3_FadeCtrl_of_the_Star(Rn) = 1
      end if
    end if
  end if
Next

For stx = 0 TO Star_mul
  If Star_render_mode > 0 or Star_render_mode = -1 then
    Private5_SubPixel_add AF3_StarMovement_X(stx), AF3_StarMovement_Y(stx), AF3_Color_of_the_Star(stx), AF3_FadePos_of_the_Star(stx), buffer
  else
    Private5_Pixel_add AF3_StarMovement_X(stx), AF3_StarMovement_Y(stx), AF3_Color_of_the_Star(stx), AF3_FadePos_of_the_Star(stx), buffer
  End if
Next

End Sub


'__________________________________________________________________________
Sub AFlibIII_StarMotion_thick ( Byval Star_mul as Integer, _
                                Byval Star_color_from as Integer, _
                                Byval Star_color_to as Integer, _
                                Byval Star_size as Integer, _
                                Byval Star_dark_glow_level as Integer, _
                                Byval buffer as any ptr = 0 )

Dim Rn as Integer, stx as Single

If Star_size > 36 then Star_size = 36
If Star_dark_glow_level < 0 then Star_dark_glow_level = 0
If Star_dark_glow_level > 511 then Star_dark_glow_level = 511

If Star_mul > 10000 then Star_mul = 10000
If Star_mul < 0 then Star_mul = 0

For Rn = 0 TO Star_mul
  AF3_Color_of_the_Star(Rn) = Star_color_from
  AF3_Brightness_Color_of_the_Star(Rn) = Star_color_to
  AF3_Glowing_Color_of_the_Star(Rn) = (int(rnd(1) * (2500) + 1) / 100) + Star_dark_glow_level
  AF3_Size_of_the_Star(Rn) = int(rnd(1) * Star_size) + 1
Next

For stx = 0 TO Star_mul
  Private5_Globe_solid AF3_StarMovement_X(stx), AF3_StarMovement_Y(stx), 1, AF3_Size_of_the_Star(stx), AF3_Color_of_the_Star(stx), AF3_Brightness_Color_of_the_Star(stx), AF3_Glowing_Color_of_the_Star(stx), buffer
Next

End Sub


'__________________________________________________________________________
Sub AFlibIII_StarMotionColors ( Byval Star_mul as Integer, _
                                Byval Star_flicker_switch as Integer, _
                                Byval Star_render_mode as Integer, _
                                Byval Star_fadespeed_alpha as Integer, _
                                Byval buffer as any ptr = 0 )

Dim Rn as Integer, stx as Single

If Star_mul > 10000 then Star_mul = 10000
If Star_mul < 0 then Star_mul = 0

For Rn = 0 TO Star_mul
  If Star_flicker_switch = -1 then
    AF3_Color_of_the_Star(Rn) = int(rnd(1) * &hffffff) + 1
  End if
  If Star_fadespeed_alpha = -1 then
    AF3_FadePos_of_the_Star(Rn) = int(rnd(1) * 255) + 1
  else
    If AF3_FadeCtrl_of_the_Star(Rn) > 0 then
      AF3_FadePos_of_the_Star(Rn) += 1
      If AF3_FadePos_of_the_Star(Rn) > 255 then
        AF3_FadePos_of_the_Star(Rn) = 255
        AF3_FadeCtrl_of_the_Star(Rn) = 0
      end if
    else
      AF3_FadePos_of_the_Star(Rn) -= 1
      If AF3_FadePos_of_the_Star(Rn) < 0 then
        AF3_FadePos_of_the_Star(Rn) = 0
        AF3_FadeCtrl_of_the_Star(Rn) = 1
      end if
    end if
  end if
Next

For stx = 0 TO Star_mul
  If Star_render_mode > 0 or Star_render_mode = -1 then
    Private5_SubPixel AF3_StarMovement_X(stx), AF3_StarMovement_Y(stx), AF3_Color_of_the_Star(stx), AF3_FadePos_of_the_Star(stx), buffer
  else
    Private5_Pixel AF3_StarMovement_X(stx), AF3_StarMovement_Y(stx), AF3_Color_of_the_Star(stx), AF3_FadePos_of_the_Star(stx), buffer
  End if
Next

End Sub


'__________________________________________________________________________
Sub AFlibIII_StarMotionColors_add ( Byval Star_mul as Integer, _
                                    Byval Star_flicker_switch as Integer, _
                                    Byval Star_render_mode as Integer, _
                                    Byval Star_fadespeed_add as Integer, _
                                    Byval buffer as any ptr = 0 )

Dim Rn as Integer, stx as Single

If Star_mul > 10000 then Star_mul = 10000
If Star_mul < 0 then Star_mul = 0

For Rn = 0 TO Star_mul
  If Star_flicker_switch = -1 then
    AF3_Color_of_the_Star(Rn) = int(rnd(1) * &hffffff) + 1
  End if
  If Star_fadespeed_add = -1 then
    AF3_FadePos_of_the_Star(Rn) = int(rnd(1) * 255) + 1
  else
    If AF3_FadeCtrl_of_the_Star(Rn) > 0 then
      AF3_FadePos_of_the_Star(Rn) += 1
      If AF3_FadePos_of_the_Star(Rn) > 255 then
        AF3_FadePos_of_the_Star(Rn) = 255
        AF3_FadeCtrl_of_the_Star(Rn) = 0
      end if
    else
      AF3_FadePos_of_the_Star(Rn) -= 1
      If AF3_FadePos_of_the_Star(Rn) < 0 then
        AF3_FadePos_of_the_Star(Rn) = 0
        AF3_FadeCtrl_of_the_Star(Rn) = 1
      end if
    end if
  end if
Next

For stx = 0 TO Star_mul
  If Star_render_mode > 0 or Star_render_mode = -1 then
    Private5_SubPixel_add AF3_StarMovement_X(stx), AF3_StarMovement_Y(stx), AF3_Color_of_the_Star(stx), AF3_FadePos_of_the_Star(stx), buffer
  else
    Private5_Pixel_add AF3_StarMovement_X(stx), AF3_StarMovement_Y(stx), AF3_Color_of_the_Star(stx), AF3_FadePos_of_the_Star(stx), buffer
  End if
Next

End Sub


'__________________________________________________________________________
Sub AFlibIII_StarMotionColors_thick ( Byval Star_mul as Integer, _
                                      Byval Star_flicker_switch as Integer, _
                                      Byval Star_size as Integer, _
                                      Byval Star_dark_glow_level as Integer, _
                                      Byval buffer as any ptr = 0 )

Dim Rn as Integer, stx as Single

If Star_size > 36 then Star_size = 36
If Star_dark_glow_level < 0 then Star_dark_glow_level = 0
If Star_dark_glow_level > 511 then Star_dark_glow_level = 511

If Star_mul > 10000 then Star_mul = 10000
If Star_mul < 0 then Star_mul = 0

For Rn = 0 TO Star_mul
  If Star_flicker_switch = -1 then
    AF3_Color_of_the_Star(Rn) = 0
    AF3_Brightness_Color_of_the_Star(Rn) = int(rnd(1) * &hffffff) + 1
  End if
  AF3_Glowing_Color_of_the_Star(Rn) = (int(rnd(1) * (2500) + 1) / 100) + (Star_dark_glow_level + 2)
  AF3_Size_of_the_Star(Rn) = int(rnd(1) * Star_size) + 1
Next

For stx = 0 TO Star_mul
  Private5_Globe_solid AF3_StarMovement_X(stx), AF3_StarMovement_Y(stx), 1, AF3_Size_of_the_Star(stx), AF3_Color_of_the_Star(stx), AF3_Brightness_Color_of_the_Star(stx), AF3_Glowing_Color_of_the_Star(stx), buffer
Next

End Sub


'__________________________________________________________________________
Sub AFlibIII_StarMotion_ranged ( Byval Star_mul_start as Integer, _
                                 Byval Star_mul_end as Integer, _
                                 Byval Star_color as Integer, _
                                 Byval Star_render_mode as Integer, _
                                 Byval Star_fadespeed_alpha as Integer, _
                                 Byval buffer as any ptr = 0 )

Dim Rn as Integer, stx as Single

If Star_mul_start > Star_mul_end then Swap Star_mul_start, Star_mul_end

If Star_mul_start > 10000 then Star_mul_start = 10000
If Star_mul_start < 0 then Star_mul_start = 0
If Star_mul_end > 10000 then Star_mul_end = 10000
If Star_mul_end < 0 then Star_mul_end = 0

For Rn = Star_mul_start TO Star_mul_end
  AF3_Color_of_the_Star(Rn) = Star_color 
  If Star_fadespeed_alpha = -1 then
    AF3_FadePos_of_the_Star(Rn) = int(rnd(1) * 255) + 1
  else
    If AF3_FadeCtrl_of_the_Star(Rn) > 0 then
      AF3_FadePos_of_the_Star(Rn) += 1
      If AF3_FadePos_of_the_Star(Rn) > 255 then
        AF3_FadePos_of_the_Star(Rn) = 255
        AF3_FadeCtrl_of_the_Star(Rn) = 0
      end if
    else
      AF3_FadePos_of_the_Star(Rn) -= 1
      If AF3_FadePos_of_the_Star(Rn) < 0 then
        AF3_FadePos_of_the_Star(Rn) = 0
        AF3_FadeCtrl_of_the_Star(Rn) = 1
      end if
    end if
  end if
Next

For stx = Star_mul_start TO Star_mul_end
  If Star_render_mode > 0 or Star_render_mode = -1 then
    Private5_SubPixel AF3_StarMovement_X(stx), AF3_StarMovement_Y(stx), AF3_Color_of_the_Star(stx), AF3_FadePos_of_the_Star(stx), buffer
  else
    Private5_Pixel AF3_StarMovement_X(stx), AF3_StarMovement_Y(stx), AF3_Color_of_the_Star(stx), AF3_FadePos_of_the_Star(stx), buffer
  End if
Next

End Sub


'__________________________________________________________________________
Sub AFlibIII_StarMotion_ranged_add ( Byval Star_mul_start as Integer, _
                                     Byval Star_mul_end as Integer, _
                                     Byval Star_color as Integer, _
                                     Byval Star_render_mode as Integer, _
                                     Byval Star_fadespeed_add as Integer, _
                                     Byval buffer as any ptr = 0 )

Dim Rn as Integer, stx as Single

If Star_mul_start > Star_mul_end then Swap Star_mul_start, Star_mul_end

If Star_mul_start > 10000 then Star_mul_start = 10000
If Star_mul_start < 0 then Star_mul_start = 0
If Star_mul_end > 10000 then Star_mul_end = 10000
If Star_mul_end < 0 then Star_mul_end = 0

For Rn = Star_mul_start TO Star_mul_end
  AF3_Color_of_the_Star(Rn) = Star_color 
  If Star_fadespeed_add = -1 then
    AF3_FadePos_of_the_Star(Rn) = int(rnd(1) * 255) + 1
  else
    If AF3_FadeCtrl_of_the_Star(Rn) > 0 then
      AF3_FadePos_of_the_Star(Rn) += 1
      If AF3_FadePos_of_the_Star(Rn) > 255 then
        AF3_FadePos_of_the_Star(Rn) = 255
        AF3_FadeCtrl_of_the_Star(Rn) = 0
      end if
    else
      AF3_FadePos_of_the_Star(Rn) -= 1
      If AF3_FadePos_of_the_Star(Rn) < 0 then
        AF3_FadePos_of_the_Star(Rn) = 0
        AF3_FadeCtrl_of_the_Star(Rn) = 1
      end if
    end if
  end if
Next

For stx = Star_mul_start TO Star_mul_end
  If Star_render_mode > 0 or Star_render_mode = -1 then
    Private5_SubPixel_add AF3_StarMovement_X(stx), AF3_StarMovement_Y(stx), AF3_Color_of_the_Star(stx), AF3_FadePos_of_the_Star(stx), buffer
  else
    Private5_Pixel_add AF3_StarMovement_X(stx), AF3_StarMovement_Y(stx), AF3_Color_of_the_Star(stx), AF3_FadePos_of_the_Star(stx), buffer
  End if
Next

End Sub


'__________________________________________________________________________
Sub AFlibIII_StarMotion_ranged_thick ( Byval Star_mul_start as Integer, _
                                       Byval Star_mul_end as Integer, _
                                       Byval Star_color_from as Integer, _
                                       Byval Star_color_to as Integer, _
                                       Byval Star_size as Integer, _
                                       Byval Star_dark_glow_level as Integer, _
                                       Byval buffer as any ptr = 0 )

Dim Rn as Integer, stx as Single

If Star_size > 36 then Star_size = 36
If Star_dark_glow_level < 0 then Star_dark_glow_level = 0
If Star_dark_glow_level > 511 then Star_dark_glow_level = 511

If Star_mul_start > Star_mul_end then Swap Star_mul_start, Star_mul_end

If Star_mul_start > 10000 then Star_mul_start = 10000
If Star_mul_start < 0 then Star_mul_start = 0
If Star_mul_end > 10000 then Star_mul_end = 10000
If Star_mul_end < 0 then Star_mul_end = 0

For Rn = Star_mul_start TO Star_mul_end
  AF3_Color_of_the_Star(Rn) = Star_color_from
  AF3_Brightness_Color_of_the_Star(Rn) = Star_color_to
  AF3_Glowing_Color_of_the_Star(Rn) = (int(rnd(1) * (2500) + 1) / 100) + Star_dark_glow_level
  AF3_Size_of_the_Star(Rn) = int(rnd(1) * Star_size) + 1
Next

For stx = Star_mul_start TO Star_mul_end
  Private5_Globe_solid AF3_StarMovement_X(stx), AF3_StarMovement_Y(stx), 1, AF3_Size_of_the_Star(stx), AF3_Color_of_the_Star(stx), AF3_Brightness_Color_of_the_Star(stx), AF3_Glowing_Color_of_the_Star(stx), buffer
Next

End Sub


'__________________________________________________________________________
Sub AFlibIII_StarMotionColors_ranged ( Byval Star_mul_start as Integer, _
                                       Byval Star_mul_end as Integer, _
                                       Byval Star_flicker_switch as Integer, _
                                       Byval Star_render_mode as Integer, _
                                       Byval Star_fadespeed_alpha as Integer, _
                                       Byval buffer as any ptr = 0 )

Dim Rn as Integer, stx as Single

If Star_mul_start > Star_mul_end then Swap Star_mul_start, Star_mul_end

If Star_mul_start > 10000 then Star_mul_start = 10000
If Star_mul_start < 0 then Star_mul_start = 0
If Star_mul_end > 10000 then Star_mul_end = 10000
If Star_mul_end < 0 then Star_mul_end = 0

For Rn = Star_mul_start TO Star_mul_end
  If Star_flicker_switch = -1 then
    AF3_Color_of_the_Star(Rn) = int(rnd(1) * &hffffff) + 1
  End if
  If Star_fadespeed_alpha = -1 then
    AF3_FadePos_of_the_Star(Rn) = int(rnd(1) * 255) + 1
  else
    If AF3_FadeCtrl_of_the_Star(Rn) > 0 then
      AF3_FadePos_of_the_Star(Rn) += 1
      If AF3_FadePos_of_the_Star(Rn) > 255 then
        AF3_FadePos_of_the_Star(Rn) = 255
        AF3_FadeCtrl_of_the_Star(Rn) = 0
      end if
    else
      AF3_FadePos_of_the_Star(Rn) -= 1
      If AF3_FadePos_of_the_Star(Rn) < 0 then
        AF3_FadePos_of_the_Star(Rn) = 0
        AF3_FadeCtrl_of_the_Star(Rn) = 1
      end if
    end if
  end if
Next

For stx = Star_mul_start TO Star_mul_end
  If Star_render_mode > 0 or Star_render_mode = -1 then
    Private5_SubPixel AF3_StarMovement_X(stx), AF3_StarMovement_Y(stx), AF3_Color_of_the_Star(stx), AF3_FadePos_of_the_Star(stx), buffer
  else
    Private5_Pixel AF3_StarMovement_X(stx), AF3_StarMovement_Y(stx), AF3_Color_of_the_Star(stx), AF3_FadePos_of_the_Star(stx), buffer
  End if
Next

End Sub


'__________________________________________________________________________
Sub AFlibIII_StarMotionColors_ranged_add ( Byval Star_mul_start as Integer, _
                                           Byval Star_mul_end as Integer, _
                                           Byval Star_flicker_switch as Integer, _
                                           Byval Star_render_mode as Integer, _
                                           Byval Star_fadespeed_add as Integer, _
                                           Byval buffer as any ptr = 0 )

Dim Rn as Integer, stx as Single

If Star_mul_start > Star_mul_end then Swap Star_mul_start, Star_mul_end

If Star_mul_start > 10000 then Star_mul_start = 10000
If Star_mul_start < 0 then Star_mul_start = 0
If Star_mul_end > 10000 then Star_mul_end = 10000
If Star_mul_end < 0 then Star_mul_end = 0

For Rn = Star_mul_start TO Star_mul_end
  If Star_flicker_switch = -1 then
    AF3_Color_of_the_Star(Rn) = int(rnd(1) * &hffffff) + 1
  End if
  If Star_fadespeed_add = -1 then
    AF3_FadePos_of_the_Star(Rn) = int(rnd(1) * 255) + 1
  else
    If AF3_FadeCtrl_of_the_Star(Rn) > 0 then
      AF3_FadePos_of_the_Star(Rn) += 1
      If AF3_FadePos_of_the_Star(Rn) > 255 then
        AF3_FadePos_of_the_Star(Rn) = 255
        AF3_FadeCtrl_of_the_Star(Rn) = 0
      end if
    else
      AF3_FadePos_of_the_Star(Rn) -= 1
      If AF3_FadePos_of_the_Star(Rn) < 0 then
        AF3_FadePos_of_the_Star(Rn) = 0
        AF3_FadeCtrl_of_the_Star(Rn) = 1
      end if
    end if
  end if
Next

For stx = Star_mul_start TO Star_mul_end
  If Star_render_mode > 0 or Star_render_mode = -1 then
    Private5_SubPixel_add AF3_StarMovement_X(stx), AF3_StarMovement_Y(stx), AF3_Color_of_the_Star(stx), AF3_FadePos_of_the_Star(stx), buffer
  else
    Private5_Pixel_add AF3_StarMovement_X(stx), AF3_StarMovement_Y(stx), AF3_Color_of_the_Star(stx), AF3_FadePos_of_the_Star(stx), buffer
  End if
Next

End Sub


'__________________________________________________________________________
Sub AFlibIII_StarMotionColors_ranged_thick ( Byval Star_mul_start as Integer, _
                                             Byval Star_mul_end as Integer, _
                                             Byval Star_flicker_switch as Integer, _
                                             Byval Star_size as Integer, _
                                             Byval Star_dark_glow_level as Integer, _
                                             Byval buffer as any ptr = 0 )

Dim Rn as Integer, stx as Single

If Star_size > 36 then Star_size = 36
If Star_dark_glow_level < 0 then Star_dark_glow_level = 0
If Star_dark_glow_level > 511 then Star_dark_glow_level = 511

If Star_mul_start > Star_mul_end then Swap Star_mul_start, Star_mul_end

If Star_mul_start > 10000 then Star_mul_start = 10000
If Star_mul_start < 0 then Star_mul_start = 0
If Star_mul_end > 10000 then Star_mul_end = 10000
If Star_mul_end < 0 then Star_mul_end = 0

For Rn = Star_mul_start TO Star_mul_end
  If Star_flicker_switch = -1 then
    AF3_Color_of_the_Star(Rn) = 0
    AF3_Brightness_Color_of_the_Star(Rn) = int(rnd(1) * &hffffff) + 1
  End if
  AF3_Glowing_Color_of_the_Star(Rn) = (int(rnd(1) * (2500) + 1) / 100) + (Star_dark_glow_level + 2)
  AF3_Size_of_the_Star(Rn) = int(rnd(1) * Star_size) + 1
Next

For stx = Star_mul_start TO Star_mul_end
  Private5_Globe_solid AF3_StarMovement_X(stx), AF3_StarMovement_Y(stx), 1, AF3_Size_of_the_Star(stx), AF3_Color_of_the_Star(stx), AF3_Brightness_Color_of_the_Star(stx), AF3_Glowing_Color_of_the_Star(stx), buffer
Next

End Sub


'__________________________________________________________________________
Sub AFlibIII_StarMove ( Byval Star_mul as Integer, Byval Star_dir as Integer, _
                        Byval Star_speed as Single )

If Star_speed <= 0 then Star_speed = 0
If Star_speed >= 300 then Star_speed = 300

If Star_mul > 10000 then Star_mul = 10000
If Star_mul < 0 then Star_mul = 0

Dim as Single stx, StAmt 
Dim as Integer Gfx_horiz, Gfx_vert
ScreenInfo Gfx_horiz, Gfx_vert

For stx = 0 TO Star_mul
  StAmt = ((stx * .001) + .01)
 
  If Star_dir = 1 then
    AF3_StarMovement_Y(stx) -= (StAmt * (Star_speed))
    If AF3_StarMovement_Y(stx) <= 0 then
      AF3_StarMovement_Y(stx) = (Gfx_vert + 50): AF3_StarMovement_X(stx) = int(rnd(1) * Gfx_horiz) + 1
    End if
  End if

  IF Star_dir = 2 then
    AF3_StarMovement_Y(stx) += (StAmt * (Star_speed))
    If AF3_StarMovement_Y(stx) >= (Gfx_vert + 50) then
      AF3_StarMovement_Y(stx) = 0: AF3_StarMovement_X(stx) = int(rnd(1) * Gfx_horiz) + 1
    End if
  End if

  IF Star_dir = 3 then
    AF3_StarMovement_X(stx) -= (StAmt * (Star_speed))
    If AF3_StarMovement_X(stx) <= -50 then
      AF3_StarMovement_X(stx) = (Gfx_horiz + 50): AF3_StarMovement_Y(stx) = int(rnd(1) * Gfx_vert) + 1
    End if
  End if

  IF Star_dir = 4 then
    AF3_StarMovement_X(stx) += (StAmt * (Star_speed))
    If AF3_StarMovement_X(stx) >= (Gfx_horiz + 50) then
      AF3_StarMovement_X(stx) = -50: AF3_StarMovement_Y(stx) = int(rnd(1) * Gfx_vert) + 1
    End if
  End if

Next

End Sub


'__________________________________________________________________________
Sub AFlibIII_StarMove_ranged ( Byval Star_mul_start as Integer, _
                               Byval Star_mul_end as Integer, _
                               Byval Star_dir as Integer, _
                               Byval Star_speed as Single )

If Star_speed <= 0 then Star_speed = 0
If Star_speed >= 300 then Star_speed = 300

If Star_mul_start > Star_mul_end then Swap Star_mul_start, Star_mul_end

If Star_mul_start > 10000 then Star_mul_start = 10000
If Star_mul_start < 0 then Star_mul_start = 0
If Star_mul_end > 10000 then Star_mul_end = 10000
If Star_mul_end < 0 then Star_mul_end = 0

Dim as Single stx, StAmt 
Dim as Integer Gfx_horiz, Gfx_vert
ScreenInfo Gfx_horiz, Gfx_vert

For stx = Star_mul_start TO Star_mul_end
  StAmt = ((stx * .001) + .01)
 
  If Star_dir = 1 then
    AF3_StarMovement_Y(stx) -= (StAmt * (Star_speed))
    If AF3_StarMovement_Y(stx) <= 0 then
      AF3_StarMovement_Y(stx) = (Gfx_vert + 50): AF3_StarMovement_X(stx) = int(rnd(1) * Gfx_horiz) + 1
    End if
  End if

  IF Star_dir = 2 then
    AF3_StarMovement_Y(stx) += (StAmt * (Star_speed))
    If AF3_StarMovement_Y(stx) >= (Gfx_vert + 50) then
      AF3_StarMovement_Y(stx) = 0: AF3_StarMovement_X(stx) = int(rnd(1) * Gfx_horiz) + 1
    End if
  End if

  IF Star_dir = 3 then
    AF3_StarMovement_X(stx) -= (StAmt * (Star_speed))
    If AF3_StarMovement_X(stx) <= -50 then
      AF3_StarMovement_X(stx) = (Gfx_horiz + 50): AF3_StarMovement_Y(stx) = int(rnd(1) * Gfx_vert) + 1
    End if
  End if

  IF Star_dir = 4 then
    AF3_StarMovement_X(stx) += (StAmt * (Star_speed))
    If AF3_StarMovement_X(stx) >= (Gfx_horiz + 50) then
      AF3_StarMovement_X(stx) = -50: AF3_StarMovement_Y(stx) = int(rnd(1) * Gfx_vert) + 1
    End if
  End if

Next

End Sub


'__________________________________________________________________________
Sub AFlibIII_StarMove_angle ( Byval Star_mul as Integer, _
                              Byval Star_angle as Double, _
                              Byval Star_speed as Double )

If Star_speed <= 0 then Star_speed = 0
If Star_speed >= 300 then Star_speed = 300

If Star_mul > 10000 then Star_mul = 10000
If Star_mul < 0 then Star_mul = 0

Dim as Single stx, StAmt 
Dim as Integer Gfx_horiz, Gfx_vert
Dim as Double FromAngle_X, FromAngle_Y
ScreenInfo Gfx_horiz, Gfx_vert

For stx = 0 TO Star_mul
  StAmt = ((stx * .01) + .1)

  FromAngle_X = ((Sin(Star_angle) * (StAmt * (Star_speed))))
  FromAngle_Y = ((Cos(Star_angle) * (StAmt * (Star_speed))))
  AF3_StarMovement_X(stx) += FromAngle_X
  AF3_StarMovement_Y(stx) += FromAngle_Y

  If FromAngle_Y < 0 then
    If AF3_StarMovement_Y(stx) <= -5 then
      AF3_StarMovement_Y(stx) = Gfx_vert: AF3_StarMovement_X(stx) = int(rnd(1) * Gfx_horiz) + 1
    End if
  else
    If AF3_StarMovement_Y(stx) >= (Gfx_vert + 5) then
      AF3_StarMovement_Y(stx) = -1 : AF3_StarMovement_X(stx) = int(rnd(1) * Gfx_horiz) + 1
    End if
  End if

  If FromAngle_X < 0 then
    If AF3_StarMovement_X(stx) <= -5 then
      AF3_StarMovement_X(stx) = Gfx_horiz: AF3_StarMovement_Y(stx) = int(rnd(1) * Gfx_vert) + 1
    End if
  else
    If AF3_StarMovement_X(stx) >= (Gfx_horiz + 5) then
      AF3_StarMovement_X(stx) = -5 : AF3_StarMovement_Y(stx) = int(rnd(1) * Gfx_vert) + 1
    End if
  End if
Next

End Sub


'__________________________________________________________________________
Sub AFlibIII_StarMove_ranged_angle ( Byval Star_mul_start as Integer, _
                                     Byval Star_mul_end as Integer, _
                                     Byval Star_angle as Double, _
                                     Byval Star_speed as Double )

If Star_speed <= 0 then Star_speed = 0
If Star_speed >= 300 then Star_speed = 300

If Star_mul_start > Star_mul_end then Swap Star_mul_start, Star_mul_end

If Star_mul_start > 10000 then Star_mul_start = 10000
If Star_mul_start < 0 then Star_mul_start = 0
If Star_mul_end > 10000 then Star_mul_end = 10000
If Star_mul_end < 0 then Star_mul_end = 0

Dim as Single stx, StAmt 
Dim as Integer Gfx_horiz, Gfx_vert
Dim as Double FromAngle_X, FromAngle_Y
ScreenInfo Gfx_horiz, Gfx_vert

For stx = Star_mul_start TO Star_mul_end
  StAmt = ((stx * .01) + .1)

  FromAngle_X = ((Sin(Star_angle) * (StAmt * (Star_speed))))
  FromAngle_Y = ((Cos(Star_angle) * (StAmt * (Star_speed))))
  AF3_StarMovement_X(stx) += FromAngle_X
  AF3_StarMovement_Y(stx) += FromAngle_Y

  If FromAngle_Y < 0 then
    If AF3_StarMovement_Y(stx) <= -5 then
      AF3_StarMovement_Y(stx) = Gfx_vert: AF3_StarMovement_X(stx) = int(rnd(1) * Gfx_horiz) + 1
    End if
  else
    If AF3_StarMovement_Y(stx) >= (Gfx_vert + 5) then
      AF3_StarMovement_Y(stx) = -1 : AF3_StarMovement_X(stx) = int(rnd(1) * Gfx_horiz) + 1
    End if
  End if

  If FromAngle_X < 0 then
    If AF3_StarMovement_X(stx) <= -5 then
      AF3_StarMovement_X(stx) = Gfx_horiz: AF3_StarMovement_Y(stx) = int(rnd(1) * Gfx_vert) + 1
    End if
  else
    If AF3_StarMovement_X(stx) >= (Gfx_horiz + 5) then
      AF3_StarMovement_X(stx) = -5 : AF3_StarMovement_Y(stx) = int(rnd(1) * Gfx_vert) + 1
    End if
  End if
Next

End Sub




Private Sub Private5_Pixel ( byval sx as integer, byval sy as integer, byval col as integer, _
                             byval alpha_blend as integer, byval buffer as Any Ptr = 0 )

dim tempbuffer as any ptr = Imagecreate(1, 1, col)
ScreenLock
  Put buffer, (sx, sy), tempbuffer, alpha, alpha_blend
ScreenUnlock

ImageDestroy tempbuffer

End sub

Private Sub Private5_Pixel_add ( byval sx as integer, byval sy as integer, byval col as integer, _
                                 byval add_blend as integer, byval buffer as Any Ptr = 0 )

dim tempbuffer as any ptr = Imagecreate(1, 1, col)
ScreenLock
  Put buffer, (sx, sy), tempbuffer, add, add_blend
ScreenUnlock

ImageDestroy tempbuffer

End sub

Private Sub Private5_SubPixel ( byval sx as single, byval sy as single, byval col as integer, _
                                byval alpha_blend as integer, byval buffer as Any Ptr = 0 )

'------------------------------------------------------------------------
' Special Thanks to both Eclipzer and axipher for the ideas for this
' AWESOME routine!!!  ^-^=b ! 
'------------------------------------------------------------------------


  Dim As Integer x,y
  Dim As Integer r0,r1,r2,r3,r4,g0,g1,g2,g3,g4,b0,b1,b2,b3,b4
  Dim As Integer bkg1,bkg2,bkg3,bkg4
  Dim As Integer c1,c2,c3,c4
  Dim As Double x0,y0,x1,y1,x2,y2
  Dim As Double ax1,ax2,ay1,ay2,a1,a2,a3,a4
  
  ' Define sub-pixel attributes
  x = Int(sx):  x0 = x+1:  x1 = sx:  x2 = x1+1
  y = Int(sy):  y0 = y+1:  y1 = sy:  y2 = y1+1
  
  ' Determine area lengths
  ax1 = x0 - x1:  ax2 = x2 - x0
  ay1 = y0 - y1:  ay2 = y2 - y0
  
  ' Calculate areas
  a1 = ax1*ay1:  a2 = ax2*ay1
  a3 = ax1*ay2:  a4 = ax2*ay2
  
  ' Determine 4 background colors
  bkg1 = Point(x  , y  )
  bkg2 = Point(x+1, y  )
  bkg3 = Point(x  , y+1)
  bkg4 = Point(x+1, y+1)
  
  ' Determine RBG components of background colors
  r1 = star_r_component(bkg1):  r2 = star_r_component(bkg2):  r3 = star_r_component(bkg3):  r4 = star_r_component(bkg4)
  g1 = star_g_component(bkg1):  g2 = star_g_component(bkg2):  g3 = star_g_component(bkg3):  g4 = star_g_component(bkg4)
  b1 = star_b_component(bkg1):  b2 = star_b_component(bkg2):  b3 = star_b_component(bkg3):  b4 = star_b_component(bkg4)
  
  ' Determine RGB components of sub-pixel color
  r0 = star_r_component(col)
  g0 = star_g_component(col)
  b0 = star_b_component(col)
  
  ' Calculate  RGB components of sub-pixel's 4 pixels
  c1 = rgb(a1*(r0 - r1) + r1, a1*(g0 - g1) + g1, a1*(b0 - b1) + b1)
  c2 = rgb(a2*(r0 - r2) + r2, a2*(g0 - g2) + g2, a2*(b0 - b2) + b2)
  c3 = rgb(a3*(r0 - r3) + r3, a3*(g0 - g3) + g3, a3*(b0 - b3) + b3)
  c4 = rgb(a4*(r0 - r4) + r4, a4*(g0 - g4) + g4, a4*(b0 - b4) + b4)
  
  ' Draw 4 pixels
  Private5_Pixel x  , y  , c1, alpha_blend, buffer
  Private5_Pixel x+1, y  , c2, alpha_blend, buffer
  Private5_Pixel x  , y+1, c3, alpha_blend, buffer
  Private5_Pixel x+1, y+1, c4, alpha_blend, buffer

End Sub

Private Sub Private5_SubPixel_add ( byval sx as single, byval sy as single, byval col as integer, _
                                    byval add_blend as integer, byval buffer as Any Ptr = 0 )

'------------------------------------------------------------------------
' Special Thanks to both Eclipzer and axipher for the ideas for this
' AWESOME routine!!!  ^-^=b ! 
'------------------------------------------------------------------------


  Dim As Integer x,y
  Dim As Integer r0,r1,r2,r3,r4,g0,g1,g2,g3,g4,b0,b1,b2,b3,b4
  Dim As Integer bkg1,bkg2,bkg3,bkg4
  Dim As Integer c1,c2,c3,c4
  Dim As Double x0,y0,x1,y1,x2,y2
  Dim As Double ax1,ax2,ay1,ay2,a1,a2,a3,a4
  
  ' Define sub-pixel attributes
  x = Int(sx):  x0 = x+1:  x1 = sx:  x2 = x1+1
  y = Int(sy):  y0 = y+1:  y1 = sy:  y2 = y1+1
  
  ' Determine area lengths
  ax1 = x0 - x1:  ax2 = x2 - x0
  ay1 = y0 - y1:  ay2 = y2 - y0
  
  ' Calculate areas
  a1 = ax1*ay1:  a2 = ax2*ay1
  a3 = ax1*ay2:  a4 = ax2*ay2
  
  ' Determine 4 background colors
  bkg1 = Point(x  , y  )
  bkg2 = Point(x+1, y  )
  bkg3 = Point(x  , y+1)
  bkg4 = Point(x+1, y+1)
  
  ' Determine RBG components of background colors
  r1 = star_r_component(bkg1):  r2 = star_r_component(bkg2):  r3 = star_r_component(bkg3):  r4 = star_r_component(bkg4)
  g1 = star_g_component(bkg1):  g2 = star_g_component(bkg2):  g3 = star_g_component(bkg3):  g4 = star_g_component(bkg4)
  b1 = star_b_component(bkg1):  b2 = star_b_component(bkg2):  b3 = star_b_component(bkg3):  b4 = star_b_component(bkg4)
  
  ' Determine RGB components of sub-pixel color
  r0 = star_r_component(col)
  g0 = star_g_component(col)
  b0 = star_b_component(col)
  
  ' Calculate  RGB components of sub-pixel's 4 pixels
  c1 = rgb(a1*(r0 - r1) + r1, a1*(g0 - g1) + g1, a1*(b0 - b1) + b1)
  c2 = rgb(a2*(r0 - r2) + r2, a2*(g0 - g2) + g2, a2*(b0 - b2) + b2)
  c3 = rgb(a3*(r0 - r3) + r3, a3*(g0 - g3) + g3, a3*(b0 - b3) + b3)
  c4 = rgb(a4*(r0 - r4) + r4, a4*(g0 - g4) + g4, a4*(b0 - b4) + b4)
  
  ' Draw 4 pixels
  Private5_Pixel_add x  , y  , c1, add_blend, buffer
  Private5_Pixel_add x+1, y  , c2, add_blend, buffer
  Private5_Pixel_add x  , y+1, c3, add_blend, buffer
  Private5_Pixel_add x+1, y+1, c4, add_blend, buffer

End Sub

Private Function star_r_component(Byval c As Integer) As Integer
  Return ((c Shr 16) And &hff)
End Function

Private Function star_g_component(Byval c As Integer) As Integer
  Return ((c Shr 8) And &hff)
End Function

Private Function star_b_component(Byval c As Integer) As Integer
  Return (c And &hff)
End Function

Private Sub Private5_Globe_solid ( Byval Xcenter as Single, Byval Ycenter as Single, _
                                   Byval radius as Single, Byval size as Single, _
                                   Byval col_from as Integer, Byval col_to as Integer, _
                                   Byval col_blend as Integer, Byval buffer as any ptr = 0 )

If Xcenter < 1 then Xcenter = 1
If Ycenter < 1 then Ycenter = 1
If size > 500 then size = 500
If size <= 0 then Exit Sub

Static As Integer RRA,RRB,GGA,GGB,BBA,BBB
Static As Integer RR,GG,BB,HARAD,DBRAD  
Dim as Integer blendcontrol

RRA = (col_to Shr 16) And 255
GGA = (col_to Shr 8) And 255
BBA = (col_to And 255)
RRB = (col_from Shr 16) And 255
GGB = (col_from Shr 8) And 255
BBB = (col_from And 255)
DBRAD = col_blend 
HARAD = DBRAD

For CircGlobe as Integer = size to 0 step -1
  If blendcontrol <= col_blend then
    RR = Percent3(RRA,RRB,HARAD,DBRAD)
    GG = Percent3(GGA,GGB,HARAD,DBRAD)
    BB = Percent3(BBA,BBB,HARAD,DBRAD)
    Circle (Xcenter, Ycenter), CircGlobe, RGB(RR, GG, BB), , , radius, F
    blendcontrol += 1
    HARAD -= 1
  else
    Exit For
  end if
Next  

End Sub
