【发布时间】:2023-12-23 08:49:01
【问题描述】:
我用色调颜色创建我的谷歌地图标记
标记的色调。值必须大于等于 0 且小于 360。
有没有办法将这种色调女巫从浮点数转换为 rgb 颜色?
谢谢
【问题讨论】:
标签: android rgb google-maps-android-api-2
我用色调颜色创建我的谷歌地图标记
标记的色调。值必须大于等于 0 且小于 360。
有没有办法将这种色调女巫从浮点数转换为 rgb 颜色?
谢谢
【问题讨论】:
标签: android rgb google-maps-android-api-2
试试这个代码:
float hue = 180.0f;
int color = Color.HSVToColor(new float[] { hue, 1.0f, 1.0f });
更多信息:
/**
* Convert HSV components to an ARGB color. Alpha set to 0xFF.
* hsv[0] is Hue [0 .. 360)
* hsv[1] is Saturation [0...1]
* hsv[2] is Value [0...1]
* If hsv values are out of range, they are pinned.
* @param hsv 3 element array which holds the input HSV components.
* @return the resulting argb color
*/
public static int HSVToColor(float hsv[]) {
【讨论】: