当前位置: 首页>>代码示例>>Java>>正文


Java Color.colorToHSV方法代码示例

本文整理汇总了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;
}
 
开发者ID:adk96r,项目名称:Selector-Switch-UI-Component,代码行数:35,代码来源:SelectorUtil.java

示例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();
}
 
开发者ID:Datatellit,项目名称:xlight_android_native,代码行数:32,代码来源:SVBar.java

示例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();
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:18,代码来源:ColorPicker.java

示例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();
}
 
开发者ID:Datatellit,项目名称:xlight_android_native,代码行数:36,代码来源:SaturationBar.java

示例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;
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:9,代码来源:ShadowImageView.java

示例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);
}
 
开发者ID:MCMrARM,项目名称:revolution-irc,代码行数:10,代码来源:ThemeHelper.java

示例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);
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:12,代码来源:PendingAppWidgetHostView.java

示例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]);
}
 
开发者ID:eltos,项目名称:SimpleDialogFragments,代码行数:11,代码来源:ColorWheelView.java

示例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);
}
 
开发者ID:uhuru-mobile,项目名称:mobile-store,代码行数:8,代码来源:FeatureImage.java

示例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);
}
 
开发者ID:TheAndroidMaster,项目名称:Metronome-Android,代码行数:8,代码来源:ColorUtils.java

示例11: ObservableColor

import android.graphics.Color; //导入方法依赖的package包/类
ObservableColor(int color) {
	Color.colorToHSV(color, hsv);
	alpha = Color.alpha(color);
}
 
开发者ID:salim3dd,项目名称:hsv-alpha-color-picker,代码行数:5,代码来源:ObservableColor.java

示例12: updateColor

import android.graphics.Color; //导入方法依赖的package包/类
public void updateColor(int color, ColorObserver sender) {
	Color.colorToHSV(color, hsv);
	alpha = Color.alpha(color);
	notifyOtherObservers(sender);
}
 
开发者ID:salim3dd,项目名称:hsv-alpha-color-picker,代码行数:6,代码来源:ObservableColor.java

示例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);
}
 
开发者ID:adityakamble49,项目名称:gofun-app,代码行数:7,代码来源:ChangelogDialog.java

示例14: setColor

import android.graphics.Color; //导入方法依赖的package包/类
public void setColor(int color) {
    Color.colorToHSV(color, mColorHSV);
    invalidate();
}
 
开发者ID:dftec-es,项目名称:planetcon,代码行数:5,代码来源:ColorPicker.java

示例15: setColor

import android.graphics.Color; //导入方法依赖的package包/类
public void setColor(int color) {
    Color.colorToHSV(color, colorHSV);
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:4,代码来源:ColorPicker.java


注:本文中的android.graphics.Color.colorToHSV方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。