Exemplo n.º 1
0
        public WicConditionalCache(WicTransform prev) : base(prev)
        {
            if (!Context.NeedsCache)
            {
                return;
            }

            var crop = Context.Settings.Crop;
            var bmp  = AddRef(Wic.CreateBitmapFromSourceRect(Source, (uint)crop.X, (uint)crop.Y, (uint)crop.Width, (uint)crop.Height));

            Source = bmp;
            Source.GetSize(out Context.Width, out Context.Height);
            Context.Settings.Crop = new Rectangle(0, 0, (int)Context.Width, (int)Context.Height);
            Context.NeedsCache    = false;
        }