Beispiel #1
0
        private void OnRender()
        {
            lock (_renderContextLock)
            {
                if (_renderTarget?.IsDisposed ?? true)
                {
                    return;
                }

                _renderTarget.BeginDraw();
                _renderTarget.Clear(_backgroundColor);

                if (_paradigmStarted) // Draw blocks
                {
                    foreach (var block in _blocks)
                    {
                        if (block.BorderWidth > 0)
                        {
                            _solidColorBrush.Color = _blockBorderColor;
                            _renderTarget.FillRectangle(block.BorderRect, _solidColorBrush);
                        }

                        if (_bitmap != null)
                        {
                            _solidColorBrush.Color = _blockNormalColor;
                            _renderTarget.FillRectangle(block.ContentRect, _solidColorBrush);
                            if (block.Actived)
                            {
                                _renderTarget.DrawBitmap(_bitmap, block.ContentRect, 1, D2D1.BitmapInterpolationMode.Linear);
                            }
                        }
                        else
                        {
                            _solidColorBrush.Color = block.Actived ? _blockActivedColor : _blockNormalColor;
                            _renderTarget.FillRectangle(block.ContentRect, _solidColorBrush);
                        }

                        if (block.Target)
                        {
                            _solidColorBrush.Color = _blockBorderColor;
                            _renderTarget.FillEllipse(block.CenterPointEllipse, _solidColorBrush);
                        }
                    }
                }
                else if (!(_displayText?.IsBlank() ?? true)) // Draw text
                {
                    _solidColorBrush.Color = _fontColor;
                    _renderTarget.DrawText(_displayText, _textFormat, new RawRectangleF(0, 0, Width, Height),
                                           _solidColorBrush, D2D1.DrawTextOptions.None);
                }

                _renderTarget.EndDraw();

                _swapChain.Present(1, DXGI.PresentFlags.None, _presentParameters);
            }
        }
Beispiel #2
0
        public void OnRender(RenderTarget target)
        {
            var brush = gBackground;
            if (mIsClicked)
                brush = gBackgroundClick;
            else if (mIsHovered)
                brush = gBackgroundHover;

            target.FillRectangle(mClientRectangle, gBorder);
            target.FillRectangle(new RectangleF(Position.X + 1, Position.Y + 1, Size.X - 2, Size.Y - 2), brush);
            target.DrawTextLayout(new Vector2(Position.X + 2, Position.Y + 2), mTextDraw, gCaptionColor, DrawTextOptions.Clip);
        }
Beispiel #3
0
        protected override void Draw(D2D1.RenderTarget renderTarget)
        {
            /* Clear canvas */
            renderTarget.Clear(_backgroundColor);

            /* Draw blocks */
            if (_paradigmStarted)
            {
                var secsPassed = (CurrentTime - _stageUpdatedAt) / 1000.0;
                foreach (var block in _blocks)
                {
                    /* Draw block border */
                    if (block.BorderRect != null)
                    {
                        SolidColorBrush.Color = _blockBorderColor;
                        renderTarget.FillRectangle(block.BorderRect.Value, SolidColorBrush);
                    }

                    /* Fill block content */
                    if (!_trialStarted || block.Pattern == null)
                    {
                        SolidColorBrush.Color = _blockNormalColor;
                        renderTarget.FillRectangle(block.ContentRect, SolidColorBrush);
                    }
                    else
                    {
                        _presenter.Present(renderTarget, block, secsPassed);
                    }

                    /* Draw block text */
                    if (block.Text != null)
                    {
                        SolidColorBrush.Color = _blockFontColor;
                        renderTarget.DrawText(block.Text, _blockTextFormat, block.ContentRect,
                                              SolidColorBrush, D2D1.DrawTextOptions.None);
                    }

                    /* Draw block fixation */
                    if (block.FixationEllipse != null)
                    {
                        SolidColorBrush.Color = _blockFixationPointColor;
                        renderTarget.FillEllipse(block.FixationEllipse.Value, SolidColorBrush);
                    }
                }
            }
            else if (_displayText != null) // Draw text
            {
                SolidColorBrush.Color = _fontColor;
                renderTarget.DrawText(_displayText, _cueTextFormat, new RawRectangleF(0, 0, Width, Height),
                                      SolidColorBrush, D2D1.DrawTextOptions.None);
            }
        }
