public static GetGradientTextureWithAlpha0To1 ( ) : |
||
return |
internal static void DrawColorSwatch(Rect position, Color color, bool showAlpha, bool hdr) { if (Event.current.type != EventType.Repaint) { return; } Color color2 = GUI.color; float a = (float)((!GUI.enabled) ? 2 : 1); GUI.color = ((!EditorGUI.showMixedValue) ? new Color(color.r, color.g, color.b, a) : (new Color(0.82f, 0.82f, 0.82f, a) * color2)); GUIStyle whiteTextureStyle = EditorGUIUtility.whiteTextureStyle; whiteTextureStyle.Draw(position, false, false, false, false); float maxColorComponent = GUI.color.maxColorComponent; if (hdr && maxColorComponent > 1f) { float num = position.width / 3f; Rect position2 = new Rect(position.x, position.y, num, position.height); Rect position3 = new Rect(position.xMax - num, position.y, num, position.height); Color color3 = GUI.color.RGBMultiplied(1f / maxColorComponent); Color color4 = GUI.color; GUI.color = color3; GUIStyle basicTextureStyle = EditorGUIUtility.GetBasicTextureStyle(EditorGUIUtility.whiteTexture); basicTextureStyle.Draw(position2, false, false, false, false); basicTextureStyle.Draw(position3, false, false, false, false); GUI.color = color4; basicTextureStyle = EditorGUIUtility.GetBasicTextureStyle(ColorPicker.GetGradientTextureWithAlpha0To1()); basicTextureStyle.Draw(position2, false, false, false, false); basicTextureStyle = EditorGUIUtility.GetBasicTextureStyle(ColorPicker.GetGradientTextureWithAlpha1To0()); basicTextureStyle.Draw(position3, false, false, false, false); } if (!EditorGUI.showMixedValue) { if (showAlpha) { GUI.color = new Color(0f, 0f, 0f, a); float num2 = Mathf.Clamp(position.height * 0.2f, 2f, 20f); Rect position4 = new Rect(position.x, position.yMax - num2, position.width, num2); whiteTextureStyle.Draw(position4, false, false, false, false); GUI.color = new Color(1f, 1f, 1f, a); position4.width *= Mathf.Clamp01(color.a); whiteTextureStyle.Draw(position4, false, false, false, false); } } else { EditorGUI.BeginHandleMixedValueContentColor(); whiteTextureStyle.Draw(position, EditorGUI.mixedValueContent, false, false, false, false); EditorGUI.EndHandleMixedValueContentColor(); } GUI.color = color2; if (hdr && maxColorComponent > 1f) { GUI.Label(new Rect(position.x, position.y, position.width - 3f, position.height), "HDR", EditorStyles.centeredGreyMiniLabel); } }
internal static void DrawColorSwatch(Rect position, Color color, bool showAlpha, bool hdr) { if (Event.current.type == EventType.Repaint) { Color color2 = GUI.color; float a = !GUI.enabled ? ((float)2) : ((float)1); GUI.color = !EditorGUI.showMixedValue ? new Color(color.r, color.g, color.b, a) : (new Color(0.82f, 0.82f, 0.82f, a) * color2); GUIStyle whiteTextureStyle = EditorGUIUtility.whiteTextureStyle; whiteTextureStyle.Draw(position, false, false, false, false); float maxColorComponent = GUI.color.maxColorComponent; if (hdr && (maxColorComponent > 1f)) { float width = position.width / 3f; Rect rect = new Rect(position.x, position.y, width, position.height); Rect rect2 = new Rect(position.xMax - width, position.y, width, position.height); Color color3 = GUI.color.RGBMultiplied((float)(1f / maxColorComponent)); Color color4 = GUI.color; GUI.color = color3; GUIStyle basicTextureStyle = GetBasicTextureStyle(whiteTexture); basicTextureStyle.Draw(rect, false, false, false, false); basicTextureStyle.Draw(rect2, false, false, false, false); GUI.color = color4; GetBasicTextureStyle(ColorPicker.GetGradientTextureWithAlpha0To1()).Draw(rect, false, false, false, false); GetBasicTextureStyle(ColorPicker.GetGradientTextureWithAlpha1To0()).Draw(rect2, false, false, false, false); } if (!EditorGUI.showMixedValue) { if (showAlpha) { GUI.color = new Color(0f, 0f, 0f, a); float height = Mathf.Clamp((float)(position.height * 0.2f), (float)2f, (float)20f); Rect rect3 = new Rect(position.x, position.yMax - height, position.width, height); whiteTextureStyle.Draw(rect3, false, false, false, false); GUI.color = new Color(1f, 1f, 1f, a); rect3.width *= Mathf.Clamp01(color.a); whiteTextureStyle.Draw(rect3, false, false, false, false); } } else { EditorGUI.BeginHandleMixedValueContentColor(); whiteTextureStyle.Draw(position, EditorGUI.mixedValueContent, false, false, false, false); EditorGUI.EndHandleMixedValueContentColor(); } GUI.color = color2; if (hdr && (maxColorComponent > 1f)) { GUI.Label(new Rect(position.x, position.y, position.width - 3f, position.height), "HDR", EditorStyles.centeredGreyMiniLabel); } } }