private static void CompileBoxArea(StylePropertyReader reader, out Color top, out Color right, out Color bottom, out Color left) { top = Color.clear; right = Color.clear; bottom = Color.clear; left = Color.clear; var valueCount = reader.valueCount; switch (valueCount) { // apply to all four sides case 0: break; case 1: { top = right = bottom = left = reader.ReadColor(0); break; } // vertical | horizontal case 2: { top = bottom = reader.ReadColor(0); left = right = reader.ReadColor(1); break; } // top | horizontal | bottom case 3: { top = reader.ReadColor(0); left = right = reader.ReadColor(1); bottom = reader.ReadColor(2); break; } // top | right | bottom | left default: { top = reader.ReadColor(0); right = reader.ReadColor(1); bottom = reader.ReadColor(2); left = reader.ReadColor(3); break; } } }
private static void CompileTextOutline(StylePropertyReader reader, out Color outlineColor, out float outlineWidth) { outlineColor = Color.clear; outlineWidth = 0.0f; var valueCount = reader.valueCount; for (int i = 0; i < valueCount; i++) { var valueType = reader.GetValueType(i); if (valueType == StyleValueType.Dimension) { outlineWidth = reader.ReadFloat(i); } else if (valueType == StyleValueType.Enum || valueType == StyleValueType.Color) { outlineColor = reader.ReadColor(i); } } }