Ejemplo n.º 1
0
        private BitmapSource NextImage(ImgInf imgInf, WWImageRead ir)
        {
            if (imgInf.duration < 0)
            {
                return(null);
            }

            int hr = ir.VReadImage(-1, imgInf.cp, out BitmapSource bi, ref imgInf.duration, ref imgInf.timeStamp);

            if (hr < 0)
            {
                MessageBox.Show(string.Format("Error: {0:x} while reading {1}", hr, imgInf.path));
                return(null);
            }
            return(bi);
        }
Ejemplo n.º 2
0
        // ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
        // event handlers

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            WWMFVideoReaderCs.WWMFVideoReader.StaticInit();

            if (!WWImageRead.StaticInit())
            {
                Close();
                return;
            }

            ReadTwoNewImgs(
                "images\\CC_AdobeRGB_D65_24bit_GT.png", 0, WWImageRead.ColorProfileType.AdobeRGB,
                "images\\CC_sRGB_D65_24bit_GT.png", 0, WWImageRead.ColorProfileType.sRGB);
            mButtonNextFrame.IsEnabled = mImageReadA.IsVideo || mImageReadB.IsVideo;

            UpdateImgDisp();

            mInitialized = true;
        }
Ejemplo n.º 3
0
        private BitmapSource ReadFromFile(ImgInf imgInf, long timeStamp, WWImageRead ir)
        {
            var ext = System.IO.Path.GetExtension(imgInf.path).ToUpper();

            string[] imgExt = { ".PNG", ".JPG", ".JPEG", ".BMP" };
            if (imgExt.Any(s => s.Equals(ext)))
            {
                // 画像の拡張子の場合。
                imgInf.duration  = -1;
                imgInf.timeStamp = -1;
                return(ir.ColorConvertedRead(imgInf.path, imgInf.cp));
            }

            ir.VReadEnd();

            int hr = ir.VReadStart(imgInf.path);

            if (hr < 0)
            {
                if (hr == WWMFVideoReaderCs.WWMFVideoReader.MF_E_INVALIDMEDIATYPE ||
                    hr == WWMFVideoReaderCs.WWMFVideoReader.MF_E_UNSUPPORTED_BYTESTREAM_TYPE)
                {
                    var w = new WWDescriptionWindow(WWDescriptionWindow.LocalPathToUri("desc/UnsupportedMediaType.html"));
                    w.ShowDialog();
                    return(null);
                }
                else
                {
                    MessageBox.Show(string.Format("Error: {0:x} while reading {1}", hr, imgInf.path));
                    return(null);
                }
            }

            hr = ir.VReadImage(timeStamp, imgInf.cp, out BitmapSource bi, ref imgInf.duration, ref imgInf.timeStamp);
            if (hr < 0)
            {
                MessageBox.Show(string.Format("Error: {0:x} while reading {1}", hr, imgInf.path));
                return(null);
            }
            return(bi);
        }