Click or drag to resize
DigitalRuneStrokedSegmentTParam, TPoint Class
Wraps a curve segment and determines whether it is stroked or not.
Inheritance Hierarchy
SystemObject
  DigitalRune.GraphicsStrokedSegmentTParam, TPoint
    DigitalRune.GraphicsStrokedSegment2F
    DigitalRune.GraphicsStrokedSegment3F

Namespace: DigitalRune.Graphics
Assembly: DigitalRune.Graphics (in DigitalRune.Graphics.dll) Version: 1.2.0.0 (1.2.1.14562)
Syntax
public class StrokedSegment<TParam, TPoint> : ICurve<TParam, TPoint>

Type Parameters

TParam
The type of the curve parameter (usually Single or Double).
TPoint
The type of the curve points (such as Vector2F, Vector3F, etc.).

The StrokedSegmentTParam, TPoint type exposes the following members.

Constructors
  NameDescription
Public methodStrokedSegmentTParam, TPoint(ICurveTParam, TPoint)
Initializes a new instance of the StrokedSegmentTParam, TPoint class with the specified stroked curve.
Public methodStrokedSegmentTParam, TPoint(ICurveTParam, TPoint, Boolean)
Initializes a new instance of the StrokedSegmentTParam, TPoint class.
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodFlatten
Computes the points of a sequence of line segments which approximate the curve.
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetLength
Computes the approximated length of the curve for the parameter interval [start, end].
Public methodGetPoint
Computes a point on the curve.
Public methodGetTangent
Computes the tangent for a point on the curve.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Properties
  NameDescription
Public propertyCurve
Gets or sets the curve.
Public propertyIsStroked
Gets or sets a value indicating whether this curve segment is stroked.
Top
Remarks
Curve segments within a PathFigure2F are stroked by default. The StrokedSegmentTParam, TPoint is a decorator that wraps another curve and adds an annotation that defines whether the curve is stroke or not.
Examples

The following example creates rectangles where all or only some edges are stroked:

C#
// Box where all edges are stroked. (Curve segments are stroked by default.)
var boxFigure1 = new PathFigure2F
{
  Segments =
  {
    new LineSegment2F { Point1 = new Vector2F(0, 0), Point2 = new Vector2F(0, 1) },
    new LineSegment2F { Point1 = new Vector2F(0, 1), Point2 = new Vector2F(1, 1) },
    new LineSegment2F { Point1 = new Vector2F(1, 1), Point2 = new Vector2F(1, 0) },
    new LineSegment2F { Point1 = new Vector2F(1, 0), Point2 = new Vector2F(0, 0) }
  }
};
var figureNode1 = new FigureNode(boxFigure1)
{
  StrokeColor = new Vector3F(0, 0, 0),
  StrokeThickness = 2,
  FillColor = new Vector3F(0.5f, 0.5f, 0.5f)
};

// Box where top and bottom edges are stroked.
var boxFigure2 = new PathFigure2F
{
  Segments =
  {
    new StrokedSegment2F(
      new LineSegment2F { Point1 = new Vector2F(0, 0), Point2 = new Vector2F(0, 1) }, 
      false),
    new LineSegment2F { Point1 = new Vector2F(0, 1), Point2 = new Vector2F(1, 1) },
    new StrokedSegment2F(
      new LineSegment2F { Point1 = new Vector2F(1, 1), Point2 = new Vector2F(1, 0) }, 
      false),
    new LineSegment2F { Point1 = new Vector2F(1, 0), Point2 = new Vector2F(0, 0) }
  }
};
var figureNode2 = new FigureNode(boxFigure2)
{
  StrokeColor = new Vector3F(0, 0, 0),
  StrokeThickness = 2,
  FillColor = new Vector3F(0.5f, 0.5f, 0.5f)
};
See Also