// --------------------------------------------------------------------------------------------------------------------
//
// Copyright (c) 2014 OxyPlot contributors
//
//
// Provides a render context that does nothing except measure text.
//
// --------------------------------------------------------------------------------------------------------------------
namespace OxyPlot.Tests
{
using System.Collections.Generic;
///
/// Provides a render context that does nothing except measure text.
///
public class NullRenderContext : RenderContextBase
{
///
/// The text measurer
///
private readonly IRenderContext textMeasurer = new PdfRenderContext(1, 1, OxyColors.White);
///
/// Draws a polyline.
///
/// The points.
/// The stroke color.
/// The stroke thickness.
/// The dash array.
/// The line join type.
/// if set to true the shape will be aliased.
public override void DrawLine(IList points, OxyColor stroke, double thickness, double[] dashArray, LineJoin lineJoin, bool aliased)
{
// do nothing
}
///
/// Draws a polygon. The polygon can have stroke and/or fill.
///
/// The points.
/// The fill color.
/// The stroke color.
/// The stroke thickness.
/// The dash array.
/// The line join type.
/// If set to true the shape will be aliased.
public override void DrawPolygon(IList points, OxyColor fill, OxyColor stroke, double thickness, double[] dashArray, LineJoin lineJoin, bool aliased)
{
// do nothing
}
///
/// Draws the text.
///
/// The position of the text.
/// The text.
/// The fill color.
/// The font family.
/// Size of the font.
/// The font weight.
/// The rotation angle.
/// The horizontal alignment.
/// The vertical alignment.
/// The maximum size of the text.
public override void DrawText(ScreenPoint p, string text, OxyColor fill, string fontFamily, double fontSize, double fontWeight, double rotate, HorizontalAlignment halign, VerticalAlignment valign, OxySize? maxSize)
{
// do nothing
}
///
/// Measures the text.
///
/// The text.
/// The font family.
/// Size of the font.
/// The font weight.
///
/// The text size.
///
public override OxySize MeasureText(string text, string fontFamily, double fontSize, double fontWeight)
{
// Use the Pdf text measurer
return this.textMeasurer.MeasureText(text, fontFamily, fontSize, fontWeight);
}
}
}