本文整理汇总了C#中OxyPlot.OxyColor.IsVisible方法的典型用法代码示例。如果您正苦于以下问题:C# OxyColor.IsVisible方法的具体用法?C# OxyColor.IsVisible怎么用?C# OxyColor.IsVisible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OxyPlot.OxyColor
的用法示例。
在下文中一共展示了OxyColor.IsVisible方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawEllipse
/// <summary>
/// Draws an ellipse.
/// </summary>
/// <param name="rect">The rectangle.</param>
/// <param name="fill">The fill color.</param>
/// <param name="stroke">The stroke color.</param>
/// <param name="thickness">The thickness.</param>
public override void DrawEllipse(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness)
{
var isStroked = stroke.IsVisible() && thickness > 0;
var isFilled = fill.IsVisible();
if (!isStroked && !isFilled)
{
return;
}
double y = this.doc.PageHeight - rect.Bottom;
if (isStroked)
{
this.SetLineWidth(thickness);
this.doc.SetColor(stroke);
if (isFilled)
{
this.doc.SetFillColor(fill);
this.doc.DrawEllipse(rect.Left, y, rect.Width, rect.Height, true);
}
else
{
this.doc.DrawEllipse(rect.Left, y, rect.Width, rect.Height);
}
}
else
{
this.doc.SetFillColor(fill);
this.doc.FillEllipse(rect.Left, y, rect.Width, rect.Height);
}
}
示例2: DrawEllipse
/// <summary>
/// Draws an ellipse.
/// </summary>
/// <param name="rect">The rectangle.</param>
/// <param name="fill">The fill color.</param>
/// <param name="stroke">The stroke color.</param>
/// <param name="thickness">The thickness.</param>
public override void DrawEllipse(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness)
{
var isStroked = stroke.IsVisible() && thickness > 0;
if (fill.IsVisible())
{
if (!isStroked)
{
this.g.SmoothingMode = SmoothingMode.HighQuality;
}
this.g.FillEllipse(this.GetCachedBrush(fill), (float)rect.Left, (float)rect.Top, (float)rect.Width, (float)rect.Height);
}
if (!isStroked)
{
return;
}
using (var pen = this.GetCachedPen(stroke, thickness))
{
this.g.SmoothingMode = SmoothingMode.HighQuality;
this.g.DrawEllipse(pen, (float)rect.Left, (float)rect.Top, (float)rect.Width, (float)rect.Height);
}
}
示例3: PdfRenderContext
/// <summary>
/// Initializes a new instance of the <see cref="PdfRenderContext" /> class.
/// </summary>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
/// <param name="background">The background.</param>
public PdfRenderContext(double width, double height, OxyColor background)
{
this.doc = new PortableDocument();
this.doc.AddPage(width, height);
this.RendersToScreen = false;
if (background.IsVisible())
{
this.doc.SetFillColor(background);
this.doc.FillRectangle(0, 0, width, height);
}
}
示例4: SvgRenderContext
/// <summary>
/// Initializes a new instance of the <see cref="SvgRenderContext" /> class.
/// </summary>
/// <param name="s">The s.</param>
/// <param name="width">The width.</param>
/// <param name="height">The height.</param>
/// <param name="isDocument">Create an SVG document if set to <c>true</c>.</param>
/// <param name="textMeasurer">The text measurer.</param>
/// <param name="background">The background.</param>
public SvgRenderContext(Stream s, double width, double height, bool isDocument, IRenderContext textMeasurer, OxyColor background)
{
if (textMeasurer == null)
{
throw new ArgumentNullException("textMeasurer", "A text measuring render context must be provided.");
}
this.w = new SvgWriter(s, width, height, isDocument);
this.TextMeasurer = textMeasurer;
if (background.IsVisible())
{
this.w.WriteRectangle(0, 0, width, height, this.w.CreateStyle(background, OxyColors.Undefined, 0));
}
}
示例5: Export
/// <summary>
/// Exports the specified plot model to a stream.
/// </summary>
/// <param name="model">The plot model.</param>
/// <param name="stream">The stream to write to.</param>
/// <param name="width">The width of the export image.</param>
/// <param name="height">The height of the exported image.</param>
/// <param name="background">The background.</param>
public static void Export(IPlotModel model, Stream stream, double width, double height, OxyColor background)
{
var canvas = new Canvas { Width = width, Height = height };
if (background.IsVisible())
{
canvas.Background = background.ToBrush();
}
canvas.Measure(new Size(width, height));
canvas.Arrange(new Rect(0, 0, width, height));
var rc = new SilverlightRenderContext(canvas);
model.Update(true);
model.Render(rc, width, height);
canvas.UpdateLayout();
var image = canvas.ToImage();
image.WriteToStream(stream);
}
示例6: DrawRectangle
/// <summary>
/// Draws the rectangle.
/// </summary>
/// <param name="rect">The rectangle.</param>
/// <param name="fill">The fill color.</param>
/// <param name="stroke">The stroke color.</param>
/// <param name="thickness">The stroke thickness.</param>
public override void DrawRectangle(OxyRect rect, OxyColor fill, OxyColor stroke, double thickness)
{
if (fill.IsVisible())
{
this.g.FillRectangle(
fill.ToBrush(), (float)rect.Left, (float)rect.Top, (float)rect.Width, (float)rect.Height);
}
if (stroke.IsInvisible() || thickness <= 0)
{
return;
}
using (var pen = this.CreatePen(stroke, thickness))
{
this.g.DrawRectangle(pen, (float)rect.Left, (float)rect.Top, (float)rect.Width, (float)rect.Height);
}
}
示例7: DrawPolygon
/// <summary>
/// Draws the polygon from the specified points. The polygon can have stroke and/or fill.
/// </summary>
/// <param name="points">The points.</param>
/// <param name="fill">The fill color.</param>
/// <param name="stroke">The stroke color.</param>
/// <param name="thickness">The stroke thickness.</param>
/// <param name="dashArray">The dash array.</param>
/// <param name="lineJoin">The line join type.</param>
/// <param name="aliased">if set to <c>true</c> the shape will be aliased.</param>
public override void DrawPolygon(
IList<ScreenPoint> points,
OxyColor fill,
OxyColor stroke,
double thickness,
double[] dashArray,
OxyPlot.LineJoin lineJoin,
bool aliased)
{
if (points.Count < 2)
{
return;
}
this.g.SmoothingMode = aliased ? SmoothingMode.None : SmoothingMode.HighQuality;
var pts = this.ToPoints(points);
if (fill.IsVisible())
{
this.g.FillPolygon(fill.ToBrush(), pts);
}
if (stroke.IsInvisible() || thickness <= 0)
{
return;
}
using (var pen = this.CreatePen(stroke, thickness))
{
if (dashArray != null)
{
pen.DashPattern = this.ToFloatArray(dashArray);
}
switch (lineJoin)
{
case OxyPlot.LineJoin.Round:
pen.LineJoin = System.Drawing.Drawing2D.LineJoin.Round;
break;
case OxyPlot.LineJoin.Bevel:
pen.LineJoin = System.Drawing.Drawing2D.LineJoin.Bevel;
break;
// The default LineJoin is Miter
}
this.g.DrawPolygon(pen, pts);
}
}
示例8: DrawPolygon
/// <summary>
/// Draws a polygon. The polygon can have stroke and/or fill.
/// </summary>
/// <param name="points">The points.</param>
/// <param name="fill">The fill color.</param>
/// <param name="stroke">The stroke color.</param>
/// <param name="thickness">The stroke thickness.</param>
/// <param name="dashArray">The dash array.</param>
/// <param name="lineJoin">The line join type.</param>
/// <param name="aliased">If set to <c>true</c> the shape will be aliased.</param>
public override void DrawPolygon(
IList<ScreenPoint> points,
OxyColor fill,
OxyColor stroke,
double thickness,
double[] dashArray,
OxyPenLineJoin lineJoin,
bool aliased)
{
var isStroked = stroke.IsVisible() && thickness > 0;
var isFilled = fill.IsVisible();
if (!isStroked && !isFilled)
{
return;
}
var h = this.doc.PageHeight;
this.doc.MoveTo(points[0].X, h - points[0].Y);
for (int i = 1; i < points.Count; i++)
{
this.doc.LineTo(points[i].X, h - points[i].Y);
}
if (isStroked)
{
this.doc.SetColor(stroke);
this.SetLineWidth(thickness);
if (dashArray != null)
{
this.SetLineDashPattern(dashArray, 0);
}
this.doc.SetLineJoin(Convert(lineJoin));
if (isFilled)
{
this.doc.SetFillColor(fill);
this.doc.FillAndStroke();
}
else
{
this.doc.Stroke();
}
if (dashArray != null)
{
this.doc.ResetLineDashPattern();
}
}
else
{
this.doc.SetFillColor(fill);
this.doc.Fill();
}
}