public static RectStylePainterParameters GetDefault(VisualElement ve) { IStyle style = ve.style; var painterParams = new RectStylePainterParameters { rect = GUIUtility.AlignRectToDevice(ve.rect), color = style.backgroundColor, }; BorderParameters.SetFromStyle(ref painterParams.border, style); return(painterParams); }
public static TextureStylePainterParameters GetDefault(VisualElement ve) { IStyle style = ve.style; var painterParams = new TextureStylePainterParameters { rect = GUIUtility.AlignRectToDevice(ve.rect), uv = new Rect(0, 0, 1, 1), color = (Color)Color.white, texture = style.backgroundImage, scaleMode = style.backgroundScaleMode, sliceLeft = style.sliceLeft, sliceTop = style.sliceTop, sliceRight = style.sliceRight, sliceBottom = style.sliceBottom }; BorderParameters.SetFromStyle(ref painterParams.border, style); return(painterParams); }
public static TextureStylePainterParameters GetDefault(VisualElement ve) { IStyle style = ve.style; var painterParams = new TextureStylePainterParameters { rect = GUIUtility.AlignRectToDevice(ve.rect), uv = new Rect(0, 0, 1, 1), // When the background color is not clear, we have to embed it into the texture... // whereas if the color is clear, the white color is used... color = (style.backgroundColor != Color.clear) ? (Color)style.backgroundColor : (Color)Color.white, texture = style.backgroundImage, scaleMode = style.backgroundScaleMode, sliceLeft = style.sliceLeft, sliceTop = style.sliceTop, sliceRight = style.sliceRight, sliceBottom = style.sliceBottom }; BorderParameters.SetFromStyle(ref painterParams.border, style); return(painterParams); }
public static void SetFromStyle(ref BorderParameters border, IStyle style) { border.SetWidth(style.borderTopWidth, style.borderRightWidth, style.borderBottomWidth, style.borderLeftWidth); border.SetRadius(style.borderTopLeftRadius, style.borderTopRightRadius, style.borderBottomRightRadius, style.borderBottomLeftRadius); }
internal static void SetBorderFromStyle(this IStylePainter painter, ref BorderParameters border, IStyle style) { border.SetWidth(style.borderTopWidth, style.borderRightWidth, style.borderBottomWidth, style.borderLeftWidth); border.SetRadius(style.borderTopLeftRadius, style.borderTopRightRadius, style.borderBottomRightRadius, style.borderBottomLeftRadius); }