ইঙ্ক এপিআই মডুলারাইজড, তাই আপনি কেবল আপনার যা প্রয়োজন তা ব্যবহার করতে পারেন।
স্ট্রোক
স্ট্রোক মডিউলটি ইঙ্ক এপিআই-এর ভিত্তি হিসেবে কাজ করে। এই মডিউলের মধ্যে মূল ডেটা টাইপগুলি হল:
-
StrokeInputBatch: পয়েন্টার ইনপুটগুলির একটি সিরিজ উপস্থাপন করে, যার মধ্যে তাদের অবস্থান, টাইমস্ট্যাম্প এবং ঐচ্ছিকভাবে চাপ, টিল্ট এবং ওরিয়েন্টেশন অন্তর্ভুক্ত থাকে। -
InProgressStroke: সক্রিয়ভাবে আঁকা একটি স্ট্রোককে প্রতিনিধিত্ব করে।InProgressStrokeকম ল্যাটেন্সিতে আংশিক স্ট্রোক রেন্ডার করতে এবং ইনপুট সম্পূর্ণ হওয়ার পরে চূড়ান্তStrokeতৈরি করতে ব্যবহৃত হয়, যার পরে বস্তুটি পুনরায় ব্যবহার করা যেতে পারে।InProgressStrokeInProgressStrokesদ্বারা ব্যবহৃত হয়। -
Stroke: স্থির জ্যামিতির সাথে একটি চূড়ান্ত স্ট্রোকের একটি অপরিবর্তনীয় উপস্থাপনা। প্রতিটিStrokeএকটিImmutableStrokeInputBatch(ইনপুট পয়েন্ট), একটিBrush(স্টাইল) এবং একটিPartitionedMesh(জ্যামিতিক আকৃতি) থাকে। আপনি আপনার অ্যাপ্লিকেশনের মধ্যে স্ট্রোক সংরক্ষণ, পরিচালনা এবং রেন্ডার করতে পারেন।
জ্যামিতি
The Geometry module supports geometric operations on primitive shapes (using dedicated classes like Box and Vec), as well as arbitrary shapes (using PartitionedMesh), including intersection detection and transformation. PartitionedMesh can also hold additional data to support rendering.
ব্রাশ
The brush module defines the style of strokes. It
consists of two main parts:
Brush: Specifies the style of a stroke including base color, base size, andBrushFamily.BrushFamilyis analogous to a font family, it defines a stroke's style. For example, aBrushFamilycan represent a specific style of marker or highlighter, allowing strokes with different sizes and colors to share that style.StockBrushes: Provides factory functions for creating ready-to-useBrushFamilyinstances.
রচনা
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.