# filters

The following routines can be used to apply filters to a bitmap:

filterDib(dib, matrix, div, bias)
  applies a filter to the bitmap.
filterDibGray(dib, matrix, div, bias)
  does the same as filterDib, but first makes the bitmap gray, and is more than twice as fast.
filterDib3x3(dib, matrix, div, bias)
  applies a filter to the bitmap, but with a 3x3 matrix instead of 7x7, and is about 3 to 4 times faster than filterDib.
filterDibGray3x3(dib, matrix, div, bias)
  does the same as filterDib3x3, but first makes the bitmap gray, and is more than twice as fast - about 3 to 4 times faster than filterDibGray.
detectDibEdges(dib)
  applies an edge detection filter to the bitmap.
sharpenDib(dib)
  makes the bitmap a bit sharper.
subtleSharpenDib(dib)
  makes the bitmap a bit sharper (faster than sharpenDib, but not as sharp).
blurDib(dib)
  makes the bitmap a bit less sharp.
subtleBlurDib(dib)
  makes the bitmap a bit less sharp (faster than blurDib, but not as blurry).
embossDib(dib, bgcolor)
  embosses the bitmap, using bgcolor as the background color.

A filter adjusts each pixel in the bitmap in roughly the following manner:

        for each pixel[y, x] in the bitmap do
            pixel[y, x] = sum(matrix[i][j]*pixel[y-4+i, x-4+j]; i = 1 to 7, j = 1 to 7) / div + bias
        end for

For more information, enter "image filtering tutorials" into your favourite search engine.
Note that the filter routines can be quite slow because they require a lot of calculations per pixel.