# GraphicState Class

> The graphic state is an internal data structure in a PDF file.

- Product: Adobe PDF Library 21
- Language: Modern C++
- Version: 21.4.0
- HTML page: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/GraphicState
- Version index: https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/llms.txt

```cpp
class GraphicState
```

**Namespace:** `datalogics_interface`

## Description

The graphic state is an internal data structure in a PDF file.

The graphics state holds the parameters that describe graphics within that file.

These parameters define how individual graphics are presented on the page, including layers and transparencies.

**Referenced by:** [`Form`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Form.md), [`Image`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Image.md), [`Path`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Path.md), [`TextRun`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/TextRun.md)

**Uses types:** [`Color`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Color.md), [`LineCap`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/LineCap.md), [`LineJoin`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/LineJoin.md), [`RenderIntent`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/RenderIntent.md)

## Constructors

### GraphicState

```cpp
datalogics_interface::GraphicState::GraphicState()
```

*constructor*

Create a new default GraphicState.

### GraphicState

```cpp
datalogics_interface::GraphicState::GraphicState(GraphicState &&) noexcept
```

*constructor*

**Parameters**

- (unnamed) ([`GraphicState &&`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/GraphicState.md))

### ~GraphicState

```cpp
datalogics_interface::GraphicState::~GraphicState()
```

*destructor*

## Methods

### clear_extended_graphic_state

```cpp
void datalogics_interface::GraphicState::clear_extended_graphic_state()
```

**Returns:** `void`

Removes the extended graphic state from this graphic state.

### get_dash_pattern

```cpp
std::vector< double > datalogics_interface::GraphicState::get_dash_pattern() const
```

**Returns:** `std::vector< double >`

A list containing the dash phase followed by the contents of the DashPattern.

The line DashPattern controls the pattern of dashes and gaps used to stroke paths. It is specified by a dash phase and then a series of elements of a DashPattern list. The DashPattern's members are numbers that specify the lengths of alternating dashes and gaps; the numbers must be nonnegative and not all zero. The dash phase specifies the distance into the dash pattern at which to start the dash. The elements of both the DashPattern List and the dash phase are expressed in user space units. This retrieves the DashPattern used by the Pattern list current graphic state.

### get_extended_graphic_state

```cpp
ExtendedGraphicState * datalogics_interface::GraphicState::get_extended_graphic_state()
```

**Returns:** [`ExtendedGraphicState *`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/ExtendedGraphicState.md)

The ExtendedGraphicState, or null if none is set.

The ExtendedGraphicState associated with this GraphicState.

The ExtendedGraphicState can contain additional parameters such as transparency, blend mode, and overprint settings that are not part of the basic GraphicState.

DeprecatedNot yet implemented — always returns nullptr

### get_fill_color

```cpp
Color datalogics_interface::GraphicState::get_fill_color() const
```

**Returns:** [`Color`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Color.md)

The current fill color.

The color used for filling operations in the current GraphicState.

### get_line_cap

```cpp
LineCap datalogics_interface::GraphicState::get_line_cap() const
```

**Returns:** [`LineCap`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/LineCap.md)

The current line cap style.

The line cap style used by the current GraphicState, specifying the shape at the ends of open subpaths when stroked.

### get_line_flatness

```cpp
double datalogics_interface::GraphicState::get_line_flatness() const
```

**Returns:** `double`

The current line flatness value.

The line flatness tolerance in the current GraphicState, corresponding to the i operator. Default is 1.0.

Flatness controls the maximum distance (in device pixels) between a curve and the flattened line segments that approximate it.

### get_line_join

```cpp
LineJoin datalogics_interface::GraphicState::get_line_join() const
```

**Returns:** [`LineJoin`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/LineJoin.md)

The current line join style.

The line join style used by the current GraphicState, specifying the shape at the corners where consecutive segments of a path connect at an angle.

### get_miter_limit

```cpp
double datalogics_interface::GraphicState::get_miter_limit() const
```

**Returns:** `double`

The current miter limit.

The miter limit for line joins in the current GraphicState, corresponding to the M operator. Default is 10.0.

When two line segments meet at a sharp angle and mitered joins have been specified, the miter limit controls when the join is beveled instead.

### get_render_intent

```cpp
RenderIntent datalogics_interface::GraphicState::get_render_intent() const
```

**Returns:** [`RenderIntent`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/RenderIntent.md)

The current rendering intent.

The color rendering intent for the current GraphicState, corresponding to the Intent key in the image dictionary. The default is RelColorimetric.

### get_stroke_color

```cpp
Color datalogics_interface::GraphicState::get_stroke_color() const
```

