Ejemplo n.º 1
0
        public override Endogine.BitmapHelpers.PixelDataProvider TransformIntoRenderTarget(Endogine.BitmapHelpers.PixelDataProvider pdp)
        {
            Surface surf     = ((PixelDataProvider)pdp).Texture.GetSurfaceLevel(0);
            bool    isTarget = ((int)surf.Description.Usage & (int)Usage.RenderTarget) != 0;

            if (isTarget)
            {
                return(pdp);
            }

            Surface oldSurfRT = this._device.GetRenderTarget(0);

            PixelDataProvider pdpRT = new PixelDataProvider(pdp.Width, pdp.Height, pdp.BitsPerPixel / 8, this._device, Usage.RenderTarget);

            this.RenderTarget = pdpRT;

            Endogine.SpriteRenderStrategy rs = this.CreateRenderStrategy();
            rs.Init();
            rs.SetPixelDataProvider(pdp);
            ERectangleF rctDrawTarget = new ERectangleF(0, 0, pdp.Width, pdp.Height);//-pdp.Width, -pdp.Height, pdp.Width * 2, pdp.Height * 2) * 2;

            //rs.SourceClipRect = sourceClipRect;
            rs.CalcRenderRegion(rctDrawTarget, 0, new EPoint(), new EPoint(pdp.Width, pdp.Height));

            //render:
            this.PreUpdate();
            rs.SubDraw();
            this.EndUpdate();

            //reset renderer and finish up:
            this._device.SetRenderTarget(0, oldSurfRT);
            this.PostUpdate();

            return(pdpRT);
        }
Ejemplo n.º 2
0
        private void Init(bool bAutoSetParent)
        {
            m_aChildrenToRemove        = new ArrayList();
            m_plChildrenByHash         = new Hashtable();
            this._slChildrenLocZSorted = new SortedFloatList();

            m_sID    = "";
            m_nInk   = (int)RasterOps.ROPs.Copy;
            m_nBlend = 255;


            m_matrix = new Matrix4();
            m_vPivot = new Vector3();

            m_fLocZ       = 0.0f;
            m_pntLoc      = new EPointF(0.0f, 0.0f);
            m_pntScale    = new EPointF(1.0f, 1.0f);
            m_pntRegPoint = new EPoint(0, 0);


            m_rctSrcClip   = new ERectangle(0, 0, 1, 1);
            m_clr          = Color.White;
            m_rctDstParent = new ERectangleF(0, 0, 0, 0);

            m_aBehaviors = new ArrayList();

            m_nMemberAnimFrame = 0;

            m_dtChildren = new DataTable();
            m_dtChildren.Columns.Add("Name", typeof(System.String));
            m_dtChildren.Columns.Add("LocZ", typeof(System.Double));
            m_dtChildren.Columns.Add("Hash", typeof(System.Int32));

            m_pntMouseDown = new EPoint();
            m_pntMouseLast = new EPoint();
            _pntMouse      = new EPoint();

            if (bAutoSetParent && m_endogine != null && m_endogine.Stage != null)
            {
                Parent = m_endogine.Stage.DefaultParent;
            }

            m_renderStrategy = m_endogine.Stage.CreateRenderStrategy();

            m_renderStrategy.SetEndogine(m_endogine);
            m_renderStrategy.SetSprite(this);
            m_renderStrategy.Init();

            //TODO: make this optional (takes some resources)
            Sprite[] lcs = new Sprite[1];
            lcs[0] = this;
            EH.Instance.LatestCreatedSprites = lcs;
        }
Ejemplo n.º 3
0
        private void Init(bool bAutoSetParent)
        {
            m_aChildrenToRemove = new ArrayList();
            m_plChildrenByHash = new Hashtable();
            this._slChildrenLocZSorted = new SortedFloatList();

            m_sID = "";
            m_nInk = (int)RasterOps.ROPs.Copy;
            m_nBlend = 255;

            m_matrix = new Matrix4();
            m_vPivot = new Vector3();

            m_fLocZ = 0.0f;
            m_pntLoc = new EPointF(0.0f, 0.0f);
            m_pntScale = new EPointF(1.0f, 1.0f);
            m_pntRegPoint = new EPoint(0,0);

            m_rctSrcClip = new ERectangle(0,0,1,1);
            m_clr = Color.White;
            m_rctDstParent = new ERectangleF(0,0,0,0);

            m_aBehaviors = new ArrayList();

            m_nMemberAnimFrame = 0;

            m_dtChildren = new DataTable();
            m_dtChildren.Columns.Add("Name", typeof(System.String));
            m_dtChildren.Columns.Add("LocZ", typeof(System.Double));
            m_dtChildren.Columns.Add("Hash", typeof(System.Int32));

            m_pntMouseDown = new EPoint();
            m_pntMouseLast = new EPoint();
            _pntMouse = new EPoint();

            if (bAutoSetParent && m_endogine!=null && m_endogine.Stage != null)
                Parent = m_endogine.Stage.DefaultParent;

            m_renderStrategy = m_endogine.Stage.CreateRenderStrategy();

            m_renderStrategy.SetEndogine(m_endogine);
            m_renderStrategy.SetSprite(this);
            m_renderStrategy.Init();

            //TODO: make this optional (takes some resources)
            Sprite[] lcs = new Sprite[1];
            lcs[0] = this;
            EH.Instance.LatestCreatedSprites = lcs;
        }