Esempio n. 1
0
 public void Render(int stream)
 {
     if (_primitiveContext != null && _renderStarted)
     {
         _primitiveContext.Render(stream);
     }
 }
Esempio n. 2
0
        public override void RenderOverride(RenderContext localRenderContext)
        {
            PerformLayout(localRenderContext);

            if (_backgroundContext != null)
            {
                if (Background.BeginRenderBrush(_backgroundContext, localRenderContext))
                {
                    _backgroundContext.Render(0);
                    Background.EndRender();
                }
            }

            if (_borderContext != null)
            {
                if (BorderBrush.BeginRenderBrush(_borderContext, localRenderContext))
                {
                    _borderContext.Render(0);
                    BorderBrush.EndRender();
                }
            }

            FrameworkElement content = _initializedContent;

            if (content != null)
            {
                content.Render(localRenderContext);
            }
        }
Esempio n. 3
0
        public override void RenderOverride(RenderContext localRenderContext)
        {
            base.RenderOverride(localRenderContext);
            PerformLayout(localRenderContext);

            Brush fill = Fill;

            if (_fillContext != null && fill != null)
            {
                if (fill.BeginRenderBrush(_fillContext, localRenderContext))
                {
                    _fillContext.Render(0);
                    fill.EndRender();
                }
            }
            Brush stroke = Stroke;

            if (_strokeContext != null && stroke != null)
            {
                if (stroke.BeginRenderBrush(_strokeContext, localRenderContext))
                {
                    _strokeContext.Render(0);
                    stroke.EndRender();
                }
            }
        }
Esempio n. 4
0
        public override void RenderOverride(RenderContext localRenderContext)
        {
            UpdateRenderOrder();

            PerformLayout(localRenderContext);

            if (_backgroundContext != null && Background.BeginRenderBrush(_backgroundContext, localRenderContext))
            {
                _backgroundContext.Render(0);
                Background.EndRender();
            }

            RenderChildren(localRenderContext);
        }
        public override void Render(RenderContext renderContext, Stretch stretchMode, StretchDirection stretchDirection)
        {
            if (!IsAllocated)
            {
                return;
            }
            SizeF   rawSourceSize      = RawSourceSize;
            SizeF   modifiedSourceSize = StretchSource(_imageContext.RotatedFrameSize, rawSourceSize, stretchMode, stretchDirection);
            Vector4 frameData          = new Vector4(rawSourceSize.Width, rawSourceSize.Height, (float)EffectTimer, 0);

            if (_primitiveBuffer != null && _imageContext.StartRender(renderContext, modifiedSourceSize, Texture, TextureClip, BorderColor, frameData))
            {
                _primitiveBuffer.Render(0);
                _imageContext.EndRender();
            }
        }
Esempio n. 6
0
        public override void RenderOverride(RenderContext localRenderContext)
        {
            PerformLayout(localRenderContext);

            base.RenderOverride(localRenderContext);
            if (_backgroundContext != null)
            {
                if (Background.BeginRenderBrush(_backgroundContext, localRenderContext))
                {
                    _backgroundContext.Render(0);
                    Background.EndRender();
                }
            }

            FrameworkElement templateControl = _initializedTemplateControl;

            if (templateControl == null)
            {
                return;
            }
            templateControl.Render(localRenderContext);
        }
Esempio n. 7
0
        public override void RenderOverride(RenderContext localRenderContext)
        {
            base.RenderOverride(localRenderContext);
            PerformLayout(localRenderContext);

            if (_fillContext != null)
            {
                if (Fill.BeginRenderBrush(_fillContext, localRenderContext))
                {
                    _fillContext.Render(0);
                    Fill.EndRender();
                }
            }
            if (_strokeContext != null)
            {
                if (Stroke.BeginRenderBrush(_strokeContext, localRenderContext))
                {
                    _strokeContext.Render(0);
                    Stroke.EndRender();
                }
            }
        }
Esempio n. 8
0
        public override void RenderOverride(RenderContext localRenderContext)
        {
            base.RenderOverride(localRenderContext);
            AllocFont();

            HorizontalTextAlignEnum horzAlign = HorizontalTextAlignEnum.Left;

            if (HorizontalContentAlignment == HorizontalAlignmentEnum.Right)
            {
                horzAlign = HorizontalTextAlignEnum.Right;
            }
            else if (HorizontalContentAlignment == HorizontalAlignmentEnum.Center)
            {
                horzAlign = HorizontalTextAlignEnum.Center;
            }

            VerticalTextAlignEnum vertAlign = VerticalTextAlignEnum.Top;

            if (VerticalContentAlignment == VerticalAlignmentEnum.Bottom)
            {
                vertAlign = VerticalTextAlignEnum.Bottom;
            }
            else if (VerticalContentAlignment == VerticalAlignmentEnum.Center)
            {
                vertAlign = VerticalTextAlignEnum.Center;
            }

            Color4 color = ColorConverter.FromColor(Color);

            color.Alpha *= (float)localRenderContext.Opacity;

            // Update text cursor
            if ((_cursorShapeInvalid || _cursorBrushInvalid) && CursorState == TextCursorState.Visible)
            {
                string textBeforeCaret = VisibleText;
                textBeforeCaret = string.IsNullOrEmpty(textBeforeCaret) ? string.Empty : textBeforeCaret.Substring(0, CaretIndex);
                float caretX     = _asset.TextWidth(textBeforeCaret);
                float textHeight = _asset.TextHeight(1);
                float textInsetY;
                switch (vertAlign)
                {
                case VerticalTextAlignEnum.Bottom:
                    textInsetY = _innerRect.Height - textHeight;
                    break;

                case VerticalTextAlignEnum.Center:
                    textInsetY = (_innerRect.Height - textHeight) / 2;
                    break;

                default: // VerticalTextAlignEnum.Top
                    textInsetY = 0;
                    break;
                }
                if (_virtualPosition + caretX < 10)
                {
                    _virtualPosition = _innerRect.Width / 3 - caretX;
                }
                if (_virtualPosition + caretX > _innerRect.Width - 10)
                {
                    _virtualPosition = _innerRect.Width * 2 / 3 - caretX;
                }
                Bound(ref _virtualPosition, -caretX, 0);
                RectangleF cursorBounds = new RectangleF(_innerRect.X + _virtualPosition + caretX, _innerRect.Y + textInsetY, CURSOR_THICKNESS, textHeight);
                UpdateCursorShape(cursorBounds, localRenderContext.ZOrder);
            }

            // Render text
            _asset.Render(_innerRect, horzAlign, vertAlign, _virtualPosition, color, localRenderContext.ZOrder, localRenderContext.Transform);

            // Render text cursor
            if (_cursorBrush != null && CursorState == TextCursorState.Visible)
            {
                _cursorBrush.BeginRenderBrush(_cursorContext, localRenderContext);
                _cursorContext.Render(0);
                _cursorBrush.EndRender();
            }
        }
Esempio n. 9
0
 public void Render(Texture texture, PrimitiveBuffer vertexdata, Matrix finalTransform)
 {
     StartRender(texture, finalTransform);
     vertexdata.Render(0);
     EndRender();
 }