Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
واجهات برمجة التطبيقات للأشكال الهندسية
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
The Geometry APIs let you create interactive tools such as selection
mechanisms and erasers.
This section shows how to use the Geometry APIs to implement an eraser.
private fun eraseIntersectingStrokes (
currentX : Float ,
currentY : Float ,
currentStrokes : MutableList<Stroke> ,
): Unit {
val prev = previousPoint
previousPoint = MutableVec ( currentX , currentY )
if ( prev == null ) return
val segment = MutableSegment ( prev , MutableVec ( currentX , currentY ))
val parallelogram = MutableParallelogram (). populateFromSegmentAndPadding (
segment ,
eraserPadding
)
currentStrokes . removeAll {
it . shape . intersects ( parallelogram , AffineTransform . IDENTITY )
}
}
Note: You can implement an eraser that only removes the parts of strokes it
touches by checking if a stroke intersects with individual line segments of a
StrokeInputBatch .
Then, create new StrokeInputBatch and Stroke objects from the line
segments that weren't intersected.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى . إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-12-22 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-12-22 (حسب التوقيت العالمي المتفَّق عليه)"],[],[]]