本文整理汇总了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
));
}
示例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);
}
}
}
示例3: CopyMemoryPressure
internal void CopyMemoryPressure(SafeMILHandle original)
{
_gcPressure = original._gcPressure;
if (_gcPressure != null)
{
_gcPressure.AddRef();
}
}
示例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);
}
示例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)
{
}
示例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);
}
}
示例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
));
}
}
//.........这里部分代码省略.........
示例8: GetMetadataQueryWriter
internal static extern int /* HRESULT */ GetMetadataQueryWriter(
SafeMILHandle /* IWICBitmapEncoder */ THIS_PTR,
out SafeMILHandle /* IWICMetadataQueryWriter */ ppIQueryWriter
);
示例9: SetThumbnail
internal static extern int /* HRESULT */ SetThumbnail(SafeMILHandle /* IWICBitmapEncoder* */ THIS_PTR,
System.Windows.Media.SafeMILHandle /* IWICBitmapSource* */ pIThumbnail);
示例10: GetEncoderInfo
internal static extern int /* HRESULT */ GetEncoderInfo(SafeMILHandle /* IWICBitmapEncoder* */ THIS_PTR,
out SafeMILHandle /* IWICBitmapEncoderInfo ** */ ppIEncoderInfo
);
示例11: GetMetadataQueryReader
internal static extern int /* HRESULT */ GetMetadataQueryReader(
SafeMILHandle /* IWICBitmapFrameDecode */ THIS_PTR,
out IntPtr /* IWICMetadataQueryReader */ ppIQueryReader
);
示例12: GetThumbnail
internal static extern int /* HRESULT */ GetThumbnail(
SafeMILHandle /* IWICBitmapFrameDecode */ THIS_PTR,
out IntPtr /* IWICBitmap */ ppIThumbnail
);
示例13: GetFrame
internal static extern int /* HRESULT */ GetFrame(
SafeMILHandle /* IWICBitmapDecoder */ THIS_PTR,
UInt32 index,
out IntPtr /* IWICBitmapFrameDecode */ ppIFrameDecode
);
示例14: GetFrameCount
internal static extern int /* HRESULT */ GetFrameCount(
SafeMILHandle THIS_PTR,
out uint pFrameCount
);
示例15: GetPreview
internal static extern int /* HRESULT */ GetPreview(
SafeMILHandle THIS_PTR,
out IntPtr /* IWICBitmapSource */ ppIBitmapSource
);