示例#1
0
		private bool ClearAndCheckImageFloat(ImageBufferFloat image, RGBA_Floats color)
		{
			image.NewGraphics2D().Clear(color);

			switch (image.BitDepth)
			{
				case 128:
					for (int y = 0; y < image.Height; y++)
					{
						for (int x = 0; x < image.Width; x++)
						{
							RGBA_Floats pixelColor = image.GetPixel(x, y);
							if (pixelColor != color)
							{
								return false;
							}
						}
					}
					break;

				default:
					throw new NotImplementedException();
			}

			return true;
		}
示例#2
0
        private void Initialize(ImageBufferFloat sourceImage)
        {
            RectangleInt sourceBoundingRect = sourceImage.GetBoundingRect();

            Initialize(sourceImage, sourceBoundingRect);
            OriginOffset = sourceImage.OriginOffset;
        }
示例#3
0
        private bool ClearAndCheckImageFloat(ImageBufferFloat image, RGBA_Floats color)
        {
            image.NewGraphics2D().Clear(color);

            switch (image.BitDepth)
            {
            case 128:
                for (int y = 0; y < image.Height; y++)
                {
                    for (int x = 0; x < image.Width; x++)
                    {
                        RGBA_Floats pixelColor = image.GetPixel(x, y);
                        if (pixelColor != color)
                        {
                            return(false);
                        }
                    }
                }
                break;

            default:
                throw new NotImplementedException();
            }

            return(true);
        }
		public MarchingSquaresFloat(ImageBufferFloat imageToMarch, int threshold, int debugColor)
		{
			this.threshold = threshold;
			this.imageToMarch = imageToMarch;
			this.debugColor = debugColor;

			CreateLineSegments();
		}
示例#5
0
            internal InternalImageGraphics2D(ImageBufferFloat owner)
                : base()
            {
                m_Owner = owner;

                ScanlineRasterizer      rasterizer         = new ScanlineRasterizer();
                ImageClippingProxyFloat imageClippingProxy = new ImageClippingProxyFloat(owner);

                Initialize(imageClippingProxy, rasterizer);
                ScanlineCache = new ScanlineCachePacked8();
            }
示例#6
0
			internal InternalImageGraphics2D(ImageBufferFloat owner)
				: base()
			{
				m_Owner = owner;

				ScanlineRasterizer rasterizer = new ScanlineRasterizer();
				ImageClippingProxyFloat imageClippingProxy = new ImageClippingProxyFloat(owner);

				Initialize(imageClippingProxy, rasterizer);
				ScanlineCache = new ScanlineCachePacked8();
			}
        public bool LoadImageData(string filename, ImageBufferFloat destImage)
        {
            if (File.Exists(filename))
            {
                var bitmap = new Bitmap(filename);
                if (bitmap != null)
                {
                    switch (bitmap.PixelFormat)
                    {
                    case System.Drawing.Imaging.PixelFormat.Format24bppRgb:
                        destImage.Allocate(bitmap.Width, bitmap.Height, bitmap.Width * 4, 128);
                        break;

                    default:
                        throw new System.NotImplementedException();
                    }

                    BitmapData bitmapData  = bitmap.LockBits(new Rectangle(0, 0, bitmap.Width, bitmap.Height), System.Drawing.Imaging.ImageLockMode.ReadWrite, bitmap.PixelFormat);
                    int        sourceIndex = 0;
                    int        destIndex   = 0;
                    unsafe
                    {
                        int     offset;
                        float[] destBuffer    = destImage.GetBuffer(out offset);
                        byte *  pSourceBuffer = (byte *)bitmapData.Scan0;
                        for (int y = 0; y < destImage.Height; y++)
                        {
                            destIndex = destImage.GetBufferOffsetXY(0, destImage.Height - 1 - y);
                            for (int x = 0; x < destImage.Width; x++)
                            {
                                destBuffer[destIndex++] = pSourceBuffer[sourceIndex++] / 255.0f;
                                destBuffer[destIndex++] = pSourceBuffer[sourceIndex++] / 255.0f;
                                destBuffer[destIndex++] = pSourceBuffer[sourceIndex++] / 255.0f;
                                destBuffer[destIndex++] = 1.0f;
                            }
                        }
                    }

                    bitmap.UnlockBits(bitmapData);

                    return(true);
                }
            }

            return(false);
        }
