本文整理汇总了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);
}
}
示例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);
}
}
示例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);
}
}