Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / CommonUI / System / Drawing / Advanced / ImageCodecInfo.cs / 1 / ImageCodecInfo.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- /*************************************************************************\ * * Copyright (c) 1998-1999, Microsoft Corp. All Rights Reserved. * * Module Name: * * ImageCodecInfo.cs * * Abstract: * * Native GDI+ ImageCodecInfo structure. * * Revision History: * * 9/22/1999 [....] * Created it. * \**************************************************************************/ namespace System.Drawing.Imaging { using System.Text; using System.Runtime.InteropServices; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System; using System.Drawing; using System.Drawing.Internal; // sdkinc\imaging.h ////// /// public sealed class ImageCodecInfo { Guid clsid; Guid formatID; string codecName; string dllName; string formatDescription; string filenameExtension; string mimeType; ImageCodecFlags flags; int version; byte[][] signaturePatterns; byte[][] signatureMasks; internal ImageCodecInfo() { } ///[To be supplied.] ////// /// public Guid Clsid { get { return clsid; } set { clsid = value; } } ///[To be supplied.] ////// /// public Guid FormatID { get { return formatID; } set { formatID = value; } } ///[To be supplied.] ////// /// public string CodecName { get { return codecName; } set { codecName = value; } } ///[To be supplied.] ////// /// public string DllName { [SuppressMessage("Microsoft.Security", "CA2103:ReviewImperativeSecurity")] get { if (dllName != null) { //a valid path is a security concern, demand //path discovery permission.... new System.Security.Permissions.FileIOPermission(System.Security.Permissions.FileIOPermissionAccess.PathDiscovery, dllName).Demand(); } return dllName; } [SuppressMessage("Microsoft.Security", "CA2103:ReviewImperativeSecurity")] set { if (value != null) { //a valid path is a security concern, demand //path discovery permission.... new System.Security.Permissions.FileIOPermission(System.Security.Permissions.FileIOPermissionAccess.PathDiscovery, value).Demand(); } dllName = value; } } ///[To be supplied.] ////// /// public string FormatDescription { get { return formatDescription; } set { formatDescription = value; } } ///[To be supplied.] ////// /// public string FilenameExtension { get { return filenameExtension; } set { filenameExtension = value; } } ///[To be supplied.] ////// /// public string MimeType { get { return mimeType; } set { mimeType = value; } } ///[To be supplied.] ////// /// public ImageCodecFlags Flags { get { return flags; } set { flags = value; } } ///[To be supplied.] ////// /// public int Version { get { return version; } set { version = value; } } ///[To be supplied.] ////// /// [CLSCompliant(false)] public byte[][] SignaturePatterns { get { return signaturePatterns; } set { signaturePatterns = value; } } ///[To be supplied.] ////// /// [CLSCompliant(false)] public byte[][] SignatureMasks { get { return signatureMasks; } set { signatureMasks = value; } } // Encoder/Decoder selection APIs ///[To be supplied.] ////// /// public static ImageCodecInfo[] GetImageDecoders() { ImageCodecInfo[] imageCodecs; int numDecoders; int size; int status = SafeNativeMethods.Gdip.GdipGetImageDecodersSize(out numDecoders, out size); if (status != SafeNativeMethods.Gdip.Ok) { throw SafeNativeMethods.Gdip.StatusException(status); } IntPtr memory = Marshal.AllocHGlobal(size); try { status = SafeNativeMethods.Gdip.GdipGetImageDecoders(numDecoders, size, memory); if (status != SafeNativeMethods.Gdip.Ok) { throw SafeNativeMethods.Gdip.StatusException(status); } imageCodecs = ImageCodecInfo.ConvertFromMemory(memory, numDecoders); } finally { Marshal.FreeHGlobal(memory); } return imageCodecs; } ///[To be supplied.] ////// /// public static ImageCodecInfo[] GetImageEncoders() { ImageCodecInfo[] imageCodecs; int numEncoders; int size; int status = SafeNativeMethods.Gdip.GdipGetImageEncodersSize(out numEncoders, out size); if (status != SafeNativeMethods.Gdip.Ok) { throw SafeNativeMethods.Gdip.StatusException(status); } IntPtr memory = Marshal.AllocHGlobal(size); try { status = SafeNativeMethods.Gdip.GdipGetImageEncoders(numEncoders, size, memory); if (status != SafeNativeMethods.Gdip.Ok) { throw SafeNativeMethods.Gdip.StatusException(status); } imageCodecs = ImageCodecInfo.ConvertFromMemory(memory, numEncoders); } finally { Marshal.FreeHGlobal(memory); } return imageCodecs; } /* FxCop rule 'AvoidBuildingNonCallableCode' - Left here in case it is needed in the future. internal static ImageCodecInfoPrivate ConvertToMemory(ImageCodecInfo imagecs) { ImageCodecInfoPrivate imagecsp = new ImageCodecInfoPrivate(); imagecsp.Clsid = imagecs.Clsid; imagecsp.FormatID = imagecs.FormatID; imagecsp.CodecName = Marshal.StringToHGlobalUni(imagecs.CodecName); imagecsp.DllName = Marshal.StringToHGlobalUni(imagecs.DllName); imagecsp.FormatDescription = Marshal.StringToHGlobalUni(imagecs.FormatDescription); imagecsp.FilenameExtension = Marshal.StringToHGlobalUni(imagecs.FilenameExtension); imagecsp.MimeType = Marshal.StringToHGlobalUni(imagecs.MimeType); imagecsp.Flags = (int)imagecs.Flags; imagecsp.Version = (int)imagecs.Version; imagecsp.SigCount = imagecs.SignaturePatterns.Length; imagecsp.SigSize = imagecs.SignaturePatterns[0].Length; imagecsp.SigPattern = Marshal.AllocHGlobal(imagecsp.SigCount*imagecsp.SigSize); imagecsp.SigMask = Marshal.AllocHGlobal(imagecsp.SigCount*imagecsp.SigSize); for (int i=0; i[To be supplied.] ///
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ActivityCodeDomReferenceService.cs
- RemotingHelper.cs
- FontTypeConverter.cs
- ContextMenuAutomationPeer.cs
- FormatException.cs
- QueryResponse.cs
- ArrayElementGridEntry.cs
- PaintEvent.cs
- ListView.cs
- DocumentAutomationPeer.cs
- ApplicationSettingsBase.cs
- BindingExpressionUncommonField.cs
- GridEntryCollection.cs
- SqlServer2KCompatibilityAnnotation.cs
- TextShapeableCharacters.cs
- ClientTargetSection.cs
- GenericTextProperties.cs
- BaseTemplateCodeDomTreeGenerator.cs
- SignatureToken.cs
- XmlReflectionImporter.cs
- AssemblyAttributesGoHere.cs
- DataSourceCache.cs
- VisualBasicSettingsConverter.cs
- RadioButtonFlatAdapter.cs
- TemplateBuilder.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- XmlLoader.cs
- ConfigurationValues.cs
- SqlRowUpdatedEvent.cs
- SmiMetaDataProperty.cs
- Subtract.cs
- ObjectNotFoundException.cs
- DataException.cs
- DropSource.cs
- Baml2006Reader.cs
- InstanceDataCollection.cs
- SecurityChannel.cs
- SqlConnectionPoolGroupProviderInfo.cs
- TouchDevice.cs
- Decorator.cs
- AccessedThroughPropertyAttribute.cs
- BooleanStorage.cs
- DbDataRecord.cs
- CharacterMetrics.cs
- CommentAction.cs
- DataGridViewAdvancedBorderStyle.cs
- DataSourceProvider.cs
- WebControl.cs
- BuildManager.cs
- SqlRecordBuffer.cs
- QilSortKey.cs
- TraceHwndHost.cs
- HTMLTagNameToTypeMapper.cs
- ErrorHandler.cs
- CodeGotoStatement.cs
- SimpleMailWebEventProvider.cs
- SchemaImporter.cs
- Gdiplus.cs
- MarkupWriter.cs
- DCSafeHandle.cs
- mediaeventshelper.cs
- SqlDataRecord.cs
- XmlReflectionImporter.cs
- RegistrationServices.cs
- AssemblyHelper.cs
- TextElementAutomationPeer.cs
- RectValueSerializer.cs
- LocalizableResourceBuilder.cs
- WebContext.cs
- ImageField.cs
- HttpGetServerProtocol.cs
- CryptoConfig.cs
- SoapIgnoreAttribute.cs
- HttpBrowserCapabilitiesWrapper.cs
- GetPageCompletedEventArgs.cs
- TreeNodeCollection.cs
- HitTestDrawingContextWalker.cs
- SafeLocalAllocation.cs
- ColumnCollection.cs
- OdbcConnection.cs
- OciHandle.cs
- Metafile.cs
- RoleService.cs
- ClientTarget.cs
- InstanceOwner.cs
- DeviceSpecificChoice.cs
- NamespaceMapping.cs
- DispatcherExceptionFilterEventArgs.cs
- WebPartConnection.cs
- ProviderException.cs
- ComponentChangingEvent.cs
- SQLDecimal.cs
- UserInitiatedNavigationPermission.cs
- NullReferenceException.cs
- MetadataItemEmitter.cs
- ConnectionPoolManager.cs
- SystemColors.cs
- IssuedTokenClientElement.cs
- LateBoundChannelParameterCollection.cs
- InvalidOleVariantTypeException.cs