Code:
/ 4.0 / 4.0 / 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. /// // 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
- Adorner.cs
- loginstatus.cs
- ScrollProviderWrapper.cs
- URLMembershipCondition.cs
- precedingquery.cs
- EventProvider.cs
- Brush.cs
- EntityDataSource.cs
- SkipStoryboardToFill.cs
- XmlWrappingReader.cs
- AudienceUriMode.cs
- ResourceSetExpression.cs
- ConstraintEnumerator.cs
- ColumnMapProcessor.cs
- TrackingQuery.cs
- ToolboxSnapDragDropEventArgs.cs
- CommaDelimitedStringAttributeCollectionConverter.cs
- SettingsBase.cs
- LifetimeServices.cs
- ScriptControl.cs
- SecurityRuntime.cs
- ResourcePool.cs
- SemanticResolver.cs
- DurableInstance.cs
- WebPartCatalogCloseVerb.cs
- XmlLinkedNode.cs
- Tuple.cs
- XPathBinder.cs
- XslCompiledTransform.cs
- MulticastNotSupportedException.cs
- ComponentResourceKeyConverter.cs
- documentsequencetextcontainer.cs
- TriggerAction.cs
- AutomationPattern.cs
- UseLicense.cs
- StorageScalarPropertyMapping.cs
- CommonProperties.cs
- TraceLevelHelper.cs
- ActivityExecutionFilter.cs
- DefaultBinder.cs
- Visual3D.cs
- DataGridViewColumnTypePicker.cs
- RadioButtonAutomationPeer.cs
- WebPartCollection.cs
- cookie.cs
- DependencyPropertyDescriptor.cs
- String.cs
- login.cs
- ContentType.cs
- HashHelpers.cs
- SecurityDescriptor.cs
- PriorityQueue.cs
- TextTrailingCharacterEllipsis.cs
- SiteMapDataSourceView.cs
- PixelFormatConverter.cs
- ComponentEditorForm.cs
- LocationEnvironment.cs
- ISAPIApplicationHost.cs
- ValidatingReaderNodeData.cs
- OrderedHashRepartitionStream.cs
- WorkItem.cs
- StreamUpgradeInitiator.cs
- SessionEndingCancelEventArgs.cs
- PageOrientation.cs
- HashCodeCombiner.cs
- shaperfactoryquerycachekey.cs
- TraceHandlerErrorFormatter.cs
- thaishape.cs
- CachingParameterInspector.cs
- CommandID.cs
- QEncodedStream.cs
- DataGridHelper.cs
- PageVisual.cs
- SqlSelectStatement.cs
- SchemaImporterExtensionElementCollection.cs
- XmlDomTextWriter.cs
- LazyTextWriterCreator.cs
- CommunicationException.cs
- DesignDataSource.cs
- Region.cs
- ReadWriteSpinLock.cs
- UnsafePeerToPeerMethods.cs
- WindowManager.cs
- IsolatedStorageSecurityState.cs
- _HeaderInfo.cs
- WmlPanelAdapter.cs
- DependencyPropertyValueSerializer.cs
- CollectionChange.cs
- SchemaTableOptionalColumn.cs
- ColorAnimation.cs
- _CookieModule.cs
- GatewayDefinition.cs
- ToolStripSeparatorRenderEventArgs.cs
- DataGridViewLinkCell.cs
- ProjectionCamera.cs
- ElementUtil.cs
- SystemUnicastIPAddressInformation.cs
- TypeDelegator.cs
- DataGridViewCellEventArgs.cs
- PartBasedPackageProperties.cs