예제 #1
0
		private static void PopulateSurface(ColorSurface surface, WriteableBitmapWrapper writeableBitmap)
		{
			for (int y = 0; y < surface.Height; ++y)
				for (int x = 0; x < surface.Width; ++x)
				{
					var c = writeableBitmap.GetPixel(x, y);
					surface[x, y, 0] = (ColorF) c;
				}
		}
예제 #2
0
		public static ColorSurface LoadFromFile(string uri)
		{
			BitmapImage bitmapImage = new BitmapImage(new Uri(uri));
			WriteableBitmapWrapper writeableBitmap = new WriteableBitmapWrapper(new WriteableBitmap(bitmapImage));

			ColorSurface surface = new ColorSurface(writeableBitmap.Width, writeableBitmap.Height, 1);
			PopulateSurface(surface, writeableBitmap);
			return surface;
		}
예제 #3
0
		public static void PopulateFromStream(ColorSurface surface, Stream stream)
		{
			BitmapFrame bitmapImage = BitmapFrame.Create(stream);
			PopulateSurface(surface, new WriteableBitmapWrapper(new WriteableBitmap(bitmapImage)));
		}