예제 #1
0
		public void GetIndexedDataLinearRectangleTest()
		{
			Bitmap Bitmap = new Bitmap(3, 3, PixelFormat.Format8bppIndexed);

			Bitmap.SetIndexedDataLinear(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 });

			Assert.AreEqual(
				"04050708",
				Bitmap.GetIndexedDataLinear(new Rectangle(1, 1, 2, 2)).ToHexString()
			);
		}
예제 #2
0
		public void SetIndexedDataLinearTest()
		{
			Bitmap Bitmap = new Bitmap(3, 3, PixelFormat.Format8bppIndexed);

			Bitmap.SetIndexedDataLinear(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 });

			Assert.AreEqual(
				"000102030405060708",
				Bitmap.GetIndexedDataLinear().ToHexString()
			);
		}
예제 #3
0
		public unsafe void GetIndexedDataLinearTest()
		{
			Bitmap Bitmap = new Bitmap(3, 3, PixelFormat.Format8bppIndexed);

			Bitmap.LockBitsUnlock(PixelFormat.Format8bppIndexed, (BitmapData) =>
			{
				byte *Data = (byte *)BitmapData.Scan0.ToPointer();
				for (int n = 0; n < 9; n++) Data[n] = (byte)n;
			});

			Assert.AreEqual(
				"000102030405060708",
				Bitmap.GetIndexedDataLinear().ToHexString()
			);
		}