VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "clsGraphics"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Public Function getAlphaValue(sc As Long, ec As Long, level As Integer) As Long
   'Get AlphaValue for this pixel

   'Parameters
   ' sc      = StartColor (of color progression)
   ' ec      = EndColor (of color progression)
   ' level   = Level of AlphaBlending

    Dim r As Byte, g As Byte, b As Byte
    
    r = getRed(sc)
    g = getGreen(sc)
    b = getBlue(sc)
   
   'This algorithm creates an virtual color progression
   ' (sc to ec). This color progression contains 256
   ' colors (like an array). The color on position of
   ' variable level is the AlphaValue
    getAlphaValue = RGB( _
        Round(r + (((getRed(ec) - r) / 256) * level)), _
        Round(g + (((getGreen(ec) - g) / 256) * level)), _
        Round(b + (((getBlue(ec) - b) / 256) * level)))
End Function

Private Function getRed(color As Long)
   'Get red color value of variable color

    getRed = color And &HFF&
End Function

Private Function getGreen(color As Long)
    'Get green color value of variable color
    
    getGreen = (color And &HFF00&) / &H100&
End Function

Private Function getBlue(color As Long)
    'Get blue color value of variable color

    getBlue = (color And &HFF0000) / &H10000
End Function