示例#8
0
        public void ClearTests()
        {
            {
                ImageBuffer clearSurface24 = new ImageBuffer(50, 50, 24, new BlenderBGR());
                Assert.IsTrue(ClearAndCheckImage(clearSurface24, RGBA_Bytes.White), "Clear 24 to white");
                Assert.IsTrue(ClearAndCheckImage(clearSurface24, RGBA_Bytes.Black), "Clear 24 to black");

                ImageBuffer clearSurface32 = new ImageBuffer(50, 50, 32, new BlenderBGRA());
                Assert.IsTrue(ClearAndCheckImage(clearSurface32, RGBA_Bytes.White), "Clear 32 to white");
                Assert.IsTrue(ClearAndCheckImage(clearSurface32, RGBA_Bytes.Black), "Clear 32 to black");
                Assert.IsTrue(ClearAndCheckImage(clearSurface32, new RGBA_Bytes(0, 0, 0, 0)), "Clear 32 to nothing");

                ImageBufferFloat clearSurface3ComponentFloat = new ImageBufferFloat(50, 50, 128, new BlenderBGRAFloat());
                Assert.IsTrue(ClearAndCheckImageFloat(clearSurface3ComponentFloat, RGBA_Floats.White), "Clear float to white");
                Assert.IsTrue(ClearAndCheckImageFloat(clearSurface3ComponentFloat, RGBA_Floats.Black), "Clear float to black");
                Assert.IsTrue(ClearAndCheckImageFloat(clearSurface3ComponentFloat, new RGBA_Floats(0, 0, 0, 0)), "Clear float to nothing");
            }
        }
示例#9
0
		public void ClearTests()
		{
			{
				ImageBuffer clearSurface24 = new ImageBuffer(50, 50, 24, new BlenderBGR());
				Assert.IsTrue(ClearAndCheckImage(clearSurface24, RGBA_Bytes.White), "Clear 24 to white");
				Assert.IsTrue(ClearAndCheckImage(clearSurface24, RGBA_Bytes.Black), "Clear 24 to black");

				ImageBuffer clearSurface32 = new ImageBuffer(50, 50, 32, new BlenderBGRA());
				Assert.IsTrue(ClearAndCheckImage(clearSurface32, RGBA_Bytes.White), "Clear 32 to white");
				Assert.IsTrue(ClearAndCheckImage(clearSurface32, RGBA_Bytes.Black), "Clear 32 to black");
				Assert.IsTrue(ClearAndCheckImage(clearSurface32, new RGBA_Bytes(0, 0, 0, 0)), "Clear 32 to nothing");

				ImageBufferFloat clearSurface3ComponentFloat = new ImageBufferFloat(50, 50, 128, new BlenderBGRAFloat());
				Assert.IsTrue(ClearAndCheckImageFloat(clearSurface3ComponentFloat, RGBA_Floats.White), "Clear float to white");
				Assert.IsTrue(ClearAndCheckImageFloat(clearSurface3ComponentFloat, RGBA_Floats.Black), "Clear float to black");
				Assert.IsTrue(ClearAndCheckImageFloat(clearSurface3ComponentFloat, new RGBA_Floats(0, 0, 0, 0)), "Clear float to nothing");
			}
		}
