Beispiel #1
0
        internal static Image GetRepresentation(CGContext context, Image image, Size destSize)
        {
            Image best = image;

            if (image.representations != null)
            {
                var size = context.ConvertSizeToDeviceSpace(new CGSize(destSize.Width, destSize.Height));
                foreach (Image img in image.representations)
                {
                    if (Math.Abs(img.Height - size.Height) < Math.Abs(best.Height - size.Height))
                    {
                        best = img;
                    }
                }
            }
            return(best);
        }