**Returns:** [`Color`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Color.md)

The current stroke color.

The color used for stroking operations in the current GraphicState.

### get_width

```cpp
double datalogics_interface::GraphicState::get_width() const
```

**Returns:** `double`

The current line width.

The line width used for stroking operations by the current GraphicState, in user space units.

### operator=

```cpp
GraphicState & datalogics_interface::GraphicState::operator=(GraphicState &&) noexcept
```

**Parameters**

- (unnamed) ([`GraphicState &&`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/GraphicState.md))

**Returns:** [`GraphicState &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/GraphicState.md)

### set_dash_pattern

```cpp
void datalogics_interface::GraphicState::set_dash_pattern(const std::vector< double > &pattern)
```

**Parameters**

- `pattern` (`const std::vector< double > &`): A list containing the dash phase followed by the contents of the DashPattern.

**Returns:** `void`

The line DashPattern controls the pattern of dashes and gaps used to stroke paths. It is specified by a dash phase and then a series of elements of a DashPattern list. The DashPattern's members are numbers that specify the lengths of alternating dashes and gaps; the numbers must be nonnegative and not all zero. The dash phase specifies the distance into the dash pattern at which to start the dash. The elements of both the DashPattern List and the dash phase are expressed in user space units. This retrieves the DashPattern used by the Pattern list current graphic state.

### set_extended_graphic_state

```cpp
void datalogics_interface::GraphicState::set_extended_graphic_state(const ExtendedGraphicState &egs)
```

**Parameters**

- `egs` ([`const ExtendedGraphicState &`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/ExtendedGraphicState.md)): The new ExtendedGraphicState, or null to remove it.

**Returns:** `void`

The ExtendedGraphicState associated with this GraphicState.

The ExtendedGraphicState can contain additional parameters such as transparency, blend mode, and overprint settings that are not part of the basic GraphicState.

**Note:** The GraphicState copies the EGS internally.

### set_fill_color

```cpp
void datalogics_interface::GraphicState::set_fill_color(Color color)
```

**Parameters**

- `color` ([`Color`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Color.md)): The new fill color.

**Returns:** `void`

The color used for filling operations in the current GraphicState.

The color may be specified in DeviceGray, DeviceRGB, or DeviceCMYK color spaces.

### set_line_cap

```cpp
void datalogics_interface::GraphicState::set_line_cap(LineCap cap)
```

**Parameters**

- `cap` ([`LineCap`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/LineCap.md)): The new line cap style.

**Returns:** `void`

The line cap style used by the current GraphicState, specifying the shape at the ends of open subpaths when stroked.

### set_line_flatness

```cpp
void datalogics_interface::GraphicState::set_line_flatness(double flatness)
```

**Parameters**

- `flatness` (`double`): The new flatness value.

**Returns:** `void`

The line flatness tolerance in the current GraphicState, corresponding to the i operator. Default is 1.0.

### set_line_join

```cpp
void datalogics_interface::GraphicState::set_line_join(LineJoin join)
```

**Parameters**

- `join` ([`LineJoin`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/LineJoin.md)): The new line join style.

**Returns:** `void`

The line join style to be used by the current GraphicState, specifying the shape at the corners where consecutive segments of a path connect at an angle.

### set_miter_limit

```cpp
void datalogics_interface::GraphicState::set_miter_limit(double limit)
```

**Parameters**

- `limit` (`double`): The new miter limit value.

**Returns:** `void`

The miter limit for line joins in the current GraphicState, corresponding to the M operator. Default is 10.0.

### set_render_intent

```cpp
void datalogics_interface::GraphicState::set_render_intent(RenderIntent intent)
```

**Parameters**

- `intent` ([`RenderIntent`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/enum/RenderIntent.md)): The new rendering intent.

**Returns:** `void`

The color rendering intent for the current GraphicState, corresponding to the Intent key in the image dictionary. The default is RelColorimetric.

### set_stroke_color

```cpp
void datalogics_interface::GraphicState::set_stroke_color(Color color)
```

**Parameters**

- `color` ([`Color`](https://docs.datalogics.com/apdfl21/ModernCPP/21.4.0/class/Color.md)): The new stroke color.

**Returns:** `void`

The color used for stroking operations in the current GraphicState.

The color may be specified in DeviceGray, DeviceRGB, or DeviceCMYK color spaces.

### set_width

```cpp
void datalogics_interface::GraphicState::set_width(double width)
```

**Parameters**

- `width` (`double`): The new line width.

**Returns:** `void`

The line width used for stroking operations by the current GraphicState, in user space units.
