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


Java Color.HSVToColor方法代码示例

本文整理汇总了Java中android.graphics.Color.HSVToColor方法的典型用法代码示例。如果您正苦于以下问题:Java Color.HSVToColor方法的具体用法?Java Color.HSVToColor怎么用?Java Color.HSVToColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.Color的用法示例。


在下文中一共展示了Color.HSVToColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calculateColor

import android.graphics.Color; //导入方法依赖的package包/类
/**
 * Calculate the color selected by the pointer on the bar.
 * 
 * @param coord
 *            Coordinate of the pointer.
 */
private void calculateColor(int coord) {
	coord = coord - mBarPointerHaloRadius;
	if (coord < 0) {
		coord = 0;
	} else if (coord > mBarLength) {
		coord = mBarLength;
	}

	mColor = Color.HSVToColor(Math.round(mPosToOpacFactor * coord),
			mHSVColor);
	if (Color.alpha(mColor) > 250) {
		mColor = Color.HSVToColor(mHSVColor);
	} else if (Color.alpha(mColor) < 5) {
		mColor = Color.TRANSPARENT;
	}
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:23,代码来源:OpacityBar.java

示例2: makeBitmap

import android.graphics.Color; //导入方法依赖的package包/类
protected Bitmap makeBitmap(int w, int h) {
	final boolean isWide = w > h;
	final int n = Math.max(w, h);
	int[] colors = new int[n];

	float[] hsv = new float[]{0, 0, 0};
	observableColor.getHsv(hsv);

	for (int i = 0; i < n; ++i) {
		hsv[2] = isWide ? (float)i / n : 1 - (float)i / n;
		colors[i] = Color.HSVToColor(hsv);
	}
	final int bmpWidth = isWide ? w : 1;
	final int bmpHeight = isWide ? 1 : h;
	return Bitmap.createBitmap(colors, bmpWidth, bmpHeight, Bitmap.Config.ARGB_8888);
}
 
开发者ID:salim3dd,项目名称:hsv-alpha-color-picker,代码行数:17,代码来源:ValueView.java

示例3: createColorWheelBitmap

import android.graphics.Color; //导入方法依赖的package包/类
private Bitmap createColorWheelBitmap(int width, int height) {

        Bitmap bitmap = Bitmap.createBitmap(width, height, Config.ARGB_8888);

        int colorCount = 12;
        int colorAngleStep = 360 / 12;
        int colors[] = new int[colorCount + 1];
        float hsv[] = new float[] { 0f, 1f, 1f };
        for (int i = 0; i < colors.length; i++) {
            hsv[0] = (i * colorAngleStep + 180) % 360;
            colors[i] = Color.HSVToColor(hsv);
        }
        colors[colorCount] = colors[0];

        SweepGradient sweepGradient = new SweepGradient(width / 2, height / 2, colors, null);
        RadialGradient radialGradient = new RadialGradient(width / 2, height / 2, colorWheelRadius, 0xFFFFFFFF, 0x00FFFFFF, TileMode.CLAMP);
        ComposeShader composeShader = new ComposeShader(sweepGradient, radialGradient, PorterDuff.Mode.SRC_OVER);

        colorWheelPaint.setShader(composeShader);

        Canvas canvas = new Canvas(bitmap);
        canvas.drawCircle(width / 2, height / 2, colorWheelRadius, colorWheelPaint);

        return bitmap;

    }
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:27,代码来源:MultiColorPicker.java

示例4: createColorDiscBitmap

import android.graphics.Color; //导入方法依赖的package包/类
private Bitmap createColorDiscBitmap(int radius) {
    int centerColor, edgeColor;
    Bitmap bitmap = Bitmap.createBitmap(2 * radius, 2 * radius, Config.ARGB_8888);

    Canvas canvas = new Canvas(bitmap);
    mHSV[0] = 0; mHSV[1] = 1; mHSV[2] = 1;   //red
    SweepGradient sweepGradient = new SweepGradient(radius, radius, getColors(mHSV), null);
    mColorPaint.setShader(sweepGradient);
    canvas.drawCircle(radius, radius, radius, mColorPaint);

    mHSV[0] = 0; mHSV[1] = 0; mHSV[2] = 1;   //white
    centerColor = Color.HSVToColor(255, mHSV);
    edgeColor = Color.HSVToColor(0, mHSV);
    RadialGradient radialGradient = new RadialGradient(radius, radius, radius, centerColor, edgeColor, TileMode.CLAMP);
    mColorPaint.setShader(radialGradient);
    canvas.drawCircle(radius, radius, radius, mColorPaint);

    return bitmap;
}
 
开发者ID:dftec-es,项目名称:planetcon,代码行数:20,代码来源:ColorPicker.java

示例5: 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.HSVToColor(0x00, mHSVColor), color }, null,
			Shader.TileMode.CLAMP);
	mBarPaint.setShader(shader);
	calculateColor(mBarPointerPosition);
	mBarPointerPaint.setColor(mColor);
	if (mPicker != null) {
		mPicker.setNewCenterColor(mColor);
	}
	invalidate();
}
 