Beispiel #4
0
        public void OnRender(RenderTarget target)
        {
            if(gBorderBrush == null)
            {
                gBackgroundBrush = Brushes.Solid[0xCC555555];
                gBackgroundHoverBrush = Brushes.Solid[0xCC888888];
                gClickBrush = Brushes.Solid[0xFFFF7F00];
                gBackgroundClickedBrush = Brushes.Solid[0xCCBBBBBB];
                gBorderBrush = Brushes.White;
            }

            target.DrawTextLayout(new Vector2(Position.X + Size + 7, Position.Y - 2), mTextDraw, Brushes.White);

            var brush = gBackgroundBrush;
            if (mIsPressed)
                brush = gBackgroundClickedBrush;
            else if (mIsHovered)
                brush = gBackgroundHoverBrush;

            target.FillRectangle(mTargetRect, brush);
            target.DrawRectangle(mTargetRect, gBorderBrush);
            if (!Checked) return;

            target.DrawLine(Position + new Vector2(3, 3), Position + new Vector2(mSize - 3, mSize - 3), gClickBrush,
                mSize / 4.0f);
            target.DrawLine(new Vector2(Position.X + 3, Position.Y + mSize - 3),
                new Vector2(Position.X + mSize - 3, Position.Y + 3), gClickBrush, mSize / 4.0f);
        }
Beispiel #5
0
 /// <summary>
 /// Draws a filled rectangle.
 /// </summary>
 /// <param name="brush">The brush.</param>
 /// <param name="rect">The rectangle bounds.</param>
 /// <param name="cornerRadius">The corner radius.</param>
 public void FillRectangle(IBrush brush, Rect rect, float cornerRadius)
 {
     using (var b = CreateBrush(brush, rect.Size))
     {
         if (b.PlatformBrush != null)
         {
             if (cornerRadius == 0)
             {
                 _renderTarget.FillRectangle(rect.ToDirect2D(), b.PlatformBrush);
             }
             else
             {
                 _renderTarget.FillRoundedRectangle(
                     new RoundedRectangle
                 {
                     Rect = new RawRectangleF(
                         (float)rect.X,
                         (float)rect.Y,
                         (float)rect.Right,
                         (float)rect.Bottom),
                     RadiusX = cornerRadius,
                     RadiusY = cornerRadius
                 },
                     b.PlatformBrush);
             }
         }
     }
 }
Beispiel #6
0
        public void OnRender(RenderTarget target)
        {
            if (gBorder == null)
                InitBrushes();

            if(mIsHovered || mIsClicked)
            {
                if (mIsClicked)
                    target.FillRectangle(mTargetRect, gClick);
                else if (mIsHovered)
                    target.FillRectangle(mTargetRect, gHover);

                target.DrawRectangle(mTargetRect, gBorder);
            }

            target.DrawBitmap(mImage.GetBitmap(), mImageRect, 1.0f, BitmapInterpolationMode.Linear);
        }
Beispiel #7
0
        public override void Render(RenderTarget pRender, float pPercent)
        {
            pRender.Transform = Matrix3x2.Identity;

            RectangleF rect = new RectangleF(x, y, width, height);
            pRender.FillRectangle(rect, highlight ? highlightBrush : backBrush);
            pRender.DrawRectangle(rect, borderBrush);
            pRender.DrawTextLayout(new Vector2(x + dx * (pPercent - 1), y + dy * (pPercent - 1)), textLayout, textBrush);
        }
Beispiel #8
0
 public void OnRender(RenderTarget target)
 {
     target.FillRectangle(new RectangleF(0, 0, mSize.X, mSize.Y), Brushes.Solid[0xFF333333]);
     mAppTitle.OnRender(target);
     mDescription.OnRender(target);
     mInputPath.OnRender(target);
     mBrowseButton.OnRender(target);
     mRegistryButton.OnRender(target);
     mConfirmButton.OnRender(target);
 }
