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;
///
///
///
/// 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
// 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
- CapabilitiesSection.cs
- LockedAssemblyCache.cs
- TaskResultSetter.cs
- NamedPipeTransportElement.cs
- CapabilitiesPattern.cs
- XmlCompatibilityReader.cs
- InitializingNewItemEventArgs.cs
- Error.cs
- StylusOverProperty.cs
- XmlNamedNodeMap.cs
- EntityCommandExecutionException.cs
- CalendarDataBindingHandler.cs
- SoapIncludeAttribute.cs
- DecimalConverter.cs
- DeclarativeConditionsCollection.cs
- ProvidePropertyAttribute.cs
- RuleSetDialog.Designer.cs
- BigInt.cs
- DataGridAutoFormatDialog.cs
- Code.cs
- Vector.cs
- __Filters.cs
- TextRunCache.cs
- MimeMultiPart.cs
- XsdValidatingReader.cs
- Underline.cs
- ParserOptions.cs
- PageHandlerFactory.cs
- OdbcCommandBuilder.cs
- CollectionExtensions.cs
- DbParameterHelper.cs
- OleDbDataAdapter.cs
- AttachedPropertyBrowsableAttribute.cs
- XmlWellformedWriter.cs
- ListViewInsertionMark.cs
- ClientTargetSection.cs
- ReachIDocumentPaginatorSerializer.cs
- FragmentQueryKB.cs
- SurrogateSelector.cs
- HelloMessageApril2005.cs
- sqlpipe.cs
- GeneralTransform3D.cs
- CfgParser.cs
- SigningCredentials.cs
- ListSourceHelper.cs
- log.cs
- ShapingWorkspace.cs
- DrawListViewSubItemEventArgs.cs
- Border.cs
- TrustManagerPromptUI.cs
- HandlerBase.cs
- ObjectSecurity.cs
- ScrollContentPresenter.cs
- TrailingSpaceComparer.cs
- LicFileLicenseProvider.cs
- LinkTarget.cs
- CopyAction.cs
- ObjectReaderCompiler.cs
- TableFieldsEditor.cs
- CodeAccessPermission.cs
- OracleRowUpdatedEventArgs.cs
- ExtensionWindowResizeGrip.cs
- Tile.cs
- MimeTypeAttribute.cs
- TimelineGroup.cs
- XmlMapping.cs
- RoleService.cs
- DocumentViewerBase.cs
- SqlConnectionString.cs
- CryptoConfig.cs
- CounterSetInstance.cs
- DbProviderFactory.cs
- CategoryAttribute.cs
- Region.cs
- StringUtil.cs
- ipaddressinformationcollection.cs
- EventArgs.cs
- AttributeAction.cs
- NetworkCredential.cs
- SequenceNumber.cs
- FontCollection.cs
- GeometryGroup.cs
- ButtonDesigner.cs
- FormClosingEvent.cs
- ArithmeticException.cs
- RenderDataDrawingContext.cs
- ViewUtilities.cs
- SqlTriggerContext.cs
- QilTargetType.cs
- Hex.cs
- SizeFConverter.cs
- XmlSchemaSimpleTypeList.cs
- TabControlCancelEvent.cs
- RoutedEvent.cs
- ComponentCollection.cs
- StateDesigner.Helpers.cs
- OutputWindow.cs
- MetadataArtifactLoaderResource.cs
- AdCreatedEventArgs.cs
- CodeArrayIndexerExpression.cs