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;
///
///
///
/// Specifies how to interpret the color
/// information in the array of colors.
///
///
public int Flags
{
get {
return flags;
}
}
///
///
/// Specifies an array of objects.
///
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; i
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SettingsPropertyWrongTypeException.cs
- TickBar.cs
- VectorAnimation.cs
- DeclaredTypeElement.cs
- LinearKeyFrames.cs
- Memoizer.cs
- DecoderFallback.cs
- ProxyWebPartManager.cs
- ObjectMemberMapping.cs
- SiteMapDataSourceView.cs
- OrthographicCamera.cs
- oledbconnectionstring.cs
- StructuralCache.cs
- TargetParameterCountException.cs
- EnumerableRowCollectionExtensions.cs
- SystemColors.cs
- ModelTreeEnumerator.cs
- StreamInfo.cs
- GeneralTransform3DTo2D.cs
- InfiniteIntConverter.cs
- RunClient.cs
- DataGridLinkButton.cs
- SerTrace.cs
- BridgeDataReader.cs
- XsdSchemaFileEditor.cs
- MenuRendererClassic.cs
- TokenizerHelper.cs
- NotConverter.cs
- WindowsEditBoxRange.cs
- DetailsViewDeleteEventArgs.cs
- TraceHwndHost.cs
- AutomationElementIdentifiers.cs
- StringValidator.cs
- GridViewUpdatedEventArgs.cs
- XmlHierarchyData.cs
- DecoderBestFitFallback.cs
- Stackframe.cs
- StringDictionaryCodeDomSerializer.cs
- EntityDataSourceColumn.cs
- linebase.cs
- TabPanel.cs
- FramingFormat.cs
- SmiRequestExecutor.cs
- DeploymentSection.cs
- Descriptor.cs
- PasswordDeriveBytes.cs
- BuildProviderUtils.cs
- TabControl.cs
- XPathPatternParser.cs
- ActiveDocumentEvent.cs
- RawStylusActions.cs
- TransportContext.cs
- TimeSpanOrInfiniteConverter.cs
- MimeFormatExtensions.cs
- EdmTypeAttribute.cs
- XmlSchemaSimpleTypeUnion.cs
- UpDownEvent.cs
- ValueSerializer.cs
- diagnosticsswitches.cs
- UnSafeCharBuffer.cs
- LinqDataSourceStatusEventArgs.cs
- ProjectionCamera.cs
- FileChangeNotifier.cs
- EntityDataSourceContextCreatedEventArgs.cs
- BuildManager.cs
- DependencyPropertyHelper.cs
- TableCellCollection.cs
- PrtCap_Base.cs
- Set.cs
- TimeoutConverter.cs
- HTMLTagNameToTypeMapper.cs
- uribuilder.cs
- TextWriter.cs
- ProfileGroupSettingsCollection.cs
- TemplatePropertyEntry.cs
- SingleAnimationUsingKeyFrames.cs
- input.cs
- AutomationPatternInfo.cs
- HeaderedContentControl.cs
- ListViewGroupConverter.cs
- LinqDataSource.cs
- SecurityContext.cs
- GenericQueueSurrogate.cs
- CapabilitiesUse.cs
- EdmItemCollection.OcAssemblyCache.cs
- CommandBindingCollection.cs
- ServiceReference.cs
- StylusPlugInCollection.cs
- HostingEnvironmentException.cs
- RegexReplacement.cs
- OleDbCommandBuilder.cs
- Rotation3D.cs
- HyperLinkStyle.cs
- TypeElement.cs
- GeneralTransform.cs
- TargetControlTypeAttribute.cs
- WebPartConnectionsDisconnectVerb.cs
- Utils.cs
- FreeFormDesigner.cs
- _FtpControlStream.cs