public void Render(IBitmapSrc source, AffinePlan[] affinePlans)
        {
            using (VxsTemp.Borrow(out var v1, out var v2))
            {
                BuildOrgImgRectVxs(source.Width, source.Height, v1);

                AffineMat destRectTransform;
                if (affinePlans == null)
                {
                    destRectTransform = AffineMat.Iden;
                    _reuseableAffine.SetElements(destRectTransform);
                }
                else
                {
                    destRectTransform = new AffineMat();
                    destRectTransform.BuildFromAffinePlans(affinePlans);
                    _reuseableAffine.SetElements(destRectTransform.CreateInvert());
                }
                //TODO: review reusable span generator an interpolator ***
                //We invert it because it is the transform to make the image go to the same position as the polygon. LBB [2/24/2004]

                _spanInterpolator.Transformer = _reuseableAffine;

                _currentImgSpanGen.BackgroundColor = Drawing.Color.Transparent;
                _currentImgSpanGen.SetInterpolator(_spanInterpolator);
                _currentImgSpanGen.SetSrcBitmap(source);
                TransformToVxs(ref destRectTransform, v1, v2);
                Render(v2, _currentImgSpanGen);
                _currentImgSpanGen.ReleaseSrcBitmap();
            }
        }
Ejemplo n.º 2
0
        public void Render(IBitmapSrc source, AffinePlan[] affinePlans)
        {
            VectorToolBox.GetFreeVxs(out var v1, out var v2);

            //BuildImageBoundsPath(source.Width, source.Height, affinePlans, v1);
            BuildOrgImgRectVxs(source.Width, source.Height, v1);


            //Affine destRectTransform = Affine.NewMatix(affinePlans);

            var destRectTransform = new AffineMat();

            destRectTransform.BuildFromAffinePlans(affinePlans);

            //TODO: review reusable span generator an interpolator ***
            var spanInterpolator = new SpanInterpolatorLinear();

            // We invert it because it is the transform to make the image go to the same position as the polygon. LBB [2/24/2004]

            _reuseableAffine.SetElements(destRectTransform.CreateInvert());
            spanInterpolator.Transformer = _reuseableAffine;//

            var imgSpanGen = new ImgSpanGenRGBA_BilinearClip(
                source,
                Drawing.Color.Transparent,
                spanInterpolator);

            TransformToVxs(ref destRectTransform, v1, v2);

            Render(v2, imgSpanGen);
            //
            VectorToolBox.ReleaseVxs(ref v1, ref v2);
        }