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


C# IRenderContext.DrawClippedRectangle方法代码示例

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


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

示例1: Render

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

            double x0 = double.IsNaN(this.MinimumX) || this.MinimumX.Equals(double.MinValue) ? this.XAxis.ActualMinimum : this.MinimumX;
            double x1 = double.IsNaN(this.MaximumX) || this.MaximumX.Equals(double.MaxValue) ? this.XAxis.ActualMaximum : this.MaximumX;
            double y0 = double.IsNaN(this.MinimumY) || this.MinimumY.Equals(double.MinValue) ? this.YAxis.ActualMinimum : this.MinimumY;
            double y1 = double.IsNaN(this.MaximumY) || this.MaximumY.Equals(double.MaxValue) ? this.YAxis.ActualMaximum : this.MaximumY;

            this.screenRectangle = OxyRect.Create(this.Transform(x0, y0), this.Transform(x1, y1));

            // clip to the area defined by the axes
            var clipping = this.GetClippingRect();

            rc.DrawClippedRectangle(this.screenRectangle, clipping, this.Fill, null, 0);

            if (!string.IsNullOrEmpty(this.Text))
            {
                var textPosition = this.screenRectangle.Center;
                rc.DrawClippedText(
                    clipping,
                    textPosition,
                    this.Text,
                    this.ActualTextColor,
                    this.ActualFont,
                    this.ActualFontSize,
                    this.ActualFontWeight,
                    this.TextRotation,
                    HorizontalTextAlign.Center,
                    VerticalTextAlign.Middle);
            }
        }
开发者ID:jgodinez,项目名称:OxyPlot.2DGraphLib.MonoTouch,代码行数:41,代码来源:RectangleAnnotation.cs

示例2: Render

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

            double x0 = double.IsNaN(this.MinimumX) || this.MinimumX.Equals(double.MinValue)
                            ? this.XAxis.ActualMinimum
                            : this.MinimumX;
            double x1 = double.IsNaN(this.MaximumX) || this.MaximumX.Equals(double.MaxValue)
                            ? this.XAxis.ActualMaximum
                            : this.MaximumX;
            double y0 = double.IsNaN(this.MinimumY) || this.MinimumY.Equals(double.MinValue)
                            ? this.YAxis.ActualMinimum
                            : this.MinimumY;
            double y1 = double.IsNaN(this.MaximumY) || this.MaximumY.Equals(double.MaxValue)
                            ? this.YAxis.ActualMaximum
                            : this.MaximumY;

            this.screenRectangle = new OxyRect(this.Transform(x0, y0), this.Transform(x1, y1));

            // clip to the area defined by the axes
            var clippingRectangle = this.GetClippingRect();

            rc.DrawClippedRectangle(
                clippingRectangle,
                this.screenRectangle,
                this.GetSelectableFillColor(this.Fill),
                this.GetSelectableColor(this.Stroke),
                this.StrokeThickness);

            if (!string.IsNullOrEmpty(this.Text))
            {
                var textPosition = this.GetActualTextPosition(() => this.screenRectangle.Center);
                rc.DrawClippedText(
                    clippingRectangle,
                    textPosition,
                    this.Text,
                    this.ActualTextColor,
                    this.ActualFont,
                    this.ActualFontSize,
                    this.ActualFontWeight,
                    this.TextRotation,
                    HorizontalAlignment.Center,
                    VerticalAlignment.Middle);
            }
        }
开发者ID:Keyabob,项目名称:MMG,代码行数:49,代码来源:RectangleAnnotation.cs

示例3: Render


//.........这里部分代码省略.........
            }

            if (this.ColorAxis == null)
            {
                throw new InvalidOperationException("Color axis not specified.");
            }

            double left = this.X0;
            double right = this.X1;
            double bottom = this.Y0;
            double top = this.Y1;

            int m = this.Data.GetLength(0);
            int n = this.Data.GetLength(1);
            double dx = (this.X1 - this.X0) / (m - 1);
            double dy = (this.Y1 - this.Y0) / (n - 1);

            if (this.CoordinateDefinition == HeatMapCoordinateDefinition.Center)
            {
                if (this.XAxis.IsLogarithmic())
                {
                    double gx = Math.Log(this.X1 / this.X0) / (m - 1);
                    left *= Math.Exp(gx / -2);
                    right *= Math.Exp(gx / 2);
                }
                else
                {
                    left -= dx / 2;
                    right += dx / 2;
                }

                if (this.YAxis.IsLogarithmic())
                {
                    double gy = Math.Log(this.Y1 / this.Y0) / (n - 1);
                    bottom *= Math.Exp(gy / -2);
                    top *= Math.Exp(gy / 2);
                }
                else
                {
                    bottom -= dy / 2;
                    top += dy / 2;
                }
            }

            var s00 = this.Transform(left, bottom);
            var s11 = this.Transform(right, top);
            var rect = new OxyRect(s00, s11);

            bool needImage = this.RenderMethod == HeatMapRenderMethod.Bitmap;

            var currentDataHash = this.Data.GetHashCode();
            var currentColorAxisHash = this.ColorAxis.GetElementHashCode();
            if ((needImage && this.image == null) || currentDataHash != this.dataHash || currentColorAxisHash != this.colorAxisHash)
            {
                if (needImage)
                {
                    this.UpdateImage();
                }

                this.dataHash = currentDataHash;
                this.colorAxisHash = currentColorAxisHash;
            }

            var clip = this.GetClippingRect();
            if (needImage)
            {
                if (this.image != null)
                {
                    rc.DrawClippedImage(clip, this.image, rect.Left, rect.Top, rect.Width, rect.Height, 1, this.Interpolate);
                }
            }
            else
            {
                s00 = this.Orientate(s00); // disorientate
                s11 = this.Orientate(s11); // disorientate

                double sdx = (s11.X - s00.X) / m;
                double sdy = (s11.Y - s00.Y) / n;

                // draw lots of rectangles
                for (int i = 0; i < m; i++)
                {
                    for (int j = 0; j < n; j++)
                    {
                        var rectcolor = this.ColorAxis.GetColor(this.Data[i, j]);

                        var pointa = this.Orientate(new ScreenPoint(s00.X + (i * sdx), s00.Y + (j * sdy))); // re-orientate
                        var pointb = this.Orientate(new ScreenPoint(s00.X + ((i + 1) * sdx), s00.Y + ((j + 1) * sdy))); // re-orientate
                        var rectrect = new OxyRect(pointa, pointb);

                        rc.DrawClippedRectangle(clip, rectrect, rectcolor, OxyColors.Undefined, 0);
                    }
                }
            }

            if (this.LabelFontSize > 0)
            {
                this.RenderLabels(rc, rect);
            }
        }
开发者ID:huoxudong125,项目名称:oxyplot,代码行数:101,代码来源:HeatMapSeries.cs


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