示例#10
0
        public static void DoMatch(ImageBufferFloat imageToSearch, ImageBufferFloat imageToFind, ImageBufferFloat result)
        {
            result = new ImageBufferFloat(imageToSearch.Width, imageToSearch.Height, 32, new BlenderBGRAFloat());
            if (imageToSearch.Width >= imageToFind.Width
                && imageToSearch.Height >= imageToFind.Height
                && imageToSearch.BitDepth == imageToFind.BitDepth)
            {
                int floatsPerPixel = imageToSearch.BitDepth / 32;
                int searchDistanceBetweenPixels = imageToSearch.GetFloatsBetweenPixelsInclusive();
                int findDistanceBetweenPixels = imageToFind.GetFloatsBetweenPixelsInclusive();
                float[] searchBuffer = imageToSearch.GetBuffer();
                float[] findBuffer = imageToFind.GetBuffer();
                float[] resultBuffer = imageToFind.GetBuffer();
                int resutsBufferOffset = 0;
                for (int matchY = 0; matchY <= imageToSearch.Height - imageToFind.Height; matchY++)
                {
                    for (int matchX = 0; matchX <= imageToSearch.Width - imageToFind.Width; matchX++)
                    {
                        double currentLeastSquares = 0;

                        for (int imageToFindY = 0; imageToFindY < imageToFind.Height; imageToFindY++)
                        {
                            int searchBufferOffset = imageToSearch.GetBufferOffsetXY(matchX, matchY + imageToFindY);
                            int findBufferOffset = imageToFind.GetBufferOffsetY(imageToFindY);
                            for (int findX = 0; findX < imageToFind.Width; findX++)
                            {
                                for (int byteIndex = 0; byteIndex < floatsPerPixel; byteIndex++)
                                {
                                    float aByte = searchBuffer[searchBufferOffset + byteIndex];
                                    float bByte = findBuffer[findBufferOffset + byteIndex];
                                    int difference = (int)aByte - (int)bByte;
                                    currentLeastSquares += difference * difference;
                                }
                                searchBufferOffset += searchDistanceBetweenPixels;
                                findBufferOffset += findDistanceBetweenPixels;
                            }
                        }

                        resultBuffer[resutsBufferOffset] = (float)currentLeastSquares;
                        resutsBufferOffset++;
                    }
                }
            }
        }
示例#11
0
        public void ClearTests()
        {
            ImageBuffer clearSurface24 = new ImageBuffer(50, 50, 24, new BlenderBGR());

            Assert.IsTrue(ClearAndCheckImage(clearSurface24, Color.White), "Clear 24 to white");
            Assert.IsTrue(ClearAndCheckImage(clearSurface24, Color.Black), "Clear 24 to black");

            ImageBuffer clearSurface32 = new ImageBuffer(50, 50);

            Assert.IsTrue(ClearAndCheckImage(clearSurface32, Color.White), "Clear 32 to white");
            Assert.IsTrue(ClearAndCheckImage(clearSurface32, Color.Black), "Clear 32 to black");
            Assert.IsTrue(ClearAndCheckImage(clearSurface32, new Color(0, 0, 0, 0)), "Clear 32 to nothing");

            ImageBufferFloat clearSurface3ComponentFloat = new ImageBufferFloat(50, 50, 128, new BlenderBGRAFloat());

            Assert.IsTrue(ClearAndCheckImageFloat(clearSurface3ComponentFloat, ColorF.White), "Clear float to white");
            Assert.IsTrue(ClearAndCheckImageFloat(clearSurface3ComponentFloat, ColorF.Black), "Clear float to black");
            Assert.IsTrue(ClearAndCheckImageFloat(clearSurface3ComponentFloat, new ColorF(0, 0, 0, 0)), "Clear float to nothing");
        }
示例#12
0
        private void Initialize(ImageBufferFloat sourceImage, RectangleInt boundsToCopyFrom)
        {
            if (sourceImage == this)
            {
                throw new Exception("We do not create a temp buffer for this to work.  You must have a source distinct from the dest.");
            }
            Deallocate();
            Allocate(boundsToCopyFrom.Width, boundsToCopyFrom.Height, boundsToCopyFrom.Width * sourceImage.BitDepth / 8, sourceImage.BitDepth);
            SetRecieveBlender(sourceImage.GetBlender());

            if (m_Width != 0 && m_Height != 0)
            {
                RectangleInt DestRect           = new RectangleInt(0, 0, boundsToCopyFrom.Width, boundsToCopyFrom.Height);
                RectangleInt AbsoluteSourceRect = boundsToCopyFrom;
                // The first thing we need to do is make sure the frame is cleared. LBB [3/15/2004]
                Graphics2D graphics2D = NewGraphics2D();
                graphics2D.Clear(new ColorF(0, 0, 0, 0));

                int x = -boundsToCopyFrom.Left - (int)sourceImage.OriginOffset.X;
                int y = -boundsToCopyFrom.Bottom - (int)sourceImage.OriginOffset.Y;

                graphics2D.Render(sourceImage, x, y, 0, 1, 1);
            }
        }
