Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / CommonUI / System / Drawing / Advanced / ColorPalette.cs / 2 / 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
- MetadataArtifactLoaderComposite.cs
- DataGridBoolColumn.cs
- ContentElementAutomationPeer.cs
- RoleGroupCollection.cs
- WebConfigurationManager.cs
- RelationshipNavigation.cs
- SchemaImporterExtensionElementCollection.cs
- StringArrayConverter.cs
- PropertyDescriptorCollection.cs
- WebPartZone.cs
- TransformCollection.cs
- TableChangeProcessor.cs
- BaseParser.cs
- DataGridViewHitTestInfo.cs
- HTMLTextWriter.cs
- DataGridViewRowsAddedEventArgs.cs
- ArithmeticException.cs
- TemplateControl.cs
- MsmqHostedTransportManager.cs
- While.cs
- DeferredSelectedIndexReference.cs
- ContentOperations.cs
- CustomAttribute.cs
- cookiecollection.cs
- XmlDataSourceNodeDescriptor.cs
- _ListenerAsyncResult.cs
- StylusDevice.cs
- DrawingGroup.cs
- SiteMapNodeItem.cs
- StateDesigner.TransitionInfo.cs
- indexingfiltermarshaler.cs
- NotImplementedException.cs
- DataServiceRequestException.cs
- XPathException.cs
- ChannelServices.cs
- _FtpControlStream.cs
- XmlUTF8TextReader.cs
- ModuleBuilder.cs
- VectorAnimationBase.cs
- QilInvoke.cs
- DiscoveryViaBehavior.cs
- FloaterBaseParagraph.cs
- TypedRowGenerator.cs
- Attributes.cs
- RuntimeConfig.cs
- DSASignatureFormatter.cs
- SecurityRuntime.cs
- TaskExceptionHolder.cs
- BindingContext.cs
- ListDictionaryInternal.cs
- TreeNodeCollection.cs
- MdImport.cs
- AutomationElement.cs
- _BasicClient.cs
- CodeStatementCollection.cs
- XD.cs
- Padding.cs
- ApplicationId.cs
- KeyTime.cs
- HGlobalSafeHandle.cs
- TextServicesContext.cs
- ContextDataSourceView.cs
- SrgsElementFactoryCompiler.cs
- SecurityKeyEntropyMode.cs
- Point3DAnimation.cs
- HtmlToClrEventProxy.cs
- RemotingConfiguration.cs
- SqlUserDefinedAggregateAttribute.cs
- COM2Enum.cs
- PropertyIDSet.cs
- PostBackOptions.cs
- BitmapEffectRenderDataResource.cs
- UrlPath.cs
- Zone.cs
- basecomparevalidator.cs
- SecurityTokenAuthenticator.cs
- EmptyReadOnlyDictionaryInternal.cs
- HttpContext.cs
- IISUnsafeMethods.cs
- BufferedGraphicsManager.cs
- RoleManagerSection.cs
- EpmSourcePathSegment.cs
- LoadedOrUnloadedOperation.cs
- SessionEndingCancelEventArgs.cs
- ResourcePermissionBase.cs
- XamlReaderHelper.cs
- InvokeGenerator.cs
- ProcessThreadCollection.cs
- ResponseBodyWriter.cs
- SchemaNamespaceManager.cs
- HtmlInputSubmit.cs
- TreeView.cs
- TraceUtils.cs
- ScrollEvent.cs
- Helpers.cs
- ScriptingJsonSerializationSection.cs
- DeadCharTextComposition.cs
- SrgsRule.cs
- TdsParser.cs
- Win32Native.cs