ইঙ্ক এপিআই মডুলারাইজড, তাই আপনি কেবল আপনার যা প্রয়োজন তা ব্যবহার করতে পারেন।
স্ট্রোক
The strokes module serves as the foundation of the Ink API. Key data types within this module are:
StrokeInputBatch: Represents a series of pointer inputs, including their position, timestamp, and optionally pressure, tilt, and orientation.InProgressStroke: Represents a stroke that is actively being drawn.InProgressStrokeis used to render partial strokes with low latency and to build the finalStrokeonce input is complete, after which the object can be reused.InProgressStrokeis used by theInProgressStrokescomposable.Stroke: An immutable representation of a finalized stroke with fixed geometry. EachStrokehas anImmutableStrokeInputBatch(input points), aBrush(style), and aPartitionedMesh(geometric shape). You can store, manipulate, and render strokes within your application.
জ্যামিতি
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.
রচনা
কম্পোজ অথরিং মডিউল আপনাকে ব্যবহারকারীর টাচ ইনপুট ক্যাপচার করতে এবং রিয়েল টাইমে স্ক্রিনে কম-লেটেন্সি স্ট্রোক হিসাবে রেন্ডার করতে দেয়। এটি InProgressStrokes কম্পোজেবলের মাধ্যমে অর্জন করা হয়, যা গতির ইভেন্টগুলি প্রক্রিয়া করে এবং স্ট্রোকগুলি আঁকার সাথে সাথে প্রদর্শন করে।
একবার স্ট্রোক সম্পন্ন হলে, কম্পোজেবল একটি InProgressStrokesFinishedListener কলব্যাক ব্যবহার করে ক্লায়েন্ট অ্যাপ্লিকেশনটিকে অবহিত করে। এটি অ্যাপ্লিকেশনটিকে রেন্ডারিং বা স্টোরেজের জন্য সমাপ্ত স্ট্রোকগুলি পুনরুদ্ধার করতে দেয়।
কম্পোজে, InProgressStrokes এই কলব্যাকটি onStrokesFinished প্যারামিটারে নেয়। রেন্ডারিং মডিউল ব্যবহার করে স্ক্রিনে কমিট করার জন্য সমাপ্ত স্ট্রোকগুলি অন্য একটি কম্পোজেবলে পাস করুন।
রেন্ডারিং
রেন্ডারিং মডিউলটি অ্যান্ড্রয়েড Canvas কালি স্ট্রোক আঁকা সহজ করে। এটি কম্পোজের জন্য CanvasStrokeRenderer ViewStrokeRenderer করে। এই রেন্ডারারগুলি রেন্ডারিং কর্মক্ষমতা অপ্টিমাইজ করে এবং অ্যান্টিএলিয়াসিং সহ উচ্চ-মানের ভিজ্যুয়াল সরবরাহ করতে সহায়তা করে।
স্ট্রোক রেন্ডার করার জন্য, CanvasStrokeRenderer ইনস্ট্যান্স পেতে create() পদ্ধতিটি কল করুন, এবং তারপর finished ( Stroke ) অথবা in-progress ( InProgressStroke ) স্ট্রোকগুলিকে Canvas এ রেন্ডার করার জন্য draw() পদ্ধতিটি কল করুন।
স্ট্রোক আঁকার সময় আপনি ক্যানভাস রূপান্তর করতে পারেন। উদাহরণস্বরূপ প্যানিং, জুমিং এবং রোটেটিং অন্তর্ভুক্ত। স্ট্রোকটি সঠিকভাবে রেন্ডার করার জন্য, আপনাকে canvas রূপান্তরটি CanvasStrokeRenderer.draw এ পাস করতে হবে।
canvas ট্রান্সফর্ম আলাদাভাবে ট্র্যাক করা এড়াতে, ViewStrokeRenderer ব্যবহার করুন।
স্টোরেজ
স্টোরেজ মডিউলটি স্ট্রোক ডেটা দক্ষতার সাথে সিরিয়ালাইজ এবং ডিসিরিয়ালাইজ করার জন্য ইউটিলিটি প্রদান করে, প্রাথমিকভাবে StrokeInputBatch উপর দৃষ্টি নিবদ্ধ করে।
মডিউলটি প্রোটোকল বাফার এবং অপ্টিমাইজড ডেল্টা কম্প্রেশন কৌশল ব্যবহার করে, যার ফলে সহজ পদ্ধতির তুলনায় উল্লেখযোগ্য স্টোরেজ সাশ্রয় হয়।
স্টোরেজ মডিউলটি স্ট্রোক সংরক্ষণ, লোডিং এবং ভাগ করে নেওয়া সহজ করে।