示例#1
0
        public static UIImage BuildGalleryBackground(bool landscape)
        {
            var key = "gallery_background_" + (landscape ? "landscape" : "portrait");

            return(ImageCache.Get(key, () =>
            {
                UIImage background0;
                if (Util.IsRetina() || Util.IsPad())
                {
                    background0 = UIImageEx.FromFile("Images/gallery/background_seamless_high.png");
                }
                else
                {
                    background0 = UIImageEx.FromFile("Images/gallery/background_seamless_low.png");
                }

                // Snip the background height so we don't shrink the viewable area
                var delta = background0.Size.Height - (Util.IsPortrait() ? GalleryScreenHeight : GalleryScreenWidth);                // - 20;
                var frame = new RectangleF(0, delta, background0.Size.Width, background0.Size.Height - delta);
                var background1 = ImageHelper.Crop(background0, frame);
                background0.Dispose();

                return background1;
            }));
        }
示例#2
0
        public SeriesDetailView(Series series, RectangleF rect) : base(rect)
        {
            _series         = series;
            BackgroundColor = UIColor.Clear;

            // Defer to latest twitter if it exists; otherwise, use embed
            var image = ImageCache.Get("latest_twitter");

            if (image == null)
            {
                var src = AppManifest.Current.Image;
                image = UIImageEx.FromIdiomBundle(src);

                var fresh = image;
                image = ImageHelper.RoundAndSquare(fresh, 14);
                fresh.Dispose();
            }

            _artistView                 = new UIImageView(new RectangleF(10, 10, 73, 73));
            _artistView.Image           = image;
            _artistView.BackgroundColor = UIColor.Clear;
            image.Dispose();

            AddSubview(_artistView);
        }
示例#3
0
        public static UIImage BuildCroppedGalleryBackground(float left, float width, int index, bool landscape)
        {
            var key = "gallery_background_" + left + "_" + landscape + "_" + width;            // + "_" + index;

            return(ImageCache.Get(key, () =>
            {
                var image0 = ImageFactory.BuildGalleryBackground(landscape);
                var image1 = ImageHelper.Crop(image0, new RectangleF(left, 0, width, landscape ? image0.Size.Width : image0.Size.Height));
                image0.Dispose();
                return image1;
            }));
        }
示例#4
0
        private void SetFlipPieceThumbnail()
        {
            var z = ImageCache.Get("flip_thumbnail_" + _series.Title + "_" + _page, () =>
            {
                var thumb0 = ImageFactory.LoadRoundedThumbnail(_series.Pieces[_page]);
                var thumb1 = ImageHelper.ImageToFitSize(thumb0, _listViewImageSize);
                thumb0.Dispose();
                return(thumb1);
            });

            _buttonGalleryThumb.Image.Dispose();
            _buttonGalleryThumb.Image = null;
            _buttonGalleryThumb.Image = z;
        }
示例#5
0
        public static GalleryImageView BuildGalleryPage(Piece piece, int index, int total, out RectangleF canvasFrame)
        {
            float width;
            float height;
            float gutter;

            GetGalleryArea(out width, out height, out gutter);

            // Background width is 1280
            var     backgroundImage = BuildGalleryBackground(Util.IsLandscape());
            UIImage background      = GetSeamlessBackgroundSlice(index, backgroundImage);
            var     imageView       = new GalleryImageView(background);   // UIImageView

            background.Dispose();
            backgroundImage.Dispose();

            // Add canvas
            UIImage canvas     = ImageCache.Get(GetImageKey(piece, width * 2, height * 2), () => GenerateGalleryPiece(piece, width * 2, height * 2));
            var     canvasView = new UIImageView(canvas);

            canvasView.Center = new PointF(width / 2, (height / 2) - gutter);
            canvasView.Layer.MasksToBounds = false;
            var canvasViewFrame = canvasView.Frame;

            canvasFrame = canvasViewFrame;

            // Add reflection
            float reflectionY = GetReflectionY();
            var   reflection  = GetOrGenerateReflection(piece, canvasViewFrame, canvas, reflectionY);

            canvas.Dispose();

            var reflectionFrame = new RectangleF(canvasViewFrame.X, reflectionY, reflection.Size.Width, reflection.Size.Height);
            var reflectionView  = new UIImageView(reflection);

            reflectionView.Frame         = reflectionFrame;
            reflectionView.Layer.Opacity = 0.30f;
            reflection.Dispose();

            // Add shadow
            var shadowY    = canvasViewFrame.Y + canvasViewFrame.Height - 10;
            var shadowView = new UIImageView(_shadowMask);

            shadowView.Frame = new RectangleF(canvasViewFrame.X, shadowY, canvasViewFrame.Width, _shadowMask.Size.Height);
            var shadowLeftView = new UIImageView(_shadowLeft);

            shadowLeftView.Frame = new RectangleF(canvasViewFrame.X - 3, canvasViewFrame.Y, 3, canvasViewFrame.Height);
            var shadowRightView = new UIImageView(_shadowRight);

            shadowRightView.Frame = new RectangleF(canvasViewFrame.X + canvasViewFrame.Width, canvasViewFrame.Y, 3, canvasViewFrame.Height);
            var shadowTopView = new UIImageView(_shadowTop);

            shadowTopView.Frame = new RectangleF(canvasViewFrame.X, canvasViewFrame.Y, canvasViewFrame.Width, _shadowTop.Size.Height);

            // Add image layers together
            imageView.AddSubview(shadowView);
            imageView.AddSubview(shadowLeftView);
            imageView.AddSubview(shadowRightView);
            imageView.AddSubview(canvasView);
            imageView.AddSubview(shadowTopView);
            imageView.AddSubview(reflectionView);

            var lighting     = BuildLighting();
            var lightingView = new LightImageView(lighting);

            lighting.Dispose();
            imageView.AddSubview(lightingView);
            imageView.Lights = lightingView;
            return(imageView);
        }
示例#6
0
        public static UIImage LoadRoundedThumbnail(Piece piece)
        {
            var s = DimensionSet.ListThumbnailSquare;

            return(ImageCache.Get(GetImageKey(piece, s, s), () => GeneratePieceThumbnail(piece, s, s)));
        }
示例#7
0
 public static UIImage LoadMapThumbnail(Piece piece)
 {
     return(ImageCache.Get(GetImageKey(piece, 27, 28), () => GeneratePieceThumbnail(piece, 27, 28)));
 }