Beispiel #9
0
        private void OnRender()
        {
            lock (_renderContextLock)
            {
                if (_renderTarget?.IsDisposed ?? true)
                {
                    return;
                }

                _renderTarget.BeginDraw();
                _renderTarget.Clear(_backgroundColor);

                if (_paradigmStarted && _trialStarted) // Draw blocks
                {
                    var borderRect  = SharpDXUtils.CenteredRect(Width / 2f, Height / 2f, _paradigm.Config.Gui.ButtonSize);
                    var buttonRect  = borderRect.Shrink(Math.Max((float)_paradigm.Config.Gui.ButtonBorder.Width, 0));
                    var paddings    = _paradigm.Config.Gui.ButtonPaddings;
                    var contentRect = buttonRect.Shrink((float)paddings.Left, (float)paddings.Top, (float)paddings.Right, (float)paddings.Bottom);

                    if (_paradigm.Config.Gui.ButtonBorder.Width > 0)
                    {
                        _solidColorBrush.Color = _blockBorderColor;
                        _renderTarget.FillRectangle(borderRect, _solidColorBrush);
                    }

                    _solidColorBrush.Color = _blockNormalColor;
                    _renderTarget.FillRectangle(buttonRect, _solidColorBrush);

                    _solidColorBrush.Color = _foregroundColor;
                    _renderTarget.DrawText(_displayText, _textFormat, contentRect, _solidColorBrush, D2D1.DrawTextOptions.None);
                }
                else if (_displayText?.IsNotBlank() ?? false) // Draw text
                {
                    _solidColorBrush.Color = _foregroundColor;
                    _renderTarget.DrawText(_displayText, _textFormat, new RawRectangleF(0, 0, Width, Height),
                                           _solidColorBrush, D2D1.DrawTextOptions.None);
                }

                _renderTarget.EndDraw();

                _swapChain.Present(1, DXGI.PresentFlags.None, _presentParameters);
            }
        }
Beispiel #10
0
            public void Present(D2D1.RenderTarget renderTarget, Block block, double secsPassed)
            {
                var bitmap = (float)ConvertCosineValueToGrayScale(block.Pattern.Sample(secsPassed)) < 0.5 ? _bitmap0 : _bitmap1;

                if (bitmap == null)
                {
                    return;
                }
                _brush.Bitmap    = bitmap;
                _brush.Transform = (Matrix3x2)block.Tag;
                renderTarget.FillRectangle(block.ContentRect, _brush);
            }
Beispiel #11
0
        public void DrawRectangle(Rect frame, Pen pen = null, Brush brush = null)
        {
            var p = GetBrush(pen);
            var b = GetBrush(frame, brush);

            if (b != null)
            {
                renderTarget.FillRectangle(frame.ToRectangleF(), b);
            }
            if (p != null)
            {
                renderTarget.DrawRectangle(frame.ToRectangleF(), p, (float)pen.Width, GetStrokeStyle(pen));
            }
        }
            //---------------------------------------------------------------------------------------------------------
            /// <summary>
            /// Рисование прямоугольника
            /// </summary>
            //---------------------------------------------------------------------------------------------------------
            public override void Draw()
            {
                Direct2D.RenderTarget render_target = XDirect2DManager.D2DRenderTarget;

                if (mIsFilled)
                {
                    render_target.FillRectangle(mBoundsRect.ToRawRectF(), mFill.D2DBrush);
                }

                if (mIsStroked)
                {
                    render_target.DrawRectangle(mBoundsRect.ToRawRectF(), mStroke.Brush.D2DBrush, mStroke.Thickness, mStroke.mD2DStrokeStyle);
                }
            }
Beispiel #13
0
        public void OnRender(RenderTarget target)
        {
            target.FillRectangle(new RectangleF(0, 0, mSize.X, mSize.Y), Brushes.Solid[0xFF333333]);

            target.PushAxisAlignedClip(new RectangleF(0, 100, mSize.X, mSize.Y - 100), AntialiasMode.Aliased);
            foreach (var label in mMapLabels)
                label.OnRender(target);
            target.PopAxisAlignedClip();

            target.DrawLine(new Vector2(0, 100.0f), new Vector2(mSize.X, 100.0f), Brushes.White);

            mTitleLabel.OnRender(target);
            mLabelScroll.OnRender(target);
        }
Beispiel #14
0
        /// <summary>
        /// Fills the given rectangle with the given brush object.
        /// </summary>
        /// <param name="rectangle">The rectangle to be filled.</param>
        /// <param name="brush">The brush to be used.</param>
        public void FillRectangle(RectangleF rectangle, BrushResource brush)
        {
            if (m_renderTarget == null)
            {
                return;
            }

            rectangle.EnsureNotEmpty(nameof(rectangle));
            brush.EnsureNotNull(nameof(brush));

            m_renderTarget.FillRectangle(
                rectangle.ToDXRectangle(),
                brush.GetBrush(m_device));
        }
