Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CommonUI / System / Drawing / Advanced / ColorMatrix.cs / 1305376 / ColorMatrix.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Drawing.Imaging { using System.Diagnostics; using System.Drawing; using System; using System.Runtime.InteropServices; // [StructLayout(LayoutKind.Sequential)] public sealed class ColorMatrix { float matrix00; float matrix01; float matrix02; float matrix03; float matrix04; float matrix10; float matrix11; float matrix12; float matrix13; float matrix14; float matrix20; float matrix21; float matrix22; float matrix23; float matrix24; float matrix30; float matrix31; float matrix32; float matrix33; float matrix34; float matrix40; float matrix41; float matrix42; float matrix43; float matrix44; ////// /// public ColorMatrix() { /* * Setup identity matrix by default */ matrix00 = 1.0f; //matrix01 = 0.0f; //matrix02 = 0.0f; //matrix03 = 0.0f; //matrix04 = 0.0f; //matrix10 = 0.0f; matrix11 = 1.0f; //matrix12 = 0.0f; //matrix13 = 0.0f; //matrix14 = 0.0f; //matrix20 = 0.0f; //matrix21 = 0.0f; matrix22 = 1.0f; // matrix23 = 0.0f; // matrix24 = 0.0f; // matrix30 = 0.0f; //matrix31 = 0.0f; // matrix32 = 0.0f; matrix33 = 1.0f; // matrix34 = 0.0f; // matrix40 = 0.0f; // matrix41 = 0.0f; // matrix42 = 0.0f; // matrix43 = 0.0f; matrix44 = 1.0f; } ////// Initializes a new instance of the ///class. /// /// /// public float Matrix00 { get { return matrix00; } set { matrix00 = value; } } ////// Represents the element at the /// 0th row and 0th column of this ///. /// /// /// public float Matrix01 { get { return matrix01; } set { matrix01 = value; } } ////// Represents the element at the 0th row and 1st column of this ///. /// /// /// public float Matrix02 { get { return matrix02; } set { matrix02 = value; } } ////// Represents the element at the 0th row and 2nd column of this ///. /// /// /// public float Matrix03 { get { return matrix03; } set { matrix03 = value; } } ////// Represents the element at the 0th row and 3rd column of this ///. /// /// /// public float Matrix04 { get { return matrix04; } set { matrix04 = value; } } ////// Represents the element at the 0th row and 4th column of this ///. /// /// /// public float Matrix10 { get { return matrix10; } set { matrix10 = value; } } ////// Represents the element at the 1st row and 0th column of this ///. /// /// /// Represents the element at the 1st row and /// 1st column of this public float Matrix11 { get { return matrix11; } set { matrix11 = value; } } ///. /// /// /// Represents the element at the 1st row /// and 2nd column of this public float Matrix12 { get { return matrix12; } set { matrix12 = value; } } ///. /// /// /// Represents the element at the 1st row /// and 3rd column of this public float Matrix13 { get { return matrix13; } set { matrix13 = value; } } ///. /// /// /// Represents the element at the 1st row /// and 4th column of this public float Matrix14 { get { return matrix14; } set { matrix14 = value; } } ///. /// /// /// public float Matrix20 { get { return matrix20; } set { matrix20 = value; } } ////// Represents the element at the 2nd row and /// 0th column of this ///. /// /// /// public float Matrix21 { get { return matrix21; } set { matrix21 = value; } } ////// Represents the element at the 2nd row and 1st column of this ///. /// /// /// public float Matrix22 { get { return matrix22; } set { matrix22 = value; } } ////// Represents the element at the 2nd row and 2nd column of this ///. /// /// /// public float Matrix23 { get { return matrix23; } set { matrix23 = value; } } ////// Represents the element at the 2nd row and 3rd column of this ///. /// /// /// public float Matrix24 { get { return matrix24; } set { matrix24 = value; } } ////// Represents the element at the 2nd row and 4th column of this ///. /// /// /// public float Matrix30 { get { return matrix30; } set { matrix30 = value; } } ////// Represents the element at the 3rd row and 0th column of this ///. /// /// /// public float Matrix31 { get { return matrix31; } set { matrix31 = value; } } ////// Represents the element at the 3rd row and 1st column of this ///. /// /// /// public float Matrix32 { get { return matrix32; } set { matrix32 = value; } } ////// Represents the element at the 3rd row and 2nd column of this ///. /// /// /// public float Matrix33 { get { return matrix33; } set { matrix33 = value; } } ////// Represents the element at the 3rd row and 3rd column of this ///. /// /// /// public float Matrix34 { get { return matrix34; } set { matrix34 = value; } } ////// Represents the element at the 3rd row and 4th column of this ///. /// /// /// public float Matrix40 { get { return matrix40; } set { matrix40 = value; } } ////// Represents the element at the 4th row and 0th column of this ///. /// /// /// public float Matrix41 { get { return matrix41; } set { matrix41 = value; } } ////// Represents the element at the 4th row and 1st column of this ///. /// /// /// public float Matrix42 { get { return matrix42; } set { matrix42 = value; } } ////// Represents the element at the 4th row and 2nd column of this ///. /// /// /// public float Matrix43 { get { return matrix43; } set { matrix43 = value; } } ////// Represents the element at the 4th row and 3rd column of this ///. /// /// /// public float Matrix44 { get { return matrix44; } set { matrix44 = value; } } ////// Represents the element at the 4th row and 4th column of this ///. /// /// /// [CLSCompliant(false)] public ColorMatrix(float[][] newColorMatrix) { SetMatrix(newColorMatrix); } internal void SetMatrix(float[][] newColorMatrix) { matrix00 = newColorMatrix[0][0]; matrix01 = newColorMatrix[0][1]; matrix02 = newColorMatrix[0][2]; matrix03 = newColorMatrix[0][3]; matrix04 = newColorMatrix[0][4]; matrix10 = newColorMatrix[1][0]; matrix11 = newColorMatrix[1][1]; matrix12 = newColorMatrix[1][2]; matrix13 = newColorMatrix[1][3]; matrix14 = newColorMatrix[1][4]; matrix20 = newColorMatrix[2][0]; matrix21 = newColorMatrix[2][1]; matrix22 = newColorMatrix[2][2]; matrix23 = newColorMatrix[2][3]; matrix24 = newColorMatrix[2][4]; matrix30 = newColorMatrix[3][0]; matrix31 = newColorMatrix[3][1]; matrix32 = newColorMatrix[3][2]; matrix33 = newColorMatrix[3][3]; matrix34 = newColorMatrix[3][4]; matrix40 = newColorMatrix[4][0]; matrix41 = newColorMatrix[4][1]; matrix42 = newColorMatrix[4][2]; matrix43 = newColorMatrix[4][3]; matrix44 = newColorMatrix[4][4]; } internal float[][] GetMatrix() { float[][] returnMatrix = new float[5][]; for (int i = 0; i < 5; i++) returnMatrix[i] = new float[5]; returnMatrix[0][0] = matrix00; returnMatrix[0][1] = matrix01; returnMatrix[0][2] = matrix02; returnMatrix[0][3] = matrix03; returnMatrix[0][4] = matrix04; returnMatrix[1][0] = matrix10; returnMatrix[1][1] = matrix11; returnMatrix[1][2] = matrix12; returnMatrix[1][3] = matrix13; returnMatrix[1][4] = matrix14; returnMatrix[2][0] = matrix20; returnMatrix[2][1] = matrix21; returnMatrix[2][2] = matrix22; returnMatrix[2][3] = matrix23; returnMatrix[2][4] = matrix24; returnMatrix[3][0] = matrix30; returnMatrix[3][1] = matrix31; returnMatrix[3][2] = matrix32; returnMatrix[3][3] = matrix33; returnMatrix[3][4] = matrix34; returnMatrix[4][0] = matrix40; returnMatrix[4][1] = matrix41; returnMatrix[4][2] = matrix42; returnMatrix[4][3] = matrix43; returnMatrix[4][4] = matrix44; return returnMatrix; } ////// Initializes a new instance of the ///class with the /// elements in the specified matrix. /// /// /// public float this[int row, int column] { get { return GetMatrix()[row][column]; } set { float[][] tempMatrix = GetMatrix(); tempMatrix[row][column] = value; SetMatrix(tempMatrix); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ ///// Gets or sets the value of the specified element of this ///. /// // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Drawing.Imaging { using System.Diagnostics; using System.Drawing; using System; using System.Runtime.InteropServices; // [StructLayout(LayoutKind.Sequential)] public sealed class ColorMatrix { float matrix00; float matrix01; float matrix02; float matrix03; float matrix04; float matrix10; float matrix11; float matrix12; float matrix13; float matrix14; float matrix20; float matrix21; float matrix22; float matrix23; float matrix24; float matrix30; float matrix31; float matrix32; float matrix33; float matrix34; float matrix40; float matrix41; float matrix42; float matrix43; float matrix44; ////// /// public ColorMatrix() { /* * Setup identity matrix by default */ matrix00 = 1.0f; //matrix01 = 0.0f; //matrix02 = 0.0f; //matrix03 = 0.0f; //matrix04 = 0.0f; //matrix10 = 0.0f; matrix11 = 1.0f; //matrix12 = 0.0f; //matrix13 = 0.0f; //matrix14 = 0.0f; //matrix20 = 0.0f; //matrix21 = 0.0f; matrix22 = 1.0f; // matrix23 = 0.0f; // matrix24 = 0.0f; // matrix30 = 0.0f; //matrix31 = 0.0f; // matrix32 = 0.0f; matrix33 = 1.0f; // matrix34 = 0.0f; // matrix40 = 0.0f; // matrix41 = 0.0f; // matrix42 = 0.0f; // matrix43 = 0.0f; matrix44 = 1.0f; } ////// Initializes a new instance of the ///class. /// /// /// public float Matrix00 { get { return matrix00; } set { matrix00 = value; } } ////// Represents the element at the /// 0th row and 0th column of this ///. /// /// /// public float Matrix01 { get { return matrix01; } set { matrix01 = value; } } ////// Represents the element at the 0th row and 1st column of this ///. /// /// /// public float Matrix02 { get { return matrix02; } set { matrix02 = value; } } ////// Represents the element at the 0th row and 2nd column of this ///. /// /// /// public float Matrix03 { get { return matrix03; } set { matrix03 = value; } } ////// Represents the element at the 0th row and 3rd column of this ///. /// /// /// public float Matrix04 { get { return matrix04; } set { matrix04 = value; } } ////// Represents the element at the 0th row and 4th column of this ///. /// /// /// public float Matrix10 { get { return matrix10; } set { matrix10 = value; } } ////// Represents the element at the 1st row and 0th column of this ///. /// /// /// Represents the element at the 1st row and /// 1st column of this public float Matrix11 { get { return matrix11; } set { matrix11 = value; } } ///. /// /// /// Represents the element at the 1st row /// and 2nd column of this public float Matrix12 { get { return matrix12; } set { matrix12 = value; } } ///. /// /// /// Represents the element at the 1st row /// and 3rd column of this public float Matrix13 { get { return matrix13; } set { matrix13 = value; } } ///. /// /// /// Represents the element at the 1st row /// and 4th column of this public float Matrix14 { get { return matrix14; } set { matrix14 = value; } } ///. /// /// /// public float Matrix20 { get { return matrix20; } set { matrix20 = value; } } ////// Represents the element at the 2nd row and /// 0th column of this ///. /// /// /// public float Matrix21 { get { return matrix21; } set { matrix21 = value; } } ////// Represents the element at the 2nd row and 1st column of this ///. /// /// /// public float Matrix22 { get { return matrix22; } set { matrix22 = value; } } ////// Represents the element at the 2nd row and 2nd column of this ///. /// /// /// public float Matrix23 { get { return matrix23; } set { matrix23 = value; } } ////// Represents the element at the 2nd row and 3rd column of this ///. /// /// /// public float Matrix24 { get { return matrix24; } set { matrix24 = value; } } ////// Represents the element at the 2nd row and 4th column of this ///. /// /// /// public float Matrix30 { get { return matrix30; } set { matrix30 = value; } } ////// Represents the element at the 3rd row and 0th column of this ///. /// /// /// public float Matrix31 { get { return matrix31; } set { matrix31 = value; } } ////// Represents the element at the 3rd row and 1st column of this ///. /// /// /// public float Matrix32 { get { return matrix32; } set { matrix32 = value; } } ////// Represents the element at the 3rd row and 2nd column of this ///. /// /// /// public float Matrix33 { get { return matrix33; } set { matrix33 = value; } } ////// Represents the element at the 3rd row and 3rd column of this ///. /// /// /// public float Matrix34 { get { return matrix34; } set { matrix34 = value; } } ////// Represents the element at the 3rd row and 4th column of this ///. /// /// /// public float Matrix40 { get { return matrix40; } set { matrix40 = value; } } ////// Represents the element at the 4th row and 0th column of this ///. /// /// /// public float Matrix41 { get { return matrix41; } set { matrix41 = value; } } ////// Represents the element at the 4th row and 1st column of this ///. /// /// /// public float Matrix42 { get { return matrix42; } set { matrix42 = value; } } ////// Represents the element at the 4th row and 2nd column of this ///. /// /// /// public float Matrix43 { get { return matrix43; } set { matrix43 = value; } } ////// Represents the element at the 4th row and 3rd column of this ///. /// /// /// public float Matrix44 { get { return matrix44; } set { matrix44 = value; } } ////// Represents the element at the 4th row and 4th column of this ///. /// /// /// [CLSCompliant(false)] public ColorMatrix(float[][] newColorMatrix) { SetMatrix(newColorMatrix); } internal void SetMatrix(float[][] newColorMatrix) { matrix00 = newColorMatrix[0][0]; matrix01 = newColorMatrix[0][1]; matrix02 = newColorMatrix[0][2]; matrix03 = newColorMatrix[0][3]; matrix04 = newColorMatrix[0][4]; matrix10 = newColorMatrix[1][0]; matrix11 = newColorMatrix[1][1]; matrix12 = newColorMatrix[1][2]; matrix13 = newColorMatrix[1][3]; matrix14 = newColorMatrix[1][4]; matrix20 = newColorMatrix[2][0]; matrix21 = newColorMatrix[2][1]; matrix22 = newColorMatrix[2][2]; matrix23 = newColorMatrix[2][3]; matrix24 = newColorMatrix[2][4]; matrix30 = newColorMatrix[3][0]; matrix31 = newColorMatrix[3][1]; matrix32 = newColorMatrix[3][2]; matrix33 = newColorMatrix[3][3]; matrix34 = newColorMatrix[3][4]; matrix40 = newColorMatrix[4][0]; matrix41 = newColorMatrix[4][1]; matrix42 = newColorMatrix[4][2]; matrix43 = newColorMatrix[4][3]; matrix44 = newColorMatrix[4][4]; } internal float[][] GetMatrix() { float[][] returnMatrix = new float[5][]; for (int i = 0; i < 5; i++) returnMatrix[i] = new float[5]; returnMatrix[0][0] = matrix00; returnMatrix[0][1] = matrix01; returnMatrix[0][2] = matrix02; returnMatrix[0][3] = matrix03; returnMatrix[0][4] = matrix04; returnMatrix[1][0] = matrix10; returnMatrix[1][1] = matrix11; returnMatrix[1][2] = matrix12; returnMatrix[1][3] = matrix13; returnMatrix[1][4] = matrix14; returnMatrix[2][0] = matrix20; returnMatrix[2][1] = matrix21; returnMatrix[2][2] = matrix22; returnMatrix[2][3] = matrix23; returnMatrix[2][4] = matrix24; returnMatrix[3][0] = matrix30; returnMatrix[3][1] = matrix31; returnMatrix[3][2] = matrix32; returnMatrix[3][3] = matrix33; returnMatrix[3][4] = matrix34; returnMatrix[4][0] = matrix40; returnMatrix[4][1] = matrix41; returnMatrix[4][2] = matrix42; returnMatrix[4][3] = matrix43; returnMatrix[4][4] = matrix44; return returnMatrix; } ////// Initializes a new instance of the ///class with the /// elements in the specified matrix. /// /// /// public float this[int row, int column] { get { return GetMatrix()[row][column]; } set { float[][] tempMatrix = GetMatrix(); tempMatrix[row][column] = value; SetMatrix(tempMatrix); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007./// Gets or sets the value of the specified element of this ///. ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DefaultHttpHandler.cs
- AutomationTextAttribute.cs
- WSDualHttpBindingCollectionElement.cs
- documentsequencetextcontainer.cs
- TextEditorContextMenu.cs
- HttpClientChannel.cs
- MSG.cs
- LocatorGroup.cs
- DecimalAnimationUsingKeyFrames.cs
- RankException.cs
- BindingsCollection.cs
- StorageMappingItemLoader.cs
- ToolboxControl.cs
- KeyFrames.cs
- RemoteHelper.cs
- NativeRecognizer.cs
- CredentialSelector.cs
- MethodAccessException.cs
- SqlCommandSet.cs
- TextContainerChangeEventArgs.cs
- RegisteredArrayDeclaration.cs
- DuplicateContext.cs
- ElementMarkupObject.cs
- OpCodes.cs
- CollaborationHelperFunctions.cs
- odbcmetadatacollectionnames.cs
- ListView.cs
- CodeSubDirectoriesCollection.cs
- SBCSCodePageEncoding.cs
- ActivityInstance.cs
- DropShadowBitmapEffect.cs
- SerializableReadOnlyDictionary.cs
- EntityDataSourceReferenceGroup.cs
- SafeProcessHandle.cs
- Trace.cs
- NotEqual.cs
- SimpleHandlerBuildProvider.cs
- SolidColorBrush.cs
- TransactionProtocol.cs
- XPathNodeInfoAtom.cs
- Schema.cs
- LocalizableResourceBuilder.cs
- MessageSecurityOverTcpElement.cs
- PageAdapter.cs
- TailPinnedEventArgs.cs
- CustomSignedXml.cs
- NumberSubstitution.cs
- SrgsRulesCollection.cs
- RelationshipConverter.cs
- FileStream.cs
- ProcessRequestArgs.cs
- PropertyDescriptorGridEntry.cs
- _Events.cs
- FileNameEditor.cs
- CustomWebEventKey.cs
- QilStrConcatenator.cs
- IfJoinedCondition.cs
- BlurEffect.cs
- Decorator.cs
- Constant.cs
- CompilerGlobalScopeAttribute.cs
- FrameworkElement.cs
- SerializationException.cs
- ColorTranslator.cs
- FloaterBaseParaClient.cs
- InstanceData.cs
- LogArchiveSnapshot.cs
- FormatVersion.cs
- WeakReadOnlyCollection.cs
- WebPartMenu.cs
- SystemFonts.cs
- PreservationFileWriter.cs
- BitmapEffect.cs
- SourceLineInfo.cs
- InputMethodStateChangeEventArgs.cs
- milrender.cs
- OutputCacheSettings.cs
- MetadataUtilsSmi.cs
- Style.cs
- AbstractSvcMapFileLoader.cs
- ListenDesigner.cs
- BrowserCapabilitiesCodeGenerator.cs
- WeakReferenceKey.cs
- ConfigXmlDocument.cs
- RemotingServices.cs
- MatrixIndependentAnimationStorage.cs
- SiteIdentityPermission.cs
- XpsInterleavingPolicy.cs
- BaseValidator.cs
- CompilationRelaxations.cs
- CodeTypeDeclaration.cs
- HtmlTernaryTree.cs
- HttpProfileGroupBase.cs
- XXXOnTypeBuilderInstantiation.cs
- ModelItemDictionary.cs
- WebConfigurationHost.cs
- SelectionHighlightInfo.cs
- PageAction.cs
- LocalizationComments.cs
- RelationshipEnd.cs