The[Ink API](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0-alpha01)is modularized, so you can use only what you need.

## Strokes

The[Strokes](https://developer.android.com/reference/kotlin/androidx/ink/strokes/package-summary)module serves as the foundation of the Ink library, offering the primary API interface and containing the core data types for interacting with the library. Key data types within this module include:

- [**`StrokeInputBatch`**](https://developer.android.com/reference/kotlin/androidx/ink/strokes/StrokeInputBatch): Represents a series of pointer inputs, encompassing position, timestamp, and optionally pressure, tilt, and orientation. This data can be utilized with the[`Stroke`](https://developer.android.com/reference/kotlin/androidx/ink/strokes/Stroke)or[`InProgressStroke`](https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke)classes, and is the type that would provide the inputs for a handwriting recognition library.
- [**`Stroke`**](https://developer.android.com/reference/kotlin/androidx/ink/strokes/Stroke): An immutable representation of a finalized stroke with fixed geometry. Stroke comprises an[`ImmutableStrokeInputBatch`](https://developer.android.com/reference/kotlin/androidx/ink/strokes/ImmutableStrokeInputBatch)(input points), a[`Brush`](https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush)(styling), and a[`PartitionedMesh`](https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh)(geometric shape). Strokes can be stored, manipulated, and rendered within your application.
- [**`InProgressStroke`**](https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke): A mutable counterpart to[`Stroke`](https://developer.android.com/reference/kotlin/androidx/ink/strokes/Stroke)designed for incremental input handling and real-time rendering during the drawing process. While often used indirectly through[`InProgressStrokesView`](https://developer.android.com/reference/kotlin/androidx/ink/authoring/InProgressStrokesView),[`InProgressStroke`](https://developer.android.com/reference/kotlin/androidx/ink/strokes/InProgressStroke)can be leveraged directly for advanced customization.

## Geometry

The[Geometry](https://developer.android.com/reference/kotlin/androidx/ink/geometry/package-summary)module provides a suite of geometry primitives for both basic and complex shapes along with operations for intersection detection and transformations. These primitives seamlessly integrate with Ink strokes, empowering you to build features like whole-stroke erasers and marquee selection tools.

While classes like[`Box`](https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box)and[`Vec`](https://developer.android.com/reference/kotlin/androidx/ink/geometry/Vec)primarily facilitate geometric operations,[`PartitionedMesh`](https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh)may also include rendering-specific data.

## Brush

The[Brush](https://developer.android.com/reference/kotlin/androidx/ink/brush/package-summary)module acts as a declarative configuration for stroke creation and rendering, functioning similarly to a text font. A[`Brush`](https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush)object ha the following properties:

- **Color**: Can be a solid color or the foundation for layered effects and textures.
- **Size**: Can be fixed or serve as a base for dynamic size adjustments.
- **Family**: Analogous to a text typeface, family defines the stroke's overall style.
- **Epsilon**: Controls the level of detail in the stroke's vector geometry, representing the smallest unit of visual distinction.

The[`epsilon`](https://developer.android.com/reference/kotlin/androidx/ink/brush/Brush#epsilon())property plays a crucial role in defining the precision of your coordinate system. More guidance is provided in the[Brush APIs](https://developer.android.com/develop/ui/compose/touch-input/stylus-input/ink-api-modules?tab=t.0#heading=h.j5tn81xa7fph)section on how to choose an appropriate epsilon value.

The[`BrushFamily`](https://developer.android.com/reference/kotlin/androidx/ink/brush/BrushFamily)serves as a powerful configuration for creating expressive strokes without delving into complex geometry or rendering code. The library provides a set of predefined[`StockBrushes`](https://developer.android.com/reference/kotlin/androidx/ink/brush/StockBrushes), including a pressure-sensitive pen, highlighter, and marker.

## Authoring

The[`Authoring`](https://developer.android.com/reference/kotlin/androidx/ink/authoring/package-summary)module enables developers to capture user touch input and render it as low-latency strokes on the screen in real-time. This is achieved through the[`InProgressStrokesView`](https://developer.android.com/reference/kotlin/androidx/ink/authoring/InProgressStrokesView)class, which processes motion events and visualizes the strokes as they're drawn.

Once a stroke is completed, the module notifies the client application using the[`onStrokesFinished()`](https://developer.android.com/reference/kotlin/androidx/ink/authoring/InProgressStrokesFinishedListener#onStrokesFinished(kotlin.collections.Map))callback of[`InProgressStrokesFinishedListener`](https://developer.android.com/reference/kotlin/androidx/ink/authoring/InProgressStrokesFinishedListener). The callback allows the application to retrieve the finished stroke data for rendering or storage.

## Rendering

The Rendering module simplifies the process of drawing ink strokes onto an Android[`Canvas`](https://developer.android.com/reference/kotlin/android/graphics/Canvas). The module provides a[`CanvasStrokeRenderer`](https://developer.android.com/reference/androidx/ink/rendering/android/canvas/CanvasStrokeRenderer)for Compose and[`ViewStrokeRenderer`](https://developer.android.com/reference/androidx/ink/rendering/android/view/ViewStrokeRenderer)for view-based layouts, both of which optimize rendering performance and ensure high-quality visuals, including anti-aliasing.

To render strokes to a canvas, obtain a[`CanvasStrokeRenderer`](https://developer.android.com/reference/kotlin/androidx/ink/rendering/android/canvas/CanvasStrokeRenderer)instance using the[`create()`](https://developer.android.com/reference/kotlin/androidx/ink/rendering/android/canvas/CanvasStrokeRenderer#create())method. Then, use the[`draw()`](https://developer.android.com/reference/kotlin/androidx/ink/rendering/android/canvas/CanvasStrokeRenderer#draw(android.graphics.Canvas,androidx.ink.strokes.InProgressStroke,androidx.ink.geometry.AffineTransform))method to render either finished or in-progress strokes. strokes onto a canvas.

The canvas can be transformed (panned, zoomed, or rotated) as part of drawing the stroke, but to make sure the stroke looks its best drawn on screen, the transform applied to the canvas must also be passed to`CanvasStrokeRenderer#draw()`. To avoid needing to keep track of this separately, use[`ViewStrokeRenderer`](https://developer.android.com/reference/kotlin/androidx/ink/rendering/android/view/ViewStrokeRenderer)instead.