public Bitmap CopyBitmap(Bitmap source)
{
int depth = ();
if (depth != 8 && depth != 24 && depth != 32)
{
return null;
}
Bitmap destination = new Bitmap(, , );
BitmapData source_bitmapdata = null;
BitmapData destination_bitmapdata = null;
try
{
source_bitmapdata = (new Rectangle(0, 0, , ), ,
);
destination_bitmapdata = (new Rectangle(0, 0, , ), ,
);
unsafe
{
byte* source_ptr = (byte*)source_bitmapdata.Scan0;
byte* destination_ptr = (byte*)destination_bitmapdata.Scan0;
for (int i = 0; i < ( * * (depth / 8)); i++)
{
*destination_ptr = *source_ptr;
source_ptr++;
destination_ptr++;
}
}
(source_bitmapdata);
(destination_bitmapdata);
return destination;
}
catch
{
();
return null;
}
}