Problem with returning value from class library
Hi,
I want get return value from a class and call it from the main programming, but it return error. The error is :
âScanFirstStageâ: members name cannot be same as their enclosing type.
Could any help me please?
This is the class that suppose return the value -->
---------------------------------------------------------------------
public int ScanFirstStage (Bitmap image, out int cb)
{
// get image size
int width = image.Width;
int height = image.Height;
pixels = width * height;
// lock bitmap data
BitmapData imgData = image.LockBits(new Rectangle(0, 0, width, height),ImageLockMode.ReadOnly,PixelFormat.Format6 4bppPArgb);
int srcStride = imgData.Stride;
int srcOffset = srcStride - width;
// do the job
unsafe
{
byte* p = (byte*)imgData.Scan0.ToPointer();
int i = 0;
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
if (*p == 0)
{
i++;
}
++p;
}
p += srcOffset;
}
cb = i;
}
// unlock image data
image.UnlockBits(imgData);
}
------------------------------------------------------------------
This is the code from mainform to call the return value -->
ClassFirstStage.ScanFirstStage filter3 = new ClassFirstStage.ScanFirstStage(binary, out scanning1);
//apply filter for extraction
double scan1 = filter3.ScanFirstStage;
int num1 = (int)scan1;
objectCount1.Text = num1.ToString();
|