Skip to content

Commit aa75c87

Browse files
committed
add backgroundColor param
1 parent ff6ae3b commit aa75c87

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cropper/src/main/java/com/smarttoolfactory/cropper/ImageCropper.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ fun ImageCropper(
4949
cropProperties: CropProperties,
5050
filterQuality: FilterQuality = DrawScope.DefaultFilterQuality,
5151
crop: Boolean = false,
52+
backgroundColor: Color = Color.Black,
5253
onCropStart: () -> Unit,
5354
onCropSuccess: (ImageBitmap) -> Unit,
5455
onDrawGrid: (DrawScope.(rect: Rect, strokeWidth: Float, color: Color) -> Unit)? = null,
@@ -180,6 +181,7 @@ fun ImageCropper(
180181
cropOutline = cropOutline,
181182
cropStyle = cropStyle,
182183
transparentColor = transparentColor,
184+
backgroundColor = backgroundColor,
183185
onDrawGrid = onDrawGrid,
184186
)
185187
}
@@ -201,12 +203,13 @@ private fun ImageCropper(
201203
cropStyle: CropStyle,
202204
overlayRect: Rect,
203205
transparentColor: Color,
206+
backgroundColor: Color,
204207
onDrawGrid: (DrawScope.(rect: Rect, strokeWidth: Float, color: Color) -> Unit)?,
205208
) {
206209
Box(
207210
modifier = Modifier
208211
.fillMaxSize()
209-
.background(Color.Black)
212+
.background(backgroundColor)
210213
) {
211214

212215
AnimatedVisibility(
@@ -284,7 +287,7 @@ private fun ImageCropperImpl(
284287
val handleColor = cropStyle.handleColor
285288
val drawHandles = cropType == CropType.Dynamic
286289
val strokeWidth = cropStyle.strokeWidth
287-
290+
288291
DrawingOverlay(
289292
modifier = Modifier.size(containerWidth, containerHeight),
290293
drawOverlay = drawOverlay,

0 commit comments

Comments
 (0)