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
- XdrBuilder.cs
- newinstructionaction.cs
- CompilerHelpers.cs
- NavigatingCancelEventArgs.cs
- CryptoApi.cs
- ScrollableControl.cs
- ByteStreamGeometryContext.cs
- Parser.cs
- WebColorConverter.cs
- TdsRecordBufferSetter.cs
- TreeBuilderXamlTranslator.cs
- NetMsmqBindingElement.cs
- SecUtil.cs
- _SslState.cs
- StrokeRenderer.cs
- DomainUpDown.cs
- PrintDialogException.cs
- PropertyPath.cs
- NavigationPropertyAccessor.cs
- AspNetSynchronizationContext.cs
- mediaeventargs.cs
- ShowExpandedMultiValueConverter.cs
- DataGridViewCellStyleChangedEventArgs.cs
- DoubleLink.cs
- Context.cs
- DataGridViewCellConverter.cs
- LogLogRecordEnumerator.cs
- UiaCoreApi.cs
- SafeHandle.cs
- oledbmetadatacolumnnames.cs
- HybridDictionary.cs
- CompositeActivityDesigner.cs
- FlowDocumentScrollViewer.cs
- TextViewSelectionProcessor.cs
- ProfileInfo.cs
- Size.cs
- XmlSchemaElement.cs
- OleDbConnectionInternal.cs
- DBAsyncResult.cs
- WebServiceData.cs
- ZipArchive.cs
- EntityClassGenerator.cs
- SpotLight.cs
- HtmlMobileTextWriter.cs
- DescendantQuery.cs
- NavigationService.cs
- Hash.cs
- SiteMapNode.cs
- FieldInfo.cs
- SqlProviderManifest.cs
- Random.cs
- EnumerableWrapperWeakToStrong.cs
- ProgressChangedEventArgs.cs
- GridViewSelectEventArgs.cs
- ChameleonKey.cs
- MethodCallTranslator.cs
- Compiler.cs
- RectKeyFrameCollection.cs
- ControlPaint.cs
- ComNativeDescriptor.cs
- DbDeleteCommandTree.cs
- ResourcePermissionBaseEntry.cs
- ReceiveMessageContent.cs
- GeometryModel3D.cs
- ButtonField.cs
- ObjectConverter.cs
- SizeAnimationUsingKeyFrames.cs
- DirectionalLight.cs
- ViewGenerator.cs
- CodeCommentStatementCollection.cs
- Socket.cs
- SocketAddress.cs
- MembershipUser.cs
- ValidatorUtils.cs
- InternalBufferOverflowException.cs
- MsmqIntegrationBinding.cs
- DataGridViewHeaderCell.cs
- DayRenderEvent.cs
- DecoderExceptionFallback.cs
- SymbolType.cs
- DrawingImage.cs
- DataTable.cs
- FileDataSourceCache.cs
- ComplexObject.cs
- ExecutionContext.cs
- WCFBuildProvider.cs
- ValuePattern.cs
- OdbcParameterCollection.cs
- WebPartTransformer.cs
- SafeRegistryHandle.cs
- ModelVisual3D.cs
- ComponentDesigner.cs
- TraceHandler.cs
- TextPattern.cs
- Column.cs
- DocumentViewer.cs
- GridViewColumn.cs
- CategoriesDocument.cs
- FileNameEditor.cs
- DeferredTextReference.cs