当前位置: 首页>>代码示例>>C#>>正文


C# IRenderContext.ResetClip方法代码示例

本文整理汇总了C#中IRenderContext.ResetClip方法的典型用法代码示例。如果您正苦于以下问题:C# IRenderContext.ResetClip方法的具体用法?C# IRenderContext.ResetClip怎么用?C# IRenderContext.ResetClip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IRenderContext的用法示例。


在下文中一共展示了IRenderContext.ResetClip方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Render

        /// <summary>
        /// Renders the series on the specified rendering context.
        /// </summary>
        /// <param name="rc">The rendering context.</param>
        public override void Render(IRenderContext rc)
        {
            var actualPoints = this.ActualPoints;
            if (actualPoints == null || actualPoints.Count == 0)
            {
                return;
            }

            this.VerifyAxes();

            var clippingRect = this.GetClippingRect();
            rc.SetClip(clippingRect);

            this.RenderPoints(rc, clippingRect, actualPoints);

            if (this.LabelFormatString != null)
            {
                // render point labels (not optimized for performance)
                this.RenderPointLabels(rc, clippingRect);
            }

            rc.ResetClip();

            if (this.LineLegendPosition != LineLegendPosition.None && !string.IsNullOrEmpty(this.Title))
            {
                // renders a legend on the line
                this.RenderLegendOnLine(rc);
            }
        }
开发者ID:Keyabob,项目名称:MMG,代码行数:33,代码来源:LineSeries.cs

示例2: Render

        /// <summary>
        /// Renders the series on the specified rendering context.
        /// </summary>
        /// <param name="rc">The rendering context.</param>
        /// <param name="model">The model.</param>
        public override void Render(IRenderContext rc, PlotModel model)
        {
            if (this.contours == null)
            {
                this.CalculateContours();
            }

            if (this.contours.Count == 0)
            {
                return;
            }

            this.VerifyAxes();

            var clippingRect = this.GetClippingRect();
            rc.SetClip(clippingRect);

            var contourLabels = new List<ContourLabel>();
            var dashArray = this.LineStyle.GetDashArray();

            foreach (var contour in this.contours)
            {
                if (this.StrokeThickness > 0 && this.LineStyle != LineStyle.None)
                {
                    var transformedPoints = contour.Points.Select(this.Transform).ToArray();
                    var strokeColor = contour.Color.GetActualColor(this.ActualColor);

                    rc.DrawClippedLine(
                        clippingRect,
                        transformedPoints,
                        4,
                        this.GetSelectableColor(strokeColor),
                        this.StrokeThickness,
                        dashArray,
                        LineJoin.Miter,
                        false);

                    // rc.DrawClippedPolygon(transformedPoints, clippingRect, 4, model.GetDefaultColor(), OxyColors.Black);
                    if (transformedPoints.Length > 10)
                    {
                        this.AddContourLabels(contour, transformedPoints, clippingRect, contourLabels);
                    }
                }
            }

            foreach (var cl in contourLabels)
            {
                this.RenderLabelBackground(rc, cl);
            }

            foreach (var cl in contourLabels)
            {
                this.RenderLabel(rc, cl);
            }

            rc.ResetClip();
        }
开发者ID:Celderon,项目名称:oxyplot,代码行数:62,代码来源:ContourSeries.cs

