string sInFile = Helpers.GetTestBitmapPath("almogaver1bit.bmp");
using (Bitmap bmp = new Bitmap(sInFile))
{
-#if false
- for (int x = 0; x < bmp.Width; x += 32) {
- for (int y = 0; y < bmp.Height; y += 32)
- Console.WriteLine ("\t\t\t\tAssert.Equal ({0}, bmp.GetPixel ({1}, {2}).ToArgb (), \"{1},{2}\");", bmp.GetPixel (x, y).ToArgb (), x, y);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(-1, bmp.GetPixel(0, 0).ToArgb());
Assert.Equal(-4144960, bmp.GetPixel(0, 32).ToArgb());
Assert.Equal(-4144960, bmp.GetPixel(160, 96).ToArgb());
Assert.Equal(-4144960, bmp.GetPixel(160, 128).ToArgb());
Assert.Equal(-8355712, bmp.GetPixel(160, 160).ToArgb());
-#endif
}
}
string sInFile = Helpers.GetTestBitmapPath("almogaver8bits.bmp");
using (Bitmap bmp = new Bitmap(sInFile))
{
-#if false
- for (int x = 0; x < bmp.Width; x += 32) {
- for (int y = 0; y < bmp.Height; y += 32)
- Console.WriteLine ("\t\t\t\tAssert.Equal ({0}, bmp.GetPixel ({1}, {2}).ToArgb (), \"{1},{2}\");", bmp.GetPixel (x, y).ToArgb (), x, y);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(-1040, bmp.GetPixel(0, 0).ToArgb());
Assert.Equal(-4137792, bmp.GetPixel(0, 32).ToArgb());
Assert.Equal(-4137792, bmp.GetPixel(160, 96).ToArgb());
Assert.Equal(-4137792, bmp.GetPixel(160, 128).ToArgb());
Assert.Equal(-8355712, bmp.GetPixel(160, 160).ToArgb());
-#endif
}
}
string sInFile = Helpers.GetTestBitmapPath("almogaver24bits.bmp");
using (Bitmap bmp = new Bitmap(sInFile))
{
-#if false
- for (int x = 0; x < bmp.Width; x += 32) {
- for (int y = 0; y < bmp.Height; y += 32)
- Console.WriteLine ("\t\t\t\tAssert.Equal ({0}, bmp.GetPixel ({1}, {2}).ToArgb (), \"{1},{2}\");", bmp.GetPixel (x, y).ToArgb (), x, y);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(-1645353, bmp.GetPixel(0, 32).ToArgb());
Assert.Equal(-461332, bmp.GetPixel(0, 64).ToArgb());
Assert.Equal(-2435382, bmp.GetPixel(160, 96).ToArgb());
Assert.Equal(-2501944, bmp.GetPixel(160, 128).ToArgb());
Assert.Equal(-9211799, bmp.GetPixel(160, 160).ToArgb());
-#endif
}
}
unsafe
{
byte* scan = (byte*)data.Scan0;
-#if false
- // 1009 is the first prime after 1000 (so we're not affected by a recurring pattern)
- for (int p = 0; p < size; p += 1009) {
- Console.WriteLine ("\t\t\t\t\t\tAssert.Equal ({0}, *(scan + {1}), \"{1}\");", *(scan + p), p);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(217, *(scan + 0));
Assert.Equal(192, *(scan + 1009));
Assert.Equal(0, *(scan + 92828));
Assert.Equal(146, *(scan + 93837));
Assert.Equal(163, *(scan + 94846));
-#endif
}
}
finally
using (Bitmap bmp = new Bitmap(sInFile))
{
Assert.Equal(PixelFormat.Format32bppRgb, bmp.PixelFormat);
-#if false
- for (int x = 0; x < bmp.Width; x += 32) {
- for (int y = 0; y < bmp.Height; y += 32)
- Console.WriteLine ("\t\t\t\tAssert.Equal ({0}, bmp.GetPixel ({1}, {2}).ToArgb (), \"{1},{2}\");", bmp.GetPixel (x, y).ToArgb (), x, y);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(-1579559, bmp.GetPixel(0, 0).ToArgb());
Assert.Equal(-1645353, bmp.GetPixel(0, 32).ToArgb());
Assert.Equal(-2435382, bmp.GetPixel(160, 96).ToArgb());
Assert.Equal(-2501944, bmp.GetPixel(160, 128).ToArgb());
Assert.Equal(-9211799, bmp.GetPixel(160, 160).ToArgb());
-#endif
}
}
{
using (Bitmap bmp = new Bitmap(filename))
{
-#if false
- for (int x = 0; x < bmp.Width; x += 32) {
- for (int y = 0; y < bmp.Height; y += 32)
- Console.WriteLine ("\t\t\t\tAssert.Equal ({0}, bmp.GetPixel ({1}, {2}).ToArgb (), \"{1},{2}\");", bmp.GetPixel (x, y).ToArgb (), x, y);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(-10644802, bmp.GetPixel(0, 0).ToArgb());
Assert.Equal(-12630705, bmp.GetPixel(0, 32).ToArgb());
Assert.Equal(-7766649, bmp.GetPixel(96, 32).ToArgb());
Assert.Equal(-11512986, bmp.GetPixel(96, 64).ToArgb());
Assert.Equal(-12616230, bmp.GetPixel(96, 96).ToArgb());
-#endif
}
}
unsafe
{
byte* scan = (byte*)data.Scan0;
-#if false
- // 1009 is the first prime after 1000 (so we're not affected by a recurring pattern)
- for (int p = 0; p < size; p += 1009) {
- Console.WriteLine ("\t\t\t\t\t\tAssert.Equal ({0}, *(scan + {1}), \"{1}\");", *(scan + p), p);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(190, *(scan + 0));
Assert.Equal(217, *(scan + 1009));
Assert.Equal(99, *(scan + 30270));
Assert.Equal(67, *(scan + 31279));
Assert.Equal(142, *(scan + 32288));
-#endif
}
}
finally
string sInFile = Helpers.GetTestBitmapPath("48x48_multiple_entries_4bit.ico");
using (Bitmap bmp = new Bitmap(sInFile))
{
-#if false
- for (int x = 0; x < bmp.Width; x += 4) {
- for (int y = 0; y < bmp.Height; y += 4)
- Console.WriteLine ("\t\t\t\tAssert.Equal ({0}, bmp.GetPixel ({1}, {2}).ToArgb (), \"{1},{2}\");", bmp.GetPixel (x, y).ToArgb (), x, y);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(0, bmp.GetPixel(0, 0).ToArgb());
Assert.Equal(0, bmp.GetPixel(0, 4).ToArgb());
Assert.Equal(0, bmp.GetPixel(12, 4).ToArgb());
Assert.Equal(-8355840, bmp.GetPixel(12, 8).ToArgb());
Assert.Equal(0, bmp.GetPixel(12, 12).ToArgb());
-#endif
}
}
unsafe
{
byte* scan = (byte*)data.Scan0;
-#if false
- // 13 is prime (so we're not affected by a recurring pattern)
- for (int p = 0; p < size; p += 13) {
- Console.WriteLine ("\t\t\t\t\t\tAssert.Equal ({0}, *(scan + {1}), \"{1}\");", *(scan + p), p);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(0, *(scan + 0));
Assert.Equal(0, *(scan + 13));
Assert.Equal(0, *(scan + 741));
Assert.Equal(0, *(scan + 754));
Assert.Equal(0, *(scan + 767));
-#endif
}
}
finally
string sInFile = Helpers.GetTestBitmapPath("VisualPng.ico");
using (Bitmap bmp = new Bitmap(sInFile))
{
-#if false
- for (int x = 0; x < bmp.Width; x += 4) {
- for (int y = 0; y < bmp.Height; y += 4)
- Console.WriteLine ("\t\t\t\tAssert.Equal ({0}, bmp.GetPixel ({1}, {2}).ToArgb (), \"{1},{2}\");", bmp.GetPixel (x, y).ToArgb (), x, y);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(0, bmp.GetPixel(0, 0).ToArgb());
Assert.Equal(-8388608, bmp.GetPixel(0, 4).ToArgb());
Assert.Equal(0, bmp.GetPixel(28, 20).ToArgb());
Assert.Equal(-8388608, bmp.GetPixel(28, 24).ToArgb());
Assert.Equal(0, bmp.GetPixel(28, 28).ToArgb());
-#endif
}
}
unsafe
{
byte* scan = (byte*)data.Scan0;
-#if false
- // 13 is prime (so we're not affected by a recurring pattern)
- for (int p = 0; p < size; p += 13) {
- Console.WriteLine ("\t\t\t\t\t\tAssert.Equal ({0}, *(scan + {1}), \"{1}\");", *(scan + p), p);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(0, *(scan + 0));
Assert.Equal(0, *(scan + 13));
Assert.Equal(0, *(scan + 858));
Assert.Equal(0, *(scan + 871));
Assert.Equal(0, *(scan + 884));
-#endif
}
}
finally
string sInFile = Helpers.GetTestBitmapPath("48x48_one_entry_1bit.ico");
using (Bitmap bmp = new Bitmap(sInFile))
{
-#if false
- for (int x = 0; x < bmp.Width; x += 4) {
- for (int y = 0; y < bmp.Height; y += 4)
- Console.WriteLine ("\t\t\t\tAssert.Equal ({0}, bmp.GetPixel ({1}, {2}).ToArgb (), \"{1},{2}\");", bmp.GetPixel (x, y).ToArgb (), x, y);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(-16777216, bmp.GetPixel(0, 0).ToArgb());
Assert.Equal(-16777216, bmp.GetPixel(0, 4).ToArgb());
Assert.Equal(-16777216, bmp.GetPixel(24, 8).ToArgb());
Assert.Equal(-1, bmp.GetPixel(24, 12).ToArgb());
Assert.Equal(0, bmp.GetPixel(24, 16).ToArgb());
-#endif
}
}
unsafe
{
byte* scan = (byte*)data.Scan0;
-#if false
- // 13 is prime (so we're not affected by a recurring pattern)
- for (int p = 0; p < size; p += 13) {
- Console.WriteLine ("\t\t\t\t\t\tAssert.Equal ({0}, *(scan + {1}), \"{1}\");", *(scan + p), p);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(0, *(scan + 0));
Assert.Equal(0, *(scan + 13));
Assert.Equal(0, *(scan + 910));
Assert.Equal(0, *(scan + 923));
Assert.Equal(0, *(scan + 936));
-#endif
}
}
finally
string sInFile = Helpers.GetTestBitmapPath("64x64_one_entry_8bit.ico");
using (Bitmap bmp = new Bitmap(sInFile))
{
-#if false
- for (int x = 0; x < bmp.Width; x += 4) {
- for (int y = 0; y < bmp.Height; y += 4)
- Console.WriteLine ("\t\t\t\tAssert.Equal ({0}, bmp.GetPixel ({1}, {2}).ToArgb (), \"{1},{2}\");", bmp.GetPixel (x, y).ToArgb (), x, y);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(-65383, bmp.GetPixel(0, 0).ToArgb());
Assert.Equal(-65383, bmp.GetPixel(0, 4).ToArgb());
Assert.Equal(-33664, bmp.GetPixel(12, 32).ToArgb());
Assert.Equal(-33664, bmp.GetPixel(12, 36).ToArgb());
Assert.Equal(-33664, bmp.GetPixel(12, 40).ToArgb());
-#endif
}
}
unsafe
{
byte* scan = (byte*)data.Scan0;
-#if false
- // 97 is prime (so we're not affected by a recurring pattern)
- for (int p = 0; p < size; p += 97) {
- Console.WriteLine ("\t\t\t\t\t\tAssert.Equal ({0}, *(scan + {1}), \"{1}\");", *(scan + p), p);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(153, *(scan + 0));
Assert.Equal(0, *(scan + 97));
Assert.Equal(0, *(scan + 12028));
Assert.Equal(255, *(scan + 12125));
Assert.Equal(153, *(scan + 12222));
-#endif
}
}
finally
string sInFile = Helpers.GetTestBitmapPath("96x96x256.ico");
using (Bitmap bmp = new Bitmap(sInFile))
{
-#if false
- for (int x = 0; x < bmp.Width; x += 4) {
- for (int y = 0; y < bmp.Height; y += 4)
- Console.WriteLine ("\t\t\t\tAssert.Equal ({0}, bmp.GetPixel ({1}, {2}).ToArgb (), \"{1},{2}\");", bmp.GetPixel (x, y).ToArgb (), x, y);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(0, bmp.GetPixel(0, 0).ToArgb());
Assert.Equal(0, bmp.GetPixel(0, 4).ToArgb());
Assert.Equal(-65383, bmp.GetPixel(92, 84).ToArgb());
Assert.Equal(-65383, bmp.GetPixel(92, 88).ToArgb());
Assert.Equal(-65383, bmp.GetPixel(92, 92).ToArgb());
-#endif
}
}
unsafe
{
byte* scan = (byte*)data.Scan0;
-#if false
- // 97 is prime (so we're not affected by a recurring pattern)
- for (int p = 0; p < size; p += 97) {
- Console.WriteLine ("\t\t\t\t\t\tAssert.Equal ({0}, *(scan + {1}), \"{1}\");", *(scan + p), p);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(0, *(scan + 0));
Assert.Equal(0, *(scan + 97));
Assert.Equal(0, *(scan + 27451));
Assert.Equal(0, *(scan + 27548));
Assert.Equal(0, *(scan + 27645));
-#endif
}
}
finally
string sInFile = Helpers.GetTestBitmapPath("nature-greyscale.jpg");
using (Bitmap bmp = new Bitmap(sInFile))
{
-#if false
- for (int x = 0; x < bmp.Width; x += 32) {
- for (int y = 0; y < bmp.Height; y += 32)
- Console.WriteLine ("\t\t\t\tAssert.Equal ({0}, bmp.GetPixel ({1}, {2}).ToArgb (), \"{1},{2}\");", bmp.GetPixel (x, y).ToArgb (), x, y);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(-7697782, bmp.GetPixel(0, 0).ToArgb());
Assert.Equal(-12171706, bmp.GetPixel(0, 32).ToArgb());
Assert.Equal(-8224126, bmp.GetPixel(96, 32).ToArgb());
Assert.Equal(-11053225, bmp.GetPixel(96, 64).ToArgb());
Assert.Equal(-9211021, bmp.GetPixel(96, 96).ToArgb());
-#endif
}
}
unsafe
{
byte* scan = (byte*)data.Scan0;
-#if false
- // 1009 is the first prime after 1000 (so we're not affected by a recurring pattern)
- for (int p = 0; p < size; p += 1009) {
- Console.WriteLine ("\t\t\t\t\t\tAssert.Equal ({0}, *(scan + {1}), \"{1}\");", *(scan + p), p);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(138, *(scan + 0));
Assert.Equal(203, *(scan + 1009));
Assert.Equal(87, *(scan + 30270));
Assert.Equal(85, *(scan + 31279));
Assert.Equal(106, *(scan + 32288));
-#endif
}
}
finally
string sInFile = Helpers.GetTestBitmapPath("nature24bits.jpg");
using (Bitmap bmp = new Bitmap(sInFile))
{
-#if false
- for (int x = 0; x < bmp.Width; x += 32) {
- for (int y = 0; y < bmp.Height; y += 32)
- Console.WriteLine ("\t\t\t\tAssert.Equal ({0}, bmp.GetPixel ({1}, {2}).ToArgb (), \"{1},{2}\");", bmp.GetPixel (x, y).ToArgb (), x, y);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(-10447423, bmp.GetPixel(0, 0).ToArgb());
Assert.Equal(-12171958, bmp.GetPixel(0, 32).ToArgb());
Assert.Equal(-8224378, bmp.GetPixel(96, 32).ToArgb());
Assert.Equal(-11053718, bmp.GetPixel(96, 64).ToArgb());
Assert.Equal(-12944166, bmp.GetPixel(96, 96).ToArgb());
-#endif
}
}
unsafe
{
byte* scan = (byte*)data.Scan0;
-#if false
- // 1009 is the first prime after 1000 (so we're not affected by a recurring pattern)
- for (int p = 0; p < size; p += 1009) {
- Console.WriteLine ("\t\t\t\t\t\tAssert.Equal ({0}, *(scan + {1}), \"{1}\");", *(scan + p), p);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(217, *(scan + 0));
Assert.Equal(192, *(scan + 1009));
Assert.Equal(0, *(scan + 92828));
Assert.Equal(146, *(scan + 93837));
Assert.Equal(163, *(scan + 94846));
-#endif
}
}
finally
string sInFile = Helpers.GetTestBitmapPath("1bit.png");
using (Bitmap bmp = new Bitmap(sInFile))
{
-#if false
- for (int x = 0; x < bmp.Width; x += 32) {
- for (int y = 0; y < bmp.Height; y += 32)
- Console.WriteLine ("\t\t\t\tAssert.Equal ({0}, bmp.GetPixel ({1}, {2}).ToArgb (), \"{1},{2}\");", bmp.GetPixel (x, y).ToArgb (), x, y);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(-1, bmp.GetPixel(0, 0).ToArgb());
Assert.Equal(-1, bmp.GetPixel(0, 32).ToArgb());
Assert.Equal(-1, bmp.GetPixel(160, 96).ToArgb());
Assert.Equal(-16777216, bmp.GetPixel(160, 128).ToArgb());
Assert.Equal(-1, bmp.GetPixel(160, 160).ToArgb());
-#endif
}
}
unsafe
{
byte* scan = (byte*)data.Scan0;
-#if false
- // 1009 is the first prime after 1000 (so we're not affected by a recurring pattern)
- for (int p = 0; p < size; p += 1009) {
- Console.WriteLine ("\t\t\t\t\t\tAssert.Equal ({0}, *(scan + {1}), \"{1}\");", *(scan + p), p);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(255, *(scan + 0));
Assert.Equal(255, *(scan + 1009));
Assert.Equal(0, *(scan + 71639));
Assert.Equal(0, *(scan + 72648));
Assert.Equal(255, *(scan + 73657));
-#endif
}
}
finally
string sInFile = Helpers.GetTestBitmapPath("81674-2bpp.png");
using (Bitmap bmp = new Bitmap(sInFile))
{
-#if false
- for (int x = 0; x < bmp.Width; x += 32) {
- for (int y = 0; y < bmp.Height; y += 32)
- Console.WriteLine ("\t\t\t\tAssert.Equal ({0}, bmp.GetPixel ({1}, {2}).ToArgb (), \"{1},{2}\");", bmp.GetPixel (x, y).ToArgb (), x, y);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(-11249559, bmp.GetPixel(0, 0).ToArgb());
Assert.Equal(-11249559, bmp.GetPixel(0, 32).ToArgb());
Assert.Equal(-11249559, bmp.GetPixel(96, 32).ToArgb());
Assert.Equal(-11249559, bmp.GetPixel(96, 64).ToArgb());
Assert.Equal(-11249559, bmp.GetPixel(96, 96).ToArgb());
-#endif
}
}
unsafe
{
byte* scan = (byte*)data.Scan0;
-#if false
- // 1009 is the first prime after 1000 (so we're not affected by a recurring pattern)
- for (int p = 0; p < size; p += 1009) {
- Console.WriteLine ("\t\t\t\t\t\tAssert.Equal ({0}, *(scan + {1}), \"{1}\");", *(scan + p), p);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(105, *(scan + 0));
Assert.Equal(88, *(scan + 1009));
Assert.Equal(105, *(scan + 27243));
Assert.Equal(88, *(scan + 28252));
Assert.Equal(84, *(scan + 29261));
-#endif
}
}
finally
string sInFile = Helpers.GetTestBitmapPath("4bit.png");
using (Bitmap bmp = new Bitmap(sInFile))
{
-#if false
- for (int x = 0; x < bmp.Width; x += 32) {
- for (int y = 0; y < bmp.Height; y += 32)
- Console.WriteLine ("\t\t\t\tAssert.Equal ({0}, bmp.GetPixel ({1}, {2}).ToArgb (), \"{1},{2}\");", bmp.GetPixel (x, y).ToArgb (), x, y);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(-10381134, bmp.GetPixel(0, 0).ToArgb());
Assert.Equal(-1314578, bmp.GetPixel(0, 32).ToArgb());
Assert.Equal(-12106173, bmp.GetPixel(160, 128).ToArgb());
Assert.Equal(-5790569, bmp.GetPixel(160, 160).ToArgb());
Assert.Equal(-12106173, bmp.GetPixel(160, 192).ToArgb());
-#endif
}
}
unsafe
{
byte* scan = (byte*)data.Scan0;
-#if false
- // 1009 is the first prime after 1000 (so we're not affected by a recurring pattern)
- for (int p = 0; p < size; p += 1009) {
- Console.WriteLine ("\t\t\t\t\t\tAssert.Equal ({0}, *(scan + {1}), \"{1}\");", *(scan + p), p);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(178, *(scan + 0));
Assert.Equal(184, *(scan + 1009));
Assert.Equal(71, *(scan + 71639));
Assert.Equal(90, *(scan + 72648));
Assert.Equal(240, *(scan + 73657));
-#endif
}
}
finally
string sInFile = Helpers.GetTestBitmapPath("almogaver32bits.tif");
using (Bitmap bmp = new Bitmap(sInFile))
{
-#if false
- for (int x = 0; x < bmp.Width; x += 32) {
- for (int y = 0; y < bmp.Height; y += 32)
- Console.WriteLine ("\t\t\t\tAssert.Equal ({0}, bmp.GetPixel ({1}, {2}).ToArgb (), \"{1},{2}\");", bmp.GetPixel (x, y).ToArgb (), x, y);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(-1579559, bmp.GetPixel(0, 0).ToArgb());
Assert.Equal(-1645353, bmp.GetPixel(0, 32).ToArgb());
Assert.Equal(-2435382, bmp.GetPixel(160, 96).ToArgb());
Assert.Equal(-2501944, bmp.GetPixel(160, 128).ToArgb());
Assert.Equal(-9211799, bmp.GetPixel(160, 160).ToArgb());
-#endif
}
}
unsafe
{
byte* scan = (byte*)data.Scan0;
-#if false
- // 1009 is the first prime after 1000 (so we're not affected by a recurring pattern)
- for (int p = 0; p < size; p += 1009) {
- Console.WriteLine ("\t\t\t\t\t\tAssert.Equal ({0}, *(scan + {1}), \"{1}\");", *(scan + p), p);
- }
-#else
// sampling values from a well known bitmap
Assert.Equal(217, *(scan + 0));
Assert.Equal(192, *(scan + 1009));
Assert.Equal(0, *(scan + 92828));
Assert.Equal(146, *(scan + 93837));
Assert.Equal(163, *(scan + 94846));
-#endif
}
}
finally