virtual public void Update(UpdateContext context)
        {
            ValidateMatrix(false);

            if (_paintingMode != 0)
            {
                if (graphics != null && paintingGraphics.texture != null)
                {
                    context.PushRenderTarget(paintingGraphics.texture, new Vector2(_renderRect.x, _renderRect.y));
                    graphics.Render(_renderRect, _renderScale, _renderRotation, _alpha, context);
                    context.PopRenderTarget();
                }

                if (!(this is Container))
                {
                    paintingGraphics.Render(_renderRect, _renderScale, _renderRotation, _alpha, context);
                }
            }
            else
            {
                if (graphics != null)
                {
                    graphics.Render(_renderRect, _renderScale, _renderRotation, _alpha, context);
                }
            }

            if (_filter != null)
            {
                _filter.Update();
            }
        }
示例#2
0
        override public void Update(UpdateContext context)
        {
            base.Update(context);

            if (_paintingMode != 0 && paintingGraphics.texture != null)
            {
                context.PushRenderTarget(paintingGraphics.texture, new Vector2(_renderRect.x, _renderRect.y));
            }

            if (_clipRect != null)
            {
                //在这里可以直接使用 _localToWorldMatrix, 因为已经更新
                Rect      clipRect = (Rect)_clipRect;
                Matrix4x4 mat      = Matrix4x4.Identity;
                ToolSet.TransformRect(ref clipRect, ref _localToWorldMatrix, ref mat);
                context.EnterClipping(this.id, clipRect);
            }

            float savedAlpha = context.alpha;

            context.alpha *= this.alpha;
            bool savedGrayed = context.grayed;

            context.grayed = context.grayed || this.grayed;

            int cnt = _children.Count;

            for (int i = 0; i < cnt; i++)
            {
                DisplayObject child = _children[i];
                if (child.visible)
                {
                    child.Update(context);
                }
            }

            if (_clipRect != null)
            {
                context.LeaveClipping();
            }

            if (_paintingMode != 0 && paintingGraphics.texture != null)
            {
                context.PopRenderTarget();
                paintingGraphics.Render(_renderRect, _renderScale, _renderRotation, 1, context);
            }

            context.alpha  = savedAlpha;
            context.grayed = savedGrayed;
        }