本文整理汇总了Java中android.graphics.Color.colorToHSV方法的典型用法代码示例。如果您正苦于以下问题:Java Color.colorToHSV方法的具体用法?Java Color.colorToHSV怎么用?Java Color.colorToHSV使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.graphics.Color
的用法示例。
在下文中一共展示了Color.colorToHSV方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateBlendingColors
import android.graphics.Color; //导入方法依赖的package包/类
/**
* Generates a list of colors that blend from a starting color to an ending color. The
* size of the list is same as dialModeCount.
*
* @param dialModeCount <tt>int</tt> : Size of the list.
* @param startingColor <tt>int</tt> : Color to start blending from.
* @param endingColor <tt>int</tt> : Color to finally blend into.
* @return colorList List of Integers representing the blended colors.
* @see Color#HSVToColor(float[])
*/
static List<Integer> generateBlendingColors(int dialModeCount, int startingColor, int endingColor) {
List<Integer> colorList = new ArrayList<>(dialModeCount);
float[] startingColorHSV = new float[3];
float[] endingColorHSV = new float[3];
Color.colorToHSV(startingColor, startingColorHSV);
Color.colorToHSV(endingColor, endingColorHSV);
float hInc = endingColorHSV[0] - startingColorHSV[0];
float sInc = endingColorHSV[1] - startingColorHSV[1];
float vInc = endingColorHSV[2] - startingColorHSV[2];
float[] temp;
// Generate the blending colors.
for (int i = 0; i < dialModeCount; i++) {
temp = new float[]{startingColorHSV[0] + i * hInc,
startingColorHSV[1] + i * sInc,
startingColorHSV[2] + i * vInc};
colorList.add(Color.HSVToColor(temp));
}
return colorList;
}
示例2: setColor
import android.graphics.Color; //导入方法依赖的package包/类
/**
* Set the bar color. <br>
* <br>
* Its discouraged to use this method.
*
* @param color
*/
public void setColor(int color) {
int x1, y1;
if(mOrientation) {
x1 = (mBarLength + mBarPointerHaloRadius);
y1 = mBarThickness;
} else {
x1 = mBarThickness;
y1 = (mBarLength + mBarPointerHaloRadius);
}
Color.colorToHSV(color, mHSVColor);
shader = new LinearGradient(mBarPointerHaloRadius, 0,
x1, y1, new int[] {Color.WHITE, color, Color.BLACK}, null,
Shader.TileMode.CLAMP);
mBarPaint.setShader(shader);
calculateColor(mBarPointerPosition);
mBarPointerPaint.setColor(mColor);
if (mPicker != null) {
mPicker.setNewCenterColor(mColor);
if(mPicker.hasOpacityBar())
mPicker.changeOpacityBarColor(mColor);
}
invalidate();
}
示例3: setLocation
import android.graphics.Color; //导入方法依赖的package包/类
public void setLocation(float value) {
int color = colorForLocation(location = value);
swatchPaint.setColor(color);
float hsv[] = new float[3];
Color.colorToHSV(color, hsv);
if (hsv[0] < 0.001 && hsv[1] < 0.001 && hsv[2] > 0.92f) {
int c = (int) ((1.0f - (hsv[2] - 0.92f) / 0.08f * 0.22f) * 255);
swatchStrokePaint.setColor(Color.rgb(c, c, c));
} else {
swatchStrokePaint.setColor(color);
}
invalidate();
}
示例4: setColor
import android.graphics.Color; //导入方法依赖的package包/类
/**
* Set the bar color. <br>
* <br>
* Its discouraged to use this method.
*
* @param color
*/
public void setColor(int color) {
int x1, y1;
if(mOrientation == ORIENTATION_HORIZONTAL) {
x1 = (mBarLength + mBarPointerHaloRadius);
y1 = mBarThickness;
}
else {
x1 = mBarThickness;
y1 = (mBarLength + mBarPointerHaloRadius);
}
Color.colorToHSV(color, mHSVColor);
shader = new LinearGradient(mBarPointerHaloRadius, 0,
x1, y1, new int[] {
Color.WHITE, color }, null,
Shader.TileMode.CLAMP);
mBarPaint.setShader(shader);
calculateColor(mBarPointerPosition);
mBarPointerPaint.setColor(mColor);
if (mPicker != null) {
mPicker.setNewCenterColor(mColor);
if(mPicker.hasValueBar())
mPicker.changeValueBarColor(mColor);
else if(mPicker.hasOpacityBar())
mPicker.changeOpacityBarColor(mColor);
}
invalidate();
}
示例5: getDarkerColor
import android.graphics.Color; //导入方法依赖的package包/类
public int getDarkerColor(int color) {
float[] hsv = new float[3];
Color.colorToHSV(color, hsv);
hsv[1] = hsv[1] + 0.1f;
hsv[2] = hsv[2] - 0.1f;
int darkerColor = Color.HSVToColor(hsv);
return darkerColor;
}
示例6: getPrimaryDarkColor
import android.graphics.Color; //导入方法依赖的package包/类
public static int getPrimaryDarkColor(Context ctx) {
if (!hasCustomPrimaryColor(ctx))
return StyledAttributesHelper.getColor(ctx, R.attr.colorPrimaryDark, 0);
int color = getPrimaryColor(ctx);
float[] hsv = new float[3];
Color.colorToHSV(color, hsv);
hsv[2] *= 0.8f;
return Color.HSVToColor(hsv);
}
示例7: updateSettingColor
import android.graphics.Color; //导入方法依赖的package包/类
private void updateSettingColor() {
int color = IconColorExtractor.get(getContext(), mIcon);
// Make the dominant color bright.
float[] hsv = new float[3];
Color.colorToHSV(color, hsv);
hsv[1] = Math.min(hsv[1], MIN_SATUNATION);
hsv[2] = 1;
color = Color.HSVToColor(hsv);
mSettingIconDrawable.setColorFilter(color, PorterDuff.Mode.SRC_IN);
}
示例8: C
import android.graphics.Color; //导入方法依赖的package包/类
C(int rgba){
float[] hsv = new float[3];
Color.colorToHSV(rgba, hsv);
int alpha = Color.alpha(rgba);
alpha(alpha);
hue(hsv[0]);
sat(hsv[1]);
val(hsv[2]);
}
示例9: init
import android.graphics.Color; //导入方法依赖的package包/类
private void init(Context context) {
float[] hsv = new float[3];
Color.colorToHSV(ContextCompat.getColor(context, R.color.fdroid_blue), hsv);
hsv[1] *= 0.5f;
hsv[2] *= 0.7f;
baseColour = Color.HSVToColor(hsv);
}
示例10: getDarkColor
import android.graphics.Color; //导入方法依赖的package包/类
@ColorInt
public static int getDarkColor(@ColorInt int color) {
float[] hsv = new float[3];
Color.colorToHSV(color, hsv);
hsv[2] *= 0.8f;
return Color.HSVToColor(hsv);
}
示例11: ObservableColor
import android.graphics.Color; //导入方法依赖的package包/类
ObservableColor(int color) {
Color.colorToHSV(color, hsv);
alpha = Color.alpha(color);
}
示例12: updateColor
import android.graphics.Color; //导入方法依赖的package包/类
public void updateColor(int color, ColorObserver sender) {
Color.colorToHSV(color, hsv);
alpha = Color.alpha(color);
notifyOtherObservers(sender);
}
示例13: shiftColor
import android.graphics.Color; //导入方法依赖的package包/类
private int shiftColor(int color, boolean up) {
float[] hsv = new float[3];
Color.colorToHSV(color, hsv);
hsv[2] *= (up ? 1.1f : 0.9f); // value component
return Color.HSVToColor(hsv);
}
示例14: setColor
import android.graphics.Color; //导入方法依赖的package包/类
public void setColor(int color) {
Color.colorToHSV(color, mColorHSV);
invalidate();
}
示例15: setColor
import android.graphics.Color; //导入方法依赖的package包/类
public void setColor(int color) {
Color.colorToHSV(color, colorHSV);
}