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
- CompositeTypefaceMetrics.cs
- WindowsScroll.cs
- GPStream.cs
- StateWorkerRequest.cs
- ConfigurationFileMap.cs
- ServiceNameElement.cs
- MeasureItemEvent.cs
- ColorConvertedBitmap.cs
- DispatchWrapper.cs
- HandlerFactoryWrapper.cs
- ImpersonationOption.cs
- StandardCommandToolStripMenuItem.cs
- MetadataSource.cs
- TextServicesLoader.cs
- ItemMap.cs
- RenderTargetBitmap.cs
- SyncOperationState.cs
- XsltLoader.cs
- NullRuntimeConfig.cs
- TextEffectCollection.cs
- PageParser.cs
- DataStreamFromComStream.cs
- ColumnMapCopier.cs
- _HelperAsyncResults.cs
- PasswordPropertyTextAttribute.cs
- RelationshipManager.cs
- CodeAttachEventStatement.cs
- ComboBoxRenderer.cs
- UserUseLicenseDictionaryLoader.cs
- ObjectView.cs
- StringHelper.cs
- Page.cs
- DashStyles.cs
- X509ChainPolicy.cs
- Single.cs
- ServiceCredentialsElement.cs
- C14NUtil.cs
- Imaging.cs
- MaskedTextBox.cs
- FormsAuthenticationModule.cs
- NamedPipeConnectionPool.cs
- ImageButton.cs
- SystemWebSectionGroup.cs
- HandleExceptionArgs.cs
- SoapFaultCodes.cs
- ReadOnlyHierarchicalDataSourceView.cs
- ToolStripRenderer.cs
- HttpCookiesSection.cs
- ReverseInheritProperty.cs
- GridViewSelectEventArgs.cs
- XmlEntity.cs
- FunctionDefinition.cs
- XPathParser.cs
- SymbolDocumentInfo.cs
- RtfNavigator.cs
- HtmlContainerControl.cs
- ShaderEffect.cs
- PropertyChangeTracker.cs
- ReachUIElementCollectionSerializerAsync.cs
- CustomLineCap.cs
- TraceXPathNavigator.cs
- PartitionedStream.cs
- UInt64Converter.cs
- ActiveXHost.cs
- PipeSecurity.cs
- CharacterString.cs
- Tuple.cs
- AttachedPropertyBrowsableAttribute.cs
- ToolStripControlHost.cs
- RenderContext.cs
- WebSysDefaultValueAttribute.cs
- HybridObjectCache.cs
- TransactionException.cs
- XamlSerializerUtil.cs
- ZipIOLocalFileHeader.cs
- _ListenerRequestStream.cs
- HttpModulesSection.cs
- WebPartMovingEventArgs.cs
- DrawListViewColumnHeaderEventArgs.cs
- WindowsTab.cs
- C14NUtil.cs
- SessionStateItemCollection.cs
- AnnotationMap.cs
- DrawItemEvent.cs
- WebPartMenuStyle.cs
- ConsumerConnectionPointCollection.cs
- RedirectionProxy.cs
- MetadataCache.cs
- HandlerFactoryCache.cs
- AppSettingsSection.cs
- MemoryStream.cs
- MdiWindowListItemConverter.cs
- DragStartedEventArgs.cs
- AttributeAction.cs
- ExtenderProvidedPropertyAttribute.cs
- Hashtable.cs
- CounterNameConverter.cs
- Pair.cs
- XmlParserContext.cs
- EntitySetDataBindingList.cs