@@ -73,7 +73,7 @@ fun rememberHandwritingController(
73
73
lassoBoundBoxColor : Color = Color .Black ,
74
74
lassoBoundBoxPadding : Padding = Padding (20, 20, 20, 20),
75
75
laserColor : Color = Color .Black ,
76
- contentBackground : Color = Color .Transparent ,
76
+ contentBackgroundColor : Color = Color .Transparent ,
77
77
contentBackgroundImage : ImageBitmap ? = null,
78
78
contentBackgroundImageColor : Color = Color .Transparent ,
79
79
contentBackgroundImageContentScale : ContentScale = ContentScale .None ,
@@ -88,7 +88,7 @@ fun rememberHandwritingController(
88
88
lassoBoundBoxColor,
89
89
lassoBoundBoxPadding,
90
90
laserColor,
91
- contentBackground ,
91
+ contentBackgroundColor ,
92
92
contentBackgroundImage,
93
93
) {
94
94
HandwritingController (
@@ -102,7 +102,7 @@ fun rememberHandwritingController(
102
102
defaultLassoBoundBoxColor = lassoBoundBoxColor,
103
103
defaultLassoBoundBoxPadding = lassoBoundBoxPadding,
104
104
defaultLaserColor = laserColor,
105
- defaultContentBackground = contentBackground ,
105
+ defaultContentBackgroundColor = contentBackgroundColor ,
106
106
defaultContentBackgroundImage = contentBackgroundImage,
107
107
defaultContentBackgroundImageColor = contentBackgroundImageColor,
108
108
defaultContentBackgroundContentScale = contentBackgroundImageContentScale,
@@ -127,7 +127,7 @@ class HandwritingController internal constructor(
127
127
defaultLassoBoundBoxColor : Color ,
128
128
defaultLassoBoundBoxPadding : Padding ,
129
129
defaultLaserColor : Color ,
130
- defaultContentBackground : Color ,
130
+ defaultContentBackgroundColor : Color ,
131
131
defaultContentBackgroundImage : ImageBitmap ? ,
132
132
defaultContentBackgroundImageColor : Color ,
133
133
defaultContentBackgroundContentScale : ContentScale ,
@@ -145,12 +145,20 @@ class HandwritingController internal constructor(
145
145
/* *
146
146
* A [Paint] object representing the pen's settings.
147
147
*/
148
- internal val penPaint: Paint = defaultPenPaint()
148
+ internal var penPaint by mutableStateOf( defaultPenPaint() )
149
149
150
150
/* *
151
- * A mutable state for the pen color, initially set to black.
151
+ * Updates the pen paint.
152
+ *
153
+ * @param paint The new paint to set for the pen.
152
154
*/
155
+ fun updatePenPaint (paint : Paint ) {
156
+ penPaint = paint
157
+ }
153
158
159
+ /* *
160
+ * A mutable state for the pen color, initially set to black.
161
+ */
154
162
private var _penColor = mutableStateOf(defaultPenColor)
155
163
156
164
/* *
@@ -197,7 +205,16 @@ class HandwritingController internal constructor(
197
205
/* *
198
206
* A [Paint] object representing the eraser's settings.
199
207
*/
200
- internal val eraserPointPaint: Paint = defaultStrokeEraserPaint()
208
+ internal var eraserPointPaint by mutableStateOf(defaultStrokeEraserPaint())
209
+
210
+ /* *
211
+ * Updates the eraser point paint.
212
+ *
213
+ * @param paint The new paint to set for the eraser point.
214
+ */
215
+ fun updateEraserPointPaint (paint : Paint ) {
216
+ eraserPointPaint = paint
217
+ }
201
218
202
219
/* *
203
220
* A mutable state for the eraser point color, initially set to light gray.
@@ -224,29 +241,41 @@ class HandwritingController internal constructor(
224
241
/* *
225
242
* A mutable state for the eraser point radius, initially set to 20f.
226
243
*/
227
- var eraserPointRadius by mutableStateOf(defaultEraserPointRadius)
244
+ private var _eraserPointRadius = mutableStateOf(defaultEraserPointRadius)
245
+
246
+ /* *
247
+ * Public property for retrieving the current eraser point radius.
248
+ */
249
+ val eraserPointRadius: Float
250
+ get() = _eraserPointRadius .value
228
251
229
252
/* *
230
253
* Updates the eraser point radius.
231
254
*
232
255
* @param radius The new radius to set for the eraser point.
233
256
*/
234
257
fun updateEraserPointRadius (radius : Float ) {
235
- eraserPointRadius = radius
258
+ _eraserPointRadius .value = radius
236
259
}
237
260
238
261
/* *
239
262
* Determines whether the eraser point is visible.
240
263
*/
241
- var isEraserPointShowed by mutableStateOf(defaultIsEraserPointShowed)
264
+ private var _isEraserPointShowed by mutableStateOf(defaultIsEraserPointShowed)
265
+
266
+ /* *
267
+ * Public property for retrieving whether the eraser point is visible.
268
+ */
269
+ val isEraserPointShowed: Boolean
270
+ get() = _isEraserPointShowed
242
271
243
272
/* *
244
273
* Updates the visibility of the eraser point.
245
274
*
246
275
* @param isShowed A boolean indicating whether the eraser point should be visible.
247
276
*/
248
277
fun updateIsEraserPointShowed (isShowed : Boolean ) {
249
- isEraserPointShowed = isShowed
278
+ _isEraserPointShowed = isShowed
250
279
}
251
280
252
281
// ==============================
@@ -256,7 +285,16 @@ class HandwritingController internal constructor(
256
285
/* *
257
286
* A [Paint] object representing the lasso's settings.
258
287
*/
259
- internal val lassoPaint: Paint = defaultLassoPaint()
288
+ internal var lassoPaint: Paint by mutableStateOf(defaultLassoPaint())
289
+
290
+ /* *
291
+ * Updates the lasso paint.
292
+ *
293
+ * @param paint The new paint to set for the lasso.
294
+ */
295
+ fun updateLassoPaint (paint : Paint ) {
296
+ lassoPaint = paint
297
+ }
260
298
261
299
/* *
262
300
* A mutable state for the lasso color, initially set to black.
@@ -282,7 +320,16 @@ class HandwritingController internal constructor(
282
320
/* *
283
321
* A [Paint] object representing the lasso bound box's settings.
284
322
*/
285
- internal val lassoBoundBoxPaint: Paint = defaultLassoPaint()
323
+ internal var lassoBoundBoxPaint by mutableStateOf(defaultLassoPaint())
324
+
325
+ /* *
326
+ * Updates the lasso bound box paint.
327
+ *
328
+ * @param paint The new paint to set for the lasso bound box.
329
+ */
330
+ fun updateLassoBoundBoxPaint (paint : Paint ) {
331
+ lassoBoundBoxPaint = paint
332
+ }
286
333
287
334
/* *
288
335
* A mutable state for the lasso bound box color, initially set to black.
@@ -335,7 +382,16 @@ class HandwritingController internal constructor(
335
382
/* *
336
383
* A [Paint] object representing the laser's settings.
337
384
*/
338
- internal val laserPaint: Paint = defaultLaserPaint()
385
+ private var laserPaint by mutableStateOf(defaultLaserPaint())
386
+
387
+ /* *
388
+ * Updates the laser paint.
389
+ *
390
+ * @param paint The new paint to set for the laser.
391
+ */
392
+ fun updateLaserPaint (paint : Paint ) {
393
+ laserPaint = paint
394
+ }
339
395
340
396
/* *
341
397
* A mutable state for the laser color, initially set to black.
@@ -394,9 +450,24 @@ class HandwritingController internal constructor(
394
450
// ==============================
395
451
396
452
/* *
397
- * The background color of the handwriting canvas.
453
+ * A mutable state holding the background color of the handwriting canvas.
454
+ */
455
+ private var _contentBackgroundColor by mutableStateOf(defaultContentBackgroundColor)
456
+
457
+ /* *
458
+ * The public property to retrieve the current background color.
398
459
*/
399
- val contentBackground by mutableStateOf(defaultContentBackground)
460
+ val contentBackgroundColor: Color
461
+ get() = _contentBackgroundColor
462
+
463
+ /* *
464
+ * Updates the background color of the handwriting canvas.
465
+ *
466
+ * @param color The new color to set as the background.
467
+ */
468
+ fun updateContentBackgroundColor (color : Color ) {
469
+ _contentBackgroundColor = color
470
+ }
400
471
401
472
/* *
402
473
* A mutable state holding the background image of the handwriting canvas.
0 commit comments