public Rectangle GetImageBounds() { Rectangle toDraw = GlobalBounds; if (!KeepAspectRatio) { return(toDraw); } if (Image == null) { return(toDraw); } toDraw = DwarfGUI.AspectRatioFit(Image.Bounds, toDraw); if (ConstrainSize) { toDraw.Width = Math.Min(Image.Bounds.Width, toDraw.Width); toDraw.Height = Math.Min(Image.Bounds.Height, toDraw.Height); toDraw.Width = Math.Max(Image.Width, toDraw.Width); toDraw.Height = Math.Max(Image.Bounds.Height, toDraw.Height); } return(toDraw); }
public Rectangle GetImageBounds() { Rectangle toDraw = GlobalBounds; if (Image == null) { return(toDraw); } if (DontMakeBigger) { toDraw.Width = Math.Min(toDraw.Width, Image.SourceRect.Width); toDraw.Height = Math.Min(toDraw.Height, Image.SourceRect.Height); } if (DontMakeSmaller) { toDraw.Width = Math.Max(toDraw.Width, Image.SourceRect.Width); toDraw.Height = Math.Max(toDraw.Height, Image.SourceRect.Height); } if (!KeepAspectRatio) { return(toDraw); } toDraw = DwarfGUI.AspectRatioFit(Image.SourceRect, toDraw); return(toDraw); }