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
- SqlBulkCopy.cs
- AbstractSvcMapFileLoader.cs
- PhotoPrintingIntent.cs
- ReachDocumentReferenceCollectionSerializerAsync.cs
- TrustManagerPromptUI.cs
- SerializationInfo.cs
- ControlTemplate.cs
- MediaElementAutomationPeer.cs
- Animatable.cs
- ColumnMapCopier.cs
- FontWeightConverter.cs
- DataGridViewLinkColumn.cs
- DbDeleteCommandTree.cs
- ToolBar.cs
- WebExceptionStatus.cs
- Camera.cs
- PartBasedPackageProperties.cs
- SiteMapHierarchicalDataSourceView.cs
- UpDownEvent.cs
- SamlConstants.cs
- CfgArc.cs
- JsonGlobals.cs
- FigureParaClient.cs
- WebPartAddingEventArgs.cs
- ItemTypeToolStripMenuItem.cs
- DataTableMappingCollection.cs
- SqlConnectionHelper.cs
- InvalidFilterCriteriaException.cs
- MouseBinding.cs
- ChildrenQuery.cs
- XPathException.cs
- DataObject.cs
- ResourceCategoryAttribute.cs
- ListViewSortEventArgs.cs
- InternalCache.cs
- XPathItem.cs
- GcHandle.cs
- XsltOutput.cs
- MenuItem.cs
- TreeViewHitTestInfo.cs
- ReaderContextStackData.cs
- AnimationTimeline.cs
- Models.cs
- XmlParserContext.cs
- TypeListConverter.cs
- DataGridViewCheckBoxCell.cs
- JsonGlobals.cs
- ClosableStream.cs
- ResourcesChangeInfo.cs
- RouteItem.cs
- CacheEntry.cs
- SystemColors.cs
- AssemblyAssociatedContentFileAttribute.cs
- CounterSample.cs
- DynamicMetaObject.cs
- TextBoxAutomationPeer.cs
- WebPartEditorApplyVerb.cs
- WrappedReader.cs
- OdbcConnection.cs
- SchemaCollectionCompiler.cs
- RangeValidator.cs
- XmlSchemaObject.cs
- FullTextLine.cs
- basevalidator.cs
- Types.cs
- BCryptNative.cs
- SystemIcons.cs
- TypedTableBaseExtensions.cs
- OutArgumentConverter.cs
- CompressedStack.cs
- ListMarkerSourceInfo.cs
- TextFindEngine.cs
- Message.cs
- AdRotator.cs
- ObjectResult.cs
- CaseStatement.cs
- HwndHost.cs
- ReadOnlyActivityGlyph.cs
- CellConstantDomain.cs
- HitTestParameters3D.cs
- BaseCollection.cs
- BaseDataList.cs
- NotFiniteNumberException.cs
- XhtmlBasicTextBoxAdapter.cs
- UInt16Storage.cs
- DetailsViewPagerRow.cs
- CustomAttribute.cs
- ValueTypePropertyReference.cs
- QuestionEventArgs.cs
- PointAnimationUsingKeyFrames.cs
- UpDownEvent.cs
- GridProviderWrapper.cs
- InputLanguageManager.cs
- SecurityChannelFactory.cs
- TextParentUndoUnit.cs
- Model3D.cs
- LoginView.cs
- SyndicationItemFormatter.cs
- PageCatalogPart.cs
- SystemParameters.cs