Skip to content

Brushes and tools

Module: byteink-kit. Conventions. Signatures and defaults follow the current source.

ViveBrushes

ViveBrushes

Families: marker, dashed-line, highlighter, pressure-pen, calligraphy-v1-p0 through p5. Unknown IDs render as pressure-pen; original metadata is preserved.

public object ViveBrushes

Source

ViveBrushes.MARKER

public const val MARKER: String = "marker"

Source

ViveBrushes.DASHED_LINE

public const val DASHED_LINE: String = "dashed-line"

Source

ViveBrushes.HIGHLIGHTER

public const val HIGHLIGHTER: String = "highlighter"

Source

ViveBrushes.PRESSURE_PEN

public const val PRESSURE_PEN: String = "pressure-pen"

Source

ViveBrushes.MAX_CALLIGRAPHY_PRESSURE

public const val MAX_CALLIGRAPHY_PRESSURE: Int = 5

Source

ViveBrushes.DEFAULT_CALLIGRAPHY_PRESSURE

public const val DEFAULT_CALLIGRAPHY_PRESSURE: Int = 3

Source

ViveBrushes.MAX_STABILIZATION

public const val MAX_STABILIZATION: Int = 5

Source

ViveBrushes.BRUSH_VERSION

public const val BRUSH_VERSION: Int = 1

Source

ViveBrushes.EPSILON

public const val EPSILON: Float = 0.25f

Source

ViveBrushes.calligraphy

public fun calligraphy(pressure: Int): String
Parameter Type Default Meaning
pressure Int Required Measured finite pressure in [0, 1], or null when unavailable; Int brush levels use 0–5.

Source

ViveBrushes.penFamilyId

public fun penFamilyId(solidLine: Boolean, fountain: Boolean, pressure: Int): String
Parameter Type Default Meaning
solidLine Boolean Required False selects the dashed family.
fountain Boolean Required True selects marker for a solid pen; false selects calligraphy.
pressure Int Required Measured finite pressure in [0, 1], or null when unavailable; Int brush levels use 0–5.

Source

ViveBrushes.inputModelFor

public fun inputModelFor(stabilization: Int): BrushFamily.InputModel
Parameter Type Default Meaning
stabilization Int Required Input-model level 0–5; tool constructors validate, catalog lookup clamps.

Source

ViveBrushes.family

public fun family(id: String, stabilization: Int): BrushFamily
Parameter Type Default Meaning
id String Required Stored brush family ID; unknown IDs fall back to pressure-pen.
stabilization Int Required Input-model level 0–5; tool constructors validate, catalog lookup clamps.

Source

ViveBrushes.brush

public fun brush(familyId: String, stabilization: Int, colorArgb: Int, size: Float): Brush
Parameter Type Default Meaning
familyId String Required Brush family ID; use ViveBrushes constants or calligraphy(level).
stabilization Int Required Input-model level 0–5; tool constructors validate, catalog lookup clamps.
colorArgb Int Required 32-bit ARGB including alpha; nullable drawing overrides use the brush color when null.
size Float Required Finite positive brush width in page/stroke units, at least epsilon.

Source

ViveBrushes.highlighter

public fun highlighter(colorArgb: Int, size: Float): Brush
Parameter Type Default Meaning
colorArgb Int Required 32-bit ARGB including alpha; nullable drawing overrides use the brush color when null.
size Float Required Finite positive brush width in page/stroke units, at least epsilon.

Source

ViveBrushes.eraseMask

public fun eraseMask(inputs: StrokeInputBatch, sizeDp: Float): Stroke
Parameter Type Default Meaning
inputs StrokeInputBatch Required Native input batch in page/stroke units, with ordered relative timestamps.
sizeDp Float Required Finite positive brush width or eraser diameter in page dp, at least epsilon.

Source

PenPreset

PenKind

Android pen kinds: Fountain and Calligraphy.

public enum class PenKind

Source

LineType

Android line types: Solid, Dashed and Dotted. Both non-solid pen values use the dashed Ink family.

public enum class LineType

Source

PenPreset

Portable drawing settings with Android's constructor fields/defaults. Preference storage and theme resolution belong to the application. Pressure and stabilization are clamped for brush construction; encode preserves the supplied stabilization value, as Android does.

public data class PenPreset( val kind: PenKind = PenKind.Fountain, val lineType: LineType = LineType.Solid, val colorArgb: Int = 0xFF000000.toInt(), val colorFollowsTheme: Boolean = false, val thickness: Float = 1.5f, val pressure: Int = 3, val stabilization: Int = 1, val holdForStraightLine: Boolean = true, )
Parameter Type Default Meaning
kind PenKind PenKind.Fountain Fountain uses the marker nib for solid lines; Calligraphy uses the pressure-level broad nib.
lineType LineType LineType.Solid Solid uses the selected pen nib; Dashed and Dotted both use Android's dashed Ink family.
colorArgb Int 0xFF000000.toInt() 32-bit ARGB including alpha; nullable drawing overrides use the brush color when null.
colorFollowsTheme Boolean false true follows automatic ink; false fixes color; null enables legacy black/white detection.
thickness Float 1.5f Brush width in page dp; Float for pens and Int for highlighter settings.
pressure Int 3 Measured finite pressure in [0, 1], or null when unavailable; Int brush levels use 0–5.
stabilization Int 1 Input-model level 0–5; tool constructors validate, catalog lookup clamps.
holdForStraightLine Boolean true Application gesture preference, default true; does not change the brush or stored stroke metadata.

