Beispiel #1
0
        public void OnRender(RenderTarget target)
        {
            target.PushAxisAlignedClip(new RectangleF(Position.X, Position.Y, Size.X, Size.Y), AntialiasMode.Aliased);

            target.DrawTextLayout(Position, mTextDraw, Color, mMultiline ? DrawTextOptions.None : DrawTextOptions.Clip);

            target.PopAxisAlignedClip();
        }
Beispiel #2
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 #3
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 #4
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 #5
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 #6
0
 /// <summary>
 /// Pops a clip change info.
 /// </summary>
 public void PopClip()
 {
     _renderTarget.PopAxisAlignedClip();
 }
        private void DrawFpsSamples(RenderTarget target)
        {
            var maxValue = mFpsSamples.Max();
            var minValue = mFpsSamples.Min();
            if (MathUtil.WithinEpsilon(minValue, maxValue, 0.5f)) maxValue = minValue + 10;

            var baseOffset = 0.0f;
            var step = mSize.X / 19.0f;
            var diff = (DateTime.Now - mLastFpsSample);

            if (mFpsSamples.Count == 20)
                baseOffset = (float)diff.TotalSeconds * step;

            var curPos = mFpsRectangle.Left - baseOffset;
            var endY = mFpsRectangle.Bottom - 5;
            var height = mFpsRectangle.Height - 20;

            target.PushAxisAlignedClip(mFpsRectangle, AntialiasMode.Aliased);

            for (var i = 1; i < mFpsSamples.Count; ++i)
            {
                var sat = (mFpsSamples[i] - minValue) / (maxValue - minValue);
                var satPrev = (mFpsSamples[i - 1] - minValue) / (maxValue - minValue);
                target.DrawLine(new Vector2(curPos, endY - satPrev * height), new Vector2(curPos + step, endY - sat * height), Brushes.White);
                curPos += step;
            }

            var satLast = (mFpsSamples.Last() - minValue) / (maxValue - minValue);
            target.DrawLine(new Vector2(curPos, endY - satLast * height),
                new Vector2(curPos + (float)diff.TotalSeconds * step, endY - satLast * height), Brushes.White);

            target.PopAxisAlignedClip();

            mFpsMin.Text = minValue.ToString("F2");
            mFpsMax.Text = maxValue.ToString("F2");

            target.DrawTextLayout(new Vector2(Position.X + 3.0f, mFpsRectangle.Top - 20.0f), mFpsMax, Brushes.White);
            target.DrawTextLayout(new Vector2(Position.X + 3.0f, mFpsRectangle.Bottom + 2.0f), mFpsMin, Brushes.White);
        }
        private void DrawMemorySamples(RenderTarget target)
        {
            var maxValue = mMemorySamples.Max();
            var minValue = mMemorySamples.Min();
            if (minValue == maxValue) maxValue = minValue + 50;

            var baseOffset = 0.0f;
            var step = mSize.X / 19.0f;
            var diff = (DateTime.Now - mLastMemorySample);

            if (mMemorySamples.Count == 20)
                baseOffset = ((float)diff.TotalSeconds / 0.5f) * step;

            var curPos = mMemoryRectangle.Left - baseOffset;
            var endY = mMemoryRectangle.Bottom - 5;
            var height = mMemoryRectangle.Height - 20;

            target.PushAxisAlignedClip(mMemoryRectangle, AntialiasMode.Aliased);

            for (var i = 1; i < mMemorySamples.Count; ++i)
            {
                var sat = (mMemorySamples[i] - (float)minValue) / (maxValue - minValue);
                var satPrev = (mMemorySamples[i - 1] - (float)minValue) / (maxValue - minValue);
                target.DrawLine(new Vector2(curPos, endY - satPrev * height), new Vector2(curPos + step, endY - sat * height), Brushes.White);
                curPos += step;
            }

            var satLast = (mMemorySamples.Last() - (float) minValue) / (maxValue - minValue);
            target.DrawLine(new Vector2(curPos, endY - satLast * height),
                new Vector2(curPos + ((float)diff.TotalSeconds / 0.5f) * step, endY - satLast * height), Brushes.White);

            target.PopAxisAlignedClip();

            DrawMemoryStrings(target, maxValue, minValue);
        }
        public override void Render(RenderTarget renderTarget)
        {
            if (!IsVisible) return;

            CurrentBorderBrush.Resource.Opacity = this.Opacity;
            CurrentBackgroundBrush.Resource.Opacity = this.Opacity;

            renderTarget.Transform = this.Transform;

            //TODO: Check if we need a second rect for this...
            renderTarget.PushAxisAlignedClip(this.ClippingRectangle, AntialiasMode.Aliased);

            try {
                if (DrawBackground) {
                    renderTarget.FillGeometry(_backgroundGeometry, CurrentBackgroundBrush.Resource);
                    //if (CurrentBitmap != null)
                    //	renderTarget.DrawBitmap(CurrentBitmap.Resource, Opacity, BitmapInterpolationMode.Linear);
                }

                if (DrawBorder)
                    renderTarget.DrawGeometry(_backgroundGeometry, CurrentBorderBrush.Resource);

                if (DrawText && !String.IsNullOrEmpty(_text))
                    renderTarget.DrawTextLayout(new DrawingPointF(TextIndent, 0f), RenderedText, CurrentFontBrush.Resource);

                base.Render(renderTarget);
            } finally {
                renderTarget.PopAxisAlignedClip();
            }
        }
Beispiel #10
0
 public void Dispose()
 {
     _target.PopAxisAlignedClip();
 }