示例#13
0
        public void CropToVisible()
        {
            Vector2 OldOriginOffset = OriginOffset;

            //Move the HotSpot to 0, 0 so PPoint will work the way we want
            OriginOffset = new Vector2(0, 0);

            RectangleInt visibleBounds;

            GetVisibleBounds(out visibleBounds);

            if (visibleBounds.Width == Width &&
                visibleBounds.Height == Height)
            {
                OriginOffset = OldOriginOffset;
                return;
            }

            // check if the Not0Rect has any size
            if (visibleBounds.Width > 0)
            {
                ImageBufferFloat TempImage = new ImageBufferFloat();

                // set TempImage equal to the Not0Rect
                TempImage.Initialize(this, visibleBounds);

                // set the frame equal to the TempImage
                Initialize(TempImage);

                OriginOffset = new Vector2(-visibleBounds.Left + OldOriginOffset.X, -visibleBounds.Bottom + OldOriginOffset.Y);
            }
            else
            {
                Deallocate();
            }
        }
示例#14
0
		static public bool LoadImageData(String filename, ImageBufferFloat destImage)
		{
			return AvailableImageIOPlugin.LoadImageData(filename, destImage);
		}
示例#15
0
		public virtual bool LoadImageData(String filename, ImageBufferFloat destImage)
		{
			throw new Exception("You must implement this in an inherited class.");
		}
示例#16
0
		public void CropToVisible()
		{
			Vector2 OldOriginOffset = OriginOffset;

			//Move the HotSpot to 0, 0 so PPoint will work the way we want
			OriginOffset = new Vector2(0, 0);

			RectangleInt visibleBounds;
			GetVisibleBounds(out visibleBounds);

			if (visibleBounds.Width == Width
				&& visibleBounds.Height == Height)
			{
				OriginOffset = OldOriginOffset;
				return;
			}

			// check if the Not0Rect has any size
			if (visibleBounds.Width > 0)
			{
				ImageBufferFloat TempImage = new ImageBufferFloat();

				// set TempImage equal to the Not0Rect
				TempImage.Initialize(this, visibleBounds);

				// set the frame equal to the TempImage
				Initialize(TempImage);

				OriginOffset = new Vector2(-visibleBounds.Left + OldOriginOffset.x, -visibleBounds.Bottom + OldOriginOffset.y);
			}
			else
			{
				Deallocate();
			}
		}
示例#17
0
		private void Initialize(ImageBufferFloat sourceImage)
		{
			RectangleInt sourceBoundingRect = sourceImage.GetBoundingRect();

			Initialize(sourceImage, sourceBoundingRect);
			OriginOffset = sourceImage.OriginOffset;
		}
示例#18
0
		private void Initialize(ImageBufferFloat sourceImage, RectangleInt boundsToCopyFrom)
		{
			if (sourceImage == this)
			{
				throw new Exception("We do not create a temp buffer for this to work.  You must have a source distinct from the dest.");
			}
			Deallocate();
			Allocate(boundsToCopyFrom.Width, boundsToCopyFrom.Height, boundsToCopyFrom.Width * sourceImage.BitDepth / 8, sourceImage.BitDepth);
			SetRecieveBlender(sourceImage.GetBlender());

			if (m_Width != 0 && m_Height != 0)
			{
				RectangleInt DestRect = new RectangleInt(0, 0, boundsToCopyFrom.Width, boundsToCopyFrom.Height);
				RectangleInt AbsoluteSourceRect = boundsToCopyFrom;
				// The first thing we need to do is make sure the frame is cleared. LBB [3/15/2004]
				Graphics2D graphics2D = NewGraphics2D();
				graphics2D.Clear(new RGBA_Floats(0, 0, 0, 0));

				int x = -boundsToCopyFrom.Left - (int)sourceImage.OriginOffset.x;
				int y = -boundsToCopyFrom.Bottom - (int)sourceImage.OriginOffset.y;

				graphics2D.Render(sourceImage, x, y, 0, 1, 1);
			}
		}
