Kernel object
'implements an easy to use kernel class
'should be good for blurs, sharpens, edge detects, etc.
'lets you set a custom kernel, or use a preset
'lets you sum and normalize it.
'an "eval" function for evaluating the kernel with a single pixel
'an "apply" function to apply it to a whole image (single channel)
'several morphological operations like erosion and dialate.

Sub
SetRow(ByVal v0 As Single, ByVal v1 As Single, ByVal v2 As Single, ByVal v3 As Single, ByVal v4 As Single, ByVal row As Long)

Function
GetKernel() As Variant
    'returns the 5x5 kernel in an array in a variant.

Function
sum() As Single

Sub
Normalize()

Sub
SetEdgeDetect()

Sub
SetSharpen()

Sub
SetUnsharpMask()
    '  a gaussian kernel

Sub
SetGaussian()
    '  a gaussian kernel

Sub
SetBox()
    '  a box kernel

Sub
SetEllipse()
    '  an elliptical kernel

Sub
SetCross()
    '  a cross kernel

'the evaluate function evaluates 1 pixel against the kernel
Function
Eval(ByVal x As Long, y As Long, buf() As Byte) As Single
    'result is not clamped or garenteed to be within 0-255

Function
Eval_Erosion(ByVal x As Long, y As Long, buf() As Byte) As Long
    'result is 0 or 1.
    'source image is interpolated as 0=0 : anything else=1
    'the kernel should be one of the 0/1 types like ellipse, box, or cross.

Function
Eval_Dialation(ByVal x As Long, y As Long, buf() As Byte) As Long
    'result is 0 or 1.
    'source image is interpolated as 0=0 : anything else=1
    'the kernel should be one of the 0/1 types like ellipse, box, or cross.

'apply the kernel to a whole channel
Sub
ApplyKernel(ByVal w As Long, ByVal h As Long, buf() As Byte, buf2() As Byte, Optional ByVal UseGaussian As Boolean = False)

Sub
ApplyToImage(Optional ByVal UseGaussian As Boolean = False)

Sub
Erode(ByVal w As Long, ByVal h As Long, buf() As Byte, buf2() As Byte, Optional ByVal UseEllipse As Boolean = False)

Sub
Dialate(ByVal w As Long, ByVal h As Long, buf() As Byte, buf2() As Byte, Optional ByVal UseEllipse As Boolean = False)