Source

PenPreset.MIN_THICKNESS

public const val MIN_THICKNESS: Float = 1f

Source

PenPreset.MAX_THICKNESS

public const val MAX_THICKNESS: Float = 8f

Source

PenPreset.THICKNESS_STEP

public const val THICKNESS_STEP: Float = 0.5f

Source

PenPreset.MAX_PRESSURE

public const val MAX_PRESSURE: Int = InkBrushCatalog.MAX_CALLIGRAPHY_PRESSURE

Source

PenPreset.MAX_STABILIZATION

public const val MAX_STABILIZATION: Int = InkBrushCatalog.MAX_STABILIZATION

Source

HighlighterSettings

HighlighterSettings

Portable Android-style color/width settings; color includes alpha. No pressure, stabilization or automatic theme color.

public data class HighlighterSettings( val colorArgb: Int = DEFAULT_COLOR, val thickness: Int = DEFAULT_THICKNESS, )
Parameter Type Default Meaning
colorArgb Int DEFAULT_COLOR 32-bit ARGB including alpha; nullable drawing overrides use the brush color when null.
thickness Int DEFAULT_THICKNESS Brush width in page dp; Float for pens and Int for highlighter settings.

Source

HighlighterSettings.MIN_THICKNESS

public const val MIN_THICKNESS: Int = 6

Source

HighlighterSettings.MAX_THICKNESS

public const val MAX_THICKNESS: Int = 40

Source

HighlighterSettings.DEFAULT_THICKNESS

public const val DEFAULT_THICKNESS: Int = 18

Source

HighlighterSettings.DEFAULT_COLOR

public const val DEFAULT_COLOR: Int = 0x66FFEB3B

Source

ViveInkTool

AuthoredViveStroke

canonicalStroke lazily rebuilds row through the codec; use that geometry for a save/reload-consistent preview.

public data class AuthoredViveStroke(public val stroke: Stroke, public val row: StoredInkStroke)
Parameter Type Default Meaning
stroke Stroke Required Native finished or live stroke, as specified by the type.
row StoredInkStroke Required Original stored row; nullable decoders return null for unsupported or damaged data.

Source

AuthoredViveStroke.canonicalStroke

public val canonicalStroke: Stroke

Lazy native rebuild of the authored stored row, matching save/reload geometry.

Source

ViveInkTool

Authoring rejects unknown families and levels outside 0–5. Highlighter requires stabilization = 0 and colorFollowsTheme = false. complete requires the captured brush.

public class ViveInkTool( public val familyId: String = ViveBrushes.MARKER, public val stabilization: Int = 0, public val colorArgb: Int = 0xff202020.toInt(), public val sizeDp: Float = 3f, public val colorFollowsTheme: Boolean? = false, )
Parameter Type Default Meaning
familyId String ViveBrushes.MARKER Brush family ID; use ViveBrushes constants or calligraphy(level).
stabilization Int 0 Input-model level 0–5; tool constructors validate, catalog lookup clamps.
colorArgb Int 0xff202020.toInt() 32-bit ARGB including alpha; nullable drawing overrides use the brush color when null.
sizeDp Float 3f Finite positive brush width or eraser diameter in page dp, at least epsilon.
colorFollowsTheme Boolean? false true follows automatic ink; false fixes color; null enables legacy black/white detection.

Source

ViveInkTool.brush

public val brush: Brush

Source

ViveInkTool.complete

public fun complete( stroke: Stroke, id: String, pageId: String, seq: Int, createdAt: Long, groupId: String? = null, ): AuthoredViveStroke
Parameter Type Default Meaning
stroke Stroke Required Native finished or live stroke, as specified by the type.
id String Required Caller-supplied unique row identifier.
pageId String Required Identifier of the page owning all supplied rows/targets.
seq Int Required Caller-allocated stroke draw-order sequence; loading sorts by seq then ID.
createdAt Long Required Creation clock in the application's stored timestamp units, normally epoch milliseconds.
groupId String? null Optional logical group ID; grouped ink selects together.

Source

InkColors

AUTOMATIC_LIGHT

public const val AUTOMATIC_LIGHT: Int = 0xFFFFFFFF.toInt()

Source

AUTOMATIC_DARK

public const val AUTOMATIC_DARK: Int = 0xFF000000.toInt()

Source

automaticInkFor

public fun automaticInkFor(isDark: Boolean): Int
Parameter Type Default Meaning
isDark Boolean Required True chooses white automatic ink; false chooses black.

Source

automaticColorOr

public fun automaticColorOr(stored: Int, followsTheme: Boolean?, canvasInk: Int): Int
Parameter Type Default Meaning
stored Int Required Original stored ARGB color, or raw erase-mode name when the type is String.
followsTheme Boolean? Required Stored theme flag: true automatic, false fixed, null legacy behavior.
canvasInk Int Required Resolved automatic canvas ARGB, usually automaticInkFor(isDark).

Source