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
- XmlConverter.cs
- ItemContainerProviderWrapper.cs
- DSASignatureDeformatter.cs
- OdbcCommand.cs
- CheckBoxPopupAdapter.cs
- SystemGatewayIPAddressInformation.cs
- SuppressMessageAttribute.cs
- ComplusTypeValidator.cs
- ListenerElementsCollection.cs
- DecodeHelper.cs
- SqlAliaser.cs
- SmiMetaData.cs
- ArraySubsetEnumerator.cs
- Timeline.cs
- WebPartTransformerCollection.cs
- CodeRemoveEventStatement.cs
- DataGridViewLinkCell.cs
- AssemblyContextControlItem.cs
- MemoryRecordBuffer.cs
- BaseCAMarshaler.cs
- HyperLink.cs
- TextRunCache.cs
- TextRangeAdaptor.cs
- SetUserLanguageRequest.cs
- WebPartEditorCancelVerb.cs
- IdentityReference.cs
- AsyncCompletedEventArgs.cs
- FontInfo.cs
- SchemaElementLookUpTable.cs
- Geometry.cs
- DataChangedEventManager.cs
- WebPartTransformer.cs
- FontStyles.cs
- SiteMapDataSourceView.cs
- CommonGetThemePartSize.cs
- AppManager.cs
- TransformConverter.cs
- InternalBufferManager.cs
- CommandField.cs
- WindowsListViewItemCheckBox.cs
- CodeArrayCreateExpression.cs
- ProcessInfo.cs
- TerminatorSinks.cs
- GridViewHeaderRowPresenterAutomationPeer.cs
- CodeTypeDelegate.cs
- _HeaderInfo.cs
- EngineSite.cs
- DependencyPropertyValueSerializer.cs
- MultipartContentParser.cs
- recordstatefactory.cs
- BackoffTimeoutHelper.cs
- SelectionItemProviderWrapper.cs
- StylusButtonCollection.cs
- WebRequestModuleElement.cs
- CompModSwitches.cs
- AtomMaterializer.cs
- DataGridTable.cs
- Activator.cs
- LinearKeyFrames.cs
- ScaleTransform3D.cs
- PartitionedDataSource.cs
- KnownTypeAttribute.cs
- SectionXmlInfo.cs
- DataObjectCopyingEventArgs.cs
- AudioLevelUpdatedEventArgs.cs
- mediapermission.cs
- DataGridViewColumnDividerDoubleClickEventArgs.cs
- ExtentKey.cs
- regiisutil.cs
- NumberFunctions.cs
- X509CertificateValidator.cs
- AutomationEventArgs.cs
- IDataContractSurrogate.cs
- entityreference_tresulttype.cs
- EventQueueState.cs
- LZCodec.cs
- PackageRelationshipCollection.cs
- Light.cs
- ExtensionQuery.cs
- BamlTreeNode.cs
- SoapAttributeAttribute.cs
- AppDomainAttributes.cs
- FileInfo.cs
- Fx.cs
- XmlQueryTypeFactory.cs
- entityreference_tresulttype.cs
- MenuStrip.cs
- MsmqAppDomainProtocolHandler.cs
- _NestedMultipleAsyncResult.cs
- SafeProcessHandle.cs
- SuspendDesigner.cs
- TrustManagerPromptUI.cs
- PhysicalAddress.cs
- OneOfConst.cs
- TransactionTraceIdentifier.cs
- ResourceAttributes.cs
- ToolboxControl.cs
- DeploymentExceptionMapper.cs
- ErrorFormatter.cs
- SrgsElementFactoryCompiler.cs