//how debluring filter are working?
I have no idea.
BitmapData pbits = deblurImage.LockBits(
new Rectangle(0, 0, width, height),
ImageLockMode.ReadWrite,
PixelFormat.Format24bppRgb);
//pixelformate.formate24bpprgb is what for?
It tells the
Bitmap.LockBits()[
^] method, how many bits are used for each pixel. Depending on the image format at hand, it could be necessary to use another member of the
PixelFormat Enumeration[
^].
//what is stride?
MSDN on BitmapData.Stride[
^]
//what is Marshal used for?
MSDN on Marshalling[
^]
//how it is filling the color in image?
Again, I have no idea.
//what is the purpose of the following statments?
//how these are working?
int r = Math.Min(Math.Max((int)(factor * red + bias), 0), 255);
int g = Math.Min(Math.Max((int)(factor * green + bias), 0), 255);
int b = Math.Min(Math.Max((int)(factor * blue + bias), 0), 255);
The combination of Min() and Max() methods ensure that values for r, g and b stay in defined range (0..255).
//what is FormArgb?
Color.FromArgb[
^]
//how the following two loops are working?mean how these are adjusting the values of the pixels?
for (int x = 0; x < width; ++x)
{
for (int y = 0; y < height; ++y)
{
rgb = y * pbits.Stride + 3 * x;
rgbValues[rgb + 2] = result[x, y].R;
rgbValues[rgb + 1] = result[x, y].G;
rgbValues[rgb + 0] = result[x, y].B;
}
}
LockBits() has transformed the pixels into a one-dimensional array of bytes. The nested loop accordingly transformes co-ordinates (somewhat human-readable) into the matching position within the array.
Remember that there can be more than one byte for every pixel. That's why there are three bytes to set for changing the colour of one pixel in this case.