SmartToolFactory / Compose-Cropper

🚀🏞✂️ Image cropper that can crop with static, dynamic crop behavior, can use customizable shapes, vectors, and other png files as mask to crop with various customizations
MIT License
331 stars 47 forks source link

it's just a suggestion #2

Closed ninyess closed 1 year ago

ninyess commented 1 year ago
@Composable
fun ImageCropper(
    modifier: Modifier = Modifier,
    imageBitmap: ImageBitmap,
    contentDescription: String?,
    cropStyle: CropStyle = CropDefaults.style(),
    cropProperties: CropProperties,
    filterQuality: FilterQuality = DrawScope.DefaultFilterQuality,
    crop: Boolean = false,
    backgroundColor: Color = Color.Black,
    onCropStart: () -> Unit,
    onCropSuccess: (ImageBitmap) -> Unit
) {

..

        val transparentColor by animateColorAsState(
            animationSpec = tween(300, easing = LinearEasing),
            targetValue = if (isTouched.value) backgroundColor.copy(alpha = .5f) else backgroundColor.copy(alpha = .7f)
        )

..

        ImageCropper(
            modifier = imageModifier,
            visible = visible,
            imageBitmap = imageBitmap,
            containerWidth = containerWidth,
            containerHeight = containerHeight,
            imageWidthPx = imageWidthPx,
            imageHeightPx = imageHeightPx,
            handleSize = cropProperties.handleSize,
            overlayRect = cropState.overlayRect,
            cropType = cropType,
            cropOutline = cropOutline,
            cropStyle = cropStyle,
            transparentColor = transparentColor,
            backgroundColor = backgroundColor
        )

..

}

Thank you :)

SmartToolFactory commented 1 year ago

Thanks for the suggestion. I will add colors to theme folder and use them instead of creating new Color instance on each touch change.

ninyess commented 1 year ago

Regardless of my suggestion, VERY thank you very much for this project.