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
- InternalConfirm.cs
- SizeAnimation.cs
- LogFlushAsyncResult.cs
- VisualStyleInformation.cs
- FormClosedEvent.cs
- httpapplicationstate.cs
- WorkflowView.cs
- TextReader.cs
- WmpBitmapDecoder.cs
- TreeViewCancelEvent.cs
- ContainerParagraph.cs
- ColumnMapProcessor.cs
- MenuAdapter.cs
- ObjectStateEntryDbUpdatableDataRecord.cs
- ThrowHelper.cs
- TemplateColumn.cs
- Brush.cs
- FastPropertyAccessor.cs
- CellQuery.cs
- RulePatternOps.cs
- CacheHelper.cs
- XamlInt32CollectionSerializer.cs
- WebPartMenu.cs
- Encoder.cs
- GatewayDefinition.cs
- XPathException.cs
- ScalarType.cs
- WpfKnownTypeInvoker.cs
- XmlElement.cs
- TabControlEvent.cs
- EnumCodeDomSerializer.cs
- PageRequestManager.cs
- DataGridViewEditingControlShowingEventArgs.cs
- DateTimeFormatInfoScanner.cs
- SqlIdentifier.cs
- SecurityHeaderElementInferenceEngine.cs
- CharacterHit.cs
- TargetControlTypeAttribute.cs
- SqlHelper.cs
- KeyInterop.cs
- ByteRangeDownloader.cs
- HandleRef.cs
- SocketStream.cs
- ApplicationSecurityManager.cs
- COM2ColorConverter.cs
- VectorAnimation.cs
- OleAutBinder.cs
- OleDbRowUpdatedEvent.cs
- TraceInternal.cs
- NameTable.cs
- FaultDesigner.cs
- NullableBoolConverter.cs
- WindowsFormsHelpers.cs
- CachedPathData.cs
- XPathAncestorQuery.cs
- DataService.cs
- StateBag.cs
- AttachedPropertyBrowsableAttribute.cs
- wmiprovider.cs
- CommentEmitter.cs
- Compiler.cs
- SchemaDeclBase.cs
- CompareValidator.cs
- TextEditorCopyPaste.cs
- BamlReader.cs
- Vertex.cs
- StatusBarDrawItemEvent.cs
- PeerEndPoint.cs
- DataControlFieldHeaderCell.cs
- CompletedAsyncResult.cs
- sqlnorm.cs
- DBDataPermission.cs
- Int32CAMarshaler.cs
- Query.cs
- GridViewDesigner.cs
- EdmTypeAttribute.cs
- BrowserCapabilitiesFactory.cs
- RelationshipFixer.cs
- RecordManager.cs
- FunctionDescription.cs
- PromptBuilder.cs
- DataServiceResponse.cs
- _HeaderInfoTable.cs
- EncoderExceptionFallback.cs
- ScriptIgnoreAttribute.cs
- TypeInitializationException.cs
- BuildManagerHost.cs
- StrongNamePublicKeyBlob.cs
- FontSizeConverter.cs
- XmlAnyElementAttributes.cs
- TypeGeneratedEventArgs.cs
- ActivationServices.cs
- StateManagedCollection.cs
- InfoCardRSACryptoProvider.cs
- RealizationDrawingContextWalker.cs
- XsdBuildProvider.cs
- TemplateColumn.cs
- ExpressionHelper.cs
- DataBoundControlAdapter.cs
- WebControl.cs