示例#19
0
		public override void OnDraw(Graphics2D graphics2D)
		{
			if (graphics2D.DestImage != null)
			{
				ImageBuffer widgetsSubImage = ImageBuffer.NewSubImageReference(graphics2D.DestImage, graphics2D.GetClippingRect());

				IImageByte backBuffer = widgetsSubImage;

				int distBetween = backBuffer.GetBytesBetweenPixelsInclusive();
				ImageBuffer redImageBuffer = new ImageBuffer();
				redImageBuffer.Attach(backBuffer, new blender_gray(distBetween), distBetween, 2, 8);
				ImageBuffer greenImageBuffer = new ImageBuffer();
				greenImageBuffer.Attach(backBuffer, new blender_gray(distBetween), distBetween, 1, 8);
				ImageBuffer blueImageBuffer = new ImageBuffer();
				blueImageBuffer.Attach(backBuffer, new blender_gray(distBetween), distBetween, 0, 8);

				ImageClippingProxy clippingProxy = new ImageClippingProxy(backBuffer);
				ImageClippingProxy clippingProxyRed = new ImageClippingProxy(redImageBuffer);
				ImageClippingProxy clippingProxyGreen = new ImageClippingProxy(greenImageBuffer);
				ImageClippingProxy clippingProxyBlue = new ImageClippingProxy(blueImageBuffer);

				ScanlineRasterizer ras = new ScanlineRasterizer();
				ScanlineCachePacked8 sl = new ScanlineCachePacked8();

				RGBA_Bytes clearColor = useBlackBackgroundCheckbox.Checked ? new RGBA_Bytes(0, 0, 0) : new RGBA_Bytes(255, 255, 255);
				clippingProxy.clear(clearColor);
				alphaSlider.View.BackgroundColor = clearColor;

				RGBA_Bytes FillColor = useBlackBackgroundCheckbox.Checked ? new RGBA_Bytes(255, 255, 255, (int)(alphaSlider.Value)) : new RGBA_Bytes(0, 0, 0, (int)(alphaSlider.Value));

				VertexSource.Ellipse er = new MatterHackers.Agg.VertexSource.Ellipse(Width / 2 - 0.87 * 50, Height / 2 - 0.5 * 50, 100, 100, 100);
				ras.add_path(er);
				ScanlineRenderer scanlineRenderer = new ScanlineRenderer();
				scanlineRenderer.RenderSolid(clippingProxyRed, ras, sl, FillColor);

				VertexSource.Ellipse eg = new MatterHackers.Agg.VertexSource.Ellipse(Width / 2 + 0.87 * 50, Height / 2 - 0.5 * 50, 100, 100, 100);
				ras.add_path(eg);
				scanlineRenderer.RenderSolid(clippingProxyGreen, ras, sl, FillColor);

				VertexSource.Ellipse eb = new MatterHackers.Agg.VertexSource.Ellipse(Width / 2, Height / 2 + 50, 100, 100, 100);
				ras.add_path(eb);
				scanlineRenderer.RenderSolid(clippingProxyBlue, ras, sl, FillColor);
			}
			else if (graphics2D.DestImageFloat != null)
			{
#if false
                IImageFloat backBuffer = graphics2D.DestImageFloat;

                int distBetween = backBuffer.GetFloatsBetweenPixelsInclusive();
                ImageBufferFloat redImageBuffer = new ImageBufferFloat();
                redImageBuffer.Attach(backBuffer, new blender_gray(distBetween), distBetween, 2, 8);
                ImageBufferFloat greenImageBuffer = new ImageBufferFloat();
                greenImageBuffer.Attach(backBuffer, new blender_gray(distBetween), distBetween, 1, 8);
                ImageBufferFloat blueImageBuffer = new ImageBufferFloat();
                blueImageBuffer.Attach(backBuffer, new blender_gray(distBetween), distBetween, 0, 8);

                ImageClippingProxy clippingProxy = new ImageClippingProxy(backBuffer);
                ImageClippingProxy clippingProxyRed = new ImageClippingProxy(redImageBuffer);
                ImageClippingProxy clippingProxyGreen = new ImageClippingProxy(greenImageBuffer);
                ImageClippingProxy clippingProxyBlue = new ImageClippingProxy(blueImageBuffer);

                ScanlineRasterizer ras = new ScanlineRasterizer();
                ScanlineCachePacked8 sl = new ScanlineCachePacked8();

                RGBA_Bytes clearColor = useBlackBackgroundCheckbox.Checked ? new RGBA_Bytes(0, 0, 0) : new RGBA_Bytes(255, 255, 255);
                clippingProxy.clear(clearColor);
                alphaSlider.View.BackGroundColor = clearColor;

                RGBA_Bytes FillColor = useBlackBackgroundCheckbox.Checked ? new RGBA_Bytes(255, 255, 255, (int)(alphaSlider.Value)) : new RGBA_Bytes(0, 0, 0, (int)(alphaSlider.Value));

                VertexSource.Ellipse er = new AGG.VertexSource.Ellipse(Width / 2 - 0.87 * 50, Height / 2 - 0.5 * 50, 100, 100, 100);
                ras.add_path(er);
                agg_renderer_scanline.Default.render_scanlines_aa_solid(clippingProxyRed, ras, sl, FillColor);

                VertexSource.Ellipse eg = new AGG.VertexSource.Ellipse(Width / 2 + 0.87 * 50, Height / 2 - 0.5 * 50, 100, 100, 100);
                ras.add_path(eg);
                agg_renderer_scanline.Default.render_scanlines_aa_solid(clippingProxyGreen, ras, sl, FillColor);

                VertexSource.Ellipse eb = new AGG.VertexSource.Ellipse(Width / 2, Height / 2 + 50, 100, 100, 100);
                ras.add_path(eb);
                agg_renderer_scanline.Default.render_scanlines_aa_solid(clippingProxyBlue, ras, sl, FillColor);
#endif
			}

			base.OnDraw(graphics2D);
		}
