下面列出了android.graphics.Color#BLACK 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Creates an image cue.
*
* @param bitmap See {@link #bitmap}.
* @param horizontalPosition The position of the horizontal anchor within the viewport, expressed
* as a fraction of the viewport width.
* @param horizontalPositionAnchor The horizontal anchor. One of {@link #ANCHOR_TYPE_START},
* {@link #ANCHOR_TYPE_MIDDLE}, {@link #ANCHOR_TYPE_END} and {@link #TYPE_UNSET}.
* @param verticalPosition The position of the vertical anchor within the viewport, expressed as a
* fraction of the viewport height.
* @param verticalPositionAnchor The vertical anchor. One of {@link #ANCHOR_TYPE_START}, {@link
* #ANCHOR_TYPE_MIDDLE}, {@link #ANCHOR_TYPE_END} and {@link #TYPE_UNSET}.
* @param width The width of the cue as a fraction of the viewport width.
* @param height The height of the cue as a fraction of the viewport height, or {@link
* #DIMEN_UNSET} if the bitmap should be displayed at its natural height for the specified
* {@code width}.
*/
public Cue(
Bitmap bitmap,
float horizontalPosition,
@AnchorType int horizontalPositionAnchor,
float verticalPosition,
@AnchorType int verticalPositionAnchor,
float width,
float height) {
this(
/* text= */ null,
/* textAlignment= */ null,
bitmap,
verticalPosition,
/* lineType= */ LINE_TYPE_FRACTION,
verticalPositionAnchor,
horizontalPosition,
horizontalPositionAnchor,
/* textSizeType= */ TYPE_UNSET,
/* textSize= */ DIMEN_UNSET,
width,
height,
/* windowColorSet= */ false,
/* windowColor= */ Color.BLACK);
}
/**
* Creates an image cue.
*
* @param bitmap See {@link #bitmap}.
* @param horizontalPosition The position of the horizontal anchor within the viewport, expressed
* as a fraction of the viewport width.
* @param horizontalPositionAnchor The horizontal anchor. One of {@link #ANCHOR_TYPE_START},
* {@link #ANCHOR_TYPE_MIDDLE}, {@link #ANCHOR_TYPE_END} and {@link #TYPE_UNSET}.
* @param verticalPosition The position of the vertical anchor within the viewport, expressed as a
* fraction of the viewport height.
* @param verticalPositionAnchor The vertical anchor. One of {@link #ANCHOR_TYPE_START}, {@link
* #ANCHOR_TYPE_MIDDLE}, {@link #ANCHOR_TYPE_END} and {@link #TYPE_UNSET}.
* @param width The width of the cue as a fraction of the viewport width.
* @param height The height of the cue as a fraction of the viewport height, or {@link
* #DIMEN_UNSET} if the bitmap should be displayed at its natural height for the specified
* {@code width}.
*/
public Cue(
Bitmap bitmap,
float horizontalPosition,
@AnchorType int horizontalPositionAnchor,
float verticalPosition,
@AnchorType int verticalPositionAnchor,
float width,
float height) {
this(
/* text= */ null,
/* textAlignment= */ null,
bitmap,
verticalPosition,
/* lineType= */ LINE_TYPE_FRACTION,
verticalPositionAnchor,
horizontalPosition,
horizontalPositionAnchor,
/* textSizeType= */ TYPE_UNSET,
/* textSize= */ DIMEN_UNSET,
width,
height,
/* windowColorSet= */ false,
/* windowColor= */ Color.BLACK);
}
private Bitmap bitMatrix2Bitmap(BitMatrix matrix,int colorBg) {
int w = matrix.getWidth();
int h = matrix.getHeight();
int[] rawData = new int[w * h];
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
int color = colorBg;
if (matrix.get(i, j)) {
color = Color.BLACK;
}
rawData[i + (j * w)] = color;
}
}
Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.RGB_565);
bitmap.setPixels(rawData, 0, w, 0, 0, w, h);
return bitmap;
}
private void initialize() {
paint = new Paint();
paint.setStyle(Paint.Style.FILL);
scrollBarAlpha = DEFAULT_SCROLLBAR_ALPHA;
backgroundAlpha = DEFAULT_BACKGROUND_ALPHA;
scrollBarWidth = 0;
scrollBarIndex = 0;
scrollBarColor = Color.WHITE;
backgroundColor = Color.BLACK;
setAlpha(0);
showAnimator = ObjectAnimator.ofFloat(
this, "alpha", getAlpha(), 1
).setDuration(100);
dismissAnimator = ObjectAnimator.ofFloat(
this, "alpha", getAlpha(), 0
).setDuration(200);
dismissAnimator.setStartDelay(600);
}
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes)
throws SAXException {
String tagName = localName.length() != 0 ? localName : qName;
tagName = tagName.toLowerCase(Locale.getDefault()).trim();
if (tagName.equals("d")) {
// <d p="23.826000213623,1,25,16777215,1422201084,0,057075e9,757076900">我从未见过如此厚颜无耻之猴</d>
// 0:时间(弹幕出现时间)
// 1:类型(1从右至左滚动弹幕|6从左至右滚动弹幕|5顶端固定弹幕|4底端固定弹幕|7高级弹幕|8脚本弹幕)
// 2:字号
// 3:颜色
// 4:时间戳 ?
// 5:弹幕池id
// 6:用户hash
// 7:弹幕id
String pValue = attributes.getValue("p");
// parse p value to danmaku
String[] values = pValue.split(",");
if (values.length > 0) {
long time = (long) (Float.parseFloat(values[0]) * 1000); // 出现时间
int type = Integer.parseInt(values[1]); // 弹幕类型
float textSize = Float.parseFloat(values[2]); // 字体大小
int color = (int) ((0x00000000ff000000 | Long.parseLong(values[3])) & 0x00000000ffffffff); // 颜色
// int poolType = Integer.parseInt(values[5]); // 弹幕池类型(忽略
item = mContext.mDanmakuFactory.createDanmaku(type, mContext);
if (item != null) {
item.setTime(time);
item.textSize = textSize * (mDispDensity - 0.6f);
item.textColor = color;
item.textShadowColor = color <= Color.BLACK ? Color.WHITE : Color.BLACK;
}
}
}
}
public LineBase(VafContext context, ViewCache viewCache) {
super(context, viewCache);
mLineColor = Color.BLACK;
mLineWidth = 1;
mIsHorizontal = true;
mStyle = STYLE_SOLID;
}
/**
* Creates a text cue.
*
* @param text See {@link #text}.
* @param textAlignment See {@link #textAlignment}.
* @param line See {@link #line}.
* @param lineType See {@link #lineType}.
* @param lineAnchor See {@link #lineAnchor}.
* @param position See {@link #position}.
* @param positionAnchor See {@link #positionAnchor}.
* @param size See {@link #size}.
* @param textSizeType See {@link #textSizeType}.
* @param textSize See {@link #textSize}.
*/
public Cue(
CharSequence text,
@Nullable Alignment textAlignment,
float line,
@LineType int lineType,
@AnchorType int lineAnchor,
float position,
@AnchorType int positionAnchor,
float size,
@TextSizeType int textSizeType,
float textSize) {
this(
text,
textAlignment,
/* bitmap= */ null,
line,
lineType,
lineAnchor,
position,
positionAnchor,
textSizeType,
textSize,
size,
/* bitmapHeight= */ DIMEN_UNSET,
/* windowColorSet= */ false,
/* windowColor= */ Color.BLACK);
}
@Override
public void onSuccess() {
Log.d(TAG, "Success");
for (int i = 0; i < labels.length; ++i) {
int luminance = luminances[i];
TextView label = labels[i];
final int textColor = bright.isBright(luminance) ? Color.BLACK
: Color.WHITE;
label.setTextColor(textColor);
label.setText("Bright (" + (int) luminance + ")");
}
}
@SuppressWarnings("unused")
C contrastColor(){
if (r()*0.299+g()*0.587+b()*0.144 >= 128){
return new C(Color.BLACK);
} else {
return new C(Color.WHITE);
}
}
public int getStatusBarColor() {
if (!hasL()) {
// On pre-L devices, you can have any status bar color so long as it's black.
return Color.BLACK;
}
return mActivity.getWindow().getStatusBarColor();
}
/**
* Color the progress bar based on the toolbar theme color.
* @param color The Android color the toolbar is using.
*/
public void setThemeColor(int color, boolean isIncognito) {
mThemeColor = color;
boolean isDefaultTheme = ColorUtils.isUsingDefaultToolbarColor(getResources(), color);
// All colors use a single path if using the status bar color as the background.
if (mUseStatusBarColorAsBackground) {
if (isDefaultTheme) color = Color.BLACK;
setForegroundColor(
ApiCompatibilityUtils.getColor(getResources(), R.color.white_alpha_70));
setBackgroundColor(ColorUtils.getDarkenedColorForStatusBar(color));
return;
}
// The default toolbar has specific colors to use.
if ((isDefaultTheme || !ColorUtils.isValidThemeColor(color)) && !isIncognito) {
setForegroundColor(ApiCompatibilityUtils.getColor(getResources(),
R.color.progress_bar_foreground));
setBackgroundColor(ApiCompatibilityUtils.getColor(getResources(),
R.color.progress_bar_background));
return;
}
setForegroundColor(ColorUtils.getThemedAssetColor(color, isIncognito));
if (mAnimatingView != null
&& (ColorUtils.shouldUseLightForegroundOnBackground(color) || isIncognito)) {
mAnimatingView.setColor(ColorUtils.getColorWithOverlay(color, Color.WHITE,
ANIMATION_WHITE_FRACTION));
}
setBackgroundColor(ColorUtils.getColorWithOverlay(color, Color.WHITE,
THEMED_BACKGROUND_WHITE_FRACTION));
}
public Option() {
this.iconId = 0;
this.iconColor = Color.BLACK;
this.titleColor = Color.BLACK;
this.descriptionColor = Color.BLACK;
this.id = -1L;
this.title = "";
this.description = "";
this.tag = null;
}
@Override
public void tracing_setup ()
{
pathColour = Color.BLACK;
path1 = (OBGroup) objectDict.get("trace_p1");
path2 = (OBGroup) objectDict.get("trace_p2");
//
dash1 = (OBImage) objectDict.get("dash_p1");
//
uPaths = new ArrayList<>();
uPaths.addAll(tracing_processDigit(path1));
uPaths.addAll(tracing_processDigit(path2));
//
List<OBGroup> spArray = new ArrayList<>();
spArray.addAll(tracing_subpathControlsFromPath("trace_p1"));
spArray.addAll(tracing_subpathControlsFromPath("trace_p2"));
//
List<OBPath> paths = new ArrayList<>();
if (path1 != null)
{
paths.addAll((List<OBPath>) (Object) path1.filterMembers("p.*"));
path1.hide();
}
if (path2 != null)
{
paths.addAll((List<OBPath>) (Object) path2.filterMembers("p.*"));
path2.hide();
}
for (OBPath path : paths)
{
path.setStrokeEnd(0.0f);
}
//
subPaths = spArray;
for (OBControl c : subPaths)
{
c.hide();
}
}
public UmbrellaDrawable() {
mColor1 = Color.RED;
mColor2 = Color.WHITE;
mBackgroundColor = Color.BLACK;
mPath = new Path();
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
}
/**
*
* @description: ��ȡָ����ɫֵ�����Խ�����ɫֵ���Ӻڹ��ɵ�ָ������ɫ���ٵ���ɫ����ɫ--color--��ɫ��
* @date: 2015-3-16 ����9:06:46
* @author�� yems
*/
private int[] getColors(int color) {
if (color == Color.BLACK || color == Color.WHITE) {
return new int[] { Color.BLACK, Color.WHITE };
}
return new int[] { Color.BLACK, color, Color.WHITE };
}
@Override
public boolean onTouchEvent(MotionEvent event) {
getParent().requestDisallowInterceptTouchEvent(true);
// Convert coordinates to our internal coordinate system
float dimen;
if (mOrientation == ORIENTATION_HORIZONTAL) {
dimen = event.getX();
} else {
dimen = event.getY();
}
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
mIsMovingPointer = true;
// Check whether the user pressed on (or near) the pointer
if (dimen >= (mBarPointerHaloRadius)
&& dimen <= (mBarPointerHaloRadius + mBarLength)) {
mBarPointerPosition = Math.round(dimen);
calculateColor(Math.round(dimen));
mBarPointerPaint.setColor(mColor);
invalidate();
}
break;
case MotionEvent.ACTION_MOVE:
if (mIsMovingPointer) {
// Move the the pointer on the bar.
if (dimen >= mBarPointerHaloRadius
&& dimen <= (mBarPointerHaloRadius + mBarLength)) {
mBarPointerPosition = Math.round(dimen);
calculateColor(Math.round(dimen));
mBarPointerPaint.setColor(mColor);
invalidate();
} else if (dimen < mBarPointerHaloRadius) {
mBarPointerPosition = mBarPointerHaloRadius;
mColor = Color.BLACK;
mWComponent = 0f;
mBarPointerPaint.setColor(mColor);
invalidate();
} else if (dimen > (mBarPointerHaloRadius + mBarLength)) {
mBarPointerPosition = mBarPointerHaloRadius + mBarLength;
mColor = Color.WHITE;//Color.HSVToColor(mHSVColor);
mWComponent = 1f;
mBarPointerPaint.setColor(mColor);
invalidate();
}
}
if (mListener != null && mOldWComponent != mWComponent) {
mListener.onWComponentChanged(mWComponent);
mOldWComponent = mWComponent;
}
break;
case MotionEvent.ACTION_UP:
mIsMovingPointer = false;
break;
}
return true;
}
/**
* Set device status bar to a given color.
* @param tab The tab that is currently showing.
* @param color The color that the status bar should be set to.
*/
protected void setStatusBarColor(Tab tab, int color) {
int statusBarColor = (tab != null && tab.isDefaultThemeColor())
? Color.BLACK : ColorUtils.getDarkenedColorForStatusBar(color);
ApiCompatibilityUtils.setStatusBarColor(getWindow(), statusBarColor);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
getParent().requestDisallowInterceptTouchEvent(true);
// Convert coordinates to our internal coordinate system
float dimen;
if (mOrientation == ORIENTATION_HORIZONTAL) {
dimen = event.getX();
}
else {
dimen = event.getY();
}
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
mIsMovingPointer = true;
// Check whether the user pressed on (or near) the pointer
if (dimen >= (mBarPointerHaloRadius)
&& dimen <= (mBarPointerHaloRadius + mBarLength)) {
mBarPointerPosition = Math.round(dimen);
calculateColor(Math.round(dimen));
mBarPointerPaint.setColor(mColor);
invalidate();
}
break;
case MotionEvent.ACTION_MOVE:
if (mIsMovingPointer) {
// Move the the pointer on the bar.
if (dimen >= mBarPointerHaloRadius
&& dimen <= (mBarPointerHaloRadius + mBarLength)) {
mBarPointerPosition = Math.round(dimen);
calculateColor(Math.round(dimen));
mBarPointerPaint.setColor(mColor);
if (mPicker != null) {
mPicker.setNewCenterColor(mColor);
mPicker.changeOpacityBarColor(mColor);
}
invalidate();
} else if (dimen < mBarPointerHaloRadius) {
mBarPointerPosition = mBarPointerHaloRadius;
mColor = Color.HSVToColor(mHSVColor);
mBarPointerPaint.setColor(mColor);
if (mPicker != null) {
mPicker.setNewCenterColor(mColor);
mPicker.changeOpacityBarColor(mColor);
}
invalidate();
} else if (dimen > (mBarPointerHaloRadius + mBarLength)) {
mBarPointerPosition = mBarPointerHaloRadius + mBarLength;
mColor = Color.BLACK;
mBarPointerPaint.setColor(mColor);
if (mPicker != null) {
mPicker.setNewCenterColor(mColor);
mPicker.changeOpacityBarColor(mColor);
}
invalidate();
}
}
if(onValueChangedListener != null && oldChangedListenerValue != mColor){
onValueChangedListener.onValueChanged(mColor);
oldChangedListenerValue = mColor;
}
break;
case MotionEvent.ACTION_UP:
mIsMovingPointer = false;
break;
}
return true;
}
@Override
protected void setStatusBarColor(Tab tab, int color) {
if (DeviceFormFactor.isTablet(getApplicationContext())) return;
super.setStatusBarColor(tab, isInOverviewMode() ? Color.BLACK : color);
}
/**
* @param view View to be animated
* @param borderWidth The width of the spinning bar
* @param arcColor The color of the spinning bar
*/
public CircularAnimatedDrawable(View view, float borderWidth, int arcColor) {
this(view, borderWidth, arcColor, 0, Color.BLACK);
}