コード例 #1
0
        /// <summary>
        /// Apply effects image to this instance.
        /// </summary>
        /// <param name="effects">the dimensions to fit</param>
        /// <returns>
        /// Returns this instance with effects.
        /// </returns>
        public XlsxImage ApplyEffects(EffectType[] effects)
        {
            if (this.Equals(XlsxImage.Null))
            {
                return(this);
            }

            if (Image == null)
            {
                return(this);
            }

            Image image =
                Configuration.Effects == null
                    ? Image.FromStream(OriginalImage.AsStream())
                    : Image.FromStream(OriginalImage.ApplyEffects(Configuration.Effects).AsStream());

            ProcessedImage = (Image)image.ApplyEffects(effects).Clone();
            Image          = (Image)ProcessedImage.Clone();

            if (_hasScaledFit)
            {
                ScaleToFit(_scaleX, _scaleY);
            }

            if (_hasScaledPercent)
            {
                ScalePercent(_scaleX, _scaleY);
            }

            return(this);
        }
コード例 #2
0
ファイル: PdfImage.cs プロジェクト: lanicon/iPdfWriter
        /// <summary>
        /// Apply effects image to this instance.
        /// </summary>
        /// <param name="effects">the dimensions to fit</param>
        /// <returns>
        /// Returns this instance with effects.
        /// </returns>
        public PdfImage ApplyEffects(EffectType[] effects)
        {
            if (this.Equals(PdfImage.Null))
            {
                return(this);
            }

            if (Image == null)
            {
                return(this);
            }

            NativeImage image =
                Configuration.Effects == null
                    ? NativeImage.FromStream(OriginalImage.AsStream())
                    : NativeImage.FromStream(OriginalImage.ApplyEffects(Configuration.Effects).AsStream());

            ProcessedImage = (NativeImage)image.ApplyEffects(effects).Clone();
            Image          = NativePdfImage.GetInstance(ProcessedImage.AsStream());

            return(this);
        }