Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / CommonUI / System / Drawing / Advanced / ColorPalette.cs / 2 / 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
- OLEDB_Enum.cs
- RegexRunner.cs
- Number.cs
- HttpVersion.cs
- QilInvokeLateBound.cs
- AssociatedControlConverter.cs
- Compiler.cs
- BitmapFrameEncode.cs
- nulltextnavigator.cs
- ReadOnlyDictionary.cs
- PinnedBufferMemoryStream.cs
- VarRemapper.cs
- loginstatus.cs
- InputManager.cs
- DataGridPagerStyle.cs
- XNodeNavigator.cs
- SharedPersonalizationStateInfo.cs
- DrawingBrush.cs
- DynamicFilterExpression.cs
- PersonalizationStateQuery.cs
- DPCustomTypeDescriptor.cs
- Listbox.cs
- CapabilitiesAssignment.cs
- SessionParameter.cs
- XmlnsDictionary.cs
- ConfigurationStrings.cs
- Attributes.cs
- GlobalDataBindingHandler.cs
- GeometryConverter.cs
- CacheChildrenQuery.cs
- HybridObjectCache.cs
- TextCharacters.cs
- XmlSchemaSimpleContent.cs
- TreeViewItem.cs
- RegexBoyerMoore.cs
- WebPartConnectionCollection.cs
- smtpconnection.cs
- AttachedProperty.cs
- DocumentGrid.cs
- TextPenaltyModule.cs
- DataGridViewTextBoxColumn.cs
- prompt.cs
- WindowsAuthenticationEventArgs.cs
- X509SecurityTokenAuthenticator.cs
- AddInController.cs
- Reference.cs
- SmiConnection.cs
- ListDesigner.cs
- HorizontalAlignConverter.cs
- OptionUsage.cs
- ServiceRoute.cs
- WebBrowserNavigatingEventHandler.cs
- SmiEventSink.cs
- DependencyPropertyDescriptor.cs
- SchemaNamespaceManager.cs
- ConfigurationSectionGroupCollection.cs
- UnicodeEncoding.cs
- MethodAccessException.cs
- UIElementHelper.cs
- ExpressionPrefixAttribute.cs
- BaseCodeDomTreeGenerator.cs
- SourceItem.cs
- MaskedTextBox.cs
- CheckBoxDesigner.cs
- ZoneButton.cs
- ConstraintCollection.cs
- BrowserDefinition.cs
- CellConstantDomain.cs
- ComplexPropertyEntry.cs
- TextTreeDeleteContentUndoUnit.cs
- ContentElement.cs
- TreeNodeMouseHoverEvent.cs
- SmtpSection.cs
- TableLayout.cs
- NativeMethods.cs
- ImplicitInputBrush.cs
- DeleteCardRequest.cs
- NestedContainer.cs
- ActivityWithResult.cs
- ProcessThread.cs
- EntityDataSourceMemberPath.cs
- XamlSerializerUtil.cs
- UpdateDelegates.Generated.cs
- SourceFileBuildProvider.cs
- ParenExpr.cs
- UnmanagedMemoryAccessor.cs
- ConfigurationManager.cs
- LoadMessageLogger.cs
- TypeReference.cs
- InputManager.cs
- GroupBox.cs
- VisualBrush.cs
- SymmetricAlgorithm.cs
- ValueConversionAttribute.cs
- ProfessionalColors.cs
- XslCompiledTransform.cs
- GraphicsPathIterator.cs
- ServiceInstallComponent.cs
- ExpressionNode.cs
- Point.cs