示例#20
0
        public override bool LoadImageData(String filename, ImageBufferFloat destImage)
        {
            if (System.IO.File.Exists(filename))
            {
                Bitmap m_WidowsBitmap = new Bitmap(filename);
                if (m_WidowsBitmap != null)
                {
                    switch (m_WidowsBitmap.PixelFormat)
                    {
                        case System.Drawing.Imaging.PixelFormat.Format24bppRgb:
                            destImage.Allocate(m_WidowsBitmap.Width, m_WidowsBitmap.Height, m_WidowsBitmap.Width * 4, 128);
                            break;

                        default:
                            throw new System.NotImplementedException();
                    }

                    BitmapData bitmapData = m_WidowsBitmap.LockBits(new Rectangle(0, 0, m_WidowsBitmap.Width, m_WidowsBitmap.Height), System.Drawing.Imaging.ImageLockMode.ReadWrite, m_WidowsBitmap.PixelFormat);
                    int sourceIndex = 0;
                    int destIndex = 0;
                    unsafe
                    {
                        int offset;
                        float[] destBuffer = destImage.GetBuffer(out offset);
                        byte* pSourceBuffer = (byte*)bitmapData.Scan0;
                        for (int y = 0; y < destImage.Height; y++)
                        {
                            destIndex = destImage.GetBufferOffsetXY(0, destImage.Height - 1 - y);
                            for (int x = 0; x < destImage.Width; x++)
                            {
                                destBuffer[destIndex++] = pSourceBuffer[sourceIndex++] / 255.0f;
                                destBuffer[destIndex++] = pSourceBuffer[sourceIndex++] / 255.0f;
                                destBuffer[destIndex++] = pSourceBuffer[sourceIndex++] / 255.0f;
                                destBuffer[destIndex++] = 1.0f;
                            }
                        }
                    }

                    m_WidowsBitmap.UnlockBits(bitmapData);

                    return true;
                }
            }

            return false;
        }
		internal void Initialize(int width, int height, int bitDepth)
		{
			if (width > 0 && height > 0)
			{
				switch (bitDepth)
				{
					case 24:
						windowsBitmap = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
						backingImageBufferByte = new ImageBuffer(width, height, 24, new BlenderBGR());
						break;

					case 32:
						windowsBitmap = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
						//widowsBitmap = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
						//widowsBitmap = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
						//32bppPArgb
						backingImageBufferByte = new ImageBuffer(width, height, 32, new BlenderBGRA());
						break;

					case 128:
						windowsBitmap = new Bitmap(width, height, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
						backingImageBufferByte = null;
						backingImageBufferFloat = new ImageBufferFloat(width, height, 128, new BlenderBGRAFloat());
						break;

					default:
						throw new NotImplementedException("Don't support this bit depth yet.");
				}
			}
		}