GetBuffer() 공개 정적인 메소드

public static GetBuffer ( ActualImage img ) : byte[]
img ActualImage
리턴 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;
        }
        /// <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();
            }
            }
        }
        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();
            }
            }
        }