Beispiel #15
0
        public void OnRender(RenderTarget target)
        {
            var offset = mIsClicked ? new Vector2(1, 1) : new Vector2(0, 0);
            target.FillRectangle(
                !mIsClicked
                    ? mRectangle
                    : new RectangleF(Position.X + offset.X, Position.Y + offset.Y, mSize.X - 2 * offset.X, mSize.Y - 2 * offset.Y),
                mIsHovered ? mColorHover : mColor);

            target.PushAxisAlignedClip(new RectangleF(Position.X + 2, Position.Y + 2, mSize.X - 4, mSize.Y - 4),
                AntialiasMode.Aliased);
            target.DrawTextLayout(new Vector2(Position.X + 2 + offset.X, Position.Y + 2 + offset.Y), mTextDraw, mIsHovered ? Brushes.Black :  Brushes.White);
            target.PopAxisAlignedClip();
        }
Beispiel #16
0
        public void OnRender(RenderTarget target)
        {
            target.AntialiasMode = AntialiasMode.Aliased;
            target.FillRectangle(mClientRectangle, gBackground);
            target.DrawRectangle(mClientRectangle, gBorder);

            if (HasCaption)
            {
                target.FillRectangle(mCaptionRect, gBorder);
                target.DrawTextLayout(new Vector2(Position.X + 5, Position.Y - 18.0f), mCaptionText, gCaptionText);
            }

            var oldTransform = target.Transform;
            target.Transform *= mTransform;

            target.PushAxisAlignedClip(mClipRect, AntialiasMode.Aliased);

            lock(Children)
                foreach (var child in Children) child.OnRender(target);

            target.PopAxisAlignedClip();

            target.Transform = oldTransform;
        }
Beispiel #17
0
        public void OnRender(RenderTarget target)
        {
            var color = Brushes.Solid[0xFFAAAAAA];
            if (mIsKnobDown)
                color = Brushes.White;
            else if (mIsKnobHovered)
                color = Brushes.Solid[0xFFDDDDDD];

            var fact = VisibleSize / TotalSize;
            var scrollStart = (mScrollOffset / TotalSize) * Size;

            target.FillRectangle(
                new RectangleF(Position.X + (Vertical ? 0 : scrollStart), Position.Y  + (Vertical ? scrollStart : 0), Vertical ? Thickness : (Size * fact),
                    Vertical ? (Size * fact) : Thickness), color);
        }
Beispiel #18
0
        public void OnRender(RenderTarget target)
        {
            var borderStart = new Vector2(mPosition.X + BorderOffsets.X, mPosition.Y);
            var borderEnd = new Vector2(mPosition.X + mSize.X - BorderOffsets.Y, mPosition.Y);

            target.FillRectangle(mTargetRectangle, Brushes.Solid[0xCC333333]);
            target.DrawLine(borderStart, borderEnd, Brushes.White);

            var ot = target.Transform;

            target.Transform *= Matrix3x2.Translation(Position.X, Position.Y);
            foreach (var item in Items)
                item.OnRender(target);

            target.Transform = ot;
        }
        public void OnRender(RenderTarget target)
        {
            var msDiff = (DateTime.Now - mAnimTime).Milliseconds;
            var numDots = msDiff > 750 ? 3 : (msDiff > 500 ? 2 : (msDiff > 250 ? 1 : 0));
            var text = "Loading files";
            for (var i = 0; i < numDots; ++i)
            {
                text = '-' + text;
                text += '-';
            }

            if (mLoadIndicator.Text.Equals(text) == false)
                mLoadIndicator.Text = text;

            target.FillRectangle(new RectangleF(0, 0, mSize.X, mSize.Y), Brushes.Solid[0xFF333333]);
            mLoadIndicator.OnRender(target);
        }
            //---------------------------------------------------------------------------------------------------------
            /// <summary>
            /// Рисование изображения
            /// </summary>
            //---------------------------------------------------------------------------------------------------------
            public override void Draw()
            {
                Direct2D.RenderTarget render_target = XDirect2DManager.D2DRenderTarget;

                if (mIsFilled)
                {
                    render_target.FillRectangle(mBoundsRect.ToRawRectF(), mFill.D2DBrush);
                }

                if (mD2DBitmap != null)
                {
                    render_target.DrawBitmap(mD2DBitmap, mBoundsRect.ToRawRectF(), 1.0f, Direct2D.BitmapInterpolationMode.NearestNeighbor);
                }

                if (mIsStroked)
                {
                    render_target.DrawRectangle(mBoundsRect.ToRawRectF(), mStroke.Brush.D2DBrush, mStroke.Thickness, mStroke.mD2DStrokeStyle);
                }
            }
