Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / CommonUI / System / Drawing / Advanced / ColorPalette.cs / 1 / ColorPalette.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Drawing.Imaging { using System.Runtime.InteropServices; using System.Diagnostics; using System; using System.Drawing; ////// /// Defines an array of colors that make up a /// color palette. /// public sealed class ColorPalette { /// Note (From VSWhidbey#444618): We don't provide a public constructor for ColorPalette because if we allow /// arbitrary creation of color palettes you could in theroy not only change the color entries, but the size /// of the palette and that is not valid for an image (meaning you cannot change the palette size for an image). /// ColorPalettes are only valid for "indexed" images like GIFs. private int flags; private Color[] entries; ////// /// public int Flags { get { return flags; } } ////// Specifies how to interpret the color /// information in the array of colors. /// ////// /// Specifies an array of public Color[] Entries { get { return entries; } } internal ColorPalette(int count) { entries = new Color[count]; } internal ColorPalette() { entries = new Color[1]; } internal void ConvertFromMemory(IntPtr memory) { // Memory layout is: // UINT Flags // UINT Count // ARGB Entries[size] flags = Marshal.ReadInt32(memory); int size; size = Marshal.ReadInt32((IntPtr)((long)memory + 4)); // Marshal.SizeOf(size.GetType()) entries = new Color[size]; for (int i=0; iobjects. /// // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Drawing.Imaging { using System.Runtime.InteropServices; using System.Diagnostics; using System; using System.Drawing; /// /// /// Defines an array of colors that make up a /// color palette. /// public sealed class ColorPalette { /// Note (From VSWhidbey#444618): We don't provide a public constructor for ColorPalette because if we allow /// arbitrary creation of color palettes you could in theroy not only change the color entries, but the size /// of the palette and that is not valid for an image (meaning you cannot change the palette size for an image). /// ColorPalettes are only valid for "indexed" images like GIFs. private int flags; private Color[] entries; ////// /// public int Flags { get { return flags; } } ////// Specifies how to interpret the color /// information in the array of colors. /// ////// /// Specifies an array of public Color[] Entries { get { return entries; } } internal ColorPalette(int count) { entries = new Color[count]; } internal ColorPalette() { entries = new Color[1]; } internal void ConvertFromMemory(IntPtr memory) { // Memory layout is: // UINT Flags // UINT Count // ARGB Entries[size] flags = Marshal.ReadInt32(memory); int size; size = Marshal.ReadInt32((IntPtr)((long)memory + 4)); // Marshal.SizeOf(size.GetType()) entries = new Color[size]; for (int i=0; iobjects. ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ScaleTransform3D.cs
- ImageField.cs
- EventPropertyMap.cs
- Events.cs
- XmlCustomFormatter.cs
- CacheDependency.cs
- WebProxyScriptElement.cs
- WindowsToolbar.cs
- DebugHandleTracker.cs
- ElapsedEventArgs.cs
- SuppressIldasmAttribute.cs
- TimeoutHelper.cs
- EnumConverter.cs
- Selection.cs
- CrossSiteScriptingValidation.cs
- XmlCompatibilityReader.cs
- EventDescriptorCollection.cs
- SchemaNamespaceManager.cs
- CommonObjectSecurity.cs
- WebPartCollection.cs
- Selection.cs
- XamlBuildProvider.cs
- BitmapEffectGeneralTransform.cs
- TempFiles.cs
- _HeaderInfo.cs
- XmlAttributeAttribute.cs
- Style.cs
- SqlConnectionPoolProviderInfo.cs
- CommonDialog.cs
- SecurityTokenContainer.cs
- TextEffectResolver.cs
- ToolStripDropDownItemDesigner.cs
- XmlAttribute.cs
- PropertyChangedEventManager.cs
- TemplateField.cs
- XmlTypeAttribute.cs
- OverflowException.cs
- TextElementEnumerator.cs
- TemplateComponentConnector.cs
- LeafCellTreeNode.cs
- ExpressionBuilderContext.cs
- WorkflowInspectionServices.cs
- ObjectQueryState.cs
- RotateTransform3D.cs
- CryptoStream.cs
- ObjectIDGenerator.cs
- EditingCommands.cs
- SapiRecognizer.cs
- SafeNativeMethodsOther.cs
- webeventbuffer.cs
- FrameworkElement.cs
- Token.cs
- _KerberosClient.cs
- NullableFloatMinMaxAggregationOperator.cs
- Visitor.cs
- ProtocolsConfigurationEntry.cs
- SolidColorBrush.cs
- SessionEndingCancelEventArgs.cs
- TransformValueSerializer.cs
- DataGridViewTextBoxEditingControl.cs
- Site.cs
- VirtualDirectoryMapping.cs
- MobileControlPersister.cs
- Soap.cs
- CommandBinding.cs
- SystemNetHelpers.cs
- RSAOAEPKeyExchangeFormatter.cs
- Matrix3D.cs
- RepeaterCommandEventArgs.cs
- Decoder.cs
- XhtmlBasicLinkAdapter.cs
- Cloud.cs
- XmlUnspecifiedAttribute.cs
- xmlfixedPageInfo.cs
- Encoder.cs
- ICspAsymmetricAlgorithm.cs
- HtmlFormParameterWriter.cs
- MatrixTransform3D.cs
- WebPartCatalogCloseVerb.cs
- HostingEnvironment.cs
- ChannelServices.cs
- KeyInfo.cs
- KnownColorTable.cs
- CompositeActivityValidator.cs
- MouseButton.cs
- ProfileEventArgs.cs
- ErrorFormatter.cs
- MatrixConverter.cs
- StringWriter.cs
- DeferrableContent.cs
- MergeFailedEvent.cs
- IndexOutOfRangeException.cs
- remotingproxy.cs
- InheritanceAttribute.cs
- BinaryObjectReader.cs
- StronglyTypedResourceBuilder.cs
- TextChange.cs
- DataGridPagerStyle.cs
- MetaDataInfo.cs
- SelectionRange.cs