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
- InvalidAsynchronousStateException.cs
- DataKeyArray.cs
- RuntimeArgumentHandle.cs
- Section.cs
- Point3D.cs
- SqlReorderer.cs
- CalendarAutoFormatDialog.cs
- OutputCacheSection.cs
- NativeBuffer.cs
- SizeConverter.cs
- SQLInt32.cs
- PolicyValidationException.cs
- CollectionsUtil.cs
- LineServices.cs
- AtomicFile.cs
- XmlSchemaParticle.cs
- InputLanguageEventArgs.cs
- XmlSerializableServices.cs
- TextViewSelectionProcessor.cs
- ParameterElementCollection.cs
- IIS7WorkerRequest.cs
- CodeDomSerializationProvider.cs
- SplayTreeNode.cs
- X509UI.cs
- SafeRightsManagementSessionHandle.cs
- DataContractSerializer.cs
- PatternMatcher.cs
- IFlowDocumentViewer.cs
- MetadataReference.cs
- MissingMemberException.cs
- CodeParameterDeclarationExpressionCollection.cs
- util.cs
- MemberMaps.cs
- ObjectConverter.cs
- ZipArchive.cs
- DomainConstraint.cs
- SrgsRule.cs
- TextRange.cs
- AttributeParameterInfo.cs
- SqlDataSourceEnumerator.cs
- XmlNamedNodeMap.cs
- DecoderExceptionFallback.cs
- AuthorizationRuleCollection.cs
- future.cs
- COAUTHINFO.cs
- ApplicationBuildProvider.cs
- SrgsElementFactoryCompiler.cs
- SevenBitStream.cs
- ControlUtil.cs
- DynamicQueryStringParameter.cs
- CharAnimationUsingKeyFrames.cs
- OdbcEnvironment.cs
- HtmlAnchor.cs
- BaseAsyncResult.cs
- MexHttpBindingElement.cs
- PersonalizationStateInfo.cs
- BrowserDefinitionCollection.cs
- KeyInstance.cs
- UInt64.cs
- InsufficientMemoryException.cs
- Regex.cs
- DataGridViewColumnDesigner.cs
- MimePart.cs
- DbConnectionPool.cs
- DataListCommandEventArgs.cs
- GeneralTransformGroup.cs
- IndentTextWriter.cs
- DBConcurrencyException.cs
- hwndwrapper.cs
- AccessedThroughPropertyAttribute.cs
- ImportOptions.cs
- PartDesigner.cs
- CalendarBlackoutDatesCollection.cs
- DataPagerField.cs
- DataGridClipboardHelper.cs
- HashSet.cs
- ConnectionStringSettingsCollection.cs
- StoreContentChangedEventArgs.cs
- TreeNodeCollection.cs
- TypeContext.cs
- Win32KeyboardDevice.cs
- UIElement.cs
- FileLogRecord.cs
- OpCopier.cs
- ValueUtilsSmi.cs
- DataBindingCollection.cs
- GridViewItemAutomationPeer.cs
- PickBranch.cs
- Header.cs
- PerformanceCounter.cs
- HostingEnvironmentSection.cs
- ErrorWrapper.cs
- HttpApplicationFactory.cs
- StrokeCollection.cs
- NativeMethods.cs
- ToolStripContentPanel.cs
- SqlDataReader.cs
- FaultDesigner.cs
- GenericIdentity.cs
- TextTabProperties.cs