Most visited

Recently visited

ColorOverlayDimmer

public final class ColorOverlayDimmer
extends Object

java.lang.Object
   ↳ android.support.v17.leanback.graphics.ColorOverlayDimmer


Helper类将颜色分配给Paint。 它保存当前活动级别的Alpha值。

Summary

Public methods

int applyToColor(int color)

根据当前的调光级别更改颜色的RGB。

static ColorOverlayDimmer createColorOverlayDimmer(int dimColor, float activeLevel, float dimmedLevel)

为给定的颜色和级别创建一个ColorOverlayDimmer。

static ColorOverlayDimmer createDefault(Context context)

创建一个默认的ColorOverlayDimmer。

void drawColorOverlay(Canvas c, View v, boolean includePadding)

在父视图的画布内绘制一个子视图顶部的暗色覆盖图。

int getAlpha()

返回调光器的alpha值。

float getAlphaFloat()

返回0到1之间的浮点值,对应于0到255之间的字母。

Paint getPaint()

返回设置为当前alpha值的Paint对象。

boolean needsDraw()

返回调光器是否需要绘制。

void setActiveLevel(float level)

设置调光器的有效电平。

Inherited methods

From class java.lang.Object

Public methods

applyToColor

int applyToColor (int color)

根据当前的调光级别更改颜色的RGB。 保持颜色的alpha值。

Parameters
color int: The color to apply the dim level to.
Returns
int A color with the RGB values adjusted by the alpha of the current dim level.

createColorOverlayDimmer

ColorOverlayDimmer createColorOverlayDimmer (int dimColor, 
                float activeLevel, 
                float dimmedLevel)

为给定的颜色和级别创建一个ColorOverlayDimmer。

Parameters
dimColor int: The color for fully dimmed. Only the RGB values are used; the alpha channel is ignored.
activeLevel float: The level of dimming when the View is in its active state. Must be a float value between 0.0 and 1.0.
dimmedLevel float: The level of dimming when the View is in its dimmed state. Must be a float value between 0.0 and 1.0.
Returns
ColorOverlayDimmer

createDefault

ColorOverlayDimmer createDefault (Context context)

创建一个默认的ColorOverlayDimmer。

Parameters
context Context
Returns
ColorOverlayDimmer

drawColorOverlay

void drawColorOverlay (Canvas c, 
                View v, 
                boolean includePadding)

在父视图的画布内绘制一个子视图顶部的暗色覆盖图。

Parameters
c Canvas: Canvas of the parent View.
v View: A child of the parent View.
includePadding boolean: Set to true to draw overlay on padding area of the View.

getAlpha

int getAlpha ()

返回调光器的alpha值。

Returns
int

getAlphaFloat

float getAlphaFloat ()

返回0到1之间的浮点值,对应于0到255之间的字母。

Returns
float

getPaint

Paint getPaint ()

返回设置为当前alpha值的Paint对象。

Returns
Paint

needsDraw

boolean needsDraw ()

返回调光器是否需要绘制。

Returns
boolean

setActiveLevel

void setActiveLevel (float level)

设置调光器的有效电平。 根据级别更新Alpha值。

Parameters
level float: A float between 0 (fully dim) and 1 (fully active).

Hooray!