从 ColorPickerDialog.java 检索颜色信息
我目前正在使用 Google 提供的 ColorPickerDialog.java。我可以让它正确加载,我可以成功选择一种颜色,按中间的圆圈确认,它会正确存储它的信息。
由于对话框使用 Canvas 绘制其元素并使用 Paint 类进行着色一切,有没有办法从选择中检索 RGB 浮点值?我不知道这是否简单,我只是想念它,但我还没有完全熟悉Android。
如果它有助于可视化我想要实现的目标,我正在使用 ColorPickerDialog.java 让用户选择一种颜色,并且我想使用该颜色为 OpenGL 中的某些内容着色(所以我需要 float r, float g、浮动 b)
I'm currently using the ColorPickerDialog.java provided by Google. I can get it to load properly, and I can successfully choose a color, press the middle circle to confirm, and it will store it's information properly.
Since the dialog uses Canvas to draw its elements and the Paint class to color everything, is there a way to retrieve the RGB float value from the selection? I don't know if it's simple and I'm just missing it, but I'm not fully acquainted with Android yet.
If it helps to visualize what I'm trying to achieve, I'm using the ColorPickerDialog.java to let the user select a color, and I want to use that color to tint some things in OpenGL (so I need float r, float g, float b)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Color 类可以处理这些转换。返回的整数是按位版本,通常编码为 ARGB,但有一些函数可以将其拆分。
The Color class can handle these conversions. The integer you are handed back is a bitwise version usually encoded as ARGB but there are functions to split it up.