You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the colorPickerDialog.colorPickerView.setPaletteDrawable loading in an image that the user has previously drawn. When the color picker dialog appears, the image shows up fine on it. However, an issue arises when I select certain drawn lines that have had their brightness reduced. The color that is being given by the ColorEnvelope is a color that has its brightness set to Max. This becomes really bad when I try to select the color black and the ColorEnvelope returns the color white.
I have included a code snippet of color picker dialog being used
I also included screenshots of the color picker using the color wheel and using an image
private fun openEyeDropper() {
try {
val bubbleFlag = CustomFlag(requireContext(), R.layout.bubble_flag)
bubbleFlag.flagMode = FlagMode.LAST
val colorPickerDialog = ColorPickerDialog.Builder(requireContext())
.setTitle("Color Eye Dropper")
.setPositiveButton(getString(R.string.confirm),
ColorEnvelopeListener { envelope, fromUser ->
defaultColor = envelope.color
draw_View.setDrawingColor(envelope.color)
changeToolColors()
})
.setNegativeButton(
getString(R.string.cancel)
) { dialogInterface, i -> dialogInterface.dismiss() }
.attachAlphaSlideBar(false) // the default value is true.
.attachBrightnessSlideBar(true) // the default value is true.
.setBottomSpace(12) // set a bottom space between the last slidebar and buttons.
colorPickerDialog.colorPickerView.setPaletteDrawable(draw_View.bitmap.toDrawable(requireContext().resources))
colorPickerDialog.colorPickerView.flagView = bubbleFlag
colorPickerDialog.show()
} catch (e: Exception){
Log.e( "Error Exception" , e.message.toString())
}
}
Picking a color and lowering the brightness
Color picker making black have max brightness
Color picker making the same color I just picked have max brightness
Expected Behavior:
What I expect to happen when I select a point on an image is that it returns the color and retains the same brightness level and alpha level.
Suggestion
The issue seems to occur in the AbstractSlider class on the notifyColor method. It calls colorPickerView.getPureColor() which seems to reset the alpha and brightness levels. I do understand why this implementation is important when using the color wheel, however, I think an image should allow you to retain the alpha and brightness values of a color point. Especially if you use the default color wheel to create a drawing and you want to retrieve a previous color from it. A possible solution could be giving a flag to the color listener to see if it using the color wheel or a custom image. Then in the color listener, you can check if it is an image and if it is then you don't have to reset the alpha and brightness of a color.
The text was updated successfully, but these errors were encountered:
Please complete the following information:
Describe the Bug:
When using the
colorPickerDialog.colorPickerView.setPaletteDrawable
loading in an image that the user has previously drawn. When the color picker dialog appears, the image shows up fine on it. However, an issue arises when I select certain drawn lines that have had their brightness reduced. The color that is being given by the ColorEnvelope is a color that has its brightness set to Max. This becomes really bad when I try to select the color black and the ColorEnvelope returns the color white.I have included a code snippet of color picker dialog being used
I also included screenshots of the color picker using the color wheel and using an image
Picking a color and lowering the brightness
![01 08 2022_01 46 08_REC](https://user-images.githubusercontent.com/7875121/182080444-4f3099d5-d560-480b-886b-f26424cfbcf4.png)
![01 08 2022_01 16 45_REC](https://user-images.githubusercontent.com/7875121/182077380-c207facd-fbda-4e8a-bb56-c3519258f9e6.png)
![01 08 2022_01 15 25_REC](https://user-images.githubusercontent.com/7875121/182077381-a57d1536-d930-46e5-bf87-e652f8554d71.png)
Color picker making black have max brightness
Color picker making the same color I just picked have max brightness
Expected Behavior:
What I expect to happen when I select a point on an image is that it returns the color and retains the same brightness level and alpha level.
Suggestion
The issue seems to occur in the
AbstractSlider
class on thenotifyColor
method. It callscolorPickerView.getPureColor()
which seems to reset the alpha and brightness levels. I do understand why this implementation is important when using the color wheel, however, I think an image should allow you to retain the alpha and brightness values of a color point. Especially if you use the default color wheel to create a drawing and you want to retrieve a previous color from it. A possible solution could be giving a flag to the color listener to see if it using the color wheel or a custom image. Then in the color listener, you can check if it is an image and if it is then you don't have to reset the alpha and brightness of a color.The text was updated successfully, but these errors were encountered: