HaikuControlLook: De-convolute edge color computation.
Previously it used "contrast" and "brightness" values that were computed in strange ways. Now it behaves more like the other color computation functions and deals with the "flags" directly. Comparing many controls, colors on button frames in all states appear to be the same (or nearly the same, within 1-2 RGB values) before and after this change. Change-Id: Ia6d696c29fc76c73c88cc97af97ea45e1ff089ff Reviewed-on: https://review.haiku-os.org/c/haiku/+/9321 Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
committed by
waddlesplash
parent
0b9af29d07
commit
8de71284ed
@@ -347,14 +347,11 @@ protected:
|
|||||||
float rightBottomRadius,
|
float rightBottomRadius,
|
||||||
const rgb_color& base,
|
const rgb_color& base,
|
||||||
const rgb_color& background,
|
const rgb_color& background,
|
||||||
float contrast, float brightness = 1.0,
|
|
||||||
uint32 flags = 0,
|
uint32 flags = 0,
|
||||||
uint32 borders = B_ALL_BORDERS);
|
uint32 borders = B_ALL_BORDERS);
|
||||||
|
|
||||||
void _DrawOuterResessedFrame(BView* view,
|
void _DrawOuterResessedFrame(BView* view,
|
||||||
BRect& rect, const rgb_color& base,
|
BRect& rect, const rgb_color& base,
|
||||||
float contrast = 1.0f,
|
|
||||||
float brightness = 1.0f,
|
|
||||||
uint32 flags = 0,
|
uint32 flags = 0,
|
||||||
uint32 borders = B_ALL_BORDERS);
|
uint32 borders = B_ALL_BORDERS);
|
||||||
|
|
||||||
@@ -529,13 +526,8 @@ protected:
|
|||||||
orientation orientation);
|
orientation orientation);
|
||||||
|
|
||||||
// Border color methods
|
// Border color methods
|
||||||
rgb_color _EdgeLightColor(const rgb_color& base,
|
rgb_color _EdgeColor(const rgb_color& base,
|
||||||
float contrast, float brightness,
|
bool shadow, uint32 flags);
|
||||||
uint32 flags);
|
|
||||||
|
|
||||||
rgb_color _EdgeShadowColor(const rgb_color& base,
|
|
||||||
float contrast, float brightness,
|
|
||||||
uint32 flags);
|
|
||||||
|
|
||||||
rgb_color _FrameLightColor(const rgb_color& base,
|
rgb_color _FrameLightColor(const rgb_color& base,
|
||||||
uint32 flags);
|
uint32 flags);
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ HaikuControlLook::DrawButtonFrame(BView* view, BRect& rect, const BRect& updateR
|
|||||||
uint32 borders)
|
uint32 borders)
|
||||||
{
|
{
|
||||||
_DrawButtonFrame(view, rect, updateRect, 0.0f, 0.0f, 0.0f, 0.0f, base,
|
_DrawButtonFrame(view, rect, updateRect, 0.0f, 0.0f, 0.0f, 0.0f, base,
|
||||||
background, 1.0, 1.0, flags, borders);
|
background, flags, borders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ HaikuControlLook::DrawButtonFrame(BView* view, BRect& rect, const BRect& updateR
|
|||||||
uint32 borders)
|
uint32 borders)
|
||||||
{
|
{
|
||||||
_DrawButtonFrame(view, rect, updateRect, radius, radius, radius, radius,
|
_DrawButtonFrame(view, rect, updateRect, radius, radius, radius, radius,
|
||||||
base, background, 1.0, 1.0, flags, borders);
|
base, background, flags, borders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ HaikuControlLook::DrawButtonFrame(BView* view, BRect& rect,
|
|||||||
{
|
{
|
||||||
_DrawButtonFrame(view, rect, updateRect, leftTopRadius, rightTopRadius,
|
_DrawButtonFrame(view, rect, updateRect, leftTopRadius, rightTopRadius,
|
||||||
leftBottomRadius, rightBottomRadius, base, background,
|
leftBottomRadius, rightBottomRadius, base, background,
|
||||||
1.0, 1.0, flags, borders);
|
flags, borders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -221,7 +221,7 @@ HaikuControlLook::DrawMenuFieldFrame(BView* view, BRect& rect,
|
|||||||
const rgb_color& background, uint32 flags, uint32 borders)
|
const rgb_color& background, uint32 flags, uint32 borders)
|
||||||
{
|
{
|
||||||
_DrawButtonFrame(view, rect, updateRect, 0.0f, 0.0f, 0.0f, 0.0f, base,
|
_DrawButtonFrame(view, rect, updateRect, 0.0f, 0.0f, 0.0f, 0.0f, base,
|
||||||
background, 0.6, 1.0, flags, borders);
|
background, flags, borders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -231,7 +231,7 @@ HaikuControlLook::DrawMenuFieldFrame(BView* view, BRect& rect,
|
|||||||
const rgb_color& background, uint32 flags, uint32 borders)
|
const rgb_color& background, uint32 flags, uint32 borders)
|
||||||
{
|
{
|
||||||
_DrawButtonFrame(view, rect, updateRect, radius, radius, radius, radius,
|
_DrawButtonFrame(view, rect, updateRect, radius, radius, radius, radius,
|
||||||
base, background, 0.6, 1.0, flags, borders);
|
base, background, flags, borders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -243,7 +243,7 @@ HaikuControlLook::DrawMenuFieldFrame(BView* view, BRect& rect,
|
|||||||
const rgb_color& background, uint32 flags, uint32 borders)
|
const rgb_color& background, uint32 flags, uint32 borders)
|
||||||
{
|
{
|
||||||
_DrawButtonFrame(view, rect, updateRect, leftTopRadius, rightTopRadius,
|
_DrawButtonFrame(view, rect, updateRect, leftTopRadius, rightTopRadius,
|
||||||
leftBottomRadius, rightBottomRadius, base, background, 0.6, 1.0,
|
leftBottomRadius, rightBottomRadius, base, background,
|
||||||
flags, borders);
|
flags, borders);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -427,7 +427,7 @@ HaikuControlLook::DrawCheckBox(BView* view, BRect& rect, const BRect& updateRect
|
|||||||
rgb_color navigationColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR);
|
rgb_color navigationColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR);
|
||||||
|
|
||||||
if ((flags & B_DISABLED) != 0) {
|
if ((flags & B_DISABLED) != 0) {
|
||||||
_DrawOuterResessedFrame(view, rect, base, 0.0, 1.0, flags);
|
_DrawOuterResessedFrame(view, rect, base, flags);
|
||||||
|
|
||||||
dark1BorderColor = tint_color(base, 1.15);
|
dark1BorderColor = tint_color(base, 1.15);
|
||||||
dark2BorderColor = tint_color(base, 1.15);
|
dark2BorderColor = tint_color(base, 1.15);
|
||||||
@@ -441,7 +441,7 @@ HaikuControlLook::DrawCheckBox(BView* view, BRect& rect, const BRect& updateRect
|
|||||||
|
|
||||||
dark2BorderColor = dark1BorderColor;
|
dark2BorderColor = dark1BorderColor;
|
||||||
} else {
|
} else {
|
||||||
_DrawOuterResessedFrame(view, rect, base, 0.6, 1.0, flags);
|
_DrawOuterResessedFrame(view, rect, base, flags);
|
||||||
|
|
||||||
dark1BorderColor = tint_color(base, 1.40);
|
dark1BorderColor = tint_color(base, 1.40);
|
||||||
dark2BorderColor = tint_color(base, 1.38);
|
dark2BorderColor = tint_color(base, 1.38);
|
||||||
@@ -973,7 +973,7 @@ HaikuControlLook::DrawScrollViewFrame(BView* view, BRect& rect,
|
|||||||
rgb_color scrollbarFrameColor = tint_color(base, B_DARKEN_2_TINT);
|
rgb_color scrollbarFrameColor = tint_color(base, B_DARKEN_2_TINT);
|
||||||
|
|
||||||
if (borderStyle == B_FANCY_BORDER)
|
if (borderStyle == B_FANCY_BORDER)
|
||||||
_DrawOuterResessedFrame(view, rect, base, 1.0, 1.0, flags, borders);
|
_DrawOuterResessedFrame(view, rect, base, flags, borders);
|
||||||
|
|
||||||
if ((flags & B_FOCUSED) != 0) {
|
if ((flags & B_FOCUSED) != 0) {
|
||||||
rgb_color focusColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR);
|
rgb_color focusColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR);
|
||||||
@@ -991,7 +991,7 @@ HaikuControlLook::DrawScrollViewFrame(BView* view, BRect& rect,
|
|||||||
borders = _borders;
|
borders = _borders;
|
||||||
borders &= ~B_TOP_BORDER;
|
borders &= ~B_TOP_BORDER;
|
||||||
_DrawOuterResessedFrame(view, horizontalScrollBarFrame, base,
|
_DrawOuterResessedFrame(view, horizontalScrollBarFrame, base,
|
||||||
1.0, 1.0, flags, borders);
|
flags, borders);
|
||||||
_DrawFrame(view, horizontalScrollBarFrame, scrollbarFrameColor,
|
_DrawFrame(view, horizontalScrollBarFrame, scrollbarFrameColor,
|
||||||
scrollbarFrameColor, scrollbarFrameColor, scrollbarFrameColor,
|
scrollbarFrameColor, scrollbarFrameColor, scrollbarFrameColor,
|
||||||
borders);
|
borders);
|
||||||
@@ -1002,7 +1002,7 @@ HaikuControlLook::DrawScrollViewFrame(BView* view, BRect& rect,
|
|||||||
borders = _borders;
|
borders = _borders;
|
||||||
borders &= ~B_LEFT_BORDER;
|
borders &= ~B_LEFT_BORDER;
|
||||||
_DrawOuterResessedFrame(view, verticalScrollBarFrame, base,
|
_DrawOuterResessedFrame(view, verticalScrollBarFrame, base,
|
||||||
1.0, 1.0, flags, borders);
|
flags, borders);
|
||||||
_DrawFrame(view, verticalScrollBarFrame, scrollbarFrameColor,
|
_DrawFrame(view, verticalScrollBarFrame, scrollbarFrameColor,
|
||||||
scrollbarFrameColor, scrollbarFrameColor, scrollbarFrameColor,
|
scrollbarFrameColor, scrollbarFrameColor, scrollbarFrameColor,
|
||||||
borders);
|
borders);
|
||||||
@@ -2052,7 +2052,7 @@ HaikuControlLook::DrawBorder(BView* view, BRect& rect, const BRect& updateRect,
|
|||||||
scrollbarFrameColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR);
|
scrollbarFrameColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR);
|
||||||
|
|
||||||
if (borderStyle == B_FANCY_BORDER)
|
if (borderStyle == B_FANCY_BORDER)
|
||||||
_DrawOuterResessedFrame(view, rect, base, 1.0, 1.0, flags, borders);
|
_DrawOuterResessedFrame(view, rect, base, flags, borders);
|
||||||
|
|
||||||
_DrawFrame(view, rect, scrollbarFrameColor, scrollbarFrameColor,
|
_DrawFrame(view, rect, scrollbarFrameColor, scrollbarFrameColor,
|
||||||
scrollbarFrameColor, scrollbarFrameColor, borders);
|
scrollbarFrameColor, scrollbarFrameColor, borders);
|
||||||
@@ -2094,7 +2094,7 @@ HaikuControlLook::DrawTextControlBorder(BView* view, BRect& rect,
|
|||||||
rgb_color invalidColor = ui_color(B_FAILURE_COLOR);
|
rgb_color invalidColor = ui_color(B_FAILURE_COLOR);
|
||||||
|
|
||||||
if ((flags & B_DISABLED) != 0) {
|
if ((flags & B_DISABLED) != 0) {
|
||||||
_DrawOuterResessedFrame(view, rect, base, 0.0, 1.0, flags, borders);
|
_DrawOuterResessedFrame(view, rect, base, flags, borders);
|
||||||
|
|
||||||
if ((flags & B_BLEND_FRAME) != 0)
|
if ((flags & B_BLEND_FRAME) != 0)
|
||||||
dark1BorderColor = (rgb_color){ 0, 0, 0, 40 };
|
dark1BorderColor = (rgb_color){ 0, 0, 0, 40 };
|
||||||
@@ -2112,7 +2112,7 @@ HaikuControlLook::DrawTextControlBorder(BView* view, BRect& rect,
|
|||||||
|
|
||||||
dark2BorderColor = dark1BorderColor;
|
dark2BorderColor = dark1BorderColor;
|
||||||
} else {
|
} else {
|
||||||
_DrawOuterResessedFrame(view, rect, base, 0.6, 1.0, flags, borders);
|
_DrawOuterResessedFrame(view, rect, base, flags, borders);
|
||||||
|
|
||||||
if ((flags & B_BLEND_FRAME) != 0) {
|
if ((flags & B_BLEND_FRAME) != 0) {
|
||||||
dark1BorderColor = (rgb_color){ 0, 0, 0, 102 };
|
dark1BorderColor = (rgb_color){ 0, 0, 0, 102 };
|
||||||
@@ -2494,8 +2494,7 @@ void
|
|||||||
HaikuControlLook::_DrawButtonFrame(BView* view, BRect& rect,
|
HaikuControlLook::_DrawButtonFrame(BView* view, BRect& rect,
|
||||||
const BRect& updateRect, float leftTopRadius, float rightTopRadius,
|
const BRect& updateRect, float leftTopRadius, float rightTopRadius,
|
||||||
float leftBottomRadius, float rightBottomRadius, const rgb_color& base,
|
float leftBottomRadius, float rightBottomRadius, const rgb_color& base,
|
||||||
const rgb_color& background, float contrast, float brightness,
|
const rgb_color& background, uint32 flags, uint32 borders)
|
||||||
uint32 flags, uint32 borders)
|
|
||||||
{
|
{
|
||||||
if (!rect.IsValid())
|
if (!rect.IsValid())
|
||||||
return;
|
return;
|
||||||
@@ -2537,12 +2536,8 @@ HaikuControlLook::_DrawButtonFrame(BView* view, BRect& rect,
|
|||||||
|
|
||||||
if ((flags & B_DEFAULT_BUTTON) != 0) {
|
if ((flags & B_DEFAULT_BUTTON) != 0) {
|
||||||
cornerBgColor = defaultIndicatorColor;
|
cornerBgColor = defaultIndicatorColor;
|
||||||
edgeLightColor = _EdgeLightColor(defaultIndicatorColor,
|
edgeLightColor = _EdgeColor(defaultIndicatorColor, false, flags);
|
||||||
contrast * ((flags & B_DISABLED) != 0 ? 0.3 : 0.8),
|
edgeShadowColor = _EdgeColor(defaultIndicatorColor, true, flags);
|
||||||
brightness * ((flags & B_DISABLED) != 0 ? 1.0 : 0.9), flags);
|
|
||||||
edgeShadowColor = _EdgeShadowColor(defaultIndicatorColor,
|
|
||||||
contrast * ((flags & B_DISABLED) != 0 ? 0.3 : 0.8),
|
|
||||||
brightness * ((flags & B_DISABLED) != 0 ? 1.0 : 0.9), flags);
|
|
||||||
|
|
||||||
// draw default button indicator
|
// draw default button indicator
|
||||||
// Allow a 1-pixel border of the background to come through.
|
// Allow a 1-pixel border of the background to come through.
|
||||||
@@ -2563,12 +2558,8 @@ HaikuControlLook::_DrawButtonFrame(BView* view, BRect& rect,
|
|||||||
view->SetDrawingMode(B_OP_ALPHA);
|
view->SetDrawingMode(B_OP_ALPHA);
|
||||||
}
|
}
|
||||||
|
|
||||||
edgeLightColor = _EdgeLightColor(background,
|
edgeLightColor = _EdgeColor(background, false, flags);
|
||||||
contrast * ((flags & B_DISABLED) != 0 ? 0.0 : 1.0),
|
edgeShadowColor = _EdgeColor(background, true, flags);
|
||||||
brightness * 1.0, flags);
|
|
||||||
edgeShadowColor = _EdgeShadowColor(background,
|
|
||||||
contrast * (flags & B_DISABLED) != 0 ? 0.0 : 1.0,
|
|
||||||
brightness * 1.0, flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// frame colors
|
// frame colors
|
||||||
@@ -2630,13 +2621,10 @@ HaikuControlLook::_DrawButtonFrame(BView* view, BRect& rect,
|
|||||||
// draw outer edge
|
// draw outer edge
|
||||||
if ((flags & B_DEFAULT_BUTTON) != 0) {
|
if ((flags & B_DEFAULT_BUTTON) != 0) {
|
||||||
_DrawOuterResessedFrame(view, rect, defaultIndicatorColor,
|
_DrawOuterResessedFrame(view, rect, defaultIndicatorColor,
|
||||||
contrast * ((flags & B_DISABLED) != 0 ? 0.3 : 0.8),
|
|
||||||
brightness * ((flags & B_DISABLED) != 0 ? 1.0 : 0.9),
|
|
||||||
flags, borders);
|
flags, borders);
|
||||||
} else {
|
} else {
|
||||||
_DrawOuterResessedFrame(view, rect, background,
|
_DrawOuterResessedFrame(view, rect, background,
|
||||||
contrast * ((flags & B_DISABLED) != 0 ? 0.0 : 1.0),
|
flags, borders);
|
||||||
brightness * 1.0, flags, borders);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
view->SetDrawingMode(oldMode);
|
view->SetDrawingMode(oldMode);
|
||||||
@@ -2662,13 +2650,10 @@ HaikuControlLook::_DrawButtonFrame(BView* view, BRect& rect,
|
|||||||
|
|
||||||
void
|
void
|
||||||
HaikuControlLook::_DrawOuterResessedFrame(BView* view, BRect& rect,
|
HaikuControlLook::_DrawOuterResessedFrame(BView* view, BRect& rect,
|
||||||
const rgb_color& base, float contrast, float brightness, uint32 flags,
|
const rgb_color& base, uint32 flags, uint32 borders)
|
||||||
uint32 borders)
|
|
||||||
{
|
{
|
||||||
rgb_color edgeLightColor = _EdgeLightColor(base, contrast,
|
rgb_color edgeLightColor = _EdgeColor(base, false, flags);
|
||||||
brightness, flags);
|
rgb_color edgeShadowColor = _EdgeColor(base, true, flags);
|
||||||
rgb_color edgeShadowColor = _EdgeShadowColor(base, contrast,
|
|
||||||
brightness, flags);
|
|
||||||
|
|
||||||
if ((flags & B_BLEND_FRAME) != 0) {
|
if ((flags & B_BLEND_FRAME) != 0) {
|
||||||
// assumes the background has already been painted
|
// assumes the background has already been painted
|
||||||
@@ -2963,10 +2948,10 @@ HaikuControlLook::_DrawNonFlatButtonBackground(BView* view, BRect& rect,
|
|||||||
if ((flags & B_ACTIVATED) != 0)
|
if ((flags & B_ACTIVATED) != 0)
|
||||||
separatorBaseColor = tint_color(base, B_DARKEN_1_TINT);
|
separatorBaseColor = tint_color(base, B_DARKEN_1_TINT);
|
||||||
|
|
||||||
rgb_color separatorLightColor = _EdgeLightColor(separatorBaseColor,
|
rgb_color separatorLightColor = _EdgeColor(separatorBaseColor,
|
||||||
(flags & B_DISABLED) != 0 ? 0.7 : 1.0, 1.0, flags);
|
true, flags);
|
||||||
rgb_color separatorShadowColor = _EdgeShadowColor(separatorBaseColor,
|
rgb_color separatorShadowColor = _EdgeColor(separatorBaseColor,
|
||||||
(flags & B_DISABLED) != 0 ? 0.7 : 1.0, 1.0, flags);
|
false, flags);
|
||||||
|
|
||||||
view->BeginLineArray(2);
|
view->BeginLineArray(2);
|
||||||
|
|
||||||
@@ -3674,65 +3659,41 @@ HaikuControlLook::_DrawRoundBarCorner(BView* view, BRect& rect,
|
|||||||
|
|
||||||
|
|
||||||
rgb_color
|
rgb_color
|
||||||
HaikuControlLook::_EdgeLightColor(const rgb_color& base, float contrast,
|
HaikuControlLook::_EdgeColor(const rgb_color& base, bool shadow, uint32 flags)
|
||||||
float brightness, uint32 flags)
|
|
||||||
{
|
{
|
||||||
rgb_color edgeLightColor;
|
rgb_color edgeColor;
|
||||||
|
|
||||||
if ((flags & B_BLEND_FRAME) != 0) {
|
if ((flags & B_BLEND_FRAME) != 0) {
|
||||||
uint8 alpha = uint8(20 * contrast);
|
uint8 alpha = 20;
|
||||||
uint8 white = uint8(255 * brightness);
|
uint8 value = shadow ? 0 : 255;
|
||||||
|
if ((flags & B_DEFAULT_BUTTON) != 0) {
|
||||||
edgeLightColor = (rgb_color){ white, white, white, alpha };
|
if ((flags & B_DISABLED) != 0) {
|
||||||
} else {
|
alpha = (uint8)(alpha * 0.3);
|
||||||
// colors
|
value = (uint8)(value * 0.9);
|
||||||
float tintLight = kEdgeBevelLightTint;
|
} else
|
||||||
|
alpha = (uint8)(alpha * 0.8);
|
||||||
if (contrast == 0.0)
|
} else {
|
||||||
tintLight = B_NO_TINT;
|
if ((flags & B_DISABLED) != 0)
|
||||||
else if (contrast != 1.0)
|
alpha = 0;
|
||||||
tintLight = B_NO_TINT + (tintLight - B_NO_TINT) * contrast;
|
|
||||||
|
|
||||||
edgeLightColor = tint_color(base, tintLight);
|
|
||||||
|
|
||||||
if (brightness < 1.0) {
|
|
||||||
edgeLightColor.red = uint8(edgeLightColor.red * brightness);
|
|
||||||
edgeLightColor.green = uint8(edgeLightColor.green * brightness);
|
|
||||||
edgeLightColor.blue = uint8(edgeLightColor.blue * brightness);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
edgeColor = (rgb_color){ value, value, value, alpha };
|
||||||
|
} else {
|
||||||
|
float tint = shadow ? kEdgeBevelShadowTint : kEdgeBevelLightTint;
|
||||||
|
if ((flags & B_DEFAULT_BUTTON) != 0) {
|
||||||
|
if ((flags & B_DISABLED) != 0)
|
||||||
|
tint = B_NO_TINT + (tint - B_NO_TINT) * 0.3;
|
||||||
|
else
|
||||||
|
tint = (tint + 1.245f /* darken "< 2" */) / 2;
|
||||||
|
} else {
|
||||||
|
if ((flags & B_DISABLED) != 0)
|
||||||
|
tint = B_NO_TINT;
|
||||||
|
}
|
||||||
|
|
||||||
|
edgeColor = tint_color(base, tint);
|
||||||
}
|
}
|
||||||
|
|
||||||
return edgeLightColor;
|
return edgeColor;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
rgb_color
|
|
||||||
HaikuControlLook::_EdgeShadowColor(const rgb_color& base, float contrast,
|
|
||||||
float brightness, uint32 flags)
|
|
||||||
{
|
|
||||||
rgb_color edgeShadowColor;
|
|
||||||
|
|
||||||
if ((flags & B_BLEND_FRAME) != 0) {
|
|
||||||
uint8 alpha = uint8(20 * contrast);
|
|
||||||
edgeShadowColor = (rgb_color){ 0, 0, 0, alpha };
|
|
||||||
} else {
|
|
||||||
float tintShadow = kEdgeBevelShadowTint;
|
|
||||||
|
|
||||||
if (contrast == 0.0)
|
|
||||||
tintShadow = B_NO_TINT;
|
|
||||||
else if (contrast != 1.0)
|
|
||||||
tintShadow = B_NO_TINT + (tintShadow - B_NO_TINT) * contrast;
|
|
||||||
|
|
||||||
edgeShadowColor = tint_color(base, tintShadow);
|
|
||||||
|
|
||||||
if (brightness < 1.0) {
|
|
||||||
edgeShadowColor.red = uint8(edgeShadowColor.red * brightness);
|
|
||||||
edgeShadowColor.green = uint8(edgeShadowColor.green * brightness);
|
|
||||||
edgeShadowColor.blue = uint8(edgeShadowColor.blue * brightness);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return edgeShadowColor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user