Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / CommonUI / System / Drawing / Advanced / ColorPalette.cs / 1 / ColorPalette.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
/*************************************************************************\
*
* Copyright (c) 1998-1999, Microsoft Corp. All Rights Reserved.
*
* Module Name:
*
* ColorPalette.cs
*
* Abstract:
*
* Native GDI+ Color Palette structure.
*
* Revision History:
*
* 9/22/1999 [....]
* Created it.
*
\**************************************************************************/
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
- DataServices.cs
- AdornedElementPlaceholder.cs
- XmlLinkedNode.cs
- SystemIPInterfaceStatistics.cs
- ApplicationServiceHelper.cs
- BuilderElements.cs
- MultiBindingExpression.cs
- GrammarBuilder.cs
- keycontainerpermission.cs
- DataGridViewRowCancelEventArgs.cs
- ExpressionConverter.cs
- XmlDataDocument.cs
- DynamicDiscoSearcher.cs
- MenuEventArgs.cs
- HashCryptoHandle.cs
- MenuAutoFormat.cs
- PolicyException.cs
- Solver.cs
- HttpListenerTimeoutManager.cs
- shaperfactoryquerycacheentry.cs
- XmlEncodedRawTextWriter.cs
- Number.cs
- XmlBaseWriter.cs
- FullTrustAssemblyCollection.cs
- securestring.cs
- WsdlBuildProvider.cs
- SystemIPGlobalProperties.cs
- ReferenceEqualityComparer.cs
- WebException.cs
- EpmContentDeSerializerBase.cs
- IndexOutOfRangeException.cs
- RoutedEventConverter.cs
- LockedBorderGlyph.cs
- HyperLinkColumn.cs
- SignedPkcs7.cs
- ThreadStateException.cs
- PageCatalogPart.cs
- webproxy.cs
- RuleInfoComparer.cs
- MethodBuilder.cs
- RenderTargetBitmap.cs
- BuiltInExpr.cs
- TimeZoneInfo.cs
- SoapElementAttribute.cs
- BamlReader.cs
- EmptyElement.cs
- hresults.cs
- AspNetCacheProfileAttribute.cs
- WeakEventTable.cs
- CodeMemberProperty.cs
- UriWriter.cs
- HtmlShim.cs
- WindowsRichEditRange.cs
- RuntimeWrappedException.cs
- SamlAuthorizationDecisionStatement.cs
- WorkflowWebService.cs
- UnmanagedBitmapWrapper.cs
- altserialization.cs
- LogRestartAreaEnumerator.cs
- FocusChangedEventArgs.cs
- BooleanStorage.cs
- DataExpression.cs
- EmptyImpersonationContext.cs
- PingReply.cs
- Guid.cs
- OleDbDataAdapter.cs
- EmissiveMaterial.cs
- InkPresenter.cs
- MailAddress.cs
- RemotingConfigParser.cs
- StringUtil.cs
- MouseDevice.cs
- StackOverflowException.cs
- Activator.cs
- IconHelper.cs
- DeobfuscatingStream.cs
- HtmlInputPassword.cs
- DiagnosticTraceSource.cs
- PreDigestedSignedInfo.cs
- FixUp.cs
- PageThemeBuildProvider.cs
- iisPickupDirectory.cs
- ControlParameter.cs
- ListControlConvertEventArgs.cs
- DetailsViewInsertedEventArgs.cs
- BatchWriter.cs
- HelpEvent.cs
- MinMaxParagraphWidth.cs
- KnownBoxes.cs
- NonClientArea.cs
- RawStylusActions.cs
- PhysicalOps.cs
- ISCIIEncoding.cs
- BufferedReceiveManager.cs
- MatrixAnimationUsingPath.cs
- UnsafeCollabNativeMethods.cs
- RoutedEventValueSerializer.cs
- RSAProtectedConfigurationProvider.cs
- TreeNodeBindingDepthConverter.cs
- SafeBitVector32.cs