# Annotation

<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->

Use annotation to draw over shared content. Both the user who is sharing and viewers can annotate during screen sharing.

## Set up annotation

To check whether annotation is available, call `isAnnotationFeatureSupport` on the share helper. If you are the share owner, you can control whether viewers may annotate with `disableViewerAnnotation`.

```cpp
IZoomVideoSDKShareHelper* pShareHelper = m_pVideoSDK->getShareHelper();

// Check whether the annotation feature is supported.
bool isSupported = pShareHelper->isAnnotationFeatureSupport();

// As the share owner, enable or disable annotation for viewers.
pShareHelper->disableViewerAnnotation(false);
```

If annotation is supported, set up [screen sharing](/docs/video-sdk/linux/share/) before continuing.

## Start and stop annotation

To annotate, a viewer must first subscribe to a shared view, then pass the same view to `createAnnotationHelper` on the share helper to create an `IZoomVideoSDKAnnotationHelper`.

```cpp
// Subscribe to the user's share pipe and render it into your view.
IZoomVideoSDKShareAction* pShareAction = pUser->getShareActionList()->GetItem(0);
IZoomVideoSDKRawDataPipe* pSharePipe = pShareAction->getSharePipe();
if (!pSharePipe) return;
pSharePipe->subscribe(ZoomVideoSDKResolution_Auto, this);

// The window handle identifies an X11 window in the form:
//   hostname:display_number-screen_number(x, y, width, height)-winid
const char* hwndChar = ":0-0(0,0,1920,1080)-34563456";
void* hwnd = reinterpret_cast<void*>(const_cast<char*>(hwndChar));

// Create the annotation helper from the same view.
IZoomVideoSDKAnnotationHelper* pAnnotationHelper = m_pVideoSDK->getShareHelper()->createAnnotationHelper(hwnd);
if (pAnnotationHelper) {
    pAnnotationHelper->startAnnotation();
    // To stop annotation later:
    pAnnotationHelper->stopAnnotation();
}
```

## Annotation tools

Select a drawing tool with `setToolType`. The full list of tools is defined on `ZoomVideoSDKAnnotationToolType`.

```cpp
// Get or set the tool type.
pAnnotationHelper->getToolType(toolType);
pAnnotationHelper->setToolType(ZoomVideoSDKAnnotationToolType_Pen);

// Get or set the tool color (unsigned long).
pAnnotationHelper->getToolColor(color);
pAnnotationHelper->setToolColor(color);

// Get or set the tool width (long).
pAnnotationHelper->getToolWidth(lineWidth);
pAnnotationHelper->setToolWidth(lineWidth);
```

`ZoomVideoSDKAnnotationToolType` includes the following values.

-   `ZoomVideoSDKAnnotationToolType_None`
-   `ZoomVideoSDKAnnotationToolType_Pen`
-   `ZoomVideoSDKAnnotationToolType_HighLighter`
-   `ZoomVideoSDKAnnotationToolType_AutoLine`
-   `ZoomVideoSDKAnnotationToolType_AutoRectangle`
-   `ZoomVideoSDKAnnotationToolType_AutoEllipse`
-   `ZoomVideoSDKAnnotationToolType_AutoArrow`
-   `ZoomVideoSDKAnnotationToolType_AutoRectangleFill`
-   `ZoomVideoSDKAnnotationToolType_AutoEllipseFill`
-   `ZoomVideoSDKAnnotationToolType_SpotLight`
-   `ZoomVideoSDKAnnotationToolType_Arrow`
-   `ZoomVideoSDKAnnotationToolType_ERASER`
-   `ZoomVideoSDKAnnotationToolType_Textbox`
-   `ZoomVideoSDKAnnotationToolType_Picker`

For the full set, including the auto-stamp and vanishing-pen variants, see the `IZoomVideoSDKAnnotationHelper` reference.

## Other annotation methods

You can undo or redo annotations, and clear all annotations, just your own, or just others' annotations.

```cpp
pAnnotationHelper->undo();
pAnnotationHelper->redo();
pAnnotationHelper->clear(ZoomVideoSDKAnnotationClearType_All);
```

`clear` takes one of the following values.

-   `ZoomVideoSDKAnnotationClearType_All`
-   `ZoomVideoSDKAnnotationClearType_My`
-   `ZoomVideoSDKAnnotationClearType_Others`

## Destroy annotation

When annotation is no longer required, destroy the helper with `destroyAnnotationHelper` on the share helper.

```cpp
m_pVideoSDK->getShareHelper()->destroyAnnotationHelper(pAnnotationHelper);
```
