Exemplo n.º 1
0
 public static extern bool WcsGetDefaultColorProfileSize(
     WcsProfileManagementScope scope,
     [MarshalAs(UnmanagedType.LPTStr)] string deviceName,
     ColorProfileType colorProfileType,
     ColorProfileSubtype colorProfileSubType,
     uint dwProfileID,
     out uint cbProfileName);
Exemplo n.º 2
0
        public BitmapSource ColorConvertedRead(string path, ColorProfileType from)
        {
            BitmapSource r = null;

            var bmi = new BitmapImage();

            bmi.BeginInit();
            bmi.UriSource   = new Uri(path, UriKind.RelativeOrAbsolute);
            bmi.CacheOption = BitmapCacheOption.OnLoad;
            bmi.EndInit();
            bmi.Freeze();

            if (0 == ColorProfileName(from).CompareTo(MonitorProfileName))
            {
                // color space is the same.
                r = bmi;
            }
            else
            {
                var ccb = new ColorConvertedBitmap();
                ccb.BeginInit();
                ccb.Source                  = bmi;
                ccb.SourceColorContext      = mColorCtx[(int)from];
                ccb.DestinationColorContext = mColorCtx[(int)ColorProfileType.Monitor];
                ccb.EndInit();
                ccb.Freeze();

                r = ccb;
            }

            IsVideo = false;

            return(r);
        }
Exemplo n.º 3
0
        public int VReadImage(long posToSeek, ColorProfileType from, out BitmapSource bs, ref long duration, ref long timeStamp)
        {
            int dpi = 96;
            var pf  = PixelFormats.Bgr32;
            int hr  = videoRead.ReadImage(posToSeek, out WWMFVideoReader.VideoImage vi);

            if (hr < 0)
            {
                bs = BitmapSource.Create(0, 0, dpi, dpi, pf, null, null, 1);
                return(hr);
            }

            var bytesPerPixel = (pf.BitsPerPixel + 7) / 8;
            var stride        = bytesPerPixel * vi.w;

            var wb = new WriteableBitmap(vi.w, vi.h, dpi, dpi, pf, null);

            wb.Lock();
            wb.WritePixels(new Int32Rect(0, 0, vi.w, vi.h), vi.img, stride, 0);
            wb.Unlock();
            wb.Freeze();

            if (0 == ColorProfileName(from).CompareTo(MonitorProfileName))
            {
                // color space is the same.
                bs = wb;
            }
            else
            {
                var ccb = new ColorConvertedBitmap();
                ccb.BeginInit();
                ccb.Source                  = wb;
                ccb.SourceColorContext      = mColorCtx[(int)from];
                ccb.DestinationColorContext = mColorCtx[(int)ColorProfileType.Monitor];
                ccb.EndInit();
                ccb.Freeze();

                bs = ccb;
            }

            duration  = vi.duration;
            timeStamp = vi.timeStamp;

            IsVideo = true;
            return(hr);
        }
Exemplo n.º 4
0
        static public string ColorProfileName(ColorProfileType t)
        {
            switch (t)
            {
            case ColorProfileType.sRGB:
                return("sRGB Color Space Profile.icm");

            case ColorProfileType.AdobeRGB:
                return("AdobeRGB1998.icc");

            case ColorProfileType.Rec709:
                return("ITU-RBT709ReferenceDisplay.icc");

            case ColorProfileType.Monitor:
                return(MonitorProfileName);

            default:
                System.Diagnostics.Debug.Assert(false);
                return("");
            }
        }
Exemplo n.º 5
0
 private protected HeifColorProfile(ColorProfileType profileType)
 {
     this.ProfileType = profileType;
 }