PhotoThumbnail/ShellExtensions/ThumbnailProviders/ManagedInitializationInterfaces.cs
2021-12-28 16:53:45 +08:00

56 lines
2.8 KiB
C#

#if THUMBNAIL
using System.Drawing;
using System.IO;
namespace ShellExtensions
{
/// <summary>
/// This interface exposes the <see cref="ConsructBitmap"/> function for initializing the
/// Thumbnail Provider with a <typeparamref name="Stream"/>.
/// If this interfaces is not used, then the handler must opt out of process isolation.
/// This interface can be used in conjunction with the other intialization interfaces,
/// but only 1 will be accessed according to the priorities preset by the Windows Shell:
/// <typeparamref name="IThumbnailFromStream"/>
/// <typeparamref name="IThumbnailFromShellObject"/>
/// <typeparamref name="IThumbnailFromFile"/>
/// </summary>
public interface IThumbnailFromStream
{
/// <summary>
/// Provides the <typeparamref name="Stream"/> to the item from which a thumbnail should be created.
/// <remarks>Only 32bpp bitmaps support adornments.
/// While 24bpp bitmaps will be displayed they will not display adornments.
/// Additional guidelines for developing thumbnails can be found at http://msdn.microsoft.com/en-us/library/cc144115(v=VS.85).aspx
/// </remarks>
/// </summary>
/// <param name="stream">Stream to initialize the thumbnail</param>
/// <param name="sideSize">Square side dimension in which the thumbnail should fit; the thumbnail will be scaled otherwise.</param>
/// <returns></returns>
Bitmap ConstructBitmap(Stream stream, int sideSize);
}
/// <summary>
/// This interface exposes the <see cref="ConsructBitmap"/> function for initializing the
/// Thumbnail Provider with file information.
/// This interface can be used in conjunction with the other intialization interfaces,
/// but only 1 will be accessed according to the priorities preset by the Windows Shell:
/// <typeparamref name="IThumbnailFromStream"/>
/// <typeparamref name="IThumbnailFromShellObject"/>
/// <typeparamref name="IThumbnailFromFile"/>
/// </summary>
public interface IThumbnailFromFile
{
/// <summary>
/// Provides the <typeparamref name="FileInfo"/> to the item from which a thumbnail should be created.
/// <remarks>Only 32bpp bitmaps support adornments.
/// While 24bpp bitmaps will be displayed they will not display adornments.
/// Additional guidelines for developing thumbnails can be found at http://msdn.microsoft.com/en-us/library/cc144115(v=VS.85).aspx
/// </remarks>
/// </summary>
/// <param name="info">FileInfo to initialize the thumbnail</param>
/// <param name="sideSize">Square side dimension in which the thumbnail should fit; the thumbnail will be scaled otherwise.</param>
/// <returns>Generated thumbnail</returns>
Bitmap ConstructBitmap(FileInfo info, int sideSize);
}
}
#endif