ইঙ্ক এপিআই মডুলারাইজড, তাই আপনি কেবল আপনার যা প্রয়োজন তা ব্যবহার করতে পারেন।
স্ট্রোক
笔画模块是 Ink API 的基础。此模块中的关键数据类型包括:
StrokeInputBatch:表示一系列指针输入,包括其位置、时间戳,以及可选的压力、倾斜度和方向。InProgressStroke:表示正在绘制的笔画。InProgressStroke用于以低延迟渲染部分笔画,并在输入完成后构建最终的Stroke,之后该对象可以重复使用。InProgressStroke由InProgressStrokes可组合项使用。Stroke:已完成的笔画的不可变表示形式,具有固定的几何形状。每个Stroke都有一个ImmutableStrokeInputBatch(输入点)、一个Brush(样式)和一个PartitionedMesh(几何形状)。您可以在应用中存储、处理和渲染笔画。
জ্যামিতি
几何图形模块支持对基本形状(使用 Box 和 Vec 等专用类)以及任意形状(使用 PartitionedMesh)进行几何运算,包括相交检测和转换。 PartitionedMesh 还可以保存其他数据以支持渲染。
ব্রাশ
brush 模块定义了笔画的样式。它包含两个主要部分:
Brush:指定笔画的样式,包括基准颜色、基准大小和BrushFamily。BrushFamily类似于字体系列,用于定义笔画的样式。例如,BrushFamily可以表示某种特定样式的标记或荧光笔,从而使不同大小和颜色的笔画共享该样式。StockBrushes:提供用于创建即用型BrushFamily实例的工厂函数。
রচনা
The Compose Authoring module lets you capture user touch input and render it
as low-latency strokes on the screen in real time. This is achieved through
the InProgressStrokes composable, which processes motion events and displays
the strokes as they are drawn.
Once a stroke is completed, the composable notifies the client application using
an InProgressStrokesFinishedListener callback. This allows the application
to retrieve the finished strokes for rendering or storage.
In Compose, InProgressStrokes takes this callback in the onStrokesFinished
parameter. Pass the finished strokes to another composable to commit them to the
screen using the rendering module.
রেন্ডারিং
রেন্ডারিং মডিউলটি অ্যান্ড্রয়েড Canvas কালি স্ট্রোক আঁকা সহজ করে। এটি কম্পোজের জন্য CanvasStrokeRenderer ViewStrokeRenderer করে। এই রেন্ডারারগুলি রেন্ডারিং কর্মক্ষমতা অপ্টিমাইজ করে এবং অ্যান্টিএলিয়াসিং সহ উচ্চ-মানের ভিজ্যুয়াল সরবরাহ করতে সহায়তা করে।
স্ট্রোক রেন্ডার করার জন্য, CanvasStrokeRenderer ইনস্ট্যান্স পেতে create() পদ্ধতিটি কল করুন, এবং তারপর finished ( Stroke ) অথবা in-progress ( InProgressStroke ) স্ট্রোকগুলিকে Canvas এ রেন্ডার করার জন্য draw() পদ্ধতিটি কল করুন।
স্ট্রোক আঁকার সময় আপনি ক্যানভাস রূপান্তর করতে পারেন। উদাহরণস্বরূপ প্যানিং, জুমিং এবং রোটেটিং অন্তর্ভুক্ত। স্ট্রোকটি সঠিকভাবে রেন্ডার করার জন্য, আপনাকে canvas রূপান্তরটি CanvasStrokeRenderer.draw এ পাস করতে হবে।
canvas ট্রান্সফর্ম আলাদাভাবে ট্র্যাক করা এড়াতে, ViewStrokeRenderer ব্যবহার করুন।
স্টোরেজ
The storage module provides utilities for
efficiently serializing and deserializing stroke data, primarily focusing
on StrokeInputBatch.
The module uses protocol buffers and optimized delta compression techniques, resulting in significant storage savings compared to naive methods.
The storage module simplifies saving, loading, and sharing strokes.