Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CommonUI / System / Drawing / Advanced / ColorPalette.cs / 1305376 / 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. ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TraceLevelStore.cs
- UInt16Storage.cs
- TemplateModeChangedEventArgs.cs
- XmlDataContract.cs
- GenericIdentity.cs
- SerializerDescriptor.cs
- SimpleApplicationHost.cs
- PreservationFileReader.cs
- OutputCacheSection.cs
- RemoteWebConfigurationHostStream.cs
- WhereQueryOperator.cs
- ActivationServices.cs
- BulletChrome.cs
- IntSecurity.cs
- ShapeTypeface.cs
- UserControlAutomationPeer.cs
- TypeConstant.cs
- XPathParser.cs
- XmlChoiceIdentifierAttribute.cs
- SelectionItemPatternIdentifiers.cs
- FixedBufferAttribute.cs
- TraceSection.cs
- CaseInsensitiveOrdinalStringComparer.cs
- RootNamespaceAttribute.cs
- ScriptModule.cs
- Int64AnimationUsingKeyFrames.cs
- AdapterUtil.cs
- StrongNameMembershipCondition.cs
- CustomBindingElement.cs
- XmlSchemaValidator.cs
- ChildChangedEventArgs.cs
- Point.cs
- SafeNativeMemoryHandle.cs
- AccessKeyManager.cs
- RuntimeUtils.cs
- SqlNotificationEventArgs.cs
- ActivityDesigner.cs
- PriorityQueue.cs
- WebServiceResponse.cs
- XPathScanner.cs
- MasterPage.cs
- SoapSchemaExporter.cs
- DispatcherProcessingDisabled.cs
- CodeExpressionCollection.cs
- InitializationEventAttribute.cs
- StrokeNodeOperations.cs
- SqlUDTStorage.cs
- Enum.cs
- MatrixAnimationBase.cs
- IConvertible.cs
- SetterTriggerConditionValueConverter.cs
- CalendarButton.cs
- HtmlTable.cs
- ObjectAnimationBase.cs
- NumberFunctions.cs
- SymbolMethod.cs
- ADMembershipUser.cs
- LinqDataSourceValidationException.cs
- WebPartManager.cs
- BindingEditor.xaml.cs
- HyperLinkDataBindingHandler.cs
- WebPartDeleteVerb.cs
- ConfigurationManagerHelper.cs
- ObjectResult.cs
- SymLanguageVendor.cs
- SortExpressionBuilder.cs
- SiteMap.cs
- HtmlFormParameterReader.cs
- SchemaAttDef.cs
- Stopwatch.cs
- Types.cs
- WindowsButton.cs
- WindowsMenu.cs
- WebPartConnection.cs
- ObjectStateManagerMetadata.cs
- ImageBrush.cs
- AxisAngleRotation3D.cs
- StringFormat.cs
- Select.cs
- RootBrowserWindowAutomationPeer.cs
- DocumentCollection.cs
- TextCompositionManager.cs
- Mapping.cs
- ProcessThreadDesigner.cs
- SizeAnimationClockResource.cs
- StaticSiteMapProvider.cs
- HttpCookieCollection.cs
- ListBase.cs
- ByValueEqualityComparer.cs
- ToolStripSplitStackLayout.cs
- SerialPinChanges.cs
- EditorZoneBase.cs
- SigningDialog.cs
- CollectionBuilder.cs
- PointAnimationUsingPath.cs
- ImageListUtils.cs
- CloseCollectionAsyncResult.cs
- DependsOnAttribute.cs
- APCustomTypeDescriptor.cs
- Image.cs