当前位置: 首页>>代码示例>>C#>>正文


C# Media.SafeMILHandle类代码示例

本文整理汇总了C#中System.Windows.Media.SafeMILHandle的典型用法代码示例。如果您正苦于以下问题:C# SafeMILHandle类的具体用法?C# SafeMILHandle怎么用?C# SafeMILHandle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SafeMILHandle类属于System.Windows.Media命名空间,在下文中一共展示了SafeMILHandle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetupFrame

 internal override void SetupFrame(SafeMILHandle frameEncodeHandle, SafeMILHandle encoderOptions)
 {
     HRESULT.Check(UnsafeNativeMethods.WICBitmapFrameEncode.Initialize(
         frameEncodeHandle,
         encoderOptions
         ));
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:7,代码来源:GifBitmapEncoder.cs

示例2: ColorTransform

        internal ColorTransform(SafeMILHandle bitmapSource, ColorContext srcContext, ColorContext dstContext, System.Windows.Media.PixelFormat pixelFormat) 
        {
            InitializeICM(); 

            if (srcContext == null)
            {
                srcContext = new ColorContext(pixelFormat); 
            }
            if (dstContext == null) 
            { 
                dstContext = new ColorContext(pixelFormat);
            } 

            _inputColorType = srcContext.ColorType;
            _outputColorType = dstContext.ColorType;
 
            //if this failed or the handle is invalid, we can't continue
            if (srcContext.ProfileHandle != null && !srcContext.ProfileHandle.IsInvalid) 
            { 
                //if this failed or the handle is invalid, we can't continue
                if (dstContext.ProfileHandle != null && !dstContext.ProfileHandle.IsInvalid) 
                {
                    _colorTransformHelper.CreateTransform(srcContext.ProfileHandle, dstContext.ProfileHandle);
                }
            } 
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:26,代码来源:ColorTransform.cs

示例3: CopyMemoryPressure

 internal void CopyMemoryPressure(SafeMILHandle original)
 {
     _gcPressure = original._gcPressure;
     if (_gcPressure != null)
     {
         _gcPressure.AddRef();
     }
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:8,代码来源:SafeMILHandle.cs

示例4: CreateMediaEventsHelper

        internal static void CreateMediaEventsHelper(MediaPlayer mediaPlayer, 
                                                     out MediaEventsHelper eventsHelper,
                                                     out SafeMILHandle unmanagedProxy)
        {
            eventsHelper = new MediaEventsHelper(mediaPlayer); 

            // Created with ref count = 1. Since this object does not hold on 
            // to the unmanaged proxy, the lifetime is now controlled by whoever 
            // called CreateMediaEventsHelper.
            unmanagedProxy = EventProxyWrapper.CreateEventProxyWrapper(eventsHelper); 
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:11,代码来源:mediaeventshelper.cs

示例5: UnknownBitmapDecoder

 internal UnknownBitmapDecoder(
     SafeMILHandle decoderHandle,
     BitmapDecoder decoder,
     Uri baseUri,
     Uri uri,
     Stream stream,
     BitmapCreateOptions createOptions,
     BitmapCacheOption cacheOption,
     bool insertInDecoderCache,
     bool originalWritable,
     Stream uriStream,
     UnmanagedMemoryStream unmanagedMemoryStream,
     SafeFileHandle safeFilehandle             
     ) : base(decoderHandle, decoder, baseUri, uri, stream, createOptions, cacheOption, insertInDecoderCache, originalWritable, uriStream, unmanagedMemoryStream, safeFilehandle)
 {
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:16,代码来源:UnknownBitmapDecoder.cs

示例6: EnsureMetadata

        private void EnsureMetadata(bool createBitmapMetadata)
        {
            if (!_supportsGlobalMetadata)
            {
                return;
            }

            if (_metadataHandle == null)
            {
                SafeMILHandle /* IWICMetadataQueryWriter */ metadataHandle = new SafeMILHandle();

                int hr = UnsafeNativeMethods.WICBitmapEncoder.GetMetadataQueryWriter(
                    _encoderHandle,
                    out metadataHandle
                    );

                if (hr == (int)WinCodecErrors.WINCODEC_ERR_UNSUPPORTEDOPERATION)
                {
                    _supportsGlobalMetadata = false;
                    return;
                }
                HRESULT.Check(hr);

                _metadataHandle = metadataHandle;
            }

            if (createBitmapMetadata &&
                _metadata == null &&
                _metadataHandle != null)
            {
                _metadata = new BitmapMetadata(_metadataHandle, false, IsMetadataFixedSize, _metadataHandle);
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:33,代码来源:BitmapEncoder.cs

示例7: Save

        public virtual void Save(System.IO.Stream stream)
        {
            VerifyAccess();
            EnsureBuiltIn();
            EnsureUnmanagedEncoder();

            // No-op to get rid of build error
            if (_encodeState == EncodeState.None)
            {
            }

            if (_hasSaved)
            {
                throw new InvalidOperationException(SR.Get(SRID.Image_OnlyOneSave));
            }

            if (_frames == null)
            {
                throw new System.NotSupportedException(SR.Get(SRID.Image_NoFrames, null));
            }

            int count = _frames.Count;
            if (count <= 0)
            {
                throw new System.NotSupportedException(SR.Get(SRID.Image_NoFrames, null));
            }

            IntPtr comStream = IntPtr.Zero;
            SafeMILHandle encoderHandle = _encoderHandle;

            try
            {
                comStream = StreamAsIStream.IStreamFrom(stream);

                // does this addref the stream?
                HRESULT.Check(UnsafeNativeMethods.WICBitmapEncoder.Initialize(
                    encoderHandle,
                    comStream,
                    WICBitmapEncodeCacheOption.WICBitmapEncodeNoCache
                    ));

                // Helpful for debugging stress and remote dumps
                _encodeState = EncodeState.EncoderInitialized;

                // Save global thumbnail if any.
                if (_thumbnail != null)
                {
                    Debug.Assert(_supportsGlobalThumbnail);
                    SafeMILHandle thumbnailBitmapSource = _thumbnail.WicSourceHandle;

                    lock (_thumbnail.SyncObject)
                    {
                        HRESULT.Check(UnsafeNativeMethods.WICBitmapEncoder.SetThumbnail(
                            encoderHandle,
                            thumbnailBitmapSource
                            ));

                        // Helpful for debugging stress and remote dumps
                        _encodeState = EncodeState.EncoderThumbnailSet;
                    }
                }

                // Save global palette if any.
                if (_palette != null && _palette.Colors.Count > 0)
                {
                    SafeMILHandle paletteHandle = _palette.InternalPalette;

                    HRESULT.Check(UnsafeNativeMethods.WICBitmapEncoder.SetPalette(
                        encoderHandle,
                        paletteHandle
                        ));

                    // Helpful for debugging stress and remote dumps
                    _encodeState = EncodeState.EncoderPaletteSet;
                }

                // Save global metadata if any.
                if (_metadata != null && _metadata.GuidFormat == ContainerFormat)
                {
                    Debug.Assert(_supportsGlobalMetadata);

                    EnsureMetadata(false);

                    if (_metadata.InternalMetadataHandle != _metadataHandle)
                    {
                        PROPVARIANT propVar = new PROPVARIANT();

                        try
                        {
                            propVar.Init(_metadata);

                            lock (_metadata.SyncObject)
                            {
                                HRESULT.Check(UnsafeNativeMethods.WICMetadataQueryWriter.SetMetadataByName(
                                    _metadataHandle,
                                    "/",
                                    ref propVar
                                    ));
                            }
                        }
//.........这里部分代码省略.........
开发者ID:JianwenSun,项目名称:cc,代码行数:101,代码来源:BitmapEncoder.cs

示例8: GetMetadataQueryWriter

 internal static extern int /* HRESULT */ GetMetadataQueryWriter(
     SafeMILHandle /* IWICBitmapEncoder */ THIS_PTR,
     out SafeMILHandle /* IWICMetadataQueryWriter */ ppIQueryWriter
     ); 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:4,代码来源:UnsafeNativeMethodsMilCoreApi.cs

示例9: SetThumbnail

 internal static extern int /* HRESULT */ SetThumbnail(SafeMILHandle /* IWICBitmapEncoder*  */ THIS_PTR,
     System.Windows.Media.SafeMILHandle /* IWICBitmapSource* */ pIThumbnail);
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:2,代码来源:UnsafeNativeMethodsMilCoreApi.cs

示例10: GetEncoderInfo

 internal static extern int /* HRESULT */ GetEncoderInfo(SafeMILHandle /* IWICBitmapEncoder* */ THIS_PTR, 
     out SafeMILHandle /* IWICBitmapEncoderInfo ** */ ppIEncoderInfo
     ); 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:3,代码来源:UnsafeNativeMethodsMilCoreApi.cs

示例11: GetMetadataQueryReader

 internal static extern int /* HRESULT */ GetMetadataQueryReader(
     SafeMILHandle /* IWICBitmapFrameDecode */ THIS_PTR,
     out IntPtr /* IWICMetadataQueryReader */ ppIQueryReader
     ); 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:4,代码来源:UnsafeNativeMethodsMilCoreApi.cs

示例12: GetThumbnail

 internal static extern int /* HRESULT */ GetThumbnail(
     SafeMILHandle /* IWICBitmapFrameDecode */ THIS_PTR,
     out IntPtr /* IWICBitmap */ ppIThumbnail
     ); 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:4,代码来源:UnsafeNativeMethodsMilCoreApi.cs

示例13: GetFrame

 internal static extern int /* HRESULT */ GetFrame(
     SafeMILHandle /* IWICBitmapDecoder */ THIS_PTR, 
     UInt32 index, 
     out IntPtr /* IWICBitmapFrameDecode */ ppIFrameDecode
     ); 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:5,代码来源:UnsafeNativeMethodsMilCoreApi.cs

示例14: GetFrameCount

 internal static extern int /* HRESULT */ GetFrameCount(
     SafeMILHandle THIS_PTR, 
     out uint pFrameCount 
     );
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:4,代码来源:UnsafeNativeMethodsMilCoreApi.cs

示例15: GetPreview

 internal static extern int /* HRESULT */ GetPreview(
     SafeMILHandle THIS_PTR, 
     out IntPtr /* IWICBitmapSource */ ppIBitmapSource
     ); 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:4,代码来源:UnsafeNativeMethodsMilCoreApi.cs


注:本文中的System.Windows.Media.SafeMILHandle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。