Beispiel #21
0
        public void OnRender(RenderTarget target)
        {
            UpdateCaret();

            var transform = target.Transform;
            target.Transform *= Matrix3x2.Translation(Position);

            target.AntialiasMode = AntialiasMode.Aliased;
            target.FillRectangle(new RectangleF(0, 0, mSize.X, mSize.Y), Brushes.Solid[0xCC111111]);
            target.DrawRectangle(new RectangleF(0, 0, mSize.X, mSize.Y), Brushes.Solid[System.Drawing.Color.White]);
            target.PushAxisAlignedClip(new RectangleF(4, 0, mSize.X - 8, mSize.Y), AntialiasMode.Aliased);
            target.DrawTextLayout(new Vector2(mStartPosition, 0), mTextDraw, Brushes.Solid[0xFFFFFFFF]);
            target.PopAxisAlignedClip();
            if (mCaretVisible && mIsFocused)
            {
                target.DrawLine(new Vector2(mCaretOffset, 4), new Vector2(mCaretOffset, 23),
                    Brushes.Solid[0xFFFFFFFF], 2.0f);
            }

            target.Transform = transform;
        }
Beispiel #22
0
        public void OnRender(RenderTarget target)
        {
            target.FillRectangle(new RectangleF(0, 0, mSize.X, mSize.Y), Brushes.Solid[0xFF333333]);
            if (mLoadingImage == null || mLoadingImage.IsLoaded == false)
                return;

            target.DrawBitmap(mLoadingImage, mTargetRectangle, 1.0f, BitmapInterpolationMode.Linear);

            if (mLoadingBarBackground == null || !mLoadingBarBackground.IsLoaded) return;

            var startPosY = mTargetRectangle.Y + mTargetRectangle.Height * 0.8f + 13;
            var startPosX = mTargetRectangle.X + (mTargetRectangle.Width - mLoadingBarBackground.Width * 1.2f + 80) / 2.0f;
            target.DrawBitmap(mLoadingBarFill,
                new RectangleF(startPosX, startPosY, (mLoadingBarBackground.Width * 1.2f - 80.0f) * mProgress, 40),
                1.0f, BitmapInterpolationMode.Linear);

            startPosY = mTargetRectangle.Y + mTargetRectangle.Height * 0.8f;
            startPosX = mTargetRectangle.X + (mTargetRectangle.Width  - mLoadingBarBackground.Width * 1.2f) / 2.0f;
            target.DrawBitmap(mLoadingBarBackground,
                new RectangleF(startPosX, startPosY, mLoadingBarBackground.Width * 1.2f, mLoadingBarBackground.Height),
                1.0f, BitmapInterpolationMode.Linear);
        }
Beispiel #23
0
        /// <summary>
        /// Draws a <see cref="TextLayout"/> object to a render target at X/Y Coordinates.
        /// </summary>
        /// <param name="renderTarget">The render target.</param>
        /// <param name="textLayout">The text to render.</param>
        /// <param name="brush">The foreground brush.</param>
        /// <param name="x">X position</param>
        /// <param name="y">Y Position</param>
        /// <param name="brushBackground">The background brush, null for no background.</param>
        /// <param name="centerX">Center the text on the X axis</param>
        /// <param name="centerY">Center the text on the y axis</param>
        public static void DrawTextAtPoint(this SharpDX.Direct2D1.RenderTarget renderTarget, TextLayout textLayout, Brush brush, float x, float y, Brush brushBackground = null, bool centerX = false, bool centerY = false, DrawTextOptions options = DrawTextOptions.None)
        {
            float width  = textLayout.Metrics.Width;
            float height = textLayout.Metrics.Height;

            if (centerX)
            {
                x -= width / 2;
            }
            if (centerY)
            {
                y -= height / 2;
            }

            if (brushBackground != null)
            {
                renderTarget.FillRectangle(new RawRectangleF(x, y, x + width, y + height), brushBackground);
            }

            renderTarget.DrawTextLayout(new RawVector2 {
                X = x, Y = y
            }, textLayout, brush, options);
        }
        public void DrawRectangle(Rect frame, Size corner, Pen pen = null, Brush brush = null)
        {
            var p = GetBrush(pen);
            var b = GetBrush(frame, brush);

            if (b != null)
            {
                if (corner.Width > 0 || corner.Height > 0)
                {
                    var rr = new D2D1.RoundedRectangle();
                    rr.Rect    = frame.ToRectangleF();
                    rr.RadiusX = (float)corner.Width;
                    rr.RadiusY = (float)corner.Height;
                    renderTarget.FillRoundedRectangle(ref rr, b);
                }
                else
                {
                    renderTarget.FillRectangle(frame.ToRectangleF(), b);
                }
            }
            if (p != null)
            {
                if (corner.Width > 0 || corner.Height > 0)
                {
                    var rr = new D2D1.RoundedRectangle();
                    rr.Rect    = frame.ToRectangleF();
                    rr.RadiusX = (float)corner.Width;
                    rr.RadiusY = (float)corner.Height;
                    renderTarget.DrawRoundedRectangle(ref rr, p, (float)pen.Width, GetStrokeStyle(pen));
                }
                else
                {
                    renderTarget.DrawRectangle(frame.ToRectangleF(), p, (float)pen.Width, GetStrokeStyle(pen));
                }
            }
        }
