本文整理汇总了C#中PdfSharp.Drawing.XPoint类的典型用法代码示例。如果您正苦于以下问题:C# XPoint类的具体用法?C# XPoint怎么用?C# XPoint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XPoint类属于PdfSharp.Drawing命名空间,在下文中一共展示了XPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderPage
/// <summary>
/// Demonstrates the use of XGraphics.DrawBeziers.
/// </summary>
public override void RenderPage(XGraphics gfx)
{
base.RenderPage(gfx);
int n = 2;
int count = 1 + 3 * n;
XPoint[] points = new XPoint[count];
Random rnd = new Random(42);
for (int idx = 0; idx < count; idx++)
{
points[idx].X = 20 + rnd.Next(600);
points[idx].Y = 50 + rnd.Next(800);
}
// Draw the points
XPen pen = new XPen(XColors.Red, 0.5);
pen.DashStyle = XDashStyle.Dash;
for (int idx = 0; idx + 3 < count; idx += 3)
{
gfx.DrawEllipse(XBrushes.Red, MakeRect(points[idx]));
gfx.DrawEllipse(XBrushes.Red, MakeRect(points[idx + 1]));
gfx.DrawEllipse(XBrushes.Red, MakeRect(points[idx + 2]));
gfx.DrawEllipse(XBrushes.Red, MakeRect(points[idx + 3]));
gfx.DrawLine(pen, points[idx], points[idx + 1]);
gfx.DrawLine(pen, points[idx + 2], points[idx + 3]);
}
// Draw the curve
gfx.DrawBeziers(properties.Pen2.Pen, points);
}
示例2: CreateCurveSegment
/// <summary>
/// Appends a Bézier segment from a curve.
/// </summary>
public static BezierSegment CreateCurveSegment(XPoint pt0, XPoint pt1, XPoint pt2, XPoint pt3, double tension3)
{
return new BezierSegment(
new System.Windows.Point(pt1.X + tension3 * (pt2.X - pt0.X), pt1.Y + tension3 * (pt2.Y - pt0.Y)),
new System.Windows.Point(pt2.X - tension3 * (pt3.X - pt1.X), pt2.Y - tension3 * (pt3.Y - pt1.Y)),
new System.Windows.Point(pt2.X, pt2.Y), true);
}
示例3: Convert
/// <summary>
/// Convert from WinForms point to core point.
/// </summary>
public static XPoint[] Convert(RPoint[] points)
{
XPoint[] myPoints = new XPoint[points.Length];
for (int i = 0; i < points.Length; i++)
myPoints[i] = Convert(points[i]);
return myPoints;
}
示例4: XRect
/// <summary>
/// Initializes a new instance of the XRect class.
/// </summary>
public XRect(XPoint point1, XPoint point2)
{
_x = Math.Min(point1.X, point2.X);
_y = Math.Min(point1.Y, point2.Y);
_width = Math.Max(Math.Max(point1.X, point2.X) - _x, 0);
_height = Math.Max(Math.Max(point1.Y, point2.Y) - _y, 0);
}
示例5: Format
/// <summary>
/// Calculates the space used for the axis title.
/// </summary>
internal override void Format()
{
XGraphics gfx = _rendererParms.Graphics;
AxisTitleRendererInfo atri = ((AxisRendererInfo)_rendererParms.RendererInfo)._axisTitleRendererInfo;
if (atri.AxisTitleText != "")
{
XSize size = gfx.MeasureString(atri.AxisTitleText, atri.AxisTitleFont);
if (atri.AxisTitleOrientation != 0)
{
XPoint[] points = new XPoint[2];
points[0].X = 0;
points[0].Y = 0;
points[1].X = size.Width;
points[1].Y = size.Height;
XMatrix matrix = new XMatrix();
matrix.RotatePrepend(-atri.AxisTitleOrientation);
matrix.TransformPoints(points);
size.Width = Math.Abs(points[1].X - points[0].X);
size.Height = Math.Abs(points[1].Y - points[0].Y);
}
atri.X = 0;
atri.Y = 0;
atri.Height = size.Height;
atri.Width = size.Width;
}
}
示例6: BarCodeRenderInfo
public BarCodeRenderInfo(XGraphics gfx, XBrush brush, XFont font, XPoint position)
{
Gfx = gfx;
Brush = brush;
Font = font;
Position = position;
}
示例7: RenderPage
/// <summary>
/// Demonstrates the use of XGraphics.DrawRoundedRectangle.
/// </summary>
public override void RenderPage(XGraphics gfx)
{
base.RenderPage(gfx);
// Stroke ellipse
gfx.DrawEllipse(properties.Pen1.Pen, 50, 100, 450, 150);
// Fill ellipse
gfx.DrawEllipse(properties.Brush2.Brush, new Rectangle(50, 300, 450, 150));
// Stroke and fill ellipse
gfx.DrawEllipse(properties.Pen2.Pen, properties.Brush2.Brush, new RectangleF(50, 500, 450, 150));
// Stroke circle
gfx.DrawEllipse(properties.Pen2.Pen, new XRect(100, 200, 400, 400));
#if DEBUG
int count = 360;
XPoint[] circle = new XPoint[count];
for (int idx = 0; idx < count; idx++)
{
double rad = idx * 2 * Math.PI / count;
circle[idx].X = Math.Cos(rad) * 200 + 300;
circle[idx].Y = Math.Sin(rad) * 200 + 400;
}
gfx.DrawPolygon(properties.Pen3.Pen, circle);
#endif
}
示例8: XRect
/// <summary>
/// Initializes a new instance of the XRect class.
/// </summary>
public XRect(XPoint location, XSize size)
{
this.x = location.X;
this.y = location.Y;
this.width = size.Width;
this.height = size.Height;
}
示例9: XLinearGradientBrush
/// <summary>
/// Initializes a new instance of the <see cref="XLinearGradientBrush"/> class.
/// </summary>
public XLinearGradientBrush(XPoint point1, XPoint point2, XColor color1, XColor color2)
{
this.point1 = point1;
this.point2 = point2;
this.color1 = color1;
this.color2 = color2;
}
示例10: XRect
/// <summary>
/// Initializes a new instance of the XRect class.
/// </summary>
public XRect(XPoint point1, XPoint point2)
{
this.x = Math.Min(point1.x, point2.x);
this.y = Math.Min(point1.y, point2.y);
this.width = Math.Max((double)(Math.Max(point1.x, point2.x) - this.x), 0);
this.height = Math.Max((double)(Math.Max(point1.y, point2.y) - this.y), 0);
}
示例11: Draw
/// <summary>
/// Draws the content of the area plot area.
/// </summary>
internal override void Draw()
{
ChartRendererInfo cri = (ChartRendererInfo)this.rendererParms.RendererInfo;
XRect plotAreaRect = cri.plotAreaRendererInfo.Rect;
if (plotAreaRect.IsEmpty)
return;
XGraphics gfx = this.rendererParms.Graphics;
XGraphicsState state = gfx.Save();
//gfx.SetClip(plotAreaRect, XCombineMode.Intersect);
gfx.IntersectClip(plotAreaRect);
XMatrix matrix = cri.plotAreaRendererInfo.matrix;
double xMajorTick = cri.xAxisRendererInfo.MajorTick;
foreach (SeriesRendererInfo sri in cri.seriesRendererInfos)
{
int count = sri.series.Elements.Count;
XPoint[] points = new XPoint[count + 2];
points[0] = new XPoint(xMajorTick / 2, 0);
for (int idx = 0; idx < count; idx++)
{
double pointValue = sri.series.Elements[idx].Value;
if (double.IsNaN(pointValue))
pointValue = 0;
points[idx + 1] = new XPoint(idx + xMajorTick / 2, pointValue);
}
points[count + 1] = new XPoint(count - 1 + xMajorTick / 2, 0);
matrix.TransformPoints(points);
gfx.DrawPolygon(sri.LineFormat, sri.FillFormat, points, XFillMode.Winding);
}
//gfx.ResetClip();
gfx.Restore(state);
}
示例12: Pagel
public Pagel(Pagel parent, XRect percetileRectangle)
{
parent.AddChild(this);
this.minPoint = new XPoint(parent.Rectangle.X * percetileRectangle.X, parent.Rectangle.Y * percetileRectangle.Y);
this.maxPoint = minPoint + new XPoint(parent.Rectangle.Width * percetileRectangle.Width,
parent.Rectangle.Height * percetileRectangle.Height);
this.Rectangle = new XRect(minPoint, maxPoint);
}
示例13: GetPentagram
/// <summary>
/// Gets a five-pointed star with the specified size and center.
/// </summary>
public static XPoint[] GetPentagram(double size, XPoint center)
{
XPoint[] points = Pentagram.Clone() as XPoint[];
for (int idx = 0; idx < 5; idx++)
{
points[idx].X = points[idx].X * size + center.X;
points[idx].Y = points[idx].Y * size + center.Y;
}
return points;
}
示例14: DrawBarCharts
public void DrawBarCharts(XGraphics gfx)
{
XPoint backgroundPoint = new XPoint(20, page_.Height * 0.55);
XRect backgroundRect = new XRect(backgroundPoint.X, backgroundPoint.Y, page_.Width - 40, page_.Height * 0.425);
double quarterRectWidth = backgroundRect.Width * 0.25;
double offset = quarterRectWidth * 0.25;
DrawingUtil.DrawOutlineRect(backgroundRect, gfx, new XSize(40,40));
gfx.DrawRoundedRectangle(new XSolidBrush(XColor.FromKnownColor(XKnownColor.Gray)),
backgroundRect,
new XSize(40, 40));
DoubleBar ShoulderFlexionBar = new DoubleBar(userParameters_[dataReadStart + 4], userParameters_[dataReadStart + 9], gfx);
ShoulderFlexionBar.Draw(new XPoint(quarterRectWidth - offset, backgroundPoint.Y + 20),
backgroundRect,
XImage.FromFile(Directory.GetCurrentDirectory() + @"\Content\DOS.png"));
DoubleBar hipFlexionBar = new DoubleBar(userParameters_[dataReadStart + 5], userParameters_[dataReadStart + 10], gfx);
hipFlexionBar.Draw(new XPoint(quarterRectWidth * 2 - offset, backgroundPoint.Y + 20),
backgroundRect,
XImage.FromFile(Directory.GetCurrentDirectory() + @"\Content\DOS.png"));
DoubleBar kneeFlexionBar = new DoubleBar(userParameters_[dataReadStart + 6], userParameters_[dataReadStart + 11], gfx);
kneeFlexionBar.Draw(new XPoint(quarterRectWidth * 3 - offset, backgroundPoint.Y + 20),
backgroundRect,
XImage.FromFile(Directory.GetCurrentDirectory() + @"\Content\DOS.png"));
DoubleBar ankleFlexionBar = new DoubleBar(userParameters_[dataReadStart + 7], userParameters_[dataReadStart + 12], gfx);
ankleFlexionBar.Draw(new XPoint(quarterRectWidth * 4 - offset, backgroundPoint.Y + 20),
backgroundRect,
XImage.FromFile(Directory.GetCurrentDirectory() + @"\Content\DOS.png"));
gfx.DrawString("Degrees :",
new XFont("Arial", 10),
XBrushes.Black,
(backgroundPoint + new XPoint(0, 20)) + new XPoint(backgroundRect.Width * 0.05, backgroundRect.Height * 0.05),
XStringFormats.Center);
gfx.DrawString("LSI % :",
new XFont("Arial", 10),
XBrushes.Black,
(backgroundPoint + new XPoint(0, 20)) + new XPoint(backgroundRect.Width * 0.05, backgroundRect.Height * 0.125),
XStringFormats.Center);
XPoint top = new XPoint(backgroundPoint.X, backgroundPoint.Y + backgroundRect.Height * 0.2);
XPoint bottom = new XPoint(backgroundPoint.X, backgroundPoint.Y + backgroundRect.Height * 0.8);
for (int i = 11; i > 0; i--)
{
float increment = -i * 0.1f;
XPoint percentagePoint = DrawingUtil.Instance.Interpolate(top, bottom, increment);
percentagePoint = new XPoint(percentagePoint.X, Math.Floor(percentagePoint.Y));
gfx.DrawString(((11 - i) * 10).ToString() + "%", new XFont("Arial", 8), XBrushes.Black, percentagePoint + new XPoint(5, -2));
gfx.DrawLine(XPens.LightGray, percentagePoint, percentagePoint + new XPoint(backgroundRect.Width, 0));
}
}
示例15: CreateCurveSegment
/// <summary>
/// Appends a Bézier segment from a curve.
/// </summary>
public static BezierSegment CreateCurveSegment(XPoint pt0, XPoint pt1, XPoint pt2, XPoint pt3, double tension3)
{
#if !SILVERLIGHT
return new BezierSegment(
new System.Windows.Point(pt1.X + tension3 * (pt2.X - pt0.X), pt1.Y + tension3 * (pt2.Y - pt0.Y)),
new System.Windows.Point(pt2.X - tension3 * (pt3.X - pt1.X), pt2.Y - tension3 * (pt3.Y - pt1.Y)),
new System.Windows.Point(pt2.X, pt2.Y), true);
#else
return new BezierSegment(); // AGHACK
#endif
}