public static RelativeSizeXY GetImageRect(string texture, RelativeSize fixedSize, bool useWidth = true) { RelativeSizeXY size = new RelativeSizeXY(); TextureInfo info = TextureManager.GetTexture(texture); if (info != null && info.PixelSize.X > 0 && info.PixelSize.Y != 0) { if (useWidth) { size.Width = fixedSize; size.Height = GetRelativeHeightInAspect(fixedSize, info.PixelSize.X, info.PixelSize.Y); } else { size.Width = GetRelativeWidthInAspect(fixedSize, info.PixelSize.X, info.PixelSize.Y); size.Height = fixedSize; } } return(size); }
public virtual void Set(RelativePoint origin, RelativeSizeXY size) { SetLocation(origin.X, origin.Y); SetSize(size.Width, size.Height); }
public virtual void Set(RelativePoint origin, RelativeSizeXY size, OriginLocation anchor) { SetLocation(origin.X, origin.Y); SetSize(size.Width, size.Height); AnchorLocation = anchor; }
public RelativeRect(RelativePoint origin, RelativeSizeXY size) { SetLocation(origin.X, origin.Y); SetSize(size.Width, size.Height); }