# CD2DGeometrySink Class

A wrapper for ID2D1GeometrySink.

## Syntax

```
class CD2DGeometrySink;
```

## Members

### Public Constructors

Name | Description |
---|---|

CD2DGeometrySink::CD2DGeometrySink | Constructs a CD2DGeometrySink object from CD2DPathGeometry object. |

CD2DGeometrySink::~CD2DGeometrySink | The destructor. Called when a D2D geometry sink object is being destroyed. |

### Public Methods

Name | Description |
---|---|

CD2DGeometrySink::AddArc | Adds a single arc to the path geometry |

CD2DGeometrySink::AddBezier | Creates a cubic Bezier curve between the current point and the specified end point. |

CD2DGeometrySink::AddBeziers | Creates a sequence of cubic Bezier curves and adds them to the geometry sink. |

CD2DGeometrySink::AddLine | Creates a line segment between the current point and the specified end point and adds it to the geometry sink. |

CD2DGeometrySink::AddLines | Creates a sequence of lines using the specified points and adds them to the geometry sink. |

CD2DGeometrySink::AddQuadraticBezier | Creates a quadratic Bezier curve between the current point and the specified end point. |

CD2DGeometrySink::AddQuadraticBeziers | Adds a sequence of quadratic Bezier segments as an array in a single call. |

CD2DGeometrySink::BeginFigure | Starts a new figure at the specified point. |

CD2DGeometrySink::Close | Closes the geometry sink |

CD2DGeometrySink::EndFigure | Ends the current figure; optionally, closes it. |

CD2DGeometrySink::Get | Returns ID2D1GeometrySink interface |

CD2DGeometrySink::IsValid | Checks geometry sink validity |

CD2DGeometrySink::SetFillMode | Specifies the method used to determine which points are inside the geometry described by this geometry sink and which points are outside. |

CD2DGeometrySink::SetSegmentFlags | Specifies stroke and join options to be applied to new segments added to the geometry sink. |

### Public Operators

Name | Description |
---|---|

CD2DGeometrySink::operator ID2D1GeometrySink* | Returns ID2D1GeometrySink interface |

### Protected Data Members

Name | Description |
---|---|

CD2DGeometrySink::m_pSink | A pointer to an ID2D1GeometrySink. |

## Inheritance Hierarchy

`CD2DGeometrySink`

## Requirements

**Header:** afxrendertarget.h

## CD2DGeometrySink::~CD2DGeometrySink

The destructor. Called when a D2D geometry sink object is being destroyed.

```
virtual ~CD2DGeometrySink();
```

## CD2DGeometrySink::AddArc

Adds a single arc to the path geometry

```
void AddArc(const D2D1_ARC_SEGMENT& arc);
```

### Parameters

*arc*

The arc segment to add to the figure

## CD2DGeometrySink::AddBezier

Creates a cubic Bezier curve between the current point and the specified end point.

```
void AddBezier(const D2D1_BEZIER_SEGMENT& bezier);
```

### Parameters

*bezier*

A structure that describes the control points and end point of the Bezier curve to add.

## CD2DGeometrySink::AddBeziers

Creates a sequence of cubic Bezier curves and adds them to the geometry sink.

```
void AddBeziers(
const CArray<D2D1_BEZIER_SEGMENT,
D2D1_BEZIER_SEGMENT>& beziers);
```

### Parameters

*beziers*

An array of Bezier segments that describes the Bezier curves to create. A curve is drawn from the geometry sink's current point (the end point of the last segment drawn or the location specified by BeginFigure) to the end point of the first Bezier segment in the array. if the array contains additional Bezier segments, each subsequent Bezier segment uses the end point of the preceding Bezier segment as its start point.

## CD2DGeometrySink::AddLine

Creates a line segment between the current point and the specified end point and adds it to the geometry sink.

```
void AddLine(CD2DPointF point);
```

### Parameters

*point*

The end point of the line to draw.

