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
- CachedPathData.cs
- CommonXSendMessage.cs
- ResourceSetExpression.cs
- DropDownList.cs
- DataGridViewComboBoxColumn.cs
- TypeReference.cs
- ToolZone.cs
- DeploymentSection.cs
- XmlEntity.cs
- FontStretch.cs
- ThousandthOfEmRealPoints.cs
- MissingMemberException.cs
- SqlDataAdapter.cs
- InfoCardClaimCollection.cs
- Geometry3D.cs
- XmlSchemaAttribute.cs
- InstalledVoice.cs
- StreamWithDictionary.cs
- WebPartConnectionsCancelVerb.cs
- NamedPipeDuplicateContext.cs
- COM2IDispatchConverter.cs
- HashStream.cs
- Base64Encoder.cs
- LinqDataSource.cs
- NativeMethods.cs
- ActivationArguments.cs
- VisualStateManager.cs
- ProjectionPlan.cs
- MethodImplAttribute.cs
- SqlDataSourceCache.cs
- Model3DCollection.cs
- Package.cs
- RenderData.cs
- AbsoluteQuery.cs
- RegionData.cs
- WinEventHandler.cs
- newinstructionaction.cs
- WebPartDeleteVerb.cs
- GridProviderWrapper.cs
- CorrelationManager.cs
- RegexRunner.cs
- StrokeDescriptor.cs
- DataServiceRequest.cs
- ExecutionEngineException.cs
- DataGridViewRowCollection.cs
- PeerTransportListenAddressValidatorAttribute.cs
- WorkingDirectoryEditor.cs
- WindowsGraphics.cs
- DynamicMetaObject.cs
- WpfPayload.cs
- ContainerSelectorActiveEvent.cs
- MembershipUser.cs
- RequiredFieldValidator.cs
- StreamUpgradeAcceptor.cs
- CodeTryCatchFinallyStatement.cs
- SqlComparer.cs
- WebConfigurationManager.cs
- DataGridRowDetailsEventArgs.cs
- DesignTimeResourceProviderFactoryAttribute.cs
- PasswordTextContainer.cs
- SQLSingleStorage.cs
- MulticastOption.cs
- ContentPlaceHolder.cs
- Win32Native.cs
- IISUnsafeMethods.cs
- TypeContext.cs
- SqlCommandBuilder.cs
- Int32CollectionValueSerializer.cs
- __FastResourceComparer.cs
- CreateUserWizardStep.cs
- EntityDataSourceSelectedEventArgs.cs
- CompiledQueryCacheKey.cs
- Button.cs
- XhtmlTextWriter.cs
- ConsoleEntryPoint.cs
- CharAnimationBase.cs
- FormParameter.cs
- Table.cs
- MsmqIntegrationSecurityElement.cs
- SourceFileInfo.cs
- RadioButton.cs
- oledbmetadatacolumnnames.cs
- InvalidBodyAccessException.cs
- WsatConfiguration.cs
- PreservationFileReader.cs
- XmlAnyElementAttributes.cs
- fixedPageContentExtractor.cs
- WindowsListViewScroll.cs
- PassportIdentity.cs
- _AutoWebProxyScriptHelper.cs
- Point.cs
- EventDescriptorCollection.cs
- panel.cs
- DesignerView.xaml.cs
- ParsedAttributeCollection.cs
- TextEditorSpelling.cs
- PathFigureCollectionValueSerializer.cs
- ReachUIElementCollectionSerializerAsync.cs
- SessionEndedEventArgs.cs
- DetailsViewInsertedEventArgs.cs