本文整理汇总了C#中LilyPath.Pen类的典型用法代码示例。如果您正苦于以下问题:C# Pen类的具体用法?C# Pen怎么用?C# Pen使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Pen类属于LilyPath命名空间,在下文中一共展示了Pen类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GraphicsPathTest
public GraphicsPathTest()
{
_thickPen = new Pen(Microsoft.Xna.Framework.Color.Green, 15);
List<CCVector2> path1 = new List<CCVector2>() {
new CCVector2(50, 50), new CCVector2(100, 50), new CCVector2(100, 100), new CCVector2(50, 100),
};
_gpathf = new GraphicsPath(_thickPen, path1, PathType.Closed);
path1.Reverse();
for (int i = 0; i < path1.Count; i++)
path1[i] = new CCVector2(path1[i].X + 100, path1[i].Y);
_gpathr = new GraphicsPath(_thickPen, path1, PathType.Closed);
for (int i = 0; i < path1.Count; i++)
path1[i] = new CCVector2(path1[i].X, path1[i].Y + 100);
_gpath2r = new GraphicsPath(_thickPen, path1);
path1.Reverse();
for (int i = 0; i < path1.Count; i++)
path1[i] = new CCVector2(path1[i].X - 100, path1[i].Y);
_gpath2f = new GraphicsPath(_thickPen, path1);
}
示例2: InitializePaths
private void InitializePaths()
{
var bounds = VisibleBoundsWorldspace;
var center = bounds.Center;
//var center = new CCVector2(200, 200);
Pen lilypadPen = new Pen(CCColor4B.Green, 15)
{
Alignment = PenAlignment.Center
};
_lilypadPath = BuildLillyPad(center, 150, 0);
_lilypadStroke = _lilypadPath.Stroke(lilypadPen, PathType.Closed);
Pen outerFlowerPen = new Pen(CCColor4B.White * 0.75f, 15)
{
Alignment = PenAlignment.Outset
};
_outerFlowerStroke = BuildFlower(center, 8, 120, 100, (float)(Math.PI / 8)).Stroke(outerFlowerPen, PathType.Closed);
Pen innerFlowerPen = new Pen(Microsoft.Xna.Framework.Color.MediumPurple * 0.5f, 10)
{
Alignment = PenAlignment.Outset
};
_innerFlowerStroke = BuildFlower(center, 16, 105, 60, 0).Stroke(innerFlowerPen, PathType.Closed);
}
示例3: Setup
public override void Setup (GraphicsDevice device)
{
_thickPen = new Pen(Color.Green, 15);
List<Vector2> path1 = new List<Vector2>() {
new Vector2(50, 50), new Vector2(100, 50), new Vector2(100, 100), new Vector2(50, 100),
};
_gpathf = new GraphicsPath(_thickPen, path1, PathType.Closed);
path1.Reverse();
for (int i = 0; i < path1.Count; i++)
path1[i] = new Vector2(path1[i].X + 100, path1[i].Y);
_gpathr = new GraphicsPath(_thickPen, path1, PathType.Closed);
for (int i = 0; i < path1.Count; i++)
path1[i] = new Vector2(path1[i].X, path1[i].Y + 100);
_gpath2r = new GraphicsPath(_thickPen, path1);
path1.Reverse();
for (int i = 0; i < path1.Count; i++)
path1[i] = new Vector2(path1[i].X - 100, path1[i].Y);
_gpath2f = new GraphicsPath(_thickPen, path1);
}
示例4: DisposeManaged
protected override void DisposeManaged()
{
if (_data != null) {
_data.FillInvalidated -= HandleFillInvalidated;
_data.FillGlowInvalidated -= HandleFillGlowInvalidated;
_data.OutlineInvalidated -= HandleOutlineInvalidated;
_data.OutlineGlowInvalidated -= HandleOutlineGlowInvalidated;
_data = null;
}
if (_fillBrush != null) {
_fillBrush.Dispose();
_fillBrush = null;
}
if (_fillGlowBrush != null) {
_fillGlowBrush.Dispose();
_fillGlowBrush = null;
}
if (_outlinePen != null) {
_outlinePen.Dispose();
_outlinePen = null;
}
if (_outlineGlowPen != null) {
_outlineGlowPen.Dispose();
_outlineGlowPen = null;
}
base.DisposeManaged();
}
示例5: Setup
public override void Setup (GraphicsDevice device)
{
_flatPen = new Pen(Color.Blue, 15) { StartCap = LineCap.Flat, EndCap = LineCap.Flat };
_squarePen = new Pen(Color.Red, 15) { StartCap = LineCap.Square, EndCap = LineCap.Square };
_trianglePen = new Pen(Color.Green, 15) { StartCap = LineCap.Triangle, EndCap = LineCap.Triangle };
_invTrianglePen = new Pen(Color.Purple, 15) { StartCap = LineCap.InvTriangle, EndCap = LineCap.InvTriangle };
_arrowPen = new Pen(Color.Orange, 15) { StartCap = LineCap.Arrow, EndCap = LineCap.Arrow };
}
示例6: WaterLilly
public WaterLilly()
{
Pen penOuterFlower = new Pen(Microsoft.Xna.Framework.Color.White * 0.75f, 15) { Alignment = PenAlignment.Outset };
_lilyOuterFlower = CreateFlowerGP(penOuterFlower, _origin, 8, 120, 100, (float)(Math.PI / 8));
Pen penInnerFlower = new Pen(Microsoft.Xna.Framework.Color.MediumPurple * 0.5f, 10) { Alignment = PenAlignment.Outset };
_lilyInnerFlower = CreateFlowerGP(penInnerFlower, _origin, 16, 105, 60, 0);
}
示例7: Setup
public override void Setup (GraphicsDevice device)
{
Pen penOuterFlower = new Pen(Color.White * 0.75f, 15) { Alignment = PenAlignment.Outset };
_lilyOuterFlower = CreateFlowerGP(penOuterFlower, _origin, 8, 120, 100, (float)(Math.PI / 8));
Pen penInnerFlower = new Pen(Color.MediumPurple * 0.5f, 10) { Alignment = PenAlignment.Outset };
_lilyInnerFlower = CreateFlowerGP(penInnerFlower, _origin, 16, 105, 60, 0);
}
示例8: LineCaps
public LineCaps()
{
_flatPen = new Pen(Microsoft.Xna.Framework.Color.Blue, 15) { StartCap = LineCap.Flat, EndCap = LineCap.Flat };
_squarePen = new Pen(Microsoft.Xna.Framework.Color.Red, 15) { StartCap = LineCap.Square, EndCap = LineCap.Square };
_trianglePen = new Pen(Microsoft.Xna.Framework.Color.Green, 15) { StartCap = LineCap.Triangle, EndCap = LineCap.Triangle };
_invTrianglePen = new Pen(Microsoft.Xna.Framework.Color.Purple, 15) { StartCap = LineCap.InvTriangle, EndCap = LineCap.InvTriangle };
_arrowPen = new Pen(Microsoft.Xna.Framework.Color.Orange, 15) { StartCap = LineCap.Arrow, EndCap = LineCap.Arrow };
}
示例9: Setup
public override void Setup (GraphicsDevice device)
{
_gradWidth = new GradientPen(Color.Lime, Color.Blue, 15);
_gradLength = new PathGradientPen(Color.Lime, Color.Blue, 15);
PathBuilder pathBuilder = new PathBuilder() { CalculateLengths = true };
pathBuilder.AddPath(StarPoints(new Vector2(325, 75), 5, 50, 25, 0, false));
_widthStar = pathBuilder.Stroke(_gradWidth, PathType.Open);
_lengthStar = pathBuilder.Stroke(_gradLength, Matrix.CreateTranslation(0, 125, 0), PathType.Open);
}
示例10: Initialize
public void Initialize (Rectangle bounds, float mag)
{
ColorPen = new Pen(new Color(rand.Next(255), rand.Next(255), rand.Next(255)));
for (int i = 0; i < Points.Length; i++) {
Points[i] = new Vector2(bounds.Left + (float)rand.NextDouble() * bounds.Width, bounds.Top + (float)rand.NextDouble() * bounds.Height);
Velocities[i] = new Vector2((float)(rand.NextDouble() - .5) * mag, (float)(rand.NextDouble() - .5) * mag);
for (int j = 0; j < History.Count; j++)
History[j][i] = Points[i];
}
}
示例11: Initialize
public void Initialize(CCRect bounds, float mag)
{
ColorPen = new Pen(new Microsoft.Xna.Framework.Color(rand.Next(255), rand.Next(255), rand.Next(255)));
for (int i = 0; i < Points.Length; i++)
{
Points[i] = new CCVector2(bounds.MinX + (float)rand.NextDouble() * bounds.Size.Width, bounds.MaxY + (float)rand.NextDouble() * bounds.Size.Height);
Velocities[i] = new CCVector2((float)(rand.NextDouble() - .5) * mag, (float)(rand.NextDouble() - .5) * mag);
for (int j = 0; j < History.Count; j++)
History[j][i] = Points[i];
}
}
示例12: CreateFlowerGP
private GraphicsPath CreateFlowerGP (Pen pen, Vector2 center, int petalCount, float petalLength, float petalWidth, float rotation)
{
List<Vector2> points = StarPoints(center, petalCount / 2, petalLength, petalLength, rotation, false);
PathBuilder builder = new PathBuilder();
builder.AddPoint(center);
foreach (Vector2 point in points) {
builder.AddArcByPoint(point, petalWidth / 2);
builder.AddArcByPoint(center, petalWidth / 2);
}
return builder.Stroke(pen, PathType.Closed);
}
示例13: GradientPens
public GradientPens()
{
_gradWidth = new GradientPen(Microsoft.Xna.Framework.Color.Lime, Microsoft.Xna.Framework.Color.Blue, 15);
_gradLength = new PathGradientPen(Microsoft.Xna.Framework.Color.Lime, Microsoft.Xna.Framework.Color.Blue, 15);
PathBuilder pathBuilder = new PathBuilder() { CalculateLengths = true };
pathBuilder.AddPath(StarPoints(new CCVector2(325, 75), 5, 50, 25, 0, false));
_widthStar = pathBuilder.Stroke(_gradWidth, PathType.Open);
_lengthStar = pathBuilder.Stroke(_gradLength,
CCAffineTransform.Translate(CCAffineTransform.Identity, 0, 125, 0),
PathType.Open);
}
示例14: OnEnter
public override void OnEnter()
{
var penWidth = 6.0f;
Pen pen = new Pen(new Microsoft.Xna.Framework.Color(Microsoft.Xna.Framework.Color.Blue, 92), penWidth);
var bounds = VisibleBoundsWorldspace;
var size = bounds.Size;
var width = size.Width - penWidth;
var height = size.Height - penWidth;
//_cache = new Grid(12, 10).Compile(pen, 3, 3, 30 * 12, 30 * 10);
_cache = new Grid(12, 10).Compile(pen, penWidth/2, penWidth/2, width, height);
base.OnEnter();
}
示例15: Setup
public override void Setup (GraphicsDevice device)
{
_gradWidthInner = new GradientPen(Color.Lime, Color.Cyan, 15) { Alignment = PenAlignment.Inset, StartCap = LineCap.Square, EndCap = LineCap.Square };
_gradWidthCenter = new GradientPen(Color.Lime, Color.Cyan, 15) { StartCap = LineCap.Square, EndCap = LineCap.Square };
_gradWidthOuter = new GradientPen(Color.Lime, Color.Cyan, 15) { Alignment = PenAlignment.Outset, StartCap = LineCap.Square, EndCap = LineCap.Square };
Pen[] pens = new Pen[] { _gradWidthInner, _gradWidthCenter, _gradWidthOuter };
for (int i = 0; i < _gPaths.Length; i++) {
PathBuilder builder = new PathBuilder();
foreach (Vector2 v in _baseCoords)
builder.AddPoint(v + Offset(i));
_gPaths[i] = builder.Stroke(pens[i]);
}
}