Beispiel #25
0
        private void OnEditViewportDrawPrimitives(Device device, RenderTarget target2D, Rectangle cliprectangle)
        {
            UiEncodingWindowSource source = _currentSource;

            WflContent info = source?.Info;
            if (info?.Header.TableType != WflHeader.LargeTable)
                return;

            int viewportX = _editViewport.X;
            int viewportY = _editViewport.Y;

            RectangleF rectangle = new RectangleF {Height = info.Header.LineHeight};

            target2D.BeginDraw();

            for (int i = 0; i < 256 * 2; i++)
            {
                if (i % 256 < 0x20)
                    continue;

                int x, y;
                info.GetOffsets(i, out x, out y);
                x -= viewportX;
                y -= viewportY;

                byte before, width, after;
                info.GetSizes(i, out before, out width, out after);

                rectangle.X = x;
                rectangle.Y = y;
                rectangle.Width = width & 0x7F;

                if (_charactersControl.CurrentMainIndices.Contains(i))
                {
                    target2D.FillRectangle(rectangle, _selectedColorBrush);

                    if (before > 0x7F)
                    {
                        rectangle.Width = (0xFF - before) + 1;
                        rectangle.X = x;
                    }
                    else
                    {
                        rectangle.Width = before;
                        rectangle.X = x - before;
                    }
                    target2D.FillRectangle(rectangle, _spacingColorBrush);

                    if (after > 0x7F)
                    {
                        rectangle.Width = (0xFF - after) + 1;
                        rectangle.X = x + (width & 0x7F) - rectangle.Width;
                    }
                    else
                    {
                        rectangle.Width = after;
                        rectangle.X = x + width & 0x7F;
                    }

                    target2D.FillRectangle(rectangle, _spacingColorBrush);
                }
                else if (source.Chars[i % 256] == 0x00)
                {
                    target2D.FillRectangle(rectangle, _notMappedColorBrush);
                }
                else
                {
                    target2D.DrawRectangle(rectangle, _gridColorBrush, 1.0f);
                }
            }

            int squareSize = info.Header.LineSpacing + info.Header.SquareDiff;
            rectangle.Height = squareSize;
            rectangle.Width = squareSize;
            for (int i = 0; i < info.AdditionalTable.Length; i++)
            {
                int value = info.AdditionalTable[i];
                if (value == 0)
                    continue;

                rectangle.Y = (value >> 8) * squareSize - viewportY;
                rectangle.X = (value & 0xFF) * squareSize - viewportX;

                if (_charactersControl.CurrentAdditionalIndices.Contains(i))
                    target2D.FillRectangle(rectangle, _selectedColorBrush);
                else if (source.Chars[i + 256] == 0x00)
                    target2D.FillRectangle(rectangle, _notMappedColorBrush);
                else
                    target2D.DrawRectangle(rectangle, _gridColorBrush, 1.0f);
            }

            target2D.EndDraw();
        }
 public void Draw(RenderTarget renderTarget)
 {
     renderTarget.FillRectangle(OutputRectangle, _backgroundColor.Resource);
     renderTarget.DrawTextLayout(new DrawingPointF(OutputRectangle.X, OutputRectangle.Y), _currentLayout, _textColor.Resource);
     if (_drawCursor)
         renderTarget.DrawTextLayout(_cursorDrawingPoint, _cursor, _textColor.Resource);
 }
            public void Draw(RenderTarget renderTarget)
            {
                renderTarget.FillRectangle(OutputRectangle, _backgroundColor.Resource);

                var bufferedLine = _buffer.First;
                // Move to current line
                for (int i = 0; i < _currentLine; i++)
                    bufferedLine = bufferedLine.Next;

                DrawingPointF origin = new DrawingPointF(0f, OutputRectangle.Bottom);
                while (origin.Y > 0f && bufferedLine != null) {
                    origin.Y -= bufferedLine.Value.Text.Metrics.Height;
                    renderTarget.DrawTextLayout(origin, bufferedLine.Value.Text, bufferedLine.Value.TextColor);
                    bufferedLine = bufferedLine.Next;
                }
            }
