public WicColorspaceConverter(WicTransform prev) : base(prev)
        {
            if (Context.SourceColorContext == null)
            {
                return;
            }

            var trans = AddRef(Wic.CreateColorTransform());

            trans.Initialize(Source, Context.SourceColorContext, Context.DestColorContext, Context.PixelFormat.FormatGuid);

            Source = trans;
        }
Exemple #2
0
        public WicColorspaceConverter(WicTransform prev) : base(prev)
        {
            if (Context.SourceColorContext == null)
            {
                return;
            }

            var trans = AddRef(Wic.CreateColorTransform());

            trans.Initialize(Source, Context.SourceColorContext, Context.DestColorContext, Context.IsCmyk ? Context.HasAlpha ? Consts.GUID_WICPixelFormat32bppBGRA : Consts.GUID_WICPixelFormat24bppBGR : Context.PixelFormat);

            Source = trans;
        }
        public WicCmykConverter(WicTransform prev) : base(prev)
        {
            if (Context.PixelFormat.ColorRepresentation != PixelColorRepresentation.Cmyk)
            {
                return;
            }

            var trans = AddRef(Wic.CreateColorTransform());

            trans.Initialize(Source, Context.SourceColorContext, Context.DestColorContext, Context.PixelFormat.AlphaRepresentation != PixelAlphaRepresentation.None ? Consts.GUID_WICPixelFormat32bppBGRA : Consts.GUID_WICPixelFormat24bppBGR);

            Source = trans;
            Context.SourceColorContext = null;
        }
Exemple #4
0
        public WicPlanarConverter(WicTransform prevY, WicTransform prevCbCr) : base(prevY)
        {
            var cfmt  = Consts.GUID_WICPixelFormat24bppBGR;
            var conv  = AddRef(Wic.CreateFormatConverter());
            var pconv = conv as IWICPlanarFormatConverter;

            pconv.Initialize(new IWICBitmapSource[] { prevY.Source, prevCbCr.Source }, 2, cfmt, WICBitmapDitherType.WICBitmapDitherTypeNone, null, 0.0, WICBitmapPaletteType.WICBitmapPaletteTypeCustom);
            Source = pconv;

            if (Context.SourceColorContext != null)
            {
                var trans = AddRef(Wic.CreateColorTransform());
                trans.Initialize(Source, Context.SourceColorContext, Context.DestColorContext, cfmt);
                Source = trans;
            }
        }