## CD2DGeometrySink::AddLines

Creates a sequence of lines using the specified points and adds them to the geometry sink.

```
void AddLines(
const CArray<CD2DPointF,
CD2DPointF>& points);
```

### Parameters

*points*

An array of one or more points that describe the lines to draw. A line is drawn from the geometry sink's current point (the end point of the last segment drawn or the location specified by BeginFigure) to the first point in the array. if the array contains additional points, a line is drawn from the first point to the second point in the array, from the second point to the third point, and so on. An array of a sequence of the end points of the lines to draw.

## CD2DGeometrySink::AddQuadraticBezier

Creates a quadratic Bezier curve between the current point and the specified end point.

```
void AddQuadraticBezier(const D2D1_QUADRATIC_BEZIER_SEGMENT& bezier);
```

### Parameters

*bezier*

A structure that describes the control point and the end point of the quadratic Bezier curve to add.

## CD2DGeometrySink::AddQuadraticBeziers

Adds a sequence of quadratic Bezier segments as an array in a single call.

```
void AddQuadraticBeziers(
const CArray<D2D1_QUADRATIC_BEZIER_SEGMENT,
D2D1_QUADRATIC_BEZIER_SEGMENT>& beziers);
```

### Parameters

*beziers*

An array of a sequence of quadratic Bezier segments.

## CD2DGeometrySink::BeginFigure

Starts a new figure at the specified point.

```
void BeginFigure(
CD2DPointF startPoint,
D2D1_FIGURE_BEGIN figureBegin);
```

### Parameters

*startPoint*

The point at which to begin the new figure.

*figureBegin*

Whether the new figure should be hollow or filled.

## CD2DGeometrySink::CD2DGeometrySink

Constructs a CD2DGeometrySink object from CD2DPathGeometry object.

```
CD2DGeometrySink(CD2DPathGeometry& pathGeometry);
```

### Parameters

*pathGeometry*

An existing CD2DPathGeometry object.

## CD2DGeometrySink::Close

Closes the geometry sink

```
BOOL Close();
```

### Return Value

Nonzero if successful; otherwise FALSE.

## CD2DGeometrySink::EndFigure

Ends the current figure; optionally, closes it.

```
void EndFigure(D2D1_FIGURE_END figureEnd);
```

### Parameters

*figureEnd*

A value that indicates whether the current figure is closed. If the figure is closed, a line is drawn between the current point and the start point specified by BeginFigure.

## CD2DGeometrySink::Get

Returns ID2D1GeometrySink interface

```
ID2D1GeometrySink* Get();
```

### Return Value

Pointer to an ID2D1GeometrySink interface or NULL if object is not initialized yet.

## CD2DGeometrySink::IsValid

Checks geometry sink validity

```
BOOL IsValid() const;
```

### Return Value

TRUE if geometry sink is valid; otherwise FALSE.

## CD2DGeometrySink::m_pSink

A pointer to an ID2D1GeometrySink.

```
ID2D1GeometrySink* m_pSink;
```

## CD2DGeometrySink::operator ID2D1GeometrySink*

Returns ID2D1GeometrySink interface

```
operator ID2D1GeometrySink*();
```

### Return Value

Pointer to an ID2D1GeometrySink interface or NULL if object is not initialized yet.

## CD2DGeometrySink::SetFillMode

Specifies the method used to determine which points are inside the geometry described by this geometry sink and which points are outside.

```
void SetFillMode(D2D1_FILL_MODE fillMode);
```

### Parameters

*fillMode*

The method used to determine whether a given point is part of the geometry.

## CD2DGeometrySink::SetSegmentFlags

Specifies stroke and join options to be applied to new segments added to the geometry sink.

```
void SetSegmentFlags(D2D1_PATH_SEGMENT vertexFlags);
```

### Parameters

*vertexFlags*

Stroke and join options to be applied to new segments added to the geometry sink.

## See also

## Feedback

Send feedback about:

Loading feedback...