Beispiel #28
0
 public void Present(D2D1.RenderTarget renderTarget, Block block, double secsPassed)
 {
     _brush.Color = Color.SmoothStep(_normalColor, _flashingColor, (float)ConvertCosineValueToGrayScale(block.Pattern.Sample(secsPassed)));
     renderTarget.FillRectangle(block.ContentRect, _brush);
 }
Beispiel #29
0
        public static void FillRectangle(this SharpDX.Direct2D1.RenderTarget target, ID2DBrush brush, float x, float y, float width, float height)
        {
            var rectF = new RawRectangleF(x, y, x + width, y + height);

            target.FillRectangle(rectF, brush.NativeBrush);
        }
        public void OnRender(RenderTarget target)
        {
            ++mFrameCount;

            var now = DateTime.Now;
            if((now - mLastMemorySample).TotalSeconds > 0.5f)
            {
                mLastMemorySample = now;
                mMemorySamples.Add(Environment.WorkingSet);
                while (mMemorySamples.Count > 20)
                    mMemorySamples.RemoveAt(0);
            }

            if((now - mLastFpsSample).TotalSeconds >= 1.0f)
            {
                mFpsSamples.Add(mFrameCount / (float) (now - mLastFpsSample).TotalSeconds);
                mLastFpsSample = now;
                mFrameCount = 0;

                while (mFpsSamples.Count > 20)
                    mFpsSamples.RemoveAt(0);
            }

            target.FillRectangle(mMemoryRectangle, Brushes.Solid[0xBB333333]);
            target.DrawRectangle(mMemoryRectangle, Brushes.White);
            target.FillRectangle(mFpsRectangle, Brushes.Solid[0xBB333333]);
            target.DrawRectangle(mFpsRectangle, Brushes.White);

            DrawMemorySamples(target);
            DrawFpsSamples(target);

            target.DrawTextLayout(new Vector2(Position.X, mMemoryRectangle.Top - 20.0f), mMemoryCaption, Brushes.White);
            target.DrawTextLayout(new Vector2(Position.X, mFpsRectangle.Top - 20.0f), mFpsCaption, Brushes.White);
        }
Beispiel #31
0
 public static void Draw(SharpDX.Direct2D1.RenderTarget target, System.Drawing.RectangleF bounds)
 {
     target.FillRectangle(new SharpDX.Mathematics.Interop.RawRectangleF(bounds.Left, bounds.Top, bounds.Right, bounds.Bottom), groundBrush);
 }
 public void Draw(double x, double y, double width, double height)
 {
     render.FillRectangle(new RectangleF((float)x, (float)y, (float)width, (float)height), brush);
 }
Beispiel #33
0
 private void dxFillRect(SharpDX.Direct2D1.RenderTarget target, int x, int y, int w, int h, Brush brush)
 {
     target.FillRectangle(new RawRectangleF(x, y, x + w, y + h), brush);
 }
Beispiel #34
0
 public override void Draw(RenderTarget renderTarget, AppTime appTime)
 {
     renderTarget.FillRectangle(new RectangleF(x, y, 20, 20), color);
 }
Beispiel #35
0
 public void OnRender(RenderTarget target)
 {
     target.FillRectangle(new RectangleF(0, 0, mSize.X, mSize.Y), Brushes.Solid[0xFF333333]);
     mWdlControl.OnRender(target);
     mBackButton.OnRender(target);
 }