예제 #1
0
        public override void DrawImage(Image img, params AffinePlan[] affinePlans)
        {
            ActualBitmap actualImg = img as ActualBitmap;

            if (actualImg == null)
            {
                //? TODO
                return;
            }

            if (this._renderQuality == RenderQualtity.Fast)
            {
                //todo, review here again
                BitmapBuffer srcBmp = new BitmapBuffer(img.Width, img.Height, ActualBitmap.GetBuffer(actualImg));
                if (affinePlans != null)
                {
                    this._bxt.BlitRender(srcBmp, false, 1, new BitmapBufferEx.MatrixTransform(affinePlans));
                }
                else
                {
                    this._bxt.BlitRender(srcBmp, false, 1, null);
                }
                return;
            }

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

            //before render an image we turn off vxs subpixel rendering
            this.UseSubPixelLcdEffect   = false;
            _aggsx.UseSubPixelRendering = false;
            this._aggsx.Render(actualImg, affinePlans);
            //restore...
            this.UseSubPixelLcdEffect   = useSubPix;
            _aggsx.UseSubPixelRendering = useSubPix;
        }
예제 #2
0
 public MyBitmapBlender(ActualBitmap actualImage, PixelProcessing.PixelBlender32 pxBlender)
 {
     this.actualImage = actualImage;
     Attach(actualImage.Width,
            actualImage.Height,
            actualImage.BitDepth,
            ActualBitmap.GetBuffer(actualImage),
            pxBlender);         //set default px blender
 }
예제 #3
0
        void DrawBitmap(ActualBitmap actualBmp, double left, double top, int srcX, int srcY, int srcW, int srcH)
        {
            //check image caching system
            if (this._renderQuality == RenderQualtity.Fast)
            {
                BitmapBuffer srcBmp = new BitmapBuffer(actualBmp.Width, actualBmp.Height, ActualBitmap.GetBuffer(actualBmp));
                try
                {
                    var          src       = new BitmapBufferEx.RectD(srcX, srcY, srcW, srcH);
                    var          dest      = new BitmapBufferEx.RectD(left, top, srcW, srcH);
                    BitmapBuffer bmpBuffer = new BitmapBuffer(actualBmp.Width, actualBmp.Height, ActualBitmap.GetBuffer(actualBmp));
                    this._bxt.CopyBlit(dest, bmpBuffer, src);
                }
                catch (Exception ex)
                {
                }

                return;
            }

            //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(actualBmp, left, this.Height - (top + actualBmp.Height), srcX, srcY, srcW, srcH);
            }
            else
            {
                //left-bottom as original
                //place left-lower of the img at specific (x,y)
                this._aggsx.Render(actualBmp, left, top, srcX, srcY, srcW, srcH);
            }

            //restore...
            this.UseSubPixelLcdEffect   = useSubPix;
            _aggsx.UseSubPixelRendering = useSubPix;
        }