GetBuffer() public static method

public static GetBuffer ( ActualImage img ) : byte[]
img ActualImage
return byte[]
コード例 #1
0
        public void ReloadImage(ActualImage actualImage)
        {
            if (this.actualImage == actualImage)
            {
                return;
            }
            this.actualImage = actualImage;
            //calculate image stride
            switch (actualImage.PixelFormat)
            {
            case PixelFormat.Rgba32:
            {
                Attach(actualImage.Width,
                       actualImage.Height,
                       actualImage.BitDepth,
                       actualImage.GetBuffer(),
                       new PixelBlenderBGRA());
            } break;

            case PixelFormat.GrayScale8:
            {
                Attach(actualImage.Width,
                       actualImage.Height,
                       actualImage.BitDepth,
                       actualImage.GetBuffer(),
                       new PixelFarm.Agg.Image.PixelBlenderGray(1));
            } break;

            case PixelFormat.Rgb24:
            default:
            {
                throw new NotSupportedException();
            }
            }
        }
コード例 #2
0
        public override void DrawImage(Image img, double left, double top)
        {
            ActualImage actualImg = img as ActualImage;

            if (actualImg == null)
            {
                //? TODO
                return;
            }
            //check image caching system
            if (this._renderQuality == RenderQualtity.Fast)
            {
                //DrawingBuffer.RectD destRect = new DrawingBuffer.RectD(left, top, img.Width, img.Height);
                //DrawingBuffer.RectD srcRect = new DrawingBuffer.RectD(0, 0, img.Width, img.Height);
                BitmapBuffer srcBmp = new BitmapBuffer(img.Width, img.Height, ActualImage.GetBuffer(actualImg));
                this._bxt.CopyBlit(left, top, srcBmp);
                return;
            }

            this.sharedImageWriterReader.ReloadImage(actualImg);

            //save, restore later...
            bool useSubPix = UseSubPixelLcdEffect;

            //before render an image we turn off vxs subpixel rendering
            this.UseSubPixelLcdEffect   = false;
            _aggsx.UseSubPixelRendering = false;

            if (this._orientation == DrawBoardOrientation.LeftTop)
            {
                //place left upper corner at specific x y
                this._aggsx.Render(this.sharedImageWriterReader, left, this.Height - (top + img.Height));
            }
            else
            {
                //left-bottom as original
                //place left-lower of the img at specific (x,y)
                this._aggsx.Render(this.sharedImageWriterReader, left, top);
            }

            //restore...
            this.UseSubPixelLcdEffect   = useSubPix;
            _aggsx.UseSubPixelRendering = useSubPix;
        }
コード例 #3
0
        /// <summary>
        /// load image to the reader/writer
        /// </summary>
        /// <param name="actualImage"></param>
        public void ReloadImage(ActualImage actualImage)
        {
            if (this.actualImage == actualImage)
            {
                return;
            }

            //in this version we support actual images
            //in 2 formats :
            //1. 32 bits ARGB
            //2. 8  bits gray scale
            //

            this.actualImage = actualImage;
            switch (actualImage.PixelFormat)
            {
            case PixelFormat.ARGB32:
            {
                Attach(actualImage.Width,
                       actualImage.Height,
                       actualImage.BitDepth,
                       ActualImage.GetBuffer(actualImage),
                       pixelBlenderRGBA ?? (pixelBlenderRGBA = new PixelBlenderBGRA()));
            }
            break;

            case PixelFormat.GrayScale8:
            {
                Attach(actualImage.Width,
                       actualImage.Height,
                       actualImage.BitDepth,
                       ActualImage.GetBuffer(actualImage),
                       pixelBlenderGray ?? (pixelBlenderGray = new PixelBlenderGray(1)));
            }
            break;

            default:
            {
                throw new NotSupportedException();
            }
            }
        }
コード例 #4
0
        public void ReloadImage(ActualImage actualImage)
        {
            if (this.actualImage == actualImage)
            {
                return;
            }
            this.actualImage = actualImage;
            //calculate image stride
            switch (actualImage.PixelFormat)
            {
            case PixelFormat.ARGB32:
            {
                Attach(actualImage.Width,
                       actualImage.Height,
                       actualImage.BitDepth,
                       ActualImage.GetBuffer(actualImage),
                       pixelBlenderRGBA ?? (pixelBlenderRGBA = new PixelBlenderBGRA()));
                //Attach(actualImage.Width,
                //    actualImage.Height,
                //    actualImage.BitDepth,
                //    ActualImage.GetBuffer(actualImage),
                //    pixelBlenderRGBA ?? (pixelBlenderRGBA = new PixelBlenderGammaBGRA(0.8f)));
            }
            break;

            case PixelFormat.GrayScale8:
            {
                Attach(actualImage.Width,
                       actualImage.Height,
                       actualImage.BitDepth,
                       ActualImage.GetBuffer(actualImage),
                       pixelBlenderGray ?? (pixelBlenderGray = new PixelBlenderGray(1)));
            }
            break;

            case PixelFormat.RGB24:
            default:
            {
                throw new NotSupportedException();
            }
            }
        }