public SlicedTextureRef(Texture2D texture, Rectangle margins) { this.Texture = texture; this.Margins = margins; NineSlice = new NineSliceMargins { Left = margins.Left, Top = margins.Top, Right = margins.Width, Bottom = margins.Height }; NineSlice.CalculateOrigins(texture); }
/// <summary> /// Sets 9 slice options on the image, this allows it to be cut /// into 9 pieces for scaling /// </summary> /// <returns></returns> public UIImage With9Slice(int marginLeft, int marginRight, int marginTop, int marginBottom) { NineSlice = true; NineSliceMargins = new NineSliceMargins { Left = marginLeft, Right = marginRight, Top = marginTop, Bottom = marginBottom }; NineSliceMargins.CalculateOrigins(m_Texture); return(this); }
public void SetBackgroundTexture(Texture2D texture, int marginLeft, int marginRight, int marginTop, int marginBottom) { m_BackgroundTex = texture; if (texture != null) { NineSliceMargins = new NineSliceMargins { Left = marginLeft, Right = marginRight, Top = marginTop, Bottom = marginBottom }; NineSliceMargins.CalculateOrigins(texture); } else { NineSliceMargins = null; } }
/// <summary> /// Sets 9 slice options on the image, this allows it to be cut /// into 9 pieces for scaling /// </summary> /// <returns></returns> public UIImage With9Slice(int marginLeft, int marginRight, int marginTop, int marginBottom) { NineSlice = true; NineSliceMargins = new NineSliceMargins { Left = marginLeft, Right = marginRight, Top = marginTop, Bottom = marginBottom }; NineSliceMargins.CalculateOrigins(m_Texture); return this; }