开发者ID:mkulesh,项目名称:microMathematics,代码行数:30,代码来源:OpacityBar.java

示例6: buildHueColorArray

import android.graphics.Color; //导入方法依赖的package包/类
private int[] buildHueColorArray(){

		int[] hue = new int[361];

		int count = 0;
		for(int i = hue.length -1; i >= 0; i--, count++){
			hue[count] = Color.HSVToColor(new float[]{i, 1f, 1f});
		}

		return hue;
	}
 
开发者ID:Bregnet,项目名称:TextView_CustomEdit_CustomColor,代码行数:12,代码来源:ColorPickerView.java

示例7: getClearerColor

import android.graphics.Color; //导入方法依赖的package包/类
public static int getClearerColor(int color) {
    float[] hsv = new float[3];
    Color.colorToHSV(color, hsv);
    hsv[2] *= 1.4f; // value component
    color = Color.HSVToColor(hsv);
    return color;
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:8,代码来源:VideoInfoCommonClass.java

示例8: makeColorDark

import android.graphics.Color; //导入方法依赖的package包/类
/**
 * Get the darker version of the given color.
 *
 * @param color Normal color.
 * @return Darker shade of the color.
 * @see 'http://stackoverflow.com/a/4928826'
 */
@ColorInt
public static int makeColorDark(@ColorInt int color) {
    float[] hsv = new float[3];
    Color.colorToHSV(color, hsv);
    hsv[2] = 1f - 0.8f * hsv[2]; // value component
    return Color.HSVToColor(hsv);
}
 
开发者ID:kevalpatel2106,项目名称:PasscodeView,代码行数:15,代码来源:Utils.java

示例9: getComplementaryColor

import android.graphics.Color; //导入方法依赖的package包/类
public static int getComplementaryColor(int colorToInvert) {
    float[] hsv = new float[3];
    Color.RGBToHSV(Color.red(colorToInvert), Color.green(colorToInvert),
            Color.blue(colorToInvert), hsv);
    hsv[0] = (hsv[0] + 180) % 360;
    return Color.HSVToColor(hsv);
}
 
开发者ID:medalionk,项目名称:simple-share-android,代码行数:8,代码来源:Utils.java

示例10: onColorsClicked

import android.graphics.Color; //导入方法依赖的package包/类
@OnClick(R.id.button_set_colors)
void onColorsClicked() {
    int color = Color.HSVToColor(new float[]{
            random.nextFloat() * 360,
            1f,
            0.75f
    });
    widget.setArrowColor(color);
    widget.setSelectionColor(color);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:DynamicSettersActivity.java

示例11: darkenColor

import android.graphics.Color; //导入方法依赖的package包/类
public static int darkenColor(int color) {
    float[] hsv = new float[3];
    int alpha = Color.alpha(color);
    Color.colorToHSV(color, hsv);
    hsv[1] = Math.min(hsv[1] * DARKEN_SATURATION, 1.0f);
    hsv[2] = hsv[2] * DARKEN_INTENSITY;
    int tempColor = Color.HSVToColor(hsv);
    return Color.argb(alpha, Color.red(tempColor), Color.green(tempColor), Color.blue(tempColor));
}
 
开发者ID:huashengzzz,项目名称:SmartChart,代码行数:10,代码来源:ChartUtils.java

示例12: darkenColor

import android.graphics.Color; //导入方法依赖的package包/类
public static int darkenColor(int color) {
    hsv = new float[3];
    int alpha = Color.alpha(color);
    Color.colorToHSV(color, hsv);
    hsv[1] = Math.min(hsv[1] * DARKEN_SATURATION, 1.0f);
    hsv[2] = hsv[2] * DARKEN_INTENSITY;
    int tempColor = Color.HSVToColor(hsv);
    return Color.argb(alpha, Color.red(tempColor), Color.green(tempColor), Color.blue(tempColor));
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:10,代码来源:ChartUtils.java

示例13: lightenColor

import android.graphics.Color; //导入方法依赖的package包/类
private static int lightenColor(int color) {
    float[] hsv = new float[3];
    Color.colorToHSV(color, hsv);
    hsv[2] *= 1.1f;
    return Color.HSVToColor(hsv);
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:7,代码来源:FloatingActionButton.java

示例14: getLighterColor

import android.graphics.Color; //导入方法依赖的package包/类
private int getLighterColor(int color) {
    float[] hsv = new float[3];
    Color.colorToHSV(color, hsv);
    hsv[2] *= 1.1f;
    return Color.HSVToColor(hsv);
}
 
开发者ID:SavorGit,项目名称:Hotspot-master-devp,代码行数:7,代码来源:SectorMenuButton.java

示例15: getStatusBarColor

import android.graphics.Color; //导入方法依赖的package包/类
public static int getStatusBarColor(int primaryColor) {
    float[] arrayOfFloat = new float[3];
    Color.colorToHSV(primaryColor, arrayOfFloat);
    arrayOfFloat[2] *= 0.9F;
    return Color.HSVToColor(arrayOfFloat);
}
 
开发者ID:Vinetos,项目名称:Hello-Music-droid,代码行数:7,代码来源:ATEUtils.java


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