Esempio n. 1
0
        public override IpcImage CloneIpcImage()
        {
            var ipcImageFileMapped = new IpcImageFileMapped(Width, Height, IpcPixelFormat);

            CopyImageTo(ipcImageFileMapped);
            return(ipcImageFileMapped);
        }
Esempio n. 2
0
        public new static IpcImageFileMapped LoadFromFile(Uri filePathUri)
        {
            using (Stream stream = File.OpenRead(filePathUri.LocalPath)) {
                var decoder     = BitmapDecoder.Create(stream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.OnLoad);
                var bitmapImage = decoder.Frames[0];

                var ipcImage = new IpcImageFileMapped(bitmapImage.PixelWidth, bitmapImage.PixelHeight, bitmapImage.Format.ToIpcPixelFormat());
                for (var i = 0; i < ipcImage.BufferSize; i++)
                {
                    Marshal.WriteByte(ipcImage.DataPtr, i, 100);
                }

                bitmapImage.CopyPixels(
                    new Int32Rect(0, 0, bitmapImage.PixelWidth, bitmapImage.PixelHeight),
                    ipcImage.DataPtr,
                    ipcImage.BufferSize,
                    ipcImage.Stride);
                return(ipcImage);
            }
        }
Esempio n. 3
0
 public static IpcImage LoadFromFile(Uri filePathUri)
 {
     return(IpcImageFileMapped.LoadFromFile(filePathUri));
 }