示例3: Render

        /// <summary>
        /// Renders the series on the specified rendering context.
        /// </summary>
        /// <param name="rc">The rendering context.</param>
        public override void Render(IRenderContext rc)
        {
            var actualPoints = this.ActualPoints;
            var actualPoints2 = this.ActualPoints2;
            int n0 = actualPoints.Count;
            if (n0 == 0)
            {
                return;
            }

            this.VerifyAxes();

            double minDistSquared = this.MinimumSegmentLength * this.MinimumSegmentLength;

            var clippingRect = this.GetClippingRect();
            rc.SetClip(clippingRect);

            // Transform all points to screen coordinates
            IList<ScreenPoint> pts0 = new ScreenPoint[n0];
            for (int i = 0; i < n0; i++)
            {
                pts0[i] = this.XAxis.Transform(actualPoints[i].X, actualPoints[i].Y, this.YAxis);
            }

            int n1 = actualPoints2.Count;
            IList<ScreenPoint> pts1 = new ScreenPoint[n1];
            for (int i = 0; i < n1; i++)
            {
                int j = this.Reverse2 ? n1 - 1 - i : i;
                pts1[j] = this.XAxis.Transform(actualPoints2[i].X, actualPoints2[i].Y, this.YAxis);
            }

            if (this.Smooth)
            {
                var rpts0 = ScreenPointHelper.ResamplePoints(pts0, this.MinimumSegmentLength);
                var rpts1 = ScreenPointHelper.ResamplePoints(pts1, this.MinimumSegmentLength);

                pts0 = CanonicalSplineHelper.CreateSpline(rpts0, 0.5, null, false, 0.25);
                pts1 = CanonicalSplineHelper.CreateSpline(rpts1, 0.5, null, false, 0.25);
            }

            var dashArray = this.ActualDashArray;

            // draw the clipped lines
            rc.DrawClippedLine(
                clippingRect,
                pts0,
                minDistSquared,
                this.GetSelectableColor(this.ActualColor),
                this.StrokeThickness,
                dashArray,
                this.LineJoin,
                false);
            rc.DrawClippedLine(
                clippingRect,
                pts1,
                minDistSquared,
                this.GetSelectableColor(this.ActualColor2),
                this.StrokeThickness,
                dashArray,
                this.LineJoin,
                false);

            // combine the two lines and draw the clipped area
            var pts = new List<ScreenPoint>();
            pts.AddRange(pts1);
            pts.AddRange(pts0);

            // pts = SutherlandHodgmanClipping.ClipPolygon(clippingRect, pts);
            rc.DrawClippedPolygon(clippingRect, pts, minDistSquared, this.GetSelectableFillColor(this.ActualFill), OxyColors.Undefined);

            var markerSizes = new[] { this.MarkerSize };

            // draw the markers on top
            rc.DrawMarkers(
                clippingRect,
                pts0,
                this.MarkerType,
                null,
                markerSizes,
                this.MarkerFill,
                this.MarkerStroke,
                this.MarkerStrokeThickness,
                1);
            rc.DrawMarkers(
                clippingRect,
                pts1,
                this.MarkerType,
                null,
                markerSizes,
                this.MarkerFill,
                this.MarkerStroke,
                this.MarkerStrokeThickness,
                1);

            rc.ResetClip();
//.........这里部分代码省略.........
开发者ID:apmKrauser,项目名称:RCUModulTest,代码行数:101,代码来源:AreaSeries.cs

示例4: Render


//.........这里部分代码省略.........
            {
                int j = n1 - 1 - i;
                pts1[j] = this.XAxis.Transform(actualPoints2[i].X, actualPoints2[i].Y, this.YAxis);
            }

            if (this.Smooth)
            {
                var rpts0 = ScreenPointHelper.ResamplePoints(pts0, this.MinimumSegmentLength);

                // var rpts1 = ScreenPointHelper.ResamplePoints(pts1, this.MinimumSegmentLength);
                pts0 = CanonicalSplineHelper.CreateSpline(rpts0, 0.5, null, false, 0.25);

                // pts1 = CanonicalSplineHelper.CreateSpline(rpts1, 0.5, null, false, 0.25);
            }

            var dashArray = this.ActualDashArray;
            var dashArray2 = this.ActualDashArray2;

            var limit = this.YAxis.Transform(this.Limit);

            if (limit < clippingRect.Top)
            {
                limit = clippingRect.Top;
            }

            if (limit > clippingRect.Bottom)
            {
                limit = clippingRect.Bottom;
            }

            var markerSizes = new[] { this.MarkerSize };

            var bottom = clippingRect.Bottom;
            var top = clippingRect.Top;

            clippingRect.Top = limit;
            clippingRect.Height = bottom - limit;

            // draw the clipped lines belove the limit line
            rc.DrawClippedLine(
                clippingRect,
                pts0,
                minDistSquared,
                this.GetSelectableColor(this.ActualColor2),
                this.StrokeThickness,
                dashArray2,
                this.LineJoin,
                false);

            // combine the two lines and draw the clipped area
            var pts = new List<ScreenPoint>();
            pts.AddRange(pts1);
            pts.AddRange(pts0);

            // fill the area belove the limit line
            rc.DrawClippedPolygon(clippingRect, pts, minDistSquared, this.GetSelectableFillColor(this.ActuallFill2), OxyColors.Undefined);

            // draw the markers on line belove the limit line
            rc.DrawMarkers(
                clippingRect,
                pts0,
                this.MarkerType,
                null,
                markerSizes,
                this.MarkerFill2,
                this.MarkerStroke2,
                this.MarkerStrokeThickness,
                1);

            clippingRect.Top = top;
            clippingRect.Bottom = limit;

            // draw the clipped lines above the limit line
            rc.DrawClippedLine(
                clippingRect,
                pts0,
                minDistSquared,
                this.GetSelectableColor(this.ActualColor),
                this.StrokeThickness,
                dashArray,
                this.LineJoin,
                false);

            // fill the area above the limit line
            rc.DrawClippedPolygon(clippingRect, pts, minDistSquared, this.GetSelectableFillColor(this.ActualFill), OxyColors.Undefined);

            // draw the markers on line above the limit line
            rc.DrawMarkers(
                clippingRect,
                pts0,
                this.MarkerType,
                null,
                markerSizes,
                this.MarkerFill,
                this.MarkerStroke,
                this.MarkerStrokeThickness,
                1);

            rc.ResetClip();
        }
开发者ID:Keyabob,项目名称:MMG,代码行数:101,代码来源:TwoColorAreaSeries.cs

示例5: Render

        /// <summary>
        /// Renders the text annotation.
        /// </summary>
        /// <param name="rc">The render context.</param>
        public override void Render(IRenderContext rc)
        {
            base.Render(rc);

            var position = this.Transform(this.TextPosition) + this.Offset;

            var clippingRectangle = this.GetClippingRect();

            var textSize = rc.MeasureText(this.Text, this.ActualFont, this.ActualFontSize, this.ActualFontWeight);

            rc.SetClip(clippingRectangle);
            this.actualBounds = GetTextBounds(
                position, textSize, this.Padding, this.TextRotation, this.TextHorizontalAlignment, this.TextVerticalAlignment);

            if ((this.TextRotation % 90).Equals(0))
            {
                var actualRect = new OxyRect(this.actualBounds[0], this.actualBounds[2]);
                rc.DrawRectangle(actualRect, this.Background, this.Stroke, this.StrokeThickness);
            }
            else
            {
                rc.DrawPolygon(this.actualBounds, this.Background, this.Stroke, this.StrokeThickness);
            }

            rc.DrawMathText(
                position,
                this.Text,
                this.GetSelectableFillColor(this.ActualTextColor),
                this.ActualFont,
                this.ActualFontSize,
                this.ActualFontWeight,
                this.TextRotation,
                this.TextHorizontalAlignment,
                this.TextVerticalAlignment);

            rc.ResetClip();
        }
开发者ID:Keyabob,项目名称:MMG,代码行数:41,代码来源:TextAnnotation.cs

示例6: Render

        /// <summary>
        /// Renders the series on the specified rendering context.
        /// </summary>
        /// <param name="rc">The rendering context.</param>
        public override void Render(IRenderContext rc)
        {
            this.rectangles.Clear();
            this.rectanglesPointIndexes.Clear();

            var actualPoints = this.ActualPoints;
            if (actualPoints == null || actualPoints.Count == 0)
            {
                return;
            }

            this.VerifyAxes();

            var clippingRect = this.GetClippingRect();
            rc.SetClip(clippingRect);

            this.RenderBars(rc, clippingRect, actualPoints);

            rc.ResetClip();
        }
开发者ID:huoxudong125,项目名称:oxyplot,代码行数:24,代码来源:LinearBarSeries.cs

示例7: Render

        /// <summary>
        /// Renders the series on the specified rendering context.
        /// </summary>
        /// <param name="rc">The rendering context.</param>
        public override void Render(IRenderContext rc)
        {
            // determine render range
            var xmin = this.XAxis.ActualMinimum;
            var xmax = this.XAxis.ActualMaximum;
            this.WindowStartIndex = this.UpdateWindowStartIndex(this.abovePoints, this.GetPointX, xmin, this.WindowStartIndex);
            this.WindowStartIndex2 = this.UpdateWindowStartIndex(this.belowPoints, this.GetPointX, xmin, this.WindowStartIndex2);

            double minDistSquared = this.MinimumSegmentLength * this.MinimumSegmentLength;

            var clippingRect = this.GetClippingRect();
            rc.SetClip(clippingRect);

            var areaContext = new TwoColorAreaRenderContext
            {
                Points = this.abovePoints,
                WindowStartIndex = this.WindowStartIndex,
                XMax = xmax,
                RenderContext = rc,
                ClippingRect = clippingRect,
                MinDistSquared = minDistSquared,
                Reverse = false,
                Color = this.ActualColor,
                Fill = this.ActualFill,
                MarkerFill = this.MarkerFill,
                MarkerStroke = this.MarkerStroke,
                DashArray = this.ActualDashArray,
                Baseline = this.Limit
            };

            this.RenderChunkedPoints(areaContext);

            areaContext.Points = this.belowPoints;
            areaContext.Reverse = this.Reverse2;
            areaContext.Color = this.ActualColor2;
            areaContext.Fill = this.ActualFill2;
            areaContext.MarkerFill = this.MarkerFill2;
            areaContext.MarkerStroke = this.MarkerStroke2;
            areaContext.DashArray = this.ActualDashArray2;
            if (this.IsPoints2Defined)
            {
                areaContext.Baseline = this.ConstantY2;
            }

            this.RenderChunkedPoints(areaContext);

            if (!this.IsPoints2Defined)
            {
                var markerSizes = new[] { this.MarkerSize };
                double limit = this.Limit;
                var points = this.ActualPoints;
                var aboveMarkers = new List<ScreenPoint>();
                var belowMarkers = new List<ScreenPoint>();
                this.markerStartIndex = this.UpdateWindowStartIndex(points, this.GetPointX, xmin, this.markerStartIndex);

                int markerClipCount = 0;
                for (int i = this.markerStartIndex; i < points.Count; i++)
                {
                    var point = points[i];
                    (point.y >= limit ? aboveMarkers : belowMarkers).Add(this.XAxis.Transform(point.x, point.y, this.YAxis));

                    markerClipCount += point.x > xmax ? 1 : 0;
                    if (markerClipCount > 1)
                    {
                        break;
                    }
                }

                rc.DrawMarkers(
                    clippingRect,
                    aboveMarkers,
                    this.MarkerType,
                    null,
                    markerSizes,
                    this.MarkerFill,
                    this.MarkerStroke,
                    this.MarkerStrokeThickness,
                    1);
                rc.DrawMarkers(
                    clippingRect,
                    belowMarkers,
                    this.MarkerType,
                    null,
                    markerSizes,
                    this.MarkerFill2,
                    this.MarkerStroke2,
                    this.MarkerStrokeThickness,
                    1);
            }

            rc.ResetClip();
        }
开发者ID:huoxudong125,项目名称:oxyplot,代码行数:96,代码来源:TwoColorAreaSeries.cs

示例8: Render

        /// <summary>
        /// Renders the series on the specified rendering context.
        /// </summary>
        /// <param name="rc">The rendering context.</param>
        public override void Render(IRenderContext rc)
        {
            this.VerifyAxes();

            var actualPoints = this.ActualPoints;
            if (actualPoints == null || actualPoints.Count == 0)
            {
                return;
            }

            var actualPoints2 = this.ActualPoints2;
            if (actualPoints2 == null || actualPoints2.Count == 0)
            {
                return;
            }

            int startIdx = 0;
            int startIdx2 = 0;
            double xmax = double.MaxValue;

            if (this.IsXMonotonic)
            {
                // determine render range
                var xmin = this.XAxis.ActualMinimum;
                xmax = this.XAxis.ActualMaximum;
                this.WindowStartIndex = this.UpdateWindowStartIndex(actualPoints, point => point.X, xmin, this.WindowStartIndex);
                this.WindowStartIndex2 = this.UpdateWindowStartIndex(actualPoints2, point => point.X, xmin, this.WindowStartIndex2);

                startIdx = this.WindowStartIndex;
                startIdx2 = this.WindowStartIndex2;
            }

            double minDistSquared = this.MinimumSegmentLength * this.MinimumSegmentLength;

            var clippingRect = this.GetClippingRect();
            rc.SetClip(clippingRect);

            var areaContext = new AreaRenderContext
            {
                Points = actualPoints,
                WindowStartIndex = startIdx,
                XMax = xmax,
                RenderContext = rc,
                ClippingRect = clippingRect,
                MinDistSquared = minDistSquared,
                Reverse = false,
                Color = this.ActualColor,
                DashArray = this.ActualDashArray
            };

            var chunksOfPoints = this.RenderChunkedPoints(areaContext);

            areaContext.Points = actualPoints2;
            areaContext.WindowStartIndex = startIdx2;
            areaContext.Reverse = this.Reverse2;
            areaContext.Color = this.ActualColor2;

            var chunksOfPoints2 = this.RenderChunkedPoints(areaContext);

            if (chunksOfPoints.Count != chunksOfPoints2.Count)
            {
                rc.ResetClip();
                return;
            }

            // Draw the fill
            for (int chunkIndex = 0; chunkIndex < chunksOfPoints.Count; chunkIndex++)
            {
                var pts = chunksOfPoints[chunkIndex];
                var pts2 = chunksOfPoints2[chunkIndex];

                // pts = SutherlandHodgmanClipping.ClipPolygon(clippingRect, pts);

                // combine the two lines and draw the clipped area
                var allPts = new List<ScreenPoint>();
                allPts.AddRange(pts2);
                allPts.AddRange(pts);
                rc.DrawClippedPolygon(
                    clippingRect,
                    allPts,
                    minDistSquared,
                    this.GetSelectableFillColor(this.ActualFill),
                    OxyColors.Undefined);

                var markerSizes = new[] { this.MarkerSize };

                // draw the markers on top
                rc.DrawMarkers(
                    clippingRect,
                    pts,
                    this.MarkerType,
                    null,
                    markerSizes,
                    this.MarkerFill,
                    this.MarkerStroke,
                    this.MarkerStrokeThickness,
//.........这里部分代码省略.........
开发者ID:huoxudong125,项目名称:oxyplot,代码行数:101,代码来源:AreaSeries.cs


注:本文中的IRenderContext.ResetClip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。