mirror of https://github.com/SixLabors/ImageSharp
495 changed files with 17994 additions and 10857 deletions
@ -1,249 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8" standalone="yes"?> |
|||
<!--Rebracer Solution Settings File--> |
|||
<!--This file contains Visual Studio settings for ImageProcessorCore.sln.--> |
|||
<!--Rebracer uses this file to apply settings for this solution--> |
|||
<!--when the solution is opened.--> |
|||
<!--Install Rebracer from http://visualstudiogallery.msdn.microsoft.com/410e9b9f-65f3-4495-b68e-15567e543c58 --> |
|||
<!--See https://github.com/SLaks/Rebracer for more information--> |
|||
<UserSettings> |
|||
<ToolsOptions> |
|||
<ToolsOptionsCategory name="Environment"> |
|||
<ToolsOptionsSubCategory name="TaskList"> |
|||
<PropertyValue name="CommentTokens" ArrayType="VT_VARIANT" ArrayElementCount="4"> |
|||
<PropertyValue name="0">HACK:2</PropertyValue> |
|||
<PropertyValue name="1">TODO:2</PropertyValue> |
|||
<PropertyValue name="2">UNDONE:2</PropertyValue> |
|||
<PropertyValue name="3">UnresolvedMergeConflict:3</PropertyValue> |
|||
</PropertyValue> |
|||
<PropertyValue name="ConfirmTaskDeletion">false</PropertyValue> |
|||
<PropertyValue name="DontShowFilePaths">false</PropertyValue> |
|||
<PropertyValue name="WarnOnAddingHiddenItem">false</PropertyValue> |
|||
</ToolsOptionsSubCategory> |
|||
</ToolsOptionsCategory> |
|||
<ToolsOptionsCategory name="TextEditor"> |
|||
<ToolsOptionsSubCategory name="CSharp-Specific"> |
|||
<PropertyValue name="AddImport_SuggestForTypesInNuGetPackages">0</PropertyValue> |
|||
<PropertyValue name="AddImport_SuggestForTypesInReferenceAssemblies">0</PropertyValue> |
|||
<PropertyValue name="AutoComment">1</PropertyValue> |
|||
<PropertyValue name="AutoInsertAsteriskForNewLinesOfBlockComments">1</PropertyValue> |
|||
<PropertyValue name="CSharpClosedFileDiagnostics">-1</PropertyValue> |
|||
<PropertyValue name="ClosedFileDiagnostics">-1</PropertyValue> |
|||
<PropertyValue name="DisplayLineSeparators">0</PropertyValue> |
|||
<PropertyValue name="EnableHighlightRelatedKeywords">1</PropertyValue> |
|||
<PropertyValue name="ExtractMethod_AllowMovingDeclaration">0</PropertyValue> |
|||
<PropertyValue name="ExtractMethod_DoNotPutOutOrRefOnStruct">1</PropertyValue> |
|||
<PropertyValue name="Formatting_TriggerOnBlockCompletion">1</PropertyValue> |
|||
<PropertyValue name="Formatting_TriggerOnPaste">1</PropertyValue> |
|||
<PropertyValue name="Formatting_TriggerOnStatementCompletion">1</PropertyValue> |
|||
<PropertyValue name="Indent_BlockContents">1</PropertyValue> |
|||
<PropertyValue name="Indent_Braces">0</PropertyValue> |
|||
<PropertyValue name="Indent_CaseContents">1</PropertyValue> |
|||
<PropertyValue name="Indent_CaseLabels">1</PropertyValue> |
|||
<PropertyValue name="Indent_FlushLabelsLeft">0</PropertyValue> |
|||
<PropertyValue name="Indent_UnindentLabels">2</PropertyValue> |
|||
<PropertyValue name="NewLines_AnonymousTypeInitializer_EachMember">1</PropertyValue> |
|||
<PropertyValue name="NewLines_Braces_Accessor">1</PropertyValue> |
|||
<PropertyValue name="NewLines_Braces_AnonymousMethod">1</PropertyValue> |
|||
<PropertyValue name="NewLines_Braces_AnonymousTypeInitializer">1</PropertyValue> |
|||
<PropertyValue name="NewLines_Braces_ControlFlow">1</PropertyValue> |
|||
<PropertyValue name="NewLines_Braces_LambdaExpressionBody">1</PropertyValue> |
|||
<PropertyValue name="NewLines_Braces_Method">1</PropertyValue> |
|||
<PropertyValue name="NewLines_Braces_ObjectInitializer">1</PropertyValue> |
|||
<PropertyValue name="NewLines_Braces_Property">1</PropertyValue> |
|||
<PropertyValue name="NewLines_Braces_Type">1</PropertyValue> |
|||
<PropertyValue name="NewLines_Keywords_Catch">1</PropertyValue> |
|||
<PropertyValue name="NewLines_Keywords_Else">1</PropertyValue> |
|||
<PropertyValue name="NewLines_Keywords_Finally">1</PropertyValue> |
|||
<PropertyValue name="NewLines_ObjectInitializer_EachMember">1</PropertyValue> |
|||
<PropertyValue name="NewLines_QueryExpression_EachClause">1</PropertyValue> |
|||
<PropertyValue name="RenameTrackingPreview">1</PropertyValue> |
|||
<PropertyValue name="SortUsings_PlaceSystemFirst">0</PropertyValue> |
|||
<PropertyValue name="Space_AfterBasesColon">1</PropertyValue> |
|||
<PropertyValue name="Space_AfterCast">0</PropertyValue> |
|||
<PropertyValue name="Space_AfterComma">1</PropertyValue> |
|||
<PropertyValue name="Space_AfterDot">0</PropertyValue> |
|||
<PropertyValue name="Space_AfterMethodCallName">0</PropertyValue> |
|||
<PropertyValue name="Space_AfterMethodDeclarationName">0</PropertyValue> |
|||
<PropertyValue name="Space_AfterSemicolonsInForStatement">1</PropertyValue> |
|||
<PropertyValue name="Space_AroundBinaryOperator">1</PropertyValue> |
|||
<PropertyValue name="Space_BeforeBasesColon">1</PropertyValue> |
|||
<PropertyValue name="Space_BeforeComma">0</PropertyValue> |
|||
<PropertyValue name="Space_BeforeDot">0</PropertyValue> |
|||
<PropertyValue name="Space_BeforeOpenSquare">0</PropertyValue> |
|||
<PropertyValue name="Space_BeforeSemicolonsInForStatement">0</PropertyValue> |
|||
<PropertyValue name="Space_BetweenEmptyMethodCallParentheses">0</PropertyValue> |
|||
<PropertyValue name="Space_BetweenEmptyMethodDeclarationParentheses">0</PropertyValue> |
|||
<PropertyValue name="Space_BetweenEmptySquares">0</PropertyValue> |
|||
<PropertyValue name="Space_InControlFlowConstruct">1</PropertyValue> |
|||
<PropertyValue name="Space_WithinCastParentheses">0</PropertyValue> |
|||
<PropertyValue name="Space_WithinExpressionParentheses">0</PropertyValue> |
|||
<PropertyValue name="Space_WithinMethodCallParentheses">0</PropertyValue> |
|||
<PropertyValue name="Space_WithinMethodDeclarationParentheses">0</PropertyValue> |
|||
<PropertyValue name="Space_WithinOtherParentheses">0</PropertyValue> |
|||
<PropertyValue name="Space_WithinSquares">0</PropertyValue> |
|||
<PropertyValue name="Style_PreferIntrinsicPredefinedTypeKeywordInDeclaration">1</PropertyValue> |
|||
<PropertyValue name="Style_PreferIntrinsicPredefinedTypeKeywordInMemberAccess">1</PropertyValue> |
|||
<PropertyValue name="Style_QualifyMemberAccessWithThisOrMe">0</PropertyValue> |
|||
<PropertyValue name="Style_UseVarWhenDeclaringLocals">1</PropertyValue> |
|||
<PropertyValue name="WarnOnBuildErrors">0</PropertyValue> |
|||
<PropertyValue name="Wrapping_IgnoreSpacesAroundBinaryOperators">0</PropertyValue> |
|||
<PropertyValue name="Wrapping_IgnoreSpacesAroundVariableDeclaration">0</PropertyValue> |
|||
<PropertyValue name="Wrapping_KeepStatementsOnSingleLine">1</PropertyValue> |
|||
<PropertyValue name="Wrapping_PreserveSingleLine">1</PropertyValue> |
|||
</ToolsOptionsSubCategory> |
|||
<ToolsOptionsSubCategory name="JavaScript Specific"> |
|||
<PropertyValue name="DownloadRemoteReferences">false</PropertyValue> |
|||
<PropertyValue name="FormatCompletedBlockOnRightCurlyBrace">true</PropertyValue> |
|||
<PropertyValue name="FormatCompletedLineOnEnter">true</PropertyValue> |
|||
<PropertyValue name="FormatCompletedStatementOnSemicolon">true</PropertyValue> |
|||
<PropertyValue name="FormatOnPaste">true</PropertyValue> |
|||
<PropertyValue name="ImplicitReferencesString">Implicit (Windows)|$(VSInstallDir)\JavaScript\References\libhelp.js|$(VSInstallDir)\JavaScript\References\domWindows.js|$(VSInstallDir)\JavaScript\References\underscorefilter.js|$(VSInstallDir)\JavaScript\References\showPlainComments.js;Implicit (Windows 8.1)|$(VSInstallDir)\JavaScript\References\libhelp.js|$(VSInstallDir)\JavaScript\References\sitetypesWindows.js|$(VSInstallDir)\JavaScript\References\domWindows_8.1.js|$(VSInstallDir)\JavaScript\References\underscorefilter.js|$(VSInstallDir)\JavaScript\References\showPlainComments.js;Implicit (Windows Phone 8.1)|$(VSInstallDir)\JavaScript\References\libhelp.js|$(VSInstallDir)\JavaScript\References\sitetypesWindows.js|$(VSInstallDir)\JavaScript\References\domWindowsPhone_8.1.js|$(VSInstallDir)\JavaScript\References\underscorefilter.js|$(VSInstallDir)\JavaScript\References\showPlainComments.js;Implicit (Web)|$(VSInstallDir)\JavaScript\References\libhelp.js|$(VSInstallDir)\JavaScript\References\sitetypesWeb.js|$(VSInstallDir)\JavaScript\References\domWeb.js|$(VSInstallDir)\JavaScript\References\underscorefilter.js|$(VSInstallDir)\JavaScript\References\showPlainComments.js|C:\Users\james.south\AppData\Local\Web Essentials 2015\Modern.Intellisense.js;Dedicated Worker|$(VSInstallDir)\JavaScript\References\libhelp.js|$(VSInstallDir)\JavaScript\References\dedicatedworker.js|$(VSInstallDir)\JavaScript\References\underscorefilter.js|$(VSInstallDir)\JavaScript\References\showPlainComments.js;Generic|$(VSInstallDir)\JavaScript\References\libhelp.js|$(VSInstallDir)\JavaScript\References\underscorefilter.js|$(VSInstallDir)\JavaScript\References\showPlainComments.js;</PropertyValue> |
|||
<PropertyValue name="InsertSpaceAfterCommaDelimiter">true</PropertyValue> |
|||
<PropertyValue name="InsertSpaceAfterFunctionKeywordForAnonymousFunctions">true</PropertyValue> |
|||
<PropertyValue name="InsertSpaceAfterKeywordsInControlFlowStatements">true</PropertyValue> |
|||
<PropertyValue name="InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis">false</PropertyValue> |
|||
<PropertyValue name="InsertSpaceAfterSemicolonInForStatements">true</PropertyValue> |
|||
<PropertyValue name="InsertSpaceBeforeAndAfterBinaryOperators">true</PropertyValue> |
|||
<PropertyValue name="PlaceOpenBraceOnNewLineForControlBlocks">false</PropertyValue> |
|||
<PropertyValue name="PlaceOpenBraceOnNewLineForFunctionsAndClasses">false</PropertyValue> |
|||
<PropertyValue name="ShowErrorsAsWarnings">true</PropertyValue> |
|||
<PropertyValue name="ShowSyntaxErrors">true</PropertyValue> |
|||
</ToolsOptionsSubCategory> |
|||
<ToolsOptionsSubCategory name="C/C++ Specific"> |
|||
<PropertyValue name="AddSemicolonForClassTypes">true</PropertyValue> |
|||
<PropertyValue name="AlignParameters">false</PropertyValue> |
|||
<PropertyValue name="AlwaysUseFallbackLocation">false</PropertyValue> |
|||
<PropertyValue name="AutoFormatOnBraceCompletion">true</PropertyValue> |
|||
<PropertyValue name="AutoFormatOnClosingBrace">true</PropertyValue> |
|||
<PropertyValue name="AutoFormatOnPaste">true</PropertyValue> |
|||
<PropertyValue name="AutoFormatOnPaste2">1</PropertyValue> |
|||
<PropertyValue name="AutoFormatOnSemicolon">true</PropertyValue> |
|||
<PropertyValue name="AutoIndentOnTab">false</PropertyValue> |
|||
<PropertyValue name="ColorizeInactiveBlocksDifferently">true</PropertyValue> |
|||
<PropertyValue name="DisableBrowsingUpToDateCheck">true</PropertyValue> |
|||
<PropertyValue name="DisableCreateDeclDefnScan">false</PropertyValue> |
|||
<PropertyValue name="DisableErrorReporting">false</PropertyValue> |
|||
<PropertyValue name="DisableIntelliSenseErrorsInErrorList">false</PropertyValue> |
|||
<PropertyValue name="EnableChangeSignature">false</PropertyValue> |
|||
<PropertyValue name="EnableExpandPrecedence">false</PropertyValue> |
|||
<PropertyValue name="EnableExpandScopes">false</PropertyValue> |
|||
<PropertyValue name="EnableExtractFunction">false</PropertyValue> |
|||
<PropertyValue name="EnableSQLiteStoreEngine">true</PropertyValue> |
|||
<PropertyValue name="EnableSingleFileISense">true</PropertyValue> |
|||
<PropertyValue name="EnableSingleFileISenseSquiggles">false</PropertyValue> |
|||
<PropertyValue name="EnumerateCommentTasks">true</PropertyValue> |
|||
<PropertyValue name="GroupBrackets">true</PropertyValue> |
|||
<PropertyValue name="HideExperimentalAd">true</PropertyValue> |
|||
<PropertyValue name="HighlightMatchingTokens">true</PropertyValue> |
|||
<PropertyValue name="IndentAccessSpecifiers">false</PropertyValue> |
|||
<PropertyValue name="IndentBlockContents">true</PropertyValue> |
|||
<PropertyValue name="IndentBraces">false</PropertyValue> |
|||
<PropertyValue name="IndentCaseBraces">false</PropertyValue> |
|||
<PropertyValue name="IndentCaseContents">true</PropertyValue> |
|||
<PropertyValue name="IndentCaseLabels">false</PropertyValue> |
|||
<PropertyValue name="IndentGotoLabels">1</PropertyValue> |
|||
<PropertyValue name="IndentNamespaceContents">true</PropertyValue> |
|||
<PropertyValue name="IndentPreprocessor">2</PropertyValue> |
|||
<PropertyValue name="IndentationReference">2</PropertyValue> |
|||
<PropertyValue name="MemberListDotToArrow">false</PropertyValue> |
|||
<PropertyValue name="MemberListFilterHeuristic">false</PropertyValue> |
|||
<PropertyValue name="NewlineControlBlockBrace">0</PropertyValue> |
|||
<PropertyValue name="NewlineEmptyFunctionCloseBrace">true</PropertyValue> |
|||
<PropertyValue name="NewlineEmptyTypeCloseBrace">true</PropertyValue> |
|||
<PropertyValue name="NewlineFunctionBrace">0</PropertyValue> |
|||
<PropertyValue name="NewlineInitListBrace">0</PropertyValue> |
|||
<PropertyValue name="NewlineKeywordCatch">true</PropertyValue> |
|||
<PropertyValue name="NewlineKeywordElse">true</PropertyValue> |
|||
<PropertyValue name="NewlineKeywordWhile">false</PropertyValue> |
|||
<PropertyValue name="NewlineLambdaBrace">0</PropertyValue> |
|||
<PropertyValue name="NewlineNamespaceBrace">0</PropertyValue> |
|||
<PropertyValue name="NewlineScopeBrace">false</PropertyValue> |
|||
<PropertyValue name="NewlineTypeBrace">0</PropertyValue> |
|||
<PropertyValue name="PreserveBlock">1</PropertyValue> |
|||
<PropertyValue name="PreserveCommentIndentation">false</PropertyValue> |
|||
<PropertyValue name="PreserveInitListSpace">true</PropertyValue> |
|||
<PropertyValue name="PreserveParameterIndentation">false</PropertyValue> |
|||
<PropertyValue name="RefactorScope">2</PropertyValue> |
|||
<PropertyValue name="RemoveSpaceBeforeSemicolon">true</PropertyValue> |
|||
<PropertyValue name="RenameRenameComments">false</PropertyValue> |
|||
<PropertyValue name="RenameRenameInactive">false</PropertyValue> |
|||
<PropertyValue name="RenameRenameStrings">false</PropertyValue> |
|||
<PropertyValue name="RenameRenameUnconfirmed">false</PropertyValue> |
|||
<PropertyValue name="RenameSearchComments">true</PropertyValue> |
|||
<PropertyValue name="RenameSearchStrings">true</PropertyValue> |
|||
<PropertyValue name="RenameShowPreview">false</PropertyValue> |
|||
<PropertyValue name="RenameSkipPreviewIfConfirmed">false</PropertyValue> |
|||
<PropertyValue name="ShowSingleFileISenseErrorsInTaskList">false</PropertyValue> |
|||
<PropertyValue name="SpaceAfterCastParenthesis">false</PropertyValue> |
|||
<PropertyValue name="SpaceAfterComma">true</PropertyValue> |
|||
<PropertyValue name="SpaceAfterSemicolon">true</PropertyValue> |
|||
<PropertyValue name="SpaceAroundAssignmentOperator">2</PropertyValue> |
|||
<PropertyValue name="SpaceAroundBinaryOperator">2</PropertyValue> |
|||
<PropertyValue name="SpaceAroundConditionalOperator">2</PropertyValue> |
|||
<PropertyValue name="SpaceBeforeBlockBrace">true</PropertyValue> |
|||
<PropertyValue name="SpaceBeforeBracket">false</PropertyValue> |
|||
<PropertyValue name="SpaceBeforeComma">false</PropertyValue> |
|||
<PropertyValue name="SpaceBeforeConstructorColon">true</PropertyValue> |
|||
<PropertyValue name="SpaceBeforeControlBlockParenthesis">true</PropertyValue> |
|||
<PropertyValue name="SpaceBeforeEmptyBracket">false</PropertyValue> |
|||
<PropertyValue name="SpaceBeforeFunctionParenthesis">false</PropertyValue> |
|||
<PropertyValue name="SpaceBeforeFunctionParenthesis2">1</PropertyValue> |
|||
<PropertyValue name="SpaceBeforeInheritanceColon">true</PropertyValue> |
|||
<PropertyValue name="SpaceBeforeInitListBrace">false</PropertyValue> |
|||
<PropertyValue name="SpaceBeforeLambdaParenthesis">false</PropertyValue> |
|||
<PropertyValue name="SpaceBetweenEmptyBraces">false</PropertyValue> |
|||
<PropertyValue name="SpaceBetweenEmptyBrackets">false</PropertyValue> |
|||
<PropertyValue name="SpaceBetweenEmptyFunctionParentheses">false</PropertyValue> |
|||
<PropertyValue name="SpaceBetweenEmptyLambdaBrackets">false</PropertyValue> |
|||
<PropertyValue name="SpaceWithinBrackets">false</PropertyValue> |
|||
<PropertyValue name="SpaceWithinCastParentheses">false</PropertyValue> |
|||
<PropertyValue name="SpaceWithinControlBlockParentheses">false</PropertyValue> |
|||
<PropertyValue name="SpaceWithinExpressionParentheses">false</PropertyValue> |
|||
<PropertyValue name="SpaceWithinFunctionParentheses">false</PropertyValue> |
|||
<PropertyValue name="SpaceWithinInitListBraces">true</PropertyValue> |
|||
<PropertyValue name="SpaceWithinLambdaBrackets">false</PropertyValue> |
|||
<PropertyValue name="SuspendNewSingleFileISenseDuringDebugging">false</PropertyValue> |
|||
<PropertyValue name="TrimSpaceAroundScope">true</PropertyValue> |
|||
<PropertyValue name="TrimSpaceUnaryOperator">true</PropertyValue> |
|||
</ToolsOptionsSubCategory> |
|||
<ToolsOptionsSubCategory name="TypeScript Specific"> |
|||
<PropertyValue name="AutomaticallyCompileTypeScriptFilesWhenSavedWhenNoSolution">false</PropertyValue> |
|||
<PropertyValue name="ES3ForFilesThatAreNotPartOfAProject">false</PropertyValue> |
|||
<PropertyValue name="ES5ForFilesThatAreNotPartOfAProject">true</PropertyValue> |
|||
<PropertyValue name="ES6ForFilesThatAreNotPartOfAProject">false</PropertyValue> |
|||
<PropertyValue name="FormatCompletedBlockOnRightCurlyBrace">true</PropertyValue> |
|||
<PropertyValue name="FormatCompletedLineOnEnter">true</PropertyValue> |
|||
<PropertyValue name="FormatCompletedStatementOnSemicolon">true</PropertyValue> |
|||
<PropertyValue name="FormatOnPaste">true</PropertyValue> |
|||
<PropertyValue name="InsertSpaceAfterCommaDelimiter">true</PropertyValue> |
|||
<PropertyValue name="InsertSpaceAfterFunctionKeywordForAnonymousFunctions">true</PropertyValue> |
|||
<PropertyValue name="InsertSpaceAfterKeywordsInControlFlowStatements">true</PropertyValue> |
|||
<PropertyValue name="InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis">false</PropertyValue> |
|||
<PropertyValue name="InsertSpaceAfterSemicolonInForStatements">true</PropertyValue> |
|||
<PropertyValue name="InsertSpaceBeforeAndAfterBinaryOperators">true</PropertyValue> |
|||
<PropertyValue name="PlaceOpenBraceOnNewLineForControlBlocks">false</PropertyValue> |
|||
<PropertyValue name="PlaceOpenBraceOnNewLineForFunctions">false</PropertyValue> |
|||
<PropertyValue name="ShowGruntGulpDialogForAspNet">true</PropertyValue> |
|||
<PropertyValue name="ShowVirtualProjectsInSolutionExplorerWhenNoSolution">true</PropertyValue> |
|||
<PropertyValue name="ShowVirtualProjectsInSolutionExplorerWhenSolutionOpen">false</PropertyValue> |
|||
<PropertyValue name="UseAMDCodeGenerationForModulesThatAreNotPartOfAProject">false</PropertyValue> |
|||
<PropertyValue name="UseCommonJSCodeGenerationForModulesThatAreNotPartOfAProject">false</PropertyValue> |
|||
<PropertyValue name="UseES2015CodeGenerationForModulesThatAreNotPartOfAProject">false</PropertyValue> |
|||
<PropertyValue name="UseJsxPreserveForFilesThatAreNotPartOfAProject">false</PropertyValue> |
|||
<PropertyValue name="UseJsxReactForFilesThatAreNotPartOfAProject">false</PropertyValue> |
|||
<PropertyValue name="UseSystemCodeGenerationForModulesThatAreNotPartOfAProject">false</PropertyValue> |
|||
<PropertyValue name="UseUMDCodeGenerationForModulesThatAreNotPartOfAProject">false</PropertyValue> |
|||
</ToolsOptionsSubCategory> |
|||
<ToolsOptionsSubCategory name="HTMLX Specific"> |
|||
<PropertyValue name="EnableTagNavigator">false</PropertyValue> |
|||
<PropertyValue name="EnableValidation">true</PropertyValue> |
|||
<PropertyValue name="ErrorsAsWarnings">true</PropertyValue> |
|||
<PropertyValue name="FormatOnPaste">true</PropertyValue> |
|||
<PropertyValue name="IdentifyHelpfulExtensions">false</PropertyValue> |
|||
<PropertyValue name="InsertAttributeValueQuotes">true</PropertyValue> |
|||
<PropertyValue name="InsertClosingTag">true</PropertyValue> |
|||
<PropertyValue name="XHtmlCodingStyle">true</PropertyValue> |
|||
</ToolsOptionsSubCategory> |
|||
</ToolsOptionsCategory> |
|||
</ToolsOptions> |
|||
</UserSettings> |
|||
@ -1,56 +0,0 @@ |
|||
<StyleCopSettings Version="105"> |
|||
<GlobalSettings> |
|||
<CollectionProperty Name="RecognizedWords"> |
|||
<Value>enum</Value> |
|||
<Value>exif</Value> |
|||
<Value>uint</Value> |
|||
<Value>lossy</Value> |
|||
<Value>octree</Value> |
|||
<Value>png</Value> |
|||
<Value>quantizer</Value> |
|||
<Value>unzig</Value> |
|||
<Value>cb</Value> |
|||
<Value>cr</Value> |
|||
<Value>Laplacian</Value> |
|||
<Value>Sobel</Value> |
|||
<Value>Scharr</Value> |
|||
<Value>rgb</Value> |
|||
<Value>rgba</Value> |
|||
<Value>rrggbb</Value> |
|||
<Value>rrggbbaa</Value> |
|||
<Value>scanline</Value> |
|||
<Value>scanlines</Value> |
|||
<Value>png's</Value> |
|||
<Value>codeword</Value> |
|||
<Value>unscaled</Value> |
|||
<Value>zig-zag</Value> |
|||
<Value>crc</Value> |
|||
<Value>zlib</Value> |
|||
<Value>xff</Value> |
|||
<Value>xda</Value> |
|||
<Value>ss</Value> |
|||
<Value>Vol</Value> |
|||
<Value>pp</Value> |
|||
<Value>cmyk</Value> |
|||
<Value>Paeth</Value> |
|||
<Value>th</Value> |
|||
<Value>bool</Value> |
|||
<Value>bools</Value> |
|||
<Value>desensitivity</Value> |
|||
<Value>premultiplied</Value> |
|||
<Value>endianness</Value> |
|||
<Value>thresholding</Value> |
|||
</CollectionProperty> |
|||
</GlobalSettings> |
|||
<Analyzers> |
|||
<Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules"> |
|||
<AnalyzerSettings> |
|||
<StringProperty Name="CompanyName">James Jackson-South</StringProperty> |
|||
<StringProperty Name="Copyright"> |
|||
Copyright © James Jackson-South and contributors. |
|||
Licensed under the Apache License, Version 2.0. |
|||
</StringProperty> |
|||
</AnalyzerSettings> |
|||
</Analyzer> |
|||
</Analyzers> |
|||
</StyleCopSettings> |
|||
@ -1,168 +0,0 @@ |
|||
// <copyright file="Brushes{TColor}.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp.Drawing.Brushes |
|||
{ |
|||
using System; |
|||
|
|||
/// <summary>
|
|||
/// A collection of methods for creating generic brushes.
|
|||
/// </summary>
|
|||
/// <typeparam name="TColor">The pixel format.</typeparam>
|
|||
/// <returns>A Brush</returns>
|
|||
public class Brushes<TColor> |
|||
where TColor : struct, IPixel<TColor> |
|||
{ |
|||
/// <summary>
|
|||
/// Percent10 Hatch Pattern
|
|||
/// </summary>
|
|||
/// ---> x axis
|
|||
/// ^
|
|||
/// | y - axis
|
|||
/// |
|
|||
/// see PatternBrush for details about how to make new patterns work
|
|||
private static readonly bool[,] Percent10Pattern = |
|||
{ |
|||
{ true, false, false, false }, |
|||
{ false, false, false, false }, |
|||
{ false, false, true, false }, |
|||
{ false, false, false, false } |
|||
}; |
|||
|
|||
/// <summary>
|
|||
/// Percent20 pattern.
|
|||
/// </summary>
|
|||
private static readonly bool[,] Percent20Pattern = |
|||
{ |
|||
{ true, false, false, false }, |
|||
{ false, false, true, false }, |
|||
{ true, false, false, false }, |
|||
{ false, false, true, false } |
|||
}; |
|||
|
|||
/// <summary>
|
|||
/// Horizontal Hatch Pattern
|
|||
/// </summary>
|
|||
private static readonly bool[,] HorizontalPattern = |
|||
{ |
|||
{ false }, |
|||
{ true }, |
|||
{ false }, |
|||
{ false } |
|||
}; |
|||
|
|||
/// <summary>
|
|||
/// Min Pattern
|
|||
/// </summary>
|
|||
private static readonly bool[,] MinPattern = |
|||
{ |
|||
{ false }, |
|||
{ false }, |
|||
{ false }, |
|||
{ true } |
|||
}; |
|||
|
|||
/// <summary>
|
|||
/// Vertical Pattern
|
|||
/// </summary>
|
|||
private static readonly bool[,] VerticalPattern = |
|||
{ |
|||
{ false, true, false, false }, |
|||
}; |
|||
|
|||
/// <summary>
|
|||
/// Forward Diagonal Pattern
|
|||
/// </summary>
|
|||
private static readonly bool[,] ForwardDiagonalPattern = |
|||
{ |
|||
{ false, false, false, true }, |
|||
{ false, false, true, false }, |
|||
{ false, true, false, false }, |
|||
{ true, false, false, false } |
|||
}; |
|||
|
|||
/// <summary>
|
|||
/// Backward Diagonal Pattern
|
|||
/// </summary>
|
|||
private static readonly bool[,] BackwardDiagonalPattern = |
|||
{ |
|||
{ true, false, false, false }, |
|||
{ false, true, false, false }, |
|||
{ false, false, true, false }, |
|||
{ false, false, false, true } |
|||
}; |
|||
|
|||
/// <summary>
|
|||
/// Create as brush that will paint a solid color
|
|||
/// </summary>
|
|||
/// <param name="color">The color.</param>
|
|||
/// <returns>A Brush</returns>
|
|||
public static SolidBrush<TColor> Solid(TColor color) |
|||
=> new SolidBrush<TColor>(color); |
|||
|
|||
/// <summary>
|
|||
/// Create as brush that will paint a Percent10 Hatch Pattern within the specified colors
|
|||
/// </summary>
|
|||
/// <param name="foreColor">Color of the foreground.</param>
|
|||
/// <param name="backColor">Color of the background.</param>
|
|||
/// <returns>A Brush</returns>
|
|||
public static PatternBrush<TColor> Percent10(TColor foreColor, TColor backColor) |
|||
=> new PatternBrush<TColor>(foreColor, backColor, Percent10Pattern); |
|||
|
|||
/// <summary>
|
|||
/// Create as brush that will paint a Percent20 Hatch Pattern within the specified colors
|
|||
/// </summary>
|
|||
/// <param name="foreColor">Color of the foreground.</param>
|
|||
/// <param name="backColor">Color of the background.</param>
|
|||
/// <returns>A Brush</returns>
|
|||
public static PatternBrush<TColor> Percent20(TColor foreColor, TColor backColor) |
|||
=> new PatternBrush<TColor>(foreColor, backColor, Percent20Pattern); |
|||
|
|||
/// <summary>
|
|||
/// Create as brush that will paint a Horizontal Hatch Pattern within the specified colors
|
|||
/// </summary>
|
|||
/// <param name="foreColor">Color of the foreground.</param>
|
|||
/// <param name="backColor">Color of the background.</param>
|
|||
/// <returns>A Brush</returns>
|
|||
public static PatternBrush<TColor> Horizontal(TColor foreColor, TColor backColor) |
|||
=> new PatternBrush<TColor>(foreColor, backColor, HorizontalPattern); |
|||
|
|||
/// <summary>
|
|||
/// Create as brush that will paint a Min Hatch Pattern within the specified colors
|
|||
/// </summary>
|
|||
/// <param name="foreColor">Color of the foreground.</param>
|
|||
/// <param name="backColor">Color of the background.</param>
|
|||
/// <returns>A Brush</returns>
|
|||
public static PatternBrush<TColor> Min(TColor foreColor, TColor backColor) |
|||
=> new PatternBrush<TColor>(foreColor, backColor, MinPattern); |
|||
|
|||
/// <summary>
|
|||
/// Create as brush that will paint a Vertical Hatch Pattern within the specified colors
|
|||
/// </summary>
|
|||
/// <param name="foreColor">Color of the foreground.</param>
|
|||
/// <param name="backColor">Color of the background.</param>
|
|||
/// <returns>A Brush</returns>
|
|||
public static PatternBrush<TColor> Vertical(TColor foreColor, TColor backColor) |
|||
=> new PatternBrush<TColor>(foreColor, backColor, VerticalPattern); |
|||
|
|||
/// <summary>
|
|||
/// Create as brush that will paint a Forward Diagonal Hatch Pattern within the specified colors
|
|||
/// </summary>
|
|||
/// <param name="foreColor">Color of the foreground.</param>
|
|||
/// <param name="backColor">Color of the background.</param>
|
|||
/// <returns>A Brush</returns>
|
|||
public static PatternBrush<TColor> ForwardDiagonal(TColor foreColor, TColor backColor) |
|||
=> new PatternBrush<TColor>(foreColor, backColor, ForwardDiagonalPattern); |
|||
|
|||
/// <summary>
|
|||
/// Create as brush that will paint a Backward Diagonal Hatch Pattern within the specified colors
|
|||
/// </summary>
|
|||
/// <param name="foreColor">Color of the foreground.</param>
|
|||
/// <param name="backColor">Color of the background.</param>
|
|||
/// <returns>A Brush</returns>
|
|||
public static PatternBrush<TColor> BackwardDiagonal(TColor foreColor, TColor backColor) |
|||
=> new PatternBrush<TColor>(foreColor, backColor, BackwardDiagonalPattern); |
|||
} |
|||
} |
|||
@ -1,22 +0,0 @@ |
|||
// <copyright file="ImageBrush.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp.Drawing.Brushes |
|||
{ |
|||
/// <summary>
|
|||
/// Provides an implementation of a solid brush for painting with repeating images. The brush uses <see cref="Color"/> for painting.
|
|||
/// </summary>
|
|||
public class ImageBrush : ImageBrush<Color> |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="ImageBrush" /> class.
|
|||
/// </summary>
|
|||
/// <param name="image">The image to paint.</param>
|
|||
public ImageBrush(IImageBase<Color> image) |
|||
: base(image) |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -1,33 +0,0 @@ |
|||
// <copyright file="PatternBrush.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp.Drawing.Brushes |
|||
{ |
|||
/// <summary>
|
|||
/// Provides an implementation of a pattern brush for painting patterns. The brush use <see cref="Color"/> for painting.
|
|||
/// </summary>
|
|||
public class PatternBrush : PatternBrush<Color> |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="PatternBrush"/> class.
|
|||
/// </summary>
|
|||
/// <param name="foreColor">Color of the fore.</param>
|
|||
/// <param name="backColor">Color of the back.</param>
|
|||
/// <param name="pattern">The pattern.</param>
|
|||
public PatternBrush(Color foreColor, Color backColor, bool[,] pattern) |
|||
: base(foreColor, backColor, pattern) |
|||
{ |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="PatternBrush"/> class.
|
|||
/// </summary>
|
|||
/// <param name="brush">The brush.</param>
|
|||
internal PatternBrush(PatternBrush<Color> brush) |
|||
: base(brush) |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -1,24 +0,0 @@ |
|||
// <copyright file="RecolorBrush.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp.Drawing.Brushes |
|||
{ |
|||
/// <summary>
|
|||
/// Provides an implementation of a recolor brush for painting color changes.
|
|||
/// </summary>
|
|||
public class RecolorBrush : RecolorBrush<Color> |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="RecolorBrush" /> class.
|
|||
/// </summary>
|
|||
/// <param name="sourceColor">Color of the source.</param>
|
|||
/// <param name="targetColor">Color of the target.</param>
|
|||
/// <param name="threshold">The threshold.</param>
|
|||
public RecolorBrush(Color sourceColor, Color targetColor, float threshold) |
|||
: base(sourceColor, targetColor, threshold) |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -1,22 +0,0 @@ |
|||
// <copyright file="SolidBrush.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp.Drawing.Brushes |
|||
{ |
|||
/// <summary>
|
|||
/// Provides an implementation of a solid brush for painting solid color areas. The brush uses <see cref="Color"/> for painting.
|
|||
/// </summary>
|
|||
public class SolidBrush : SolidBrush<Color> |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="SolidBrush" /> class.
|
|||
/// </summary>
|
|||
/// <param name="color">The color.</param>
|
|||
public SolidBrush(Color color) |
|||
: base(color) |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -1,118 +0,0 @@ |
|||
// <copyright file="SolidBrush{TColor}.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp.Drawing.Brushes |
|||
{ |
|||
using System; |
|||
using System.Numerics; |
|||
|
|||
using Processors; |
|||
|
|||
/// <summary>
|
|||
/// Provides an implementation of a solid brush for painting solid color areas.
|
|||
/// </summary>
|
|||
/// <typeparam name="TColor">The pixel format.</typeparam>
|
|||
public class SolidBrush<TColor> : IBrush<TColor> |
|||
where TColor : struct, IPixel<TColor> |
|||
{ |
|||
/// <summary>
|
|||
/// The color to paint.
|
|||
/// </summary>
|
|||
private readonly TColor color; |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="SolidBrush{TColor}"/> class.
|
|||
/// </summary>
|
|||
/// <param name="color">The color.</param>
|
|||
public SolidBrush(TColor color) |
|||
{ |
|||
this.color = color; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets the color.
|
|||
/// </summary>
|
|||
/// <value>
|
|||
/// The color.
|
|||
/// </value>
|
|||
public TColor Color => this.color; |
|||
|
|||
/// <inheritdoc />
|
|||
public BrushApplicator<TColor> CreateApplicator(PixelAccessor<TColor> sourcePixels, RectangleF region) |
|||
{ |
|||
return new SolidBrushApplicator(sourcePixels, this.color); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The solid brush applicator.
|
|||
/// </summary>
|
|||
private class SolidBrushApplicator : BrushApplicator<TColor> |
|||
{ |
|||
/// <summary>
|
|||
/// The solid color.
|
|||
/// </summary>
|
|||
private readonly TColor color; |
|||
private readonly Vector4 colorVector; |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="SolidBrushApplicator"/> class.
|
|||
/// </summary>
|
|||
/// <param name="color">The color.</param>
|
|||
/// <param name="sourcePixels">The sourcePixels.</param>
|
|||
public SolidBrushApplicator(PixelAccessor<TColor> sourcePixels, TColor color) |
|||
: base(sourcePixels) |
|||
{ |
|||
this.color = color; |
|||
this.colorVector = color.ToVector4(); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets the color for a single pixel.
|
|||
/// </summary>
|
|||
/// <param name="x">The x.</param>
|
|||
/// <param name="y">The y.</param>
|
|||
/// <returns>
|
|||
/// The color
|
|||
/// </returns>
|
|||
internal override TColor this[int x, int y] => this.color; |
|||
|
|||
/// <inheritdoc />
|
|||
public override void Dispose() |
|||
{ |
|||
// noop
|
|||
} |
|||
|
|||
/// <inheritdoc />
|
|||
internal override void Apply(float[] scanlineBuffer, int scanlineWidth, int offset, int x, int y) |
|||
{ |
|||
Guard.MustBeGreaterThanOrEqualTo(scanlineBuffer.Length, offset + scanlineWidth, nameof(scanlineWidth)); |
|||
|
|||
using (PinnedBuffer<float> buffer = new PinnedBuffer<float>(scanlineBuffer)) |
|||
{ |
|||
BufferSpan<float> slice = buffer.Slice(offset); |
|||
|
|||
for (int xPos = 0; xPos < scanlineWidth; xPos++) |
|||
{ |
|||
int targetX = xPos + x; |
|||
int targetY = y; |
|||
|
|||
float opacity = slice[xPos]; |
|||
if (opacity > Constants.Epsilon) |
|||
{ |
|||
Vector4 backgroundVector = this.Target[targetX, targetY].ToVector4(); |
|||
Vector4 sourceVector = this.colorVector; |
|||
|
|||
Vector4 finalColor = Vector4BlendTransforms.PremultipliedLerp(backgroundVector, sourceVector, opacity); |
|||
|
|||
TColor packed = default(TColor); |
|||
packed.PackFromVector4(finalColor); |
|||
this.Target[targetX, targetY] = packed; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,109 @@ |
|||
// <copyright file="SolidBrush{TPixel}.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp.Drawing.Brushes |
|||
{ |
|||
using System; |
|||
using System.Numerics; |
|||
|
|||
using ImageSharp.Memory; |
|||
using ImageSharp.PixelFormats; |
|||
using Processors; |
|||
|
|||
/// <summary>
|
|||
/// Provides an implementation of a solid brush for painting solid color areas.
|
|||
/// </summary>
|
|||
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|||
public class SolidBrush<TPixel> : IBrush<TPixel> |
|||
where TPixel : struct, IPixel<TPixel> |
|||
{ |
|||
/// <summary>
|
|||
/// The color to paint.
|
|||
/// </summary>
|
|||
private readonly TPixel color; |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="SolidBrush{TPixel}"/> class.
|
|||
/// </summary>
|
|||
/// <param name="color">The color.</param>
|
|||
public SolidBrush(TPixel color) |
|||
{ |
|||
this.color = color; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets the color.
|
|||
/// </summary>
|
|||
/// <value>
|
|||
/// The color.
|
|||
/// </value>
|
|||
public TPixel Color => this.color; |
|||
|
|||
/// <inheritdoc />
|
|||
public BrushApplicator<TPixel> CreateApplicator(PixelAccessor<TPixel> sourcePixels, RectangleF region, GraphicsOptions options) |
|||
{ |
|||
return new SolidBrushApplicator(sourcePixels, this.color, options); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The solid brush applicator.
|
|||
/// </summary>
|
|||
private class SolidBrushApplicator : BrushApplicator<TPixel> |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="SolidBrushApplicator"/> class.
|
|||
/// </summary>
|
|||
/// <param name="color">The color.</param>
|
|||
/// <param name="options">The options</param>
|
|||
/// <param name="sourcePixels">The sourcePixels.</param>
|
|||
public SolidBrushApplicator(PixelAccessor<TPixel> sourcePixels, TPixel color, GraphicsOptions options) |
|||
: base(sourcePixels, options) |
|||
{ |
|||
this.Colors = new Buffer<TPixel>(sourcePixels.Width); |
|||
for (int i = 0; i < this.Colors.Length; i++) |
|||
{ |
|||
this.Colors[i] = color; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets the colors.
|
|||
/// </summary>
|
|||
protected Buffer<TPixel> Colors { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the color for a single pixel.
|
|||
/// </summary>
|
|||
/// <param name="x">The x.</param>
|
|||
/// <param name="y">The y.</param>
|
|||
/// <returns>
|
|||
/// The color
|
|||
/// </returns>
|
|||
internal override TPixel this[int x, int y] => this.Colors[x]; |
|||
|
|||
/// <inheritdoc />
|
|||
public override void Dispose() |
|||
{ |
|||
this.Colors.Dispose(); |
|||
} |
|||
|
|||
/// <inheritdoc />
|
|||
internal override void Apply(Span<float> scanline, int x, int y) |
|||
{ |
|||
Span<TPixel> destinationRow = this.Target.GetRowSpan(x, y).Slice(0, scanline.Length); |
|||
|
|||
using (Buffer<float> amountBuffer = new Buffer<float>(scanline.Length)) |
|||
{ |
|||
for (int i = 0; i < scanline.Length; i++) |
|||
{ |
|||
amountBuffer[i] = scanline[i] * this.Options.BlendPercentage; |
|||
} |
|||
|
|||
this.Blender.Blend(destinationRow, destinationRow, this.Colors, amountBuffer); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,58 +1,129 @@ |
|||
// <copyright file="DrawImage.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp |
|||
{ |
|||
using System; |
|||
|
|||
using Drawing.Processors; |
|||
|
|||
/// <summary>
|
|||
/// Extension methods for the <see cref="Image"/> type.
|
|||
/// </summary>
|
|||
public static partial class ImageExtensions |
|||
{ |
|||
/// <summary>
|
|||
/// Draws the given image together with the current one by blending their pixels.
|
|||
/// </summary>
|
|||
/// <typeparam name="TColor">The pixel format.</typeparam>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="image">The image to blend with the currently processing image.</param>
|
|||
/// <param name="percent">The opacity of the image image to blend. Must be between 0 and 100.</param>
|
|||
/// <returns>The <see cref="Image{TColor}"/>.</returns>
|
|||
public static Image<TColor> Blend<TColor>(this Image<TColor> source, Image<TColor> image, int percent = 50) |
|||
where TColor : struct, IPixel<TColor> |
|||
{ |
|||
return DrawImage(source, image, percent, default(Size), default(Point)); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Draws the given image together with the current one by blending their pixels.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="image">The image to blend with the currently processing image.</param>
|
|||
/// <typeparam name="TColor">The pixel format.</typeparam>
|
|||
/// <param name="percent">The opacity of the image image to blend. Must be between 0 and 100.</param>
|
|||
/// <param name="size">The size to draw the blended image.</param>
|
|||
/// <param name="location">The location to draw the blended image.</param>
|
|||
/// <returns>The <see cref="Image{TColor}"/>.</returns>
|
|||
public static Image<TColor> DrawImage<TColor>(this Image<TColor> source, Image<TColor> image, int percent, Size size, Point location) |
|||
where TColor : struct, IPixel<TColor> |
|||
{ |
|||
if (size == default(Size)) |
|||
{ |
|||
size = new Size(image.Width, image.Height); |
|||
} |
|||
|
|||
if (location == default(Point)) |
|||
{ |
|||
location = Point.Empty; |
|||
} |
|||
|
|||
source.ApplyProcessor(new DrawImageProcessor<TColor>(image, size, location, percent), source.Bounds); |
|||
return source; |
|||
} |
|||
} |
|||
// <copyright file="DrawImage.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp |
|||
{ |
|||
using Drawing.Processors; |
|||
using ImageSharp.PixelFormats; |
|||
|
|||
/// <summary>
|
|||
/// Extension methods for the <see cref="Image{TPixel}"/> type.
|
|||
/// </summary>
|
|||
public static partial class ImageExtensions |
|||
{ |
|||
/// <summary>
|
|||
/// Draws the given image together with the current one by blending their pixels.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="image">The image to blend with the currently processing image.</param>
|
|||
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|||
/// <param name="size">The size to draw the blended image.</param>
|
|||
/// <param name="location">The location to draw the blended image.</param>
|
|||
/// <param name="options">The options.</param>
|
|||
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
|
|||
public static Image<TPixel> DrawImage<TPixel>(this Image<TPixel> source, Image<TPixel> image, Size size, Point location, GraphicsOptions options) |
|||
where TPixel : struct, IPixel<TPixel> |
|||
{ |
|||
if (size == default(Size)) |
|||
{ |
|||
size = new Size(image.Width, image.Height); |
|||
} |
|||
|
|||
if (location == default(Point)) |
|||
{ |
|||
location = Point.Empty; |
|||
} |
|||
|
|||
source.ApplyProcessor(new DrawImageProcessor<TPixel>(image, size, location, options), source.Bounds); |
|||
return source; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Draws the given image together with the current one by blending their pixels.
|
|||
/// </summary>
|
|||
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="image">The image to blend with the currently processing image.</param>
|
|||
/// <param name="percent">The opacity of the image image to blend. Must be between 0 and 1.</param>
|
|||
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
|
|||
public static Image<TPixel> Blend<TPixel>(this Image<TPixel> source, Image<TPixel> image, float percent) |
|||
where TPixel : struct, IPixel<TPixel> |
|||
{ |
|||
GraphicsOptions options = GraphicsOptions.Default; |
|||
options.BlendPercentage = percent; |
|||
return DrawImage(source, image, default(Size), default(Point), options); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Draws the given image together with the current one by blending their pixels.
|
|||
/// </summary>
|
|||
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="image">The image to blend with the currently processing image.</param>
|
|||
/// <param name="blender">The blending mode.</param>
|
|||
/// <param name="percent">The opacity of the image image to blend. Must be between 0 and 1.</param>
|
|||
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
|
|||
public static Image<TPixel> Blend<TPixel>(this Image<TPixel> source, Image<TPixel> image, PixelBlenderMode blender, float percent) |
|||
where TPixel : struct, IPixel<TPixel> |
|||
{ |
|||
GraphicsOptions options = GraphicsOptions.Default; |
|||
options.BlendPercentage = percent; |
|||
options.BlenderMode = blender; |
|||
return DrawImage(source, image, default(Size), default(Point), options); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Draws the given image together with the current one by blending their pixels.
|
|||
/// </summary>
|
|||
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="image">The image to blend with the currently processing image.</param>
|
|||
/// <param name="options">The options, including the blending type and belnding amount.</param>
|
|||
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
|
|||
public static Image<TPixel> Blend<TPixel>(this Image<TPixel> source, Image<TPixel> image, GraphicsOptions options) |
|||
where TPixel : struct, IPixel<TPixel> |
|||
{ |
|||
return DrawImage(source, image, default(Size), default(Point), options); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Draws the given image together with the current one by blending their pixels.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="image">The image to blend with the currently processing image.</param>
|
|||
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|||
/// <param name="percent">The opacity of the image image to blend. Must be between 0 and 1.</param>
|
|||
/// <param name="size">The size to draw the blended image.</param>
|
|||
/// <param name="location">The location to draw the blended image.</param>
|
|||
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
|
|||
public static Image<TPixel> DrawImage<TPixel>(this Image<TPixel> source, Image<TPixel> image, float percent, Size size, Point location) |
|||
where TPixel : struct, IPixel<TPixel> |
|||
{ |
|||
GraphicsOptions options = GraphicsOptions.Default; |
|||
options.BlendPercentage = percent; |
|||
return source.DrawImage(image, size, location, options); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Draws the given image together with the current one by blending their pixels.
|
|||
/// </summary>
|
|||
/// <param name="source">The image this method extends.</param>
|
|||
/// <param name="image">The image to blend with the currently processing image.</param>
|
|||
/// <typeparam name="TPixel">The pixel format.</typeparam>
|
|||
/// <param name="blender">The type of bending to apply.</param>
|
|||
/// <param name="percent">The opacity of the image image to blend. Must be between 0 and 1.</param>
|
|||
/// <param name="size">The size to draw the blended image.</param>
|
|||
/// <param name="location">The location to draw the blended image.</param>
|
|||
/// <returns>The <see cref="Image{TPixel}"/>.</returns>
|
|||
public static Image<TPixel> DrawImage<TPixel>(this Image<TPixel> source, Image<TPixel> image, PixelBlenderMode blender, float percent, Size size, Point location) |
|||
where TPixel : struct, IPixel<TPixel> |
|||
{ |
|||
GraphicsOptions options = GraphicsOptions.Default; |
|||
options.BlenderMode = blender; |
|||
options.BlendPercentage = percent; |
|||
return source.DrawImage(image, size, location, options); |
|||
} |
|||
} |
|||
} |
|||
@ -1,38 +0,0 @@ |
|||
// <copyright file="GraphicsOptions.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp.Drawing |
|||
{ |
|||
/// <summary>
|
|||
/// Options for influencing the drawing functions.
|
|||
/// </summary>
|
|||
public struct GraphicsOptions |
|||
{ |
|||
/// <summary>
|
|||
/// Represents the default <see cref="GraphicsOptions"/>.
|
|||
/// </summary>
|
|||
public static readonly GraphicsOptions Default = new GraphicsOptions(true); |
|||
|
|||
/// <summary>
|
|||
/// Whether antialiasing should be applied.
|
|||
/// </summary>
|
|||
public bool Antialias; |
|||
|
|||
/// <summary>
|
|||
/// The number of subpixels to use while rendering with antialiasing enabled.
|
|||
/// </summary>
|
|||
public int AntialiasSubpixelDepth; |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="GraphicsOptions"/> struct.
|
|||
/// </summary>
|
|||
/// <param name="enableAntialiasing">If set to <c>true</c> [enable antialiasing].</param>
|
|||
public GraphicsOptions(bool enableAntialiasing) |
|||
{ |
|||
this.Antialias = enableAntialiasing; |
|||
this.AntialiasSubpixelDepth = 16; |
|||
} |
|||
} |
|||
} |
|||
@ -1,53 +0,0 @@ |
|||
// <copyright file="Pen.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp.Drawing.Pens |
|||
{ |
|||
/// <summary>
|
|||
/// Represents a <see cref="Pen{TColor}"/> in the <see cref="Color"/> color space.
|
|||
/// </summary>
|
|||
public class Pen : Pen<Color> |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="Pen"/> class.
|
|||
/// </summary>
|
|||
/// <param name="color">The color.</param>
|
|||
/// <param name="width">The width.</param>
|
|||
public Pen(Color color, float width) |
|||
: base(color, width) |
|||
{ |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="Pen"/> class.
|
|||
/// </summary>
|
|||
/// <param name="brush">The brush.</param>
|
|||
/// <param name="width">The width.</param>
|
|||
public Pen(IBrush<Color> brush, float width) |
|||
: base(brush, width) |
|||
{ |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="Pen"/> class.
|
|||
/// </summary>
|
|||
/// <param name="brush">The brush.</param>
|
|||
/// <param name="width">The width.</param>
|
|||
/// <param name="pattern">The pattern.</param>
|
|||
public Pen(IBrush<Color> brush, float width, float[] pattern) |
|||
: base(brush, width, pattern) |
|||
{ |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="Pen"/> class.
|
|||
/// </summary>
|
|||
/// <param name="pen">The pen.</param>
|
|||
internal Pen(Pen<Color> pen) |
|||
: base(pen) |
|||
{ |
|||
} |
|||
} |
|||
} |
|||
@ -1,112 +0,0 @@ |
|||
// <copyright file="Pens{TColor}.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp.Drawing.Pens |
|||
{ |
|||
using System; |
|||
|
|||
/// <summary>
|
|||
/// Common Pen styles
|
|||
/// </summary>
|
|||
/// <typeparam name="TColor">The type of the color.</typeparam>
|
|||
public class Pens<TColor> |
|||
where TColor : struct, IPixel<TColor> |
|||
{ |
|||
private static readonly float[] DashDotPattern = new[] { 3f, 1f, 1f, 1f }; |
|||
private static readonly float[] DashDotDotPattern = new[] { 3f, 1f, 1f, 1f, 1f, 1f }; |
|||
private static readonly float[] DottedPattern = new[] { 1f, 1f }; |
|||
private static readonly float[] DashedPattern = new[] { 3f, 1f }; |
|||
|
|||
/// <summary>
|
|||
/// Create a solid pen with out any drawing patterns
|
|||
/// </summary>
|
|||
/// <param name="color">The color.</param>
|
|||
/// <param name="width">The width.</param>
|
|||
/// <returns>The Pen</returns>
|
|||
public static Pen<TColor> Solid(TColor color, float width) |
|||
=> new Pen<TColor>(color, width); |
|||
|
|||
/// <summary>
|
|||
/// Create a solid pen with out any drawing patterns
|
|||
/// </summary>
|
|||
/// <param name="brush">The brush.</param>
|
|||
/// <param name="width">The width.</param>
|
|||
/// <returns>The Pen</returns>
|
|||
public static Pen<TColor> Solid(IBrush<TColor> brush, float width) |
|||
=> new Pen<TColor>(brush, width); |
|||
|
|||
/// <summary>
|
|||
/// Create a pen with a 'Dash' drawing patterns
|
|||
/// </summary>
|
|||
/// <param name="color">The color.</param>
|
|||
/// <param name="width">The width.</param>
|
|||
/// <returns>The Pen</returns>
|
|||
public static Pen<TColor> Dash(TColor color, float width) |
|||
=> new Pen<TColor>(color, width, DashedPattern); |
|||
|
|||
/// <summary>
|
|||
/// Create a pen with a 'Dash' drawing patterns
|
|||
/// </summary>
|
|||
/// <param name="brush">The brush.</param>
|
|||
/// <param name="width">The width.</param>
|
|||
/// <returns>The Pen</returns>
|
|||
public static Pen<TColor> Dash(IBrush<TColor> brush, float width) |
|||
=> new Pen<TColor>(brush, width, DashedPattern); |
|||
|
|||
/// <summary>
|
|||
/// Create a pen with a 'Dot' drawing patterns
|
|||
/// </summary>
|
|||
/// <param name="color">The color.</param>
|
|||
/// <param name="width">The width.</param>
|
|||
/// <returns>The Pen</returns>
|
|||
public static Pen<TColor> Dot(TColor color, float width) |
|||
=> new Pen<TColor>(color, width, DottedPattern); |
|||
|
|||
/// <summary>
|
|||
/// Create a pen with a 'Dot' drawing patterns
|
|||
/// </summary>
|
|||
/// <param name="brush">The brush.</param>
|
|||
/// <param name="width">The width.</param>
|
|||
/// <returns>The Pen</returns>
|
|||
public static Pen<TColor> Dot(IBrush<TColor> brush, float width) |
|||
=> new Pen<TColor>(brush, width, DottedPattern); |
|||
|
|||
/// <summary>
|
|||
/// Create a pen with a 'Dash Dot' drawing patterns
|
|||
/// </summary>
|
|||
/// <param name="color">The color.</param>
|
|||
/// <param name="width">The width.</param>
|
|||
/// <returns>The Pen</returns>
|
|||
public static Pen<TColor> DashDot(TColor color, float width) |
|||
=> new Pen<TColor>(color, width, DashDotPattern); |
|||
|
|||
/// <summary>
|
|||
/// Create a pen with a 'Dash Dot' drawing patterns
|
|||
/// </summary>
|
|||
/// <param name="brush">The brush.</param>
|
|||
/// <param name="width">The width.</param>
|
|||
/// <returns>The Pen</returns>
|
|||
public static Pen<TColor> DashDot(IBrush<TColor> brush, float width) |
|||
=> new Pen<TColor>(brush, width, DashDotPattern); |
|||
|
|||
/// <summary>
|
|||
/// Create a pen with a 'Dash Dot Dot' drawing patterns
|
|||
/// </summary>
|
|||
/// <param name="color">The color.</param>
|
|||
/// <param name="width">The width.</param>
|
|||
/// <returns>The Pen</returns>
|
|||
public static Pen<TColor> DashDotDot(TColor color, float width) |
|||
=> new Pen<TColor>(color, width, DashDotDotPattern); |
|||
|
|||
/// <summary>
|
|||
/// Create a pen with a 'Dash Dot Dot' drawing patterns
|
|||
/// </summary>
|
|||
/// <param name="brush">The brush.</param>
|
|||
/// <param name="width">The width.</param>
|
|||
/// <returns>The Pen</returns>
|
|||
public static Pen<TColor> DashDotDot(IBrush<TColor> brush, float width) |
|||
=> new Pen<TColor>(brush, width, DashDotDotPattern); |
|||
} |
|||
} |
|||
@ -1,255 +0,0 @@ |
|||
// <copyright file="Color.BulkOperations.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp |
|||
{ |
|||
using System; |
|||
using System.Numerics; |
|||
using System.Runtime.CompilerServices; |
|||
using System.Runtime.InteropServices; |
|||
|
|||
/// <content>
|
|||
/// Conains the definition of <see cref="BulkOperations"/>
|
|||
/// </content>
|
|||
public partial struct Color |
|||
{ |
|||
/// <summary>
|
|||
/// <see cref="BulkPixelOperations{TColor}"/> implementation optimized for <see cref="Color"/>.
|
|||
/// </summary>
|
|||
internal class BulkOperations : BulkPixelOperations<Color> |
|||
{ |
|||
/// <summary>
|
|||
/// SIMD optimized bulk implementation of <see cref="IPixel.PackFromVector4(Vector4)"/>
|
|||
/// that works only with `count` divisible by <see cref="Vector{UInt32}.Count"/>.
|
|||
/// </summary>
|
|||
/// <param name="sourceColors">The <see cref="BufferSpan{T}"/> to the source colors.</param>
|
|||
/// <param name="destVectors">The <see cref="BufferSpan{T}"/> to the dstination vectors.</param>
|
|||
/// <param name="count">The number of pixels to convert.</param>
|
|||
/// <remarks>
|
|||
/// Implementation adapted from:
|
|||
/// <see>
|
|||
/// <cref>http://stackoverflow.com/a/5362789</cref>
|
|||
/// </see>
|
|||
/// TODO: We can replace this implementation in the future using new Vector API-s:
|
|||
/// <see>
|
|||
/// <cref>https://github.com/dotnet/corefx/issues/15957</cref>
|
|||
/// </see>
|
|||
/// </remarks>
|
|||
internal static unsafe void ToVector4SimdAligned( |
|||
BufferSpan<Color> sourceColors, |
|||
BufferSpan<Vector4> destVectors, |
|||
int count) |
|||
{ |
|||
if (!Vector.IsHardwareAccelerated) |
|||
{ |
|||
throw new InvalidOperationException( |
|||
"Color.BulkOperations.ToVector4SimdAligned() should not be called when Vector.IsHardwareAccelerated == false!"); |
|||
} |
|||
|
|||
int vecSize = Vector<uint>.Count; |
|||
|
|||
DebugGuard.IsTrue( |
|||
count % vecSize == 0, |
|||
nameof(count), |
|||
"Argument 'count' should divisible by Vector<uint>.Count!"); |
|||
|
|||
Vector<float> bVec = new Vector<float>(256.0f / 255.0f); |
|||
Vector<float> magicFloat = new Vector<float>(32768.0f); |
|||
Vector<uint> magicInt = new Vector<uint>(1191182336); // reinterpreded value of 32768.0f
|
|||
Vector<uint> mask = new Vector<uint>(255); |
|||
|
|||
int unpackedRawCount = count * 4; |
|||
|
|||
uint* src = (uint*)sourceColors.PointerAtOffset; |
|||
uint* srcEnd = src + count; |
|||
|
|||
using (PinnedBuffer<uint> tempBuf = new PinnedBuffer<uint>( |
|||
unpackedRawCount + Vector<uint>.Count)) |
|||
{ |
|||
uint* tPtr = (uint*)tempBuf.Pointer; |
|||
uint[] temp = tempBuf.Array; |
|||
float[] fTemp = Unsafe.As<float[]>(temp); |
|||
UnpackedRGBA* dst = (UnpackedRGBA*)tPtr; |
|||
|
|||
for (; src < srcEnd; src++, dst++) |
|||
{ |
|||
// This call is the bottleneck now:
|
|||
dst->Load(*src); |
|||
} |
|||
|
|||
for (int i = 0; i < unpackedRawCount; i += vecSize) |
|||
{ |
|||
Vector<uint> vi = new Vector<uint>(temp, i); |
|||
|
|||
vi &= mask; |
|||
vi |= magicInt; |
|||
|
|||
Vector<float> vf = Vector.AsVectorSingle(vi); |
|||
vf = (vf - magicFloat) * bVec; |
|||
vf.CopyTo(fTemp, i); |
|||
} |
|||
|
|||
BufferSpan.Copy<uint>(tempBuf, (BufferSpan<byte>)destVectors, unpackedRawCount); |
|||
} |
|||
} |
|||
|
|||
/// <inheritdoc />
|
|||
internal override void ToVector4(BufferSpan<Color> sourceColors, BufferSpan<Vector4> destVectors, int count) |
|||
{ |
|||
if (count < 256 || !Vector.IsHardwareAccelerated) |
|||
{ |
|||
// Doesn't worth to bother with SIMD:
|
|||
base.ToVector4(sourceColors, destVectors, count); |
|||
return; |
|||
} |
|||
|
|||
int remainder = count % Vector<uint>.Count; |
|||
|
|||
int alignedCount = count - remainder; |
|||
|
|||
if (alignedCount > 0) |
|||
{ |
|||
ToVector4SimdAligned(sourceColors, destVectors, alignedCount); |
|||
} |
|||
|
|||
if (remainder > 0) |
|||
{ |
|||
sourceColors = sourceColors.Slice(alignedCount); |
|||
destVectors = destVectors.Slice(alignedCount); |
|||
base.ToVector4(sourceColors, destVectors, remainder); |
|||
} |
|||
} |
|||
|
|||
/// <inheritdoc />
|
|||
internal override unsafe void PackFromXyzBytes(BufferSpan<byte> sourceBytes, BufferSpan<Color> destColors, int count) |
|||
{ |
|||
byte* source = (byte*)sourceBytes; |
|||
byte* destination = (byte*)destColors; |
|||
|
|||
for (int x = 0; x < count; x++) |
|||
{ |
|||
Unsafe.Write(destination, (uint)(*source << 0 | *(source + 1) << 8 | *(source + 2) << 16 | 255 << 24)); |
|||
|
|||
source += 3; |
|||
destination += 4; |
|||
} |
|||
} |
|||
|
|||
/// <inheritdoc />
|
|||
internal override unsafe void ToXyzBytes(BufferSpan<Color> sourceColors, BufferSpan<byte> destBytes, int count) |
|||
{ |
|||
byte* source = (byte*)sourceColors; |
|||
byte* destination = (byte*)destBytes; |
|||
|
|||
for (int x = 0; x < count; x++) |
|||
{ |
|||
*destination = *(source + 0); |
|||
*(destination + 1) = *(source + 1); |
|||
*(destination + 2) = *(source + 2); |
|||
|
|||
source += 4; |
|||
destination += 3; |
|||
} |
|||
} |
|||
|
|||
/// <inheritdoc />
|
|||
internal override void PackFromXyzwBytes(BufferSpan<byte> sourceBytes, BufferSpan<Color> destColors, int count) |
|||
{ |
|||
BufferSpan.Copy(sourceBytes, destColors, count); |
|||
} |
|||
|
|||
/// <inheritdoc />
|
|||
internal override void ToXyzwBytes(BufferSpan<Color> sourceColors, BufferSpan<byte> destBytes, int count) |
|||
{ |
|||
BufferSpan.Copy(sourceColors, destBytes, count); |
|||
} |
|||
|
|||
/// <inheritdoc />
|
|||
internal override unsafe void PackFromZyxBytes(BufferSpan<byte> sourceBytes, BufferSpan<Color> destColors, int count) |
|||
{ |
|||
byte* source = (byte*)sourceBytes; |
|||
byte* destination = (byte*)destColors; |
|||
|
|||
for (int x = 0; x < count; x++) |
|||
{ |
|||
Unsafe.Write(destination, (uint)(*(source + 2) << 0 | *(source + 1) << 8 | *source << 16 | 255 << 24)); |
|||
|
|||
source += 3; |
|||
destination += 4; |
|||
} |
|||
} |
|||
|
|||
/// <inheritdoc />
|
|||
internal override unsafe void ToZyxBytes(BufferSpan<Color> sourceColors, BufferSpan<byte> destBytes, int count) |
|||
{ |
|||
byte* source = (byte*)sourceColors; |
|||
byte* destination = (byte*)destBytes; |
|||
|
|||
for (int x = 0; x < count; x++) |
|||
{ |
|||
*destination = *(source + 2); |
|||
*(destination + 1) = *(source + 1); |
|||
*(destination + 2) = *(source + 0); |
|||
|
|||
source += 4; |
|||
destination += 3; |
|||
} |
|||
} |
|||
|
|||
/// <inheritdoc />
|
|||
internal override unsafe void PackFromZyxwBytes(BufferSpan<byte> sourceBytes, BufferSpan<Color> destColors, int count) |
|||
{ |
|||
byte* source = (byte*)sourceBytes; |
|||
byte* destination = (byte*)destColors; |
|||
|
|||
for (int x = 0; x < count; x++) |
|||
{ |
|||
Unsafe.Write(destination, (uint)(*(source + 2) << 0 | *(source + 1) << 8 | *source << 16 | *(source + 3) << 24)); |
|||
|
|||
source += 4; |
|||
destination += 4; |
|||
} |
|||
} |
|||
|
|||
/// <inheritdoc />
|
|||
internal override unsafe void ToZyxwBytes(BufferSpan<Color> sourceColors, BufferSpan<byte> destBytes, int count) |
|||
{ |
|||
byte* source = (byte*)sourceColors; |
|||
byte* destination = (byte*)destBytes; |
|||
|
|||
for (int x = 0; x < count; x++) |
|||
{ |
|||
*destination = *(source + 2); |
|||
*(destination + 1) = *(source + 1); |
|||
*(destination + 2) = *(source + 0); |
|||
*(destination + 3) = *(source + 3); |
|||
|
|||
source += 4; |
|||
destination += 4; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Value type to store <see cref="Color"/>-s unpacked into multiple <see cref="uint"/>-s.
|
|||
/// </summary>
|
|||
private struct UnpackedRGBA |
|||
{ |
|||
private uint r; |
|||
private uint g; |
|||
private uint b; |
|||
private uint a; |
|||
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|||
public void Load(uint p) |
|||
{ |
|||
this.r = p; |
|||
this.g = p >> Color.GreenShift; |
|||
this.b = p >> Color.BlueShift; |
|||
this.a = p >> Color.AlphaShift; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,179 +0,0 @@ |
|||
// <copyright file="ColorConstants.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp |
|||
{ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
|
|||
/// <summary>
|
|||
/// Provides useful color definitions.
|
|||
/// </summary>
|
|||
public static class ColorConstants |
|||
{ |
|||
/// <summary>
|
|||
/// Provides a lazy, one time method of returning the colors.
|
|||
/// </summary>
|
|||
private static readonly Lazy<Color[]> SafeColors = new Lazy<Color[]>(GetWebSafeColors); |
|||
|
|||
/// <summary>
|
|||
/// Gets a collection of named, web safe, colors as defined in the CSS Color Module Level 4.
|
|||
/// </summary>
|
|||
public static Color[] WebSafeColors => SafeColors.Value; |
|||
|
|||
/// <summary>
|
|||
/// Returns an array of web safe colors.
|
|||
/// </summary>
|
|||
/// <returns>The <see cref="T:Color[]"/></returns>
|
|||
private static Color[] GetWebSafeColors() |
|||
{ |
|||
return new List<Color> |
|||
{ |
|||
Color.AliceBlue, |
|||
Color.AntiqueWhite, |
|||
Color.Aqua, |
|||
Color.Aquamarine, |
|||
Color.Azure, |
|||
Color.Beige, |
|||
Color.Bisque, |
|||
Color.Black, |
|||
Color.BlanchedAlmond, |
|||
Color.Blue, |
|||
Color.BlueViolet, |
|||
Color.Brown, |
|||
Color.BurlyWood, |
|||
Color.CadetBlue, |
|||
Color.Chartreuse, |
|||
Color.Chocolate, |
|||
Color.Coral, |
|||
Color.CornflowerBlue, |
|||
Color.Cornsilk, |
|||
Color.Crimson, |
|||
Color.Cyan, |
|||
Color.DarkBlue, |
|||
Color.DarkCyan, |
|||
Color.DarkGoldenrod, |
|||
Color.DarkGray, |
|||
Color.DarkGreen, |
|||
Color.DarkKhaki, |
|||
Color.DarkMagenta, |
|||
Color.DarkOliveGreen, |
|||
Color.DarkOrange, |
|||
Color.DarkOrchid, |
|||
Color.DarkRed, |
|||
Color.DarkSalmon, |
|||
Color.DarkSeaGreen, |
|||
Color.DarkSlateBlue, |
|||
Color.DarkSlateGray, |
|||
Color.DarkTurquoise, |
|||
Color.DarkViolet, |
|||
Color.DeepPink, |
|||
Color.DeepSkyBlue, |
|||
Color.DimGray, |
|||
Color.DodgerBlue, |
|||
Color.Firebrick, |
|||
Color.FloralWhite, |
|||
Color.ForestGreen, |
|||
Color.Fuchsia, |
|||
Color.Gainsboro, |
|||
Color.GhostWhite, |
|||
Color.Gold, |
|||
Color.Goldenrod, |
|||
Color.Gray, |
|||
Color.Green, |
|||
Color.GreenYellow, |
|||
Color.Honeydew, |
|||
Color.HotPink, |
|||
Color.IndianRed, |
|||
Color.Indigo, |
|||
Color.Ivory, |
|||
Color.Khaki, |
|||
Color.Lavender, |
|||
Color.LavenderBlush, |
|||
Color.LawnGreen, |
|||
Color.LemonChiffon, |
|||
Color.LightBlue, |
|||
Color.LightCoral, |
|||
Color.LightCyan, |
|||
Color.LightGoldenrodYellow, |
|||
Color.LightGray, |
|||
Color.LightGreen, |
|||
Color.LightPink, |
|||
Color.LightSalmon, |
|||
Color.LightSeaGreen, |
|||
Color.LightSkyBlue, |
|||
Color.LightSlateGray, |
|||
Color.LightSteelBlue, |
|||
Color.LightYellow, |
|||
Color.Lime, |
|||
Color.LimeGreen, |
|||
Color.Linen, |
|||
Color.Magenta, |
|||
Color.Maroon, |
|||
Color.MediumAquamarine, |
|||
Color.MediumBlue, |
|||
Color.MediumOrchid, |
|||
Color.MediumPurple, |
|||
Color.MediumSeaGreen, |
|||
Color.MediumSlateBlue, |
|||
Color.MediumSpringGreen, |
|||
Color.MediumTurquoise, |
|||
Color.MediumVioletRed, |
|||
Color.MidnightBlue, |
|||
Color.MintCream, |
|||
Color.MistyRose, |
|||
Color.Moccasin, |
|||
Color.NavajoWhite, |
|||
Color.Navy, |
|||
Color.OldLace, |
|||
Color.Olive, |
|||
Color.OliveDrab, |
|||
Color.Orange, |
|||
Color.OrangeRed, |
|||
Color.Orchid, |
|||
Color.PaleGoldenrod, |
|||
Color.PaleGreen, |
|||
Color.PaleTurquoise, |
|||
Color.PaleVioletRed, |
|||
Color.PapayaWhip, |
|||
Color.PeachPuff, |
|||
Color.Peru, |
|||
Color.Pink, |
|||
Color.Plum, |
|||
Color.PowderBlue, |
|||
Color.Purple, |
|||
Color.RebeccaPurple, |
|||
Color.Red, |
|||
Color.RosyBrown, |
|||
Color.RoyalBlue, |
|||
Color.SaddleBrown, |
|||
Color.Salmon, |
|||
Color.SandyBrown, |
|||
Color.SeaGreen, |
|||
Color.SeaShell, |
|||
Color.Sienna, |
|||
Color.Silver, |
|||
Color.SkyBlue, |
|||
Color.SlateBlue, |
|||
Color.SlateGray, |
|||
Color.Snow, |
|||
Color.SpringGreen, |
|||
Color.SteelBlue, |
|||
Color.Tan, |
|||
Color.Teal, |
|||
Color.Thistle, |
|||
Color.Tomato, |
|||
Color.Transparent, |
|||
Color.Turquoise, |
|||
Color.Violet, |
|||
Color.Wheat, |
|||
Color.White, |
|||
Color.WhiteSmoke, |
|||
Color.Yellow, |
|||
Color.YellowGreen |
|||
}.ToArray(); |
|||
} |
|||
} |
|||
} |
|||
@ -1,728 +0,0 @@ |
|||
// <copyright file="ColorDefinitions.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp |
|||
{ |
|||
/// <summary>
|
|||
/// Packed vector type containing four 8-bit unsigned normalized values ranging from 0 to 255.
|
|||
/// The color components are stored in red, green, blue, and alpha order.
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// This struct is fully mutable. This is done (against the guidelines) for the sake of performance,
|
|||
/// as it avoids the need to create new values for modification operations.
|
|||
/// </remarks>
|
|||
public partial struct Color |
|||
{ |
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #F0F8FF.
|
|||
/// </summary>
|
|||
public static readonly Color AliceBlue = NamedColors<Color>.AliceBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FAEBD7.
|
|||
/// </summary>
|
|||
public static readonly Color AntiqueWhite = NamedColors<Color>.AntiqueWhite; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #00FFFF.
|
|||
/// </summary>
|
|||
public static readonly Color Aqua = NamedColors<Color>.Aqua; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #7FFFD4.
|
|||
/// </summary>
|
|||
public static readonly Color Aquamarine = NamedColors<Color>.Aquamarine; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #F0FFFF.
|
|||
/// </summary>
|
|||
public static readonly Color Azure = NamedColors<Color>.Azure; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #F5F5DC.
|
|||
/// </summary>
|
|||
public static readonly Color Beige = NamedColors<Color>.Beige; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFE4C4.
|
|||
/// </summary>
|
|||
public static readonly Color Bisque = NamedColors<Color>.Bisque; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #000000.
|
|||
/// </summary>
|
|||
public static readonly Color Black = NamedColors<Color>.Black; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFEBCD.
|
|||
/// </summary>
|
|||
public static readonly Color BlanchedAlmond = NamedColors<Color>.BlanchedAlmond; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #0000FF.
|
|||
/// </summary>
|
|||
public static readonly Color Blue = NamedColors<Color>.Blue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #8A2BE2.
|
|||
/// </summary>
|
|||
public static readonly Color BlueViolet = NamedColors<Color>.BlueViolet; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #A52A2A.
|
|||
/// </summary>
|
|||
public static readonly Color Brown = NamedColors<Color>.Brown; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #DEB887.
|
|||
/// </summary>
|
|||
public static readonly Color BurlyWood = NamedColors<Color>.BurlyWood; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #5F9EA0.
|
|||
/// </summary>
|
|||
public static readonly Color CadetBlue = NamedColors<Color>.CadetBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #7FFF00.
|
|||
/// </summary>
|
|||
public static readonly Color Chartreuse = NamedColors<Color>.Chartreuse; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #D2691E.
|
|||
/// </summary>
|
|||
public static readonly Color Chocolate = NamedColors<Color>.Chocolate; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FF7F50.
|
|||
/// </summary>
|
|||
public static readonly Color Coral = NamedColors<Color>.Coral; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #6495ED.
|
|||
/// </summary>
|
|||
public static readonly Color CornflowerBlue = NamedColors<Color>.CornflowerBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFF8DC.
|
|||
/// </summary>
|
|||
public static readonly Color Cornsilk = NamedColors<Color>.Cornsilk; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #DC143C.
|
|||
/// </summary>
|
|||
public static readonly Color Crimson = NamedColors<Color>.Crimson; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #00FFFF.
|
|||
/// </summary>
|
|||
public static readonly Color Cyan = NamedColors<Color>.Cyan; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #00008B.
|
|||
/// </summary>
|
|||
public static readonly Color DarkBlue = NamedColors<Color>.DarkBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #008B8B.
|
|||
/// </summary>
|
|||
public static readonly Color DarkCyan = NamedColors<Color>.DarkCyan; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #B8860B.
|
|||
/// </summary>
|
|||
public static readonly Color DarkGoldenrod = NamedColors<Color>.DarkGoldenrod; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #A9A9A9.
|
|||
/// </summary>
|
|||
public static readonly Color DarkGray = NamedColors<Color>.DarkGray; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #006400.
|
|||
/// </summary>
|
|||
public static readonly Color DarkGreen = NamedColors<Color>.DarkGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #BDB76B.
|
|||
/// </summary>
|
|||
public static readonly Color DarkKhaki = NamedColors<Color>.DarkKhaki; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #8B008B.
|
|||
/// </summary>
|
|||
public static readonly Color DarkMagenta = NamedColors<Color>.DarkMagenta; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #556B2F.
|
|||
/// </summary>
|
|||
public static readonly Color DarkOliveGreen = NamedColors<Color>.DarkOliveGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FF8C00.
|
|||
/// </summary>
|
|||
public static readonly Color DarkOrange = NamedColors<Color>.DarkOrange; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #9932CC.
|
|||
/// </summary>
|
|||
public static readonly Color DarkOrchid = NamedColors<Color>.DarkOrchid; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #8B0000.
|
|||
/// </summary>
|
|||
public static readonly Color DarkRed = NamedColors<Color>.DarkRed; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #E9967A.
|
|||
/// </summary>
|
|||
public static readonly Color DarkSalmon = NamedColors<Color>.DarkSalmon; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #8FBC8B.
|
|||
/// </summary>
|
|||
public static readonly Color DarkSeaGreen = NamedColors<Color>.DarkSeaGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #483D8B.
|
|||
/// </summary>
|
|||
public static readonly Color DarkSlateBlue = NamedColors<Color>.DarkSlateBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #2F4F4F.
|
|||
/// </summary>
|
|||
public static readonly Color DarkSlateGray = NamedColors<Color>.DarkSlateGray; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #00CED1.
|
|||
/// </summary>
|
|||
public static readonly Color DarkTurquoise = NamedColors<Color>.DarkTurquoise; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #9400D3.
|
|||
/// </summary>
|
|||
public static readonly Color DarkViolet = NamedColors<Color>.DarkViolet; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FF1493.
|
|||
/// </summary>
|
|||
public static readonly Color DeepPink = NamedColors<Color>.DeepPink; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #00BFFF.
|
|||
/// </summary>
|
|||
public static readonly Color DeepSkyBlue = NamedColors<Color>.DeepSkyBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #696969.
|
|||
/// </summary>
|
|||
public static readonly Color DimGray = NamedColors<Color>.DimGray; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #1E90FF.
|
|||
/// </summary>
|
|||
public static readonly Color DodgerBlue = NamedColors<Color>.DodgerBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #B22222.
|
|||
/// </summary>
|
|||
public static readonly Color Firebrick = NamedColors<Color>.Firebrick; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFFAF0.
|
|||
/// </summary>
|
|||
public static readonly Color FloralWhite = NamedColors<Color>.FloralWhite; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #228B22.
|
|||
/// </summary>
|
|||
public static readonly Color ForestGreen = NamedColors<Color>.ForestGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FF00FF.
|
|||
/// </summary>
|
|||
public static readonly Color Fuchsia = NamedColors<Color>.Fuchsia; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #DCDCDC.
|
|||
/// </summary>
|
|||
public static readonly Color Gainsboro = NamedColors<Color>.Gainsboro; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #F8F8FF.
|
|||
/// </summary>
|
|||
public static readonly Color GhostWhite = NamedColors<Color>.GhostWhite; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFD700.
|
|||
/// </summary>
|
|||
public static readonly Color Gold = NamedColors<Color>.Gold; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #DAA520.
|
|||
/// </summary>
|
|||
public static readonly Color Goldenrod = NamedColors<Color>.Goldenrod; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #808080.
|
|||
/// </summary>
|
|||
public static readonly Color Gray = NamedColors<Color>.Gray; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #008000.
|
|||
/// </summary>
|
|||
public static readonly Color Green = NamedColors<Color>.Green; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #ADFF2F.
|
|||
/// </summary>
|
|||
public static readonly Color GreenYellow = NamedColors<Color>.GreenYellow; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #F0FFF0.
|
|||
/// </summary>
|
|||
public static readonly Color Honeydew = NamedColors<Color>.Honeydew; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FF69B4.
|
|||
/// </summary>
|
|||
public static readonly Color HotPink = NamedColors<Color>.HotPink; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #CD5C5C.
|
|||
/// </summary>
|
|||
public static readonly Color IndianRed = NamedColors<Color>.IndianRed; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #4B0082.
|
|||
/// </summary>
|
|||
public static readonly Color Indigo = NamedColors<Color>.Indigo; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFFFF0.
|
|||
/// </summary>
|
|||
public static readonly Color Ivory = NamedColors<Color>.Ivory; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #F0E68C.
|
|||
/// </summary>
|
|||
public static readonly Color Khaki = NamedColors<Color>.Khaki; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #E6E6FA.
|
|||
/// </summary>
|
|||
public static readonly Color Lavender = NamedColors<Color>.Lavender; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFF0F5.
|
|||
/// </summary>
|
|||
public static readonly Color LavenderBlush = NamedColors<Color>.LavenderBlush; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #7CFC00.
|
|||
/// </summary>
|
|||
public static readonly Color LawnGreen = NamedColors<Color>.LawnGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFFACD.
|
|||
/// </summary>
|
|||
public static readonly Color LemonChiffon = NamedColors<Color>.LemonChiffon; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #ADD8E6.
|
|||
/// </summary>
|
|||
public static readonly Color LightBlue = NamedColors<Color>.LightBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #F08080.
|
|||
/// </summary>
|
|||
public static readonly Color LightCoral = NamedColors<Color>.LightCoral; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #E0FFFF.
|
|||
/// </summary>
|
|||
public static readonly Color LightCyan = NamedColors<Color>.LightCyan; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FAFAD2.
|
|||
/// </summary>
|
|||
public static readonly Color LightGoldenrodYellow = NamedColors<Color>.LightGoldenrodYellow; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #D3D3D3.
|
|||
/// </summary>
|
|||
public static readonly Color LightGray = NamedColors<Color>.LightGray; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #90EE90.
|
|||
/// </summary>
|
|||
public static readonly Color LightGreen = NamedColors<Color>.LightGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFB6C1.
|
|||
/// </summary>
|
|||
public static readonly Color LightPink = NamedColors<Color>.LightPink; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFA07A.
|
|||
/// </summary>
|
|||
public static readonly Color LightSalmon = NamedColors<Color>.LightSalmon; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #20B2AA.
|
|||
/// </summary>
|
|||
public static readonly Color LightSeaGreen = NamedColors<Color>.LightSeaGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #87CEFA.
|
|||
/// </summary>
|
|||
public static readonly Color LightSkyBlue = NamedColors<Color>.LightSkyBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #778899.
|
|||
/// </summary>
|
|||
public static readonly Color LightSlateGray = NamedColors<Color>.LightSlateGray; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #B0C4DE.
|
|||
/// </summary>
|
|||
public static readonly Color LightSteelBlue = NamedColors<Color>.LightSteelBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFFFE0.
|
|||
/// </summary>
|
|||
public static readonly Color LightYellow = NamedColors<Color>.LightYellow; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #00FF00.
|
|||
/// </summary>
|
|||
public static readonly Color Lime = NamedColors<Color>.Lime; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #32CD32.
|
|||
/// </summary>
|
|||
public static readonly Color LimeGreen = NamedColors<Color>.LimeGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FAF0E6.
|
|||
/// </summary>
|
|||
public static readonly Color Linen = NamedColors<Color>.Linen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FF00FF.
|
|||
/// </summary>
|
|||
public static readonly Color Magenta = NamedColors<Color>.Magenta; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #800000.
|
|||
/// </summary>
|
|||
public static readonly Color Maroon = NamedColors<Color>.Maroon; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #66CDAA.
|
|||
/// </summary>
|
|||
public static readonly Color MediumAquamarine = NamedColors<Color>.MediumAquamarine; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #0000CD.
|
|||
/// </summary>
|
|||
public static readonly Color MediumBlue = NamedColors<Color>.MediumBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #BA55D3.
|
|||
/// </summary>
|
|||
public static readonly Color MediumOrchid = NamedColors<Color>.MediumOrchid; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #9370DB.
|
|||
/// </summary>
|
|||
public static readonly Color MediumPurple = NamedColors<Color>.MediumPurple; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #3CB371.
|
|||
/// </summary>
|
|||
public static readonly Color MediumSeaGreen = NamedColors<Color>.MediumSeaGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #7B68EE.
|
|||
/// </summary>
|
|||
public static readonly Color MediumSlateBlue = NamedColors<Color>.MediumSlateBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #00FA9A.
|
|||
/// </summary>
|
|||
public static readonly Color MediumSpringGreen = NamedColors<Color>.MediumSpringGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #48D1CC.
|
|||
/// </summary>
|
|||
public static readonly Color MediumTurquoise = NamedColors<Color>.MediumTurquoise; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #C71585.
|
|||
/// </summary>
|
|||
public static readonly Color MediumVioletRed = NamedColors<Color>.MediumVioletRed; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #191970.
|
|||
/// </summary>
|
|||
public static readonly Color MidnightBlue = NamedColors<Color>.MidnightBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #F5FFFA.
|
|||
/// </summary>
|
|||
public static readonly Color MintCream = NamedColors<Color>.MintCream; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFE4E1.
|
|||
/// </summary>
|
|||
public static readonly Color MistyRose = NamedColors<Color>.MistyRose; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFE4B5.
|
|||
/// </summary>
|
|||
public static readonly Color Moccasin = NamedColors<Color>.Moccasin; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFDEAD.
|
|||
/// </summary>
|
|||
public static readonly Color NavajoWhite = NamedColors<Color>.NavajoWhite; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #000080.
|
|||
/// </summary>
|
|||
public static readonly Color Navy = NamedColors<Color>.Navy; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FDF5E6.
|
|||
/// </summary>
|
|||
public static readonly Color OldLace = NamedColors<Color>.OldLace; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #808000.
|
|||
/// </summary>
|
|||
public static readonly Color Olive = NamedColors<Color>.Olive; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #6B8E23.
|
|||
/// </summary>
|
|||
public static readonly Color OliveDrab = NamedColors<Color>.OliveDrab; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFA500.
|
|||
/// </summary>
|
|||
public static readonly Color Orange = NamedColors<Color>.Orange; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FF4500.
|
|||
/// </summary>
|
|||
public static readonly Color OrangeRed = NamedColors<Color>.OrangeRed; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #DA70D6.
|
|||
/// </summary>
|
|||
public static readonly Color Orchid = NamedColors<Color>.Orchid; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #EEE8AA.
|
|||
/// </summary>
|
|||
public static readonly Color PaleGoldenrod = NamedColors<Color>.PaleGoldenrod; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #98FB98.
|
|||
/// </summary>
|
|||
public static readonly Color PaleGreen = NamedColors<Color>.PaleGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #AFEEEE.
|
|||
/// </summary>
|
|||
public static readonly Color PaleTurquoise = NamedColors<Color>.PaleTurquoise; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #DB7093.
|
|||
/// </summary>
|
|||
public static readonly Color PaleVioletRed = NamedColors<Color>.PaleVioletRed; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFEFD5.
|
|||
/// </summary>
|
|||
public static readonly Color PapayaWhip = NamedColors<Color>.PapayaWhip; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFDAB9.
|
|||
/// </summary>
|
|||
public static readonly Color PeachPuff = NamedColors<Color>.PeachPuff; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #CD853F.
|
|||
/// </summary>
|
|||
public static readonly Color Peru = NamedColors<Color>.Peru; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFC0CB.
|
|||
/// </summary>
|
|||
public static readonly Color Pink = NamedColors<Color>.Pink; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #DDA0DD.
|
|||
/// </summary>
|
|||
public static readonly Color Plum = NamedColors<Color>.Plum; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #B0E0E6.
|
|||
/// </summary>
|
|||
public static readonly Color PowderBlue = NamedColors<Color>.PowderBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #800080.
|
|||
/// </summary>
|
|||
public static readonly Color Purple = NamedColors<Color>.Purple; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #663399.
|
|||
/// </summary>
|
|||
public static readonly Color RebeccaPurple = NamedColors<Color>.RebeccaPurple; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FF0000.
|
|||
/// </summary>
|
|||
public static readonly Color Red = NamedColors<Color>.Red; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #BC8F8F.
|
|||
/// </summary>
|
|||
public static readonly Color RosyBrown = NamedColors<Color>.RosyBrown; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #4169E1.
|
|||
/// </summary>
|
|||
public static readonly Color RoyalBlue = NamedColors<Color>.RoyalBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #8B4513.
|
|||
/// </summary>
|
|||
public static readonly Color SaddleBrown = NamedColors<Color>.SaddleBrown; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FA8072.
|
|||
/// </summary>
|
|||
public static readonly Color Salmon = NamedColors<Color>.Salmon; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #F4A460.
|
|||
/// </summary>
|
|||
public static readonly Color SandyBrown = NamedColors<Color>.SandyBrown; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #2E8B57.
|
|||
/// </summary>
|
|||
public static readonly Color SeaGreen = NamedColors<Color>.SeaGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFF5EE.
|
|||
/// </summary>
|
|||
public static readonly Color SeaShell = NamedColors<Color>.SeaShell; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #A0522D.
|
|||
/// </summary>
|
|||
public static readonly Color Sienna = NamedColors<Color>.Sienna; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #C0C0C0.
|
|||
/// </summary>
|
|||
public static readonly Color Silver = NamedColors<Color>.Silver; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #87CEEB.
|
|||
/// </summary>
|
|||
public static readonly Color SkyBlue = NamedColors<Color>.SkyBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #6A5ACD.
|
|||
/// </summary>
|
|||
public static readonly Color SlateBlue = NamedColors<Color>.SlateBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #708090.
|
|||
/// </summary>
|
|||
public static readonly Color SlateGray = NamedColors<Color>.SlateGray; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFFAFA.
|
|||
/// </summary>
|
|||
public static readonly Color Snow = NamedColors<Color>.Snow; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #00FF7F.
|
|||
/// </summary>
|
|||
public static readonly Color SpringGreen = NamedColors<Color>.SpringGreen; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #4682B4.
|
|||
/// </summary>
|
|||
public static readonly Color SteelBlue = NamedColors<Color>.SteelBlue; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #D2B48C.
|
|||
/// </summary>
|
|||
public static readonly Color Tan = NamedColors<Color>.Tan; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #008080.
|
|||
/// </summary>
|
|||
public static readonly Color Teal = NamedColors<Color>.Teal; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #D8BFD8.
|
|||
/// </summary>
|
|||
public static readonly Color Thistle = NamedColors<Color>.Thistle; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FF6347.
|
|||
/// </summary>
|
|||
public static readonly Color Tomato = NamedColors<Color>.Tomato; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFFFFF.
|
|||
/// </summary>
|
|||
public static readonly Color Transparent = NamedColors<Color>.Transparent; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #40E0D0.
|
|||
/// </summary>
|
|||
public static readonly Color Turquoise = NamedColors<Color>.Turquoise; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #EE82EE.
|
|||
/// </summary>
|
|||
public static readonly Color Violet = NamedColors<Color>.Violet; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #F5DEB3.
|
|||
/// </summary>
|
|||
public static readonly Color Wheat = NamedColors<Color>.Wheat; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFFFFF.
|
|||
/// </summary>
|
|||
public static readonly Color White = NamedColors<Color>.White; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #F5F5F5.
|
|||
/// </summary>
|
|||
public static readonly Color WhiteSmoke = NamedColors<Color>.WhiteSmoke; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFFF00.
|
|||
/// </summary>
|
|||
public static readonly Color Yellow = NamedColors<Color>.Yellow; |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #9ACD32.
|
|||
/// </summary>
|
|||
public static readonly Color YellowGreen = NamedColors<Color>.YellowGreen; |
|||
} |
|||
} |
|||
@ -1,255 +0,0 @@ |
|||
// <copyright file="ColorTransforms.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp |
|||
{ |
|||
using System.Numerics; |
|||
|
|||
/// <summary>
|
|||
/// Packed vector type containing four 8-bit unsigned normalized values ranging from 0 to 255.
|
|||
/// The color components are stored in red, green, blue, and alpha order.
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// This struct is fully mutable. This is done (against the guidelines) for the sake of performance,
|
|||
/// as it avoids the need to create new values for modification operations.
|
|||
/// </remarks>
|
|||
public partial struct Color |
|||
{ |
|||
/// <summary>
|
|||
/// Adds the second color to the first.
|
|||
/// </summary>
|
|||
/// <param name="left">The first source color.</param>
|
|||
/// <param name="right">The second source color.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Color"/>.
|
|||
/// </returns>
|
|||
public static Color operator +(Color left, Color right) |
|||
{ |
|||
Vector4 add = left.ToVector4() + right.ToVector4(); |
|||
return new Color(Pack(ref add)); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Subtracts the second color from the first.
|
|||
/// </summary>
|
|||
/// <param name="left">The first source color.</param>
|
|||
/// <param name="right">The second source color.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Color"/>.
|
|||
/// </returns>
|
|||
public static Color operator -(Color left, Color right) |
|||
{ |
|||
Vector4 sub = left.ToVector4() - right.ToVector4(); |
|||
return new Color(Pack(ref sub)); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// The blending formula simply selects the source color.
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop color.</param>
|
|||
/// <param name="source">The source color.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Color"/>.
|
|||
/// </returns>
|
|||
public static Color Normal(Color backdrop, Color source) |
|||
{ |
|||
Vector4 normal = Vector4BlendTransforms.Normal(backdrop.ToVector4(), source.ToVector4()); |
|||
return new Color(Pack(ref normal)); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Blends two colors by multiplication.
|
|||
/// <remarks>
|
|||
/// The source color is multiplied by the destination color and replaces the destination.
|
|||
/// The resultant color is always at least as dark as either the source or destination color.
|
|||
/// Multiplying any color with black results in black. Multiplying any color with white preserves the
|
|||
/// original color.
|
|||
/// </remarks>
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop color.</param>
|
|||
/// <param name="source">The source color.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Color"/>.
|
|||
/// </returns>
|
|||
public static Color Multiply(Color backdrop, Color source) |
|||
{ |
|||
Vector4 multiply = Vector4BlendTransforms.Multiply(backdrop.ToVector4(), source.ToVector4()); |
|||
return new Color(Pack(ref multiply)); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Multiplies the complements of the backdrop and source color values, then complements the result.
|
|||
/// <remarks>
|
|||
/// The result color is always at least as light as either of the two constituent colors. Screening any
|
|||
/// color with white produces white; screening with black leaves the original color unchanged.
|
|||
/// The effect is similar to projecting multiple photographic slides simultaneously onto a single screen.
|
|||
/// </remarks>
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop color.</param>
|
|||
/// <param name="source">The source color.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Color"/>.
|
|||
/// </returns>
|
|||
public static Color Screen(Color backdrop, Color source) |
|||
{ |
|||
Vector4 subtract = Vector4BlendTransforms.Screen(backdrop.ToVector4(), source.ToVector4()); |
|||
return new Color(Pack(ref subtract)); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Multiplies or screens the colors, depending on the source color value. The effect is similar to
|
|||
/// shining a harsh spotlight on the backdrop.
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop color.</param>
|
|||
/// <param name="source">The source color.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Color"/>.
|
|||
/// </returns>
|
|||
public static Color HardLight(Color backdrop, Color source) |
|||
{ |
|||
Vector4 hardlight = Vector4BlendTransforms.HardLight(backdrop.ToVector4(), source.ToVector4()); |
|||
return new Color(Pack(ref hardlight)); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Multiplies or screens the colors, depending on the backdrop color value.
|
|||
/// <remarks>
|
|||
/// Source colors overlay the backdrop while preserving its highlights and shadows.
|
|||
/// The backdrop color is not replaced but is mixed with the source color to reflect the lightness or darkness
|
|||
/// of the backdrop.
|
|||
/// </remarks>
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop color.</param>
|
|||
/// <param name="source">The source color.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Color"/>.
|
|||
/// </returns>
|
|||
public static Color Overlay(Color backdrop, Color source) |
|||
{ |
|||
Vector4 overlay = Vector4BlendTransforms.Overlay(backdrop.ToVector4(), source.ToVector4()); |
|||
return new Color(Pack(ref overlay)); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Selects the darker of the backdrop and source colors.
|
|||
/// The backdrop is replaced with the source where the source is darker; otherwise, it is left unchanged.
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop color.</param>
|
|||
/// <param name="source">The source color.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Color"/>.
|
|||
/// </returns>
|
|||
public static Color Darken(Color backdrop, Color source) |
|||
{ |
|||
Vector4 darken = Vector4BlendTransforms.Darken(backdrop.ToVector4(), source.ToVector4()); |
|||
return new Color(Pack(ref darken)); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Selects the lighter of the backdrop and source colors.
|
|||
/// The backdrop is replaced with the source where the source is lighter; otherwise, it is left unchanged.
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop color.</param>
|
|||
/// <param name="source">The source color.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Color"/>.
|
|||
/// </returns>
|
|||
public static Color Lighten(Color backdrop, Color source) |
|||
{ |
|||
Vector4 lighten = Vector4BlendTransforms.Lighten(backdrop.ToVector4(), source.ToVector4()); |
|||
return new Color(Pack(ref lighten)); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Darkens or lightens the colors, depending on the source color value. The effect is similar to shining
|
|||
/// a diffused spotlight on the backdrop.
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop color.</param>
|
|||
/// <param name="source">The source color.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Color"/>.
|
|||
/// </returns>
|
|||
public static Color SoftLight(Color backdrop, Color source) |
|||
{ |
|||
Vector4 softlight = Vector4BlendTransforms.SoftLight(backdrop.ToVector4(), source.ToVector4()); |
|||
return new Color(Pack(ref softlight)); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Brightens the backdrop color to reflect the source color. Painting with black produces no changes.
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop color.</param>
|
|||
/// <param name="source">The source color.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Color"/>.
|
|||
/// </returns>
|
|||
public static Color ColorDodge(Color backdrop, Color source) |
|||
{ |
|||
Vector4 dodge = Vector4BlendTransforms.Dodge(backdrop.ToVector4(), source.ToVector4()); |
|||
return new Color(Pack(ref dodge)); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Darkens the backdrop color to reflect the source color. Painting with white produces no change.
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop color.</param>
|
|||
/// <param name="source">The source color.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Color"/>.
|
|||
/// </returns>
|
|||
public static Color ColorBurn(Color backdrop, Color source) |
|||
{ |
|||
Vector4 burn = Vector4BlendTransforms.Burn(backdrop.ToVector4(), source.ToVector4()); |
|||
return new Color(Pack(ref burn)); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Subtracts the darker of the two constituent colors from the lighter color.
|
|||
/// Painting with white inverts the backdrop color; painting with black produces no change.
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop color.</param>
|
|||
/// <param name="source">The source color.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Color"/>.
|
|||
/// </returns>
|
|||
public static Color Difference(Color backdrop, Color source) |
|||
{ |
|||
Vector4 difference = Vector4BlendTransforms.Difference(backdrop.ToVector4(), source.ToVector4()); |
|||
return new Color(Pack(ref difference)); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Produces an effect similar to that of the <see cref="Difference"/> mode but lower in contrast. Painting with white
|
|||
/// inverts the backdrop color; painting with black produces no change
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop color.</param>
|
|||
/// <param name="source">The source color.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Color"/>.
|
|||
/// </returns>
|
|||
public static Color Exclusion(Color backdrop, Color source) |
|||
{ |
|||
Vector4 exclusion = Vector4BlendTransforms.Exclusion(backdrop.ToVector4(), source.ToVector4()); |
|||
return new Color(Pack(ref exclusion)); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Linearly interpolates from one color to another based on the given weighting.
|
|||
/// </summary>
|
|||
/// <param name="from">The first color value.</param>
|
|||
/// <param name="to">The second color value.</param>
|
|||
/// <param name="amount">
|
|||
/// A value between 0 and 1 indicating the weight of the second source vector.
|
|||
/// At amount = 0, "from" is returned, at amount = 1, "to" is returned.
|
|||
/// </param>
|
|||
/// <returns>
|
|||
/// The <see cref="Color"/>
|
|||
/// </returns>
|
|||
public static Color Lerp(Color from, Color to, float amount) |
|||
{ |
|||
return new Color(Vector4.Lerp(from.ToVector4(), to.ToVector4(), amount)); |
|||
} |
|||
} |
|||
} |
|||
@ -1,727 +0,0 @@ |
|||
// <copyright file="NamedColors{TColor}.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp |
|||
{ |
|||
using System; |
|||
|
|||
/// <summary>
|
|||
/// A set of named colors mapped to the provided Color space.
|
|||
/// </summary>
|
|||
/// <typeparam name="TColor">The type of the color.</typeparam>
|
|||
public static class NamedColors<TColor> |
|||
where TColor : struct, IPixel<TColor> |
|||
{ |
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #F0F8FF.
|
|||
/// </summary>
|
|||
public static readonly TColor AliceBlue = ColorBuilder<TColor>.FromRGBA(240, 248, 255, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FAEBD7.
|
|||
/// </summary>
|
|||
public static readonly TColor AntiqueWhite = ColorBuilder<TColor>.FromRGBA(250, 235, 215, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #00FFFF.
|
|||
/// </summary>
|
|||
public static readonly TColor Aqua = ColorBuilder<TColor>.FromRGBA(0, 255, 255, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #7FFFD4.
|
|||
/// </summary>
|
|||
public static readonly TColor Aquamarine = ColorBuilder<TColor>.FromRGBA(127, 255, 212, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #F0FFFF.
|
|||
/// </summary>
|
|||
public static readonly TColor Azure = ColorBuilder<TColor>.FromRGBA(240, 255, 255, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #F5F5DC.
|
|||
/// </summary>
|
|||
public static readonly TColor Beige = ColorBuilder<TColor>.FromRGBA(245, 245, 220, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFE4C4.
|
|||
/// </summary>
|
|||
public static readonly TColor Bisque = ColorBuilder<TColor>.FromRGBA(255, 228, 196, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #000000.
|
|||
/// </summary>
|
|||
public static readonly TColor Black = ColorBuilder<TColor>.FromRGBA(0, 0, 0, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFEBCD.
|
|||
/// </summary>
|
|||
public static readonly TColor BlanchedAlmond = ColorBuilder<TColor>.FromRGBA(255, 235, 205, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #0000FF.
|
|||
/// </summary>
|
|||
public static readonly TColor Blue = ColorBuilder<TColor>.FromRGBA(0, 0, 255, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #8A2BE2.
|
|||
/// </summary>
|
|||
public static readonly TColor BlueViolet = ColorBuilder<TColor>.FromRGBA(138, 43, 226, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #A52A2A.
|
|||
/// </summary>
|
|||
public static readonly TColor Brown = ColorBuilder<TColor>.FromRGBA(165, 42, 42, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #DEB887.
|
|||
/// </summary>
|
|||
public static readonly TColor BurlyWood = ColorBuilder<TColor>.FromRGBA(222, 184, 135, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #5F9EA0.
|
|||
/// </summary>
|
|||
public static readonly TColor CadetBlue = ColorBuilder<TColor>.FromRGBA(95, 158, 160, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #7FFF00.
|
|||
/// </summary>
|
|||
public static readonly TColor Chartreuse = ColorBuilder<TColor>.FromRGBA(127, 255, 0, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #D2691E.
|
|||
/// </summary>
|
|||
public static readonly TColor Chocolate = ColorBuilder<TColor>.FromRGBA(210, 105, 30, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FF7F50.
|
|||
/// </summary>
|
|||
public static readonly TColor Coral = ColorBuilder<TColor>.FromRGBA(255, 127, 80, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #6495ED.
|
|||
/// </summary>
|
|||
public static readonly TColor CornflowerBlue = ColorBuilder<TColor>.FromRGBA(100, 149, 237, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFF8DC.
|
|||
/// </summary>
|
|||
public static readonly TColor Cornsilk = ColorBuilder<TColor>.FromRGBA(255, 248, 220, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #DC143C.
|
|||
/// </summary>
|
|||
public static readonly TColor Crimson = ColorBuilder<TColor>.FromRGBA(220, 20, 60, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #00FFFF.
|
|||
/// </summary>
|
|||
public static readonly TColor Cyan = ColorBuilder<TColor>.FromRGBA(0, 255, 255, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #00008B.
|
|||
/// </summary>
|
|||
public static readonly TColor DarkBlue = ColorBuilder<TColor>.FromRGBA(0, 0, 139, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #008B8B.
|
|||
/// </summary>
|
|||
public static readonly TColor DarkCyan = ColorBuilder<TColor>.FromRGBA(0, 139, 139, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #B8860B.
|
|||
/// </summary>
|
|||
public static readonly TColor DarkGoldenrod = ColorBuilder<TColor>.FromRGBA(184, 134, 11, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #A9A9A9.
|
|||
/// </summary>
|
|||
public static readonly TColor DarkGray = ColorBuilder<TColor>.FromRGBA(169, 169, 169, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #006400.
|
|||
/// </summary>
|
|||
public static readonly TColor DarkGreen = ColorBuilder<TColor>.FromRGBA(0, 100, 0, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #BDB76B.
|
|||
/// </summary>
|
|||
public static readonly TColor DarkKhaki = ColorBuilder<TColor>.FromRGBA(189, 183, 107, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #8B008B.
|
|||
/// </summary>
|
|||
public static readonly TColor DarkMagenta = ColorBuilder<TColor>.FromRGBA(139, 0, 139, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #556B2F.
|
|||
/// </summary>
|
|||
public static readonly TColor DarkOliveGreen = ColorBuilder<TColor>.FromRGBA(85, 107, 47, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FF8C00.
|
|||
/// </summary>
|
|||
public static readonly TColor DarkOrange = ColorBuilder<TColor>.FromRGBA(255, 140, 0, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #9932CC.
|
|||
/// </summary>
|
|||
public static readonly TColor DarkOrchid = ColorBuilder<TColor>.FromRGBA(153, 50, 204, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #8B0000.
|
|||
/// </summary>
|
|||
public static readonly TColor DarkRed = ColorBuilder<TColor>.FromRGBA(139, 0, 0, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #E9967A.
|
|||
/// </summary>
|
|||
public static readonly TColor DarkSalmon = ColorBuilder<TColor>.FromRGBA(233, 150, 122, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #8FBC8B.
|
|||
/// </summary>
|
|||
public static readonly TColor DarkSeaGreen = ColorBuilder<TColor>.FromRGBA(143, 188, 139, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #483D8B.
|
|||
/// </summary>
|
|||
public static readonly TColor DarkSlateBlue = ColorBuilder<TColor>.FromRGBA(72, 61, 139, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #2F4F4F.
|
|||
/// </summary>
|
|||
public static readonly TColor DarkSlateGray = ColorBuilder<TColor>.FromRGBA(47, 79, 79, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #00CED1.
|
|||
/// </summary>
|
|||
public static readonly TColor DarkTurquoise = ColorBuilder<TColor>.FromRGBA(0, 206, 209, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #9400D3.
|
|||
/// </summary>
|
|||
public static readonly TColor DarkViolet = ColorBuilder<TColor>.FromRGBA(148, 0, 211, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FF1493.
|
|||
/// </summary>
|
|||
public static readonly TColor DeepPink = ColorBuilder<TColor>.FromRGBA(255, 20, 147, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #00BFFF.
|
|||
/// </summary>
|
|||
public static readonly TColor DeepSkyBlue = ColorBuilder<TColor>.FromRGBA(0, 191, 255, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #696969.
|
|||
/// </summary>
|
|||
public static readonly TColor DimGray = ColorBuilder<TColor>.FromRGBA(105, 105, 105, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #1E90FF.
|
|||
/// </summary>
|
|||
public static readonly TColor DodgerBlue = ColorBuilder<TColor>.FromRGBA(30, 144, 255, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #B22222.
|
|||
/// </summary>
|
|||
public static readonly TColor Firebrick = ColorBuilder<TColor>.FromRGBA(178, 34, 34, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFFAF0.
|
|||
/// </summary>
|
|||
public static readonly TColor FloralWhite = ColorBuilder<TColor>.FromRGBA(255, 250, 240, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #228B22.
|
|||
/// </summary>
|
|||
public static readonly TColor ForestGreen = ColorBuilder<TColor>.FromRGBA(34, 139, 34, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FF00FF.
|
|||
/// </summary>
|
|||
public static readonly TColor Fuchsia = ColorBuilder<TColor>.FromRGBA(255, 0, 255, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #DCDCDC.
|
|||
/// </summary>
|
|||
public static readonly TColor Gainsboro = ColorBuilder<TColor>.FromRGBA(220, 220, 220, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #F8F8FF.
|
|||
/// </summary>
|
|||
public static readonly TColor GhostWhite = ColorBuilder<TColor>.FromRGBA(248, 248, 255, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFD700.
|
|||
/// </summary>
|
|||
public static readonly TColor Gold = ColorBuilder<TColor>.FromRGBA(255, 215, 0, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #DAA520.
|
|||
/// </summary>
|
|||
public static readonly TColor Goldenrod = ColorBuilder<TColor>.FromRGBA(218, 165, 32, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #808080.
|
|||
/// </summary>
|
|||
public static readonly TColor Gray = ColorBuilder<TColor>.FromRGBA(128, 128, 128, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #008000.
|
|||
/// </summary>
|
|||
public static readonly TColor Green = ColorBuilder<TColor>.FromRGBA(0, 128, 0, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #ADFF2F.
|
|||
/// </summary>
|
|||
public static readonly TColor GreenYellow = ColorBuilder<TColor>.FromRGBA(173, 255, 47, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #F0FFF0.
|
|||
/// </summary>
|
|||
public static readonly TColor Honeydew = ColorBuilder<TColor>.FromRGBA(240, 255, 240, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FF69B4.
|
|||
/// </summary>
|
|||
public static readonly TColor HotPink = ColorBuilder<TColor>.FromRGBA(255, 105, 180, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #CD5C5C.
|
|||
/// </summary>
|
|||
public static readonly TColor IndianRed = ColorBuilder<TColor>.FromRGBA(205, 92, 92, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #4B0082.
|
|||
/// </summary>
|
|||
public static readonly TColor Indigo = ColorBuilder<TColor>.FromRGBA(75, 0, 130, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFFFF0.
|
|||
/// </summary>
|
|||
public static readonly TColor Ivory = ColorBuilder<TColor>.FromRGBA(255, 255, 240, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #F0E68C.
|
|||
/// </summary>
|
|||
public static readonly TColor Khaki = ColorBuilder<TColor>.FromRGBA(240, 230, 140, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #E6E6FA.
|
|||
/// </summary>
|
|||
public static readonly TColor Lavender = ColorBuilder<TColor>.FromRGBA(230, 230, 250, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFF0F5.
|
|||
/// </summary>
|
|||
public static readonly TColor LavenderBlush = ColorBuilder<TColor>.FromRGBA(255, 240, 245, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #7CFC00.
|
|||
/// </summary>
|
|||
public static readonly TColor LawnGreen = ColorBuilder<TColor>.FromRGBA(124, 252, 0, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFFACD.
|
|||
/// </summary>
|
|||
public static readonly TColor LemonChiffon = ColorBuilder<TColor>.FromRGBA(255, 250, 205, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #ADD8E6.
|
|||
/// </summary>
|
|||
public static readonly TColor LightBlue = ColorBuilder<TColor>.FromRGBA(173, 216, 230, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #F08080.
|
|||
/// </summary>
|
|||
public static readonly TColor LightCoral = ColorBuilder<TColor>.FromRGBA(240, 128, 128, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #E0FFFF.
|
|||
/// </summary>
|
|||
public static readonly TColor LightCyan = ColorBuilder<TColor>.FromRGBA(224, 255, 255, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FAFAD2.
|
|||
/// </summary>
|
|||
public static readonly TColor LightGoldenrodYellow = ColorBuilder<TColor>.FromRGBA(250, 250, 210, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #D3D3D3.
|
|||
/// </summary>
|
|||
public static readonly TColor LightGray = ColorBuilder<TColor>.FromRGBA(211, 211, 211, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #90EE90.
|
|||
/// </summary>
|
|||
public static readonly TColor LightGreen = ColorBuilder<TColor>.FromRGBA(144, 238, 144, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFB6C1.
|
|||
/// </summary>
|
|||
public static readonly TColor LightPink = ColorBuilder<TColor>.FromRGBA(255, 182, 193, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFA07A.
|
|||
/// </summary>
|
|||
public static readonly TColor LightSalmon = ColorBuilder<TColor>.FromRGBA(255, 160, 122, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #20B2AA.
|
|||
/// </summary>
|
|||
public static readonly TColor LightSeaGreen = ColorBuilder<TColor>.FromRGBA(32, 178, 170, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #87CEFA.
|
|||
/// </summary>
|
|||
public static readonly TColor LightSkyBlue = ColorBuilder<TColor>.FromRGBA(135, 206, 250, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #778899.
|
|||
/// </summary>
|
|||
public static readonly TColor LightSlateGray = ColorBuilder<TColor>.FromRGBA(119, 136, 153, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #B0C4DE.
|
|||
/// </summary>
|
|||
public static readonly TColor LightSteelBlue = ColorBuilder<TColor>.FromRGBA(176, 196, 222, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFFFE0.
|
|||
/// </summary>
|
|||
public static readonly TColor LightYellow = ColorBuilder<TColor>.FromRGBA(255, 255, 224, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #00FF00.
|
|||
/// </summary>
|
|||
public static readonly TColor Lime = ColorBuilder<TColor>.FromRGBA(0, 255, 0, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #32CD32.
|
|||
/// </summary>
|
|||
public static readonly TColor LimeGreen = ColorBuilder<TColor>.FromRGBA(50, 205, 50, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FAF0E6.
|
|||
/// </summary>
|
|||
public static readonly TColor Linen = ColorBuilder<TColor>.FromRGBA(250, 240, 230, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FF00FF.
|
|||
/// </summary>
|
|||
public static readonly TColor Magenta = ColorBuilder<TColor>.FromRGBA(255, 0, 255, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #800000.
|
|||
/// </summary>
|
|||
public static readonly TColor Maroon = ColorBuilder<TColor>.FromRGBA(128, 0, 0, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #66CDAA.
|
|||
/// </summary>
|
|||
public static readonly TColor MediumAquamarine = ColorBuilder<TColor>.FromRGBA(102, 205, 170, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #0000CD.
|
|||
/// </summary>
|
|||
public static readonly TColor MediumBlue = ColorBuilder<TColor>.FromRGBA(0, 0, 205, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #BA55D3.
|
|||
/// </summary>
|
|||
public static readonly TColor MediumOrchid = ColorBuilder<TColor>.FromRGBA(186, 85, 211, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #9370DB.
|
|||
/// </summary>
|
|||
public static readonly TColor MediumPurple = ColorBuilder<TColor>.FromRGBA(147, 112, 219, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #3CB371.
|
|||
/// </summary>
|
|||
public static readonly TColor MediumSeaGreen = ColorBuilder<TColor>.FromRGBA(60, 179, 113, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #7B68EE.
|
|||
/// </summary>
|
|||
public static readonly TColor MediumSlateBlue = ColorBuilder<TColor>.FromRGBA(123, 104, 238, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #00FA9A.
|
|||
/// </summary>
|
|||
public static readonly TColor MediumSpringGreen = ColorBuilder<TColor>.FromRGBA(0, 250, 154, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #48D1CC.
|
|||
/// </summary>
|
|||
public static readonly TColor MediumTurquoise = ColorBuilder<TColor>.FromRGBA(72, 209, 204, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #C71585.
|
|||
/// </summary>
|
|||
public static readonly TColor MediumVioletRed = ColorBuilder<TColor>.FromRGBA(199, 21, 133, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #191970.
|
|||
/// </summary>
|
|||
public static readonly TColor MidnightBlue = ColorBuilder<TColor>.FromRGBA(25, 25, 112, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #F5FFFA.
|
|||
/// </summary>
|
|||
public static readonly TColor MintCream = ColorBuilder<TColor>.FromRGBA(245, 255, 250, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFE4E1.
|
|||
/// </summary>
|
|||
public static readonly TColor MistyRose = ColorBuilder<TColor>.FromRGBA(255, 228, 225, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFE4B5.
|
|||
/// </summary>
|
|||
public static readonly TColor Moccasin = ColorBuilder<TColor>.FromRGBA(255, 228, 181, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFDEAD.
|
|||
/// </summary>
|
|||
public static readonly TColor NavajoWhite = ColorBuilder<TColor>.FromRGBA(255, 222, 173, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #000080.
|
|||
/// </summary>
|
|||
public static readonly TColor Navy = ColorBuilder<TColor>.FromRGBA(0, 0, 128, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FDF5E6.
|
|||
/// </summary>
|
|||
public static readonly TColor OldLace = ColorBuilder<TColor>.FromRGBA(253, 245, 230, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #808000.
|
|||
/// </summary>
|
|||
public static readonly TColor Olive = ColorBuilder<TColor>.FromRGBA(128, 128, 0, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #6B8E23.
|
|||
/// </summary>
|
|||
public static readonly TColor OliveDrab = ColorBuilder<TColor>.FromRGBA(107, 142, 35, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFA500.
|
|||
/// </summary>
|
|||
public static readonly TColor Orange = ColorBuilder<TColor>.FromRGBA(255, 165, 0, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FF4500.
|
|||
/// </summary>
|
|||
public static readonly TColor OrangeRed = ColorBuilder<TColor>.FromRGBA(255, 69, 0, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #DA70D6.
|
|||
/// </summary>
|
|||
public static readonly TColor Orchid = ColorBuilder<TColor>.FromRGBA(218, 112, 214, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #EEE8AA.
|
|||
/// </summary>
|
|||
public static readonly TColor PaleGoldenrod = ColorBuilder<TColor>.FromRGBA(238, 232, 170, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #98FB98.
|
|||
/// </summary>
|
|||
public static readonly TColor PaleGreen = ColorBuilder<TColor>.FromRGBA(152, 251, 152, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #AFEEEE.
|
|||
/// </summary>
|
|||
public static readonly TColor PaleTurquoise = ColorBuilder<TColor>.FromRGBA(175, 238, 238, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #DB7093.
|
|||
/// </summary>
|
|||
public static readonly TColor PaleVioletRed = ColorBuilder<TColor>.FromRGBA(219, 112, 147, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFEFD5.
|
|||
/// </summary>
|
|||
public static readonly TColor PapayaWhip = ColorBuilder<TColor>.FromRGBA(255, 239, 213, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFDAB9.
|
|||
/// </summary>
|
|||
public static readonly TColor PeachPuff = ColorBuilder<TColor>.FromRGBA(255, 218, 185, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #CD853F.
|
|||
/// </summary>
|
|||
public static readonly TColor Peru = ColorBuilder<TColor>.FromRGBA(205, 133, 63, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFC0CB.
|
|||
/// </summary>
|
|||
public static readonly TColor Pink = ColorBuilder<TColor>.FromRGBA(255, 192, 203, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #DDA0DD.
|
|||
/// </summary>
|
|||
public static readonly TColor Plum = ColorBuilder<TColor>.FromRGBA(221, 160, 221, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #B0E0E6.
|
|||
/// </summary>
|
|||
public static readonly TColor PowderBlue = ColorBuilder<TColor>.FromRGBA(176, 224, 230, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #800080.
|
|||
/// </summary>
|
|||
public static readonly TColor Purple = ColorBuilder<TColor>.FromRGBA(128, 0, 128, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #663399.
|
|||
/// </summary>
|
|||
public static readonly TColor RebeccaPurple = ColorBuilder<TColor>.FromRGBA(102, 51, 153, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FF0000.
|
|||
/// </summary>
|
|||
public static readonly TColor Red = ColorBuilder<TColor>.FromRGBA(255, 0, 0, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #BC8F8F.
|
|||
/// </summary>
|
|||
public static readonly TColor RosyBrown = ColorBuilder<TColor>.FromRGBA(188, 143, 143, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #4169E1.
|
|||
/// </summary>
|
|||
public static readonly TColor RoyalBlue = ColorBuilder<TColor>.FromRGBA(65, 105, 225, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #8B4513.
|
|||
/// </summary>
|
|||
public static readonly TColor SaddleBrown = ColorBuilder<TColor>.FromRGBA(139, 69, 19, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FA8072.
|
|||
/// </summary>
|
|||
public static readonly TColor Salmon = ColorBuilder<TColor>.FromRGBA(250, 128, 114, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #F4A460.
|
|||
/// </summary>
|
|||
public static readonly TColor SandyBrown = ColorBuilder<TColor>.FromRGBA(244, 164, 96, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #2E8B57.
|
|||
/// </summary>
|
|||
public static readonly TColor SeaGreen = ColorBuilder<TColor>.FromRGBA(46, 139, 87, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFF5EE.
|
|||
/// </summary>
|
|||
public static readonly TColor SeaShell = ColorBuilder<TColor>.FromRGBA(255, 245, 238, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #A0522D.
|
|||
/// </summary>
|
|||
public static readonly TColor Sienna = ColorBuilder<TColor>.FromRGBA(160, 82, 45, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #C0C0C0.
|
|||
/// </summary>
|
|||
public static readonly TColor Silver = ColorBuilder<TColor>.FromRGBA(192, 192, 192, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #87CEEB.
|
|||
/// </summary>
|
|||
public static readonly TColor SkyBlue = ColorBuilder<TColor>.FromRGBA(135, 206, 235, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #6A5ACD.
|
|||
/// </summary>
|
|||
public static readonly TColor SlateBlue = ColorBuilder<TColor>.FromRGBA(106, 90, 205, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #708090.
|
|||
/// </summary>
|
|||
public static readonly TColor SlateGray = ColorBuilder<TColor>.FromRGBA(112, 128, 144, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFFAFA.
|
|||
/// </summary>
|
|||
public static readonly TColor Snow = ColorBuilder<TColor>.FromRGBA(255, 250, 250, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #00FF7F.
|
|||
/// </summary>
|
|||
public static readonly TColor SpringGreen = ColorBuilder<TColor>.FromRGBA(0, 255, 127, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #4682B4.
|
|||
/// </summary>
|
|||
public static readonly TColor SteelBlue = ColorBuilder<TColor>.FromRGBA(70, 130, 180, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #D2B48C.
|
|||
/// </summary>
|
|||
public static readonly TColor Tan = ColorBuilder<TColor>.FromRGBA(210, 180, 140, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #008080.
|
|||
/// </summary>
|
|||
public static readonly TColor Teal = ColorBuilder<TColor>.FromRGBA(0, 128, 128, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #D8BFD8.
|
|||
/// </summary>
|
|||
public static readonly TColor Thistle = ColorBuilder<TColor>.FromRGBA(216, 191, 216, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FF6347.
|
|||
/// </summary>
|
|||
public static readonly TColor Tomato = ColorBuilder<TColor>.FromRGBA(255, 99, 71, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFFFFF.
|
|||
/// </summary>
|
|||
public static readonly TColor Transparent = ColorBuilder<TColor>.FromRGBA(255, 255, 255, 0); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #40E0D0.
|
|||
/// </summary>
|
|||
public static readonly TColor Turquoise = ColorBuilder<TColor>.FromRGBA(64, 224, 208, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #EE82EE.
|
|||
/// </summary>
|
|||
public static readonly TColor Violet = ColorBuilder<TColor>.FromRGBA(238, 130, 238, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #F5DEB3.
|
|||
/// </summary>
|
|||
public static readonly TColor Wheat = ColorBuilder<TColor>.FromRGBA(245, 222, 179, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFFFFF.
|
|||
/// </summary>
|
|||
public static readonly TColor White = ColorBuilder<TColor>.FromRGBA(255, 255, 255, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #F5F5F5.
|
|||
/// </summary>
|
|||
public static readonly TColor WhiteSmoke = ColorBuilder<TColor>.FromRGBA(245, 245, 245, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #FFFF00.
|
|||
/// </summary>
|
|||
public static readonly TColor Yellow = ColorBuilder<TColor>.FromRGBA(255, 255, 0, 255); |
|||
|
|||
/// <summary>
|
|||
/// Represents a <see cref="Color"/> matching the W3C definition that has an hex value of #9ACD32.
|
|||
/// </summary>
|
|||
public static readonly TColor YellowGreen = ColorBuilder<TColor>.FromRGBA(154, 205, 50, 255); |
|||
} |
|||
} |
|||
@ -1,256 +0,0 @@ |
|||
// <copyright file="BulkPixelOperations{TColor}.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp |
|||
{ |
|||
using System.Numerics; |
|||
using System.Runtime.CompilerServices; |
|||
|
|||
/// <summary>
|
|||
/// A stateless class implementing Strategy Pattern for batched pixel-data conversion operations
|
|||
/// for pixel buffers of type <typeparamref name="TColor"/>.
|
|||
/// </summary>
|
|||
/// <typeparam name="TColor">The pixel format.</typeparam>
|
|||
public unsafe class BulkPixelOperations<TColor> |
|||
where TColor : struct, IPixel<TColor> |
|||
{ |
|||
/// <summary>
|
|||
/// The size of <typeparamref name="TColor"/> in bytes
|
|||
/// </summary>
|
|||
private static readonly int ColorSize = Unsafe.SizeOf<TColor>(); |
|||
|
|||
/// <summary>
|
|||
/// Gets the global <see cref="BulkPixelOperations{TColor}"/> instance for the pixel type <typeparamref name="TColor"/>
|
|||
/// </summary>
|
|||
public static BulkPixelOperations<TColor> Instance { get; } = default(TColor).CreateBulkOperations(); |
|||
|
|||
/// <summary>
|
|||
/// Bulk version of <see cref="IPixel.PackFromVector4(Vector4)"/>
|
|||
/// </summary>
|
|||
/// <param name="sourceVectors">The <see cref="BufferSpan{T}"/> to the source vectors.</param>
|
|||
/// <param name="destColors">The <see cref="BufferSpan{T}"/> to the destination colors.</param>
|
|||
/// <param name="count">The number of pixels to convert.</param>
|
|||
internal virtual void PackFromVector4( |
|||
BufferSpan<Vector4> sourceVectors, |
|||
BufferSpan<TColor> destColors, |
|||
int count) |
|||
{ |
|||
Vector4* sp = (Vector4*)sourceVectors.PointerAtOffset; |
|||
byte* dp = (byte*)destColors; |
|||
|
|||
for (int i = 0; i < count; i++) |
|||
{ |
|||
Vector4 v = Unsafe.Read<Vector4>(sp); |
|||
TColor c = default(TColor); |
|||
c.PackFromVector4(v); |
|||
Unsafe.Write(dp, c); |
|||
|
|||
sp++; |
|||
dp += ColorSize; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Bulk version of <see cref="IPixel.ToVector4()"/>.
|
|||
/// </summary>
|
|||
/// <param name="sourceColors">The <see cref="BufferSpan{T}"/> to the source colors.</param>
|
|||
/// <param name="destVectors">The <see cref="BufferSpan{T}"/> to the destination vectors.</param>
|
|||
/// <param name="count">The number of pixels to convert.</param>
|
|||
internal virtual void ToVector4( |
|||
BufferSpan<TColor> sourceColors, |
|||
BufferSpan<Vector4> destVectors, |
|||
int count) |
|||
{ |
|||
byte* sp = (byte*)sourceColors; |
|||
Vector4* dp = (Vector4*)destVectors.PointerAtOffset; |
|||
|
|||
for (int i = 0; i < count; i++) |
|||
{ |
|||
TColor c = Unsafe.Read<TColor>(sp); |
|||
*dp = c.ToVector4(); |
|||
sp += ColorSize; |
|||
dp++; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Bulk version of <see cref="IPixel.PackFromBytes(byte, byte, byte, byte)"/> that converts data in <see cref="ComponentOrder.Xyz"/>.
|
|||
/// </summary>
|
|||
/// <param name="sourceBytes">The <see cref="BufferSpan{T}"/> to the source bytes.</param>
|
|||
/// <param name="destColors">The <see cref="BufferSpan{T}"/> to the destination colors.</param>
|
|||
/// <param name="count">The number of pixels to convert.</param>
|
|||
internal virtual void PackFromXyzBytes( |
|||
BufferSpan<byte> sourceBytes, |
|||
BufferSpan<TColor> destColors, |
|||
int count) |
|||
{ |
|||
byte* sp = (byte*)sourceBytes; |
|||
byte* dp = (byte*)destColors.PointerAtOffset; |
|||
|
|||
for (int i = 0; i < count; i++) |
|||
{ |
|||
TColor c = default(TColor); |
|||
c.PackFromBytes(sp[0], sp[1], sp[2], 255); |
|||
Unsafe.Write(dp, c); |
|||
sp += 3; |
|||
dp += ColorSize; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Bulk version of <see cref="IPixel.ToXyzBytes(byte[], int)"/>.
|
|||
/// </summary>
|
|||
/// <param name="sourceColors">The <see cref="BufferSpan{T}"/> to the source colors.</param>
|
|||
/// <param name="destBytes">The <see cref="BufferSpan{T}"/> to the destination bytes.</param>
|
|||
/// <param name="count">The number of pixels to convert.</param>
|
|||
internal virtual void ToXyzBytes(BufferSpan<TColor> sourceColors, BufferSpan<byte> destBytes, int count) |
|||
{ |
|||
byte* sp = (byte*)sourceColors; |
|||
byte[] dest = destBytes.Array; |
|||
|
|||
for (int i = destBytes.Start; i < destBytes.Start + (count * 3); i += 3) |
|||
{ |
|||
TColor c = Unsafe.Read<TColor>(sp); |
|||
c.ToXyzBytes(dest, i); |
|||
sp += ColorSize; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Bulk version of <see cref="IPixel.PackFromBytes(byte, byte, byte, byte)"/> that converts data in <see cref="ComponentOrder.Xyzw"/>.
|
|||
/// </summary>
|
|||
/// <param name="sourceBytes">The <see cref="BufferSpan{T}"/> to the source bytes.</param>
|
|||
/// <param name="destColors">The <see cref="BufferSpan{T}"/> to the destination colors.</param>
|
|||
/// <param name="count">The number of pixels to convert.</param>
|
|||
internal virtual void PackFromXyzwBytes( |
|||
BufferSpan<byte> sourceBytes, |
|||
BufferSpan<TColor> destColors, |
|||
int count) |
|||
{ |
|||
byte* sp = (byte*)sourceBytes; |
|||
byte* dp = (byte*)destColors.PointerAtOffset; |
|||
|
|||
for (int i = 0; i < count; i++) |
|||
{ |
|||
TColor c = default(TColor); |
|||
c.PackFromBytes(sp[0], sp[1], sp[2], sp[3]); |
|||
Unsafe.Write(dp, c); |
|||
sp += 4; |
|||
dp += ColorSize; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Bulk version of <see cref="IPixel.ToXyzwBytes(byte[], int)"/>.
|
|||
/// </summary>
|
|||
/// <param name="sourceColors">The <see cref="BufferSpan{T}"/> to the source colors.</param>
|
|||
/// <param name="destBytes">The <see cref="BufferSpan{T}"/> to the destination bytes.</param>
|
|||
/// <param name="count">The number of pixels to convert.</param>
|
|||
internal virtual void ToXyzwBytes( |
|||
BufferSpan<TColor> sourceColors, |
|||
BufferSpan<byte> destBytes, |
|||
int count) |
|||
{ |
|||
byte* sp = (byte*)sourceColors; |
|||
byte[] dest = destBytes.Array; |
|||
|
|||
for (int i = destBytes.Start; i < destBytes.Start + (count * 4); i += 4) |
|||
{ |
|||
TColor c = Unsafe.Read<TColor>(sp); |
|||
c.ToXyzwBytes(dest, i); |
|||
sp += ColorSize; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Bulk version of <see cref="IPixel.PackFromBytes(byte, byte, byte, byte)"/> that converts data in <see cref="ComponentOrder.Zyx"/>.
|
|||
/// </summary>
|
|||
/// <param name="sourceBytes">The <see cref="BufferSpan{T}"/> to the source bytes.</param>
|
|||
/// <param name="destColors">The <see cref="BufferSpan{T}"/> to the destination colors.</param>
|
|||
/// <param name="count">The number of pixels to convert.</param>
|
|||
internal virtual void PackFromZyxBytes( |
|||
BufferSpan<byte> sourceBytes, |
|||
BufferSpan<TColor> destColors, |
|||
int count) |
|||
{ |
|||
byte* sp = (byte*)sourceBytes; |
|||
byte* dp = (byte*)destColors.PointerAtOffset; |
|||
|
|||
for (int i = 0; i < count; i++) |
|||
{ |
|||
TColor c = default(TColor); |
|||
c.PackFromBytes(sp[2], sp[1], sp[0], 255); |
|||
Unsafe.Write(dp, c); |
|||
sp += 3; |
|||
dp += ColorSize; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Bulk version of <see cref="IPixel.ToZyxBytes(byte[], int)"/>.
|
|||
/// </summary>
|
|||
/// <param name="sourceColors">The <see cref="BufferSpan{T}"/> to the source colors.</param>
|
|||
/// <param name="destBytes">The <see cref="BufferSpan{T}"/> to the destination bytes.</param>
|
|||
/// <param name="count">The number of pixels to convert.</param>
|
|||
internal virtual void ToZyxBytes(BufferSpan<TColor> sourceColors, BufferSpan<byte> destBytes, int count) |
|||
{ |
|||
byte* sp = (byte*)sourceColors; |
|||
byte[] dest = destBytes.Array; |
|||
|
|||
for (int i = destBytes.Start; i < destBytes.Start + (count * 3); i += 3) |
|||
{ |
|||
TColor c = Unsafe.Read<TColor>(sp); |
|||
c.ToZyxBytes(dest, i); |
|||
sp += ColorSize; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Bulk version of <see cref="IPixel.PackFromBytes(byte, byte, byte, byte)"/> that converts data in <see cref="ComponentOrder.Zyxw"/>.
|
|||
/// </summary>
|
|||
/// <param name="sourceBytes">The <see cref="BufferSpan{T}"/> to the source bytes.</param>
|
|||
/// <param name="destColors">The <see cref="BufferSpan{T}"/> to the destination colors.</param>
|
|||
/// <param name="count">The number of pixels to convert.</param>
|
|||
internal virtual void PackFromZyxwBytes( |
|||
BufferSpan<byte> sourceBytes, |
|||
BufferSpan<TColor> destColors, |
|||
int count) |
|||
{ |
|||
byte* sp = (byte*)sourceBytes; |
|||
byte* dp = (byte*)destColors.PointerAtOffset; |
|||
|
|||
for (int i = 0; i < count; i++) |
|||
{ |
|||
TColor c = default(TColor); |
|||
c.PackFromBytes(sp[2], sp[1], sp[0], sp[3]); |
|||
Unsafe.Write(dp, c); |
|||
sp += 4; |
|||
dp += ColorSize; |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Bulk version of <see cref="IPixel.ToZyxwBytes(byte[], int)"/>.
|
|||
/// </summary>
|
|||
/// <param name="sourceColors">The <see cref="BufferSpan{T}"/> to the source colors.</param>
|
|||
/// <param name="destBytes">The <see cref="BufferSpan{T}"/> to the destination bytes.</param>
|
|||
/// <param name="count">The number of pixels to convert.</param>
|
|||
internal virtual void ToZyxwBytes( |
|||
BufferSpan<TColor> sourceColors, |
|||
BufferSpan<byte> destBytes, |
|||
int count) |
|||
{ |
|||
byte* sp = (byte*)sourceColors; |
|||
byte[] dest = destBytes.Array; |
|||
|
|||
for (int i = destBytes.Start; i < destBytes.Start + (count * 4); i += 4) |
|||
{ |
|||
TColor c = Unsafe.Read<TColor>(sp); |
|||
c.ToZyxwBytes(dest, i); |
|||
sp += ColorSize; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -1,3 +0,0 @@ |
|||
Pixel formats adapted and extended from: |
|||
|
|||
https://github.com/MonoGame/MonoGame |
|||
@ -1,292 +0,0 @@ |
|||
// <copyright file="Vector4BlendTransforms.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp |
|||
{ |
|||
using System.Numerics; |
|||
|
|||
/// <summary>
|
|||
/// Transform algorithms that match the equations defined in the W3C Compositing and Blending Level 1 specification.
|
|||
/// <see href="https://www.w3.org/TR/compositing-1/"/>
|
|||
/// </summary>
|
|||
public class Vector4BlendTransforms |
|||
{ |
|||
/// <summary>
|
|||
/// The blending formula simply selects the source vector.
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop vector.</param>
|
|||
/// <param name="source">The source vector.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Vector4"/>.
|
|||
/// </returns>
|
|||
public static Vector4 Normal(Vector4 backdrop, Vector4 source) |
|||
{ |
|||
return new Vector4(source.X, source.Y, source.Z, source.W); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Blends two vectors by multiplication.
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop vector.</param>
|
|||
/// <param name="source">The source vector.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Vector4"/>.
|
|||
/// </returns>
|
|||
public static Vector4 Multiply(Vector4 backdrop, Vector4 source) |
|||
{ |
|||
Vector4 multiply = backdrop * source; |
|||
multiply.W = backdrop.W; |
|||
return multiply; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Multiplies the complements of the backdrop and source vector values, then complements the result.
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop vector.</param>
|
|||
/// <param name="source">The source vector.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Vector4"/>.
|
|||
/// </returns>
|
|||
public static Vector4 Screen(Vector4 backdrop, Vector4 source) |
|||
{ |
|||
Vector4 subtract = backdrop + source - (backdrop * source); |
|||
subtract.W = backdrop.W; |
|||
return subtract; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Multiplies or screens the colors, depending on the source vector value.
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop vector.</param>
|
|||
/// <param name="source">The source vector.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Vector4"/>.
|
|||
/// </returns>
|
|||
public static Vector4 HardLight(Vector4 backdrop, Vector4 source) |
|||
{ |
|||
return new Vector4(BlendOverlay(source.X, backdrop.X), BlendOverlay(source.Y, backdrop.Y), BlendOverlay(source.Z, backdrop.Z), backdrop.W); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Multiplies or screens the vectors, depending on the backdrop vector value.
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop vector.</param>
|
|||
/// <param name="source">The source vector.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Vector4"/>.
|
|||
/// </returns>
|
|||
public static Vector4 Overlay(Vector4 backdrop, Vector4 source) |
|||
{ |
|||
return new Vector4(BlendOverlay(backdrop.X, source.X), BlendOverlay(backdrop.Y, source.Y), BlendOverlay(backdrop.Z, source.Z), backdrop.W); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Selects the minimum of the backdrop and source vectors.
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop vector.</param>
|
|||
/// <param name="source">The source vector.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Vector4"/>.
|
|||
/// </returns>
|
|||
public static Vector4 Darken(Vector4 backdrop, Vector4 source) |
|||
{ |
|||
Vector4 result = Vector4.Min(backdrop, source); |
|||
result.W = backdrop.W; |
|||
return result; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Selects the max of the backdrop and source vector.
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop vector.</param>
|
|||
/// <param name="source">The source vector.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Vector4"/>.
|
|||
/// </returns>
|
|||
public static Vector4 Lighten(Vector4 backdrop, Vector4 source) |
|||
{ |
|||
Vector4 result = Vector4.Max(backdrop, source); |
|||
result.W = backdrop.W; |
|||
return result; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Selects the maximum or minimum of the vectors, depending on the source vector value.
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop vector.</param>
|
|||
/// <param name="source">The source vector.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Vector4"/>.
|
|||
/// </returns>
|
|||
public static Vector4 SoftLight(Vector4 backdrop, Vector4 source) |
|||
{ |
|||
return new Vector4(BlendSoftLight(backdrop.X, source.X), BlendSoftLight(backdrop.Y, source.Y), BlendSoftLight(backdrop.Z, source.Z), backdrop.W); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Increases the backdrop vector to reflect the source vector.
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop vector.</param>
|
|||
/// <param name="source">The source vector.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Vector4"/>.
|
|||
/// </returns>
|
|||
public static Vector4 Dodge(Vector4 backdrop, Vector4 source) |
|||
{ |
|||
return new Vector4(BlendDodge(backdrop.X, source.X), BlendDodge(backdrop.Y, source.Y), BlendDodge(backdrop.Z, source.Z), backdrop.W); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Decreases the backdrop vector to reflect the source vector.
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop vector.</param>
|
|||
/// <param name="source">The source vector.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Vector4"/>.
|
|||
/// </returns>
|
|||
public static Vector4 Burn(Vector4 backdrop, Vector4 source) |
|||
{ |
|||
return new Vector4(BlendBurn(backdrop.X, source.X), BlendBurn(backdrop.Y, source.Y), BlendBurn(backdrop.Z, source.Z), backdrop.W); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Subtracts the minimum of the two constituent vectors from the maximum vector.
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop vector.</param>
|
|||
/// <param name="source">The source vector.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Vector4"/>.
|
|||
/// </returns>
|
|||
public static Vector4 Difference(Vector4 backdrop, Vector4 source) |
|||
{ |
|||
Vector4 result = Vector4.Abs(backdrop - source); |
|||
result.W = backdrop.W; |
|||
return result; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Produces an effect similar to that of the <see cref="Difference"/> mode but lower in magnitude.
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop vector.</param>
|
|||
/// <param name="source">The source vector.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="Vector4"/>.
|
|||
/// </returns>
|
|||
public static Vector4 Exclusion(Vector4 backdrop, Vector4 source) |
|||
{ |
|||
return new Vector4(BlendExclusion(backdrop.X, source.X), BlendExclusion(backdrop.Y, source.Y), BlendExclusion(backdrop.Z, source.Z), backdrop.W); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Linearly interpolates from one vector to another based on the given weighting.
|
|||
/// The two vectors are premultiplied before operating.
|
|||
/// </summary>
|
|||
/// <param name="backdrop">The backdrop vector.</param>
|
|||
/// <param name="source">The source vector.</param>
|
|||
/// <param name="amount">
|
|||
/// A value between 0 and 1 indicating the weight of the second source vector.
|
|||
/// At amount = 0, "from" is returned, at amount = 1, "to" is returned.
|
|||
/// </param>
|
|||
/// <returns>
|
|||
/// The <see cref="Vector4"/>
|
|||
/// </returns>
|
|||
public static Vector4 PremultipliedLerp(Vector4 backdrop, Vector4 source, float amount) |
|||
{ |
|||
amount = amount.Clamp(0, 1); |
|||
|
|||
// Santize on zero alpha
|
|||
if (MathF.Abs(backdrop.W) < Constants.Epsilon) |
|||
{ |
|||
source.W *= amount; |
|||
return source; |
|||
} |
|||
|
|||
if (MathF.Abs(source.W) < Constants.Epsilon) |
|||
{ |
|||
return backdrop; |
|||
} |
|||
|
|||
// Premultiply the source vector.
|
|||
// Oddly premultiplying the background vector creates dark outlines when pixels
|
|||
// Have low alpha values.
|
|||
source = new Vector4(source.X, source.Y, source.Z, 1) * (source.W * amount); |
|||
|
|||
// This should be implementing the following formula
|
|||
// https://en.wikipedia.org/wiki/Alpha_compositing
|
|||
// Vout = Vs + Vb (1 - Vsa)
|
|||
// Aout = Vsa + Vsb (1 - Vsa)
|
|||
Vector3 inverseW = new Vector3(1 - source.W); |
|||
Vector3 xyzB = new Vector3(backdrop.X, backdrop.Y, backdrop.Z); |
|||
Vector3 xyzS = new Vector3(source.X, source.Y, source.Z); |
|||
|
|||
return new Vector4(xyzS + (xyzB * inverseW), source.W + (backdrop.W * (1 - source.W))); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Multiplies or screens the backdrop component, depending on the component value.
|
|||
/// </summary>
|
|||
/// <param name="b">The backdrop component.</param>
|
|||
/// <param name="s">The source component.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="float"/>.
|
|||
/// </returns>
|
|||
private static float BlendOverlay(float b, float s) |
|||
{ |
|||
return b <= .5F ? (2F * b * s) : (1F - (2F * (1F - b) * (1F - s))); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Darkens or lightens the backdrop component, depending on the source component value.
|
|||
/// </summary>
|
|||
/// <param name="b">The backdrop component.</param>
|
|||
/// <param name="s">The source component.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="float"/>.
|
|||
/// </returns>
|
|||
private static float BlendSoftLight(float b, float s) |
|||
{ |
|||
return s <= .5F ? ((2F * b * s) + (b * b * (1F - (2F * s)))) : (MathF.Sqrt(b) * ((2F * s) - 1F)) + (2F * b * (1F - s)); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Brightens the backdrop component to reflect the source component.
|
|||
/// </summary>
|
|||
/// <param name="b">The backdrop component.</param>
|
|||
/// <param name="s">The source component.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="float"/>.
|
|||
/// </returns>
|
|||
private static float BlendDodge(float b, float s) |
|||
{ |
|||
return MathF.Abs(s - 1F) < Constants.Epsilon ? s : MathF.Min(b / (1F - s), 1F); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Darkens the backdrop component to reflect the source component.
|
|||
/// </summary>
|
|||
/// <param name="b">The backdrop component.</param>
|
|||
/// <param name="s">The source component.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="float"/>.
|
|||
/// </returns>
|
|||
private static float BlendBurn(float b, float s) |
|||
{ |
|||
return MathF.Abs(s) < Constants.Epsilon ? s : MathF.Max(1F - ((1F - b) / s), 0F); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Darkens the backdrop component to reflect the source component.
|
|||
/// </summary>
|
|||
/// <param name="b">The backdrop component.</param>
|
|||
/// <param name="s">The source component.</param>
|
|||
/// <returns>
|
|||
/// The <see cref="float"/>.
|
|||
/// </returns>
|
|||
private static float BlendExclusion(float b, float s) |
|||
{ |
|||
return b + s - (2F * b * s); |
|||
} |
|||
} |
|||
} |
|||
@ -1,129 +0,0 @@ |
|||
// <copyright file="BufferSpan.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp |
|||
{ |
|||
using System; |
|||
using System.Numerics; |
|||
using System.Runtime.CompilerServices; |
|||
using System.Runtime.InteropServices; |
|||
|
|||
/// <summary>
|
|||
/// Utility methods for <see cref="BufferSpan{T}"/>
|
|||
/// </summary>
|
|||
internal static class BufferSpan |
|||
{ |
|||
/// <summary>
|
|||
/// It's worth to use Marshal.Copy() or Buffer.BlockCopy() over this size.
|
|||
/// </summary>
|
|||
private const int ByteCountThreshold = 1024; |
|||
|
|||
/// <summary>
|
|||
/// Copy 'count' number of elements of the same type from 'source' to 'dest'
|
|||
/// </summary>
|
|||
/// <typeparam name="T">The element type.</typeparam>
|
|||
/// <param name="source">The input <see cref="BufferSpan{T}"/></param>
|
|||
/// <param name="destination">The destination <see cref="BufferSpan{T}"/>.</param>
|
|||
/// <param name="count">The number of elements to copy</param>
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|||
public static void Copy<T>(BufferSpan<T> source, BufferSpan<T> destination, int count) |
|||
where T : struct |
|||
{ |
|||
CopyImpl(source, destination, count); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Copy 'countInSource' elements of <typeparamref name="T"/> from 'source' into the raw byte buffer 'destination'.
|
|||
/// </summary>
|
|||
/// <typeparam name="T">The element type.</typeparam>
|
|||
/// <param name="source">The source buffer of <typeparamref name="T"/> elements to copy from.</param>
|
|||
/// <param name="destination">The destination buffer.</param>
|
|||
/// <param name="countInSource">The number of elements to copy from 'source'</param>
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|||
public static void Copy<T>(BufferSpan<T> source, BufferSpan<byte> destination, int countInSource) |
|||
where T : struct |
|||
{ |
|||
CopyImpl(source, destination, countInSource); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Copy 'countInDest' number of <typeparamref name="T"/> elements into 'dest' from a raw byte buffer defined by 'source'.
|
|||
/// </summary>
|
|||
/// <typeparam name="T">The element type.</typeparam>
|
|||
/// <param name="source">The raw source buffer to copy from"/></param>
|
|||
/// <param name="destination">The destination buffer"/></param>
|
|||
/// <param name="countInDest">The number of <typeparamref name="T"/> elements to copy.</param>
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|||
public static unsafe void Copy<T>(BufferSpan<byte> source, BufferSpan<T> destination, int countInDest) |
|||
where T : struct |
|||
{ |
|||
int byteCount = SizeOf<T>(countInDest); |
|||
|
|||
if (byteCount > (int)ByteCountThreshold) |
|||
{ |
|||
Marshal.Copy(source.Array, source.Start, destination.PointerAtOffset, byteCount); |
|||
} |
|||
else |
|||
{ |
|||
Unsafe.CopyBlock((void*)destination.PointerAtOffset, (void*)source.PointerAtOffset, (uint)byteCount); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets the size of `count` elements in bytes.
|
|||
/// </summary>
|
|||
/// <typeparam name="T">The element type.</typeparam>
|
|||
/// <param name="count">The count of the elements</param>
|
|||
/// <returns>The size in bytes as int</returns>
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|||
public static int SizeOf<T>(int count) |
|||
where T : struct => Unsafe.SizeOf<T>() * count; |
|||
|
|||
/// <summary>
|
|||
/// Gets the size of `count` elements in bytes as UInt32
|
|||
/// </summary>
|
|||
/// <typeparam name="T">The element type.</typeparam>
|
|||
/// <param name="count">The count of the elements</param>
|
|||
/// <returns>The size in bytes as UInt32</returns>
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|||
public static uint USizeOf<T>(int count) |
|||
where T : struct |
|||
=> (uint)SizeOf<T>(count); |
|||
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|||
private static unsafe void CopyImpl<T, TDest>(BufferSpan<T> source, BufferSpan<TDest> destination, int count) |
|||
where T : struct |
|||
where TDest : struct |
|||
{ |
|||
int byteCount = SizeOf<T>(count); |
|||
|
|||
if (byteCount > ByteCountThreshold) |
|||
{ |
|||
if (Unsafe.SizeOf<T>() == sizeof(long)) |
|||
{ |
|||
Marshal.Copy(Unsafe.As<long[]>(source.Array), source.Start, destination.PointerAtOffset, count); |
|||
return; |
|||
} |
|||
else if (Unsafe.SizeOf<T>() == sizeof(int)) |
|||
{ |
|||
Marshal.Copy(Unsafe.As<int[]>(source.Array), source.Start, destination.PointerAtOffset, count); |
|||
return; |
|||
} |
|||
else if (Unsafe.SizeOf<T>() == sizeof(short)) |
|||
{ |
|||
Marshal.Copy(Unsafe.As<short[]>(source.Array), source.Start, destination.PointerAtOffset, count); |
|||
return; |
|||
} |
|||
else if (Unsafe.SizeOf<T>() == sizeof(byte)) |
|||
{ |
|||
Marshal.Copy(Unsafe.As<byte[]>(source.Array), source.Start, destination.PointerAtOffset, count); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
Unsafe.CopyBlock((void*)destination.PointerAtOffset, (void*)source.PointerAtOffset, (uint)byteCount); |
|||
} |
|||
} |
|||
} |
|||
@ -1,237 +0,0 @@ |
|||
// <copyright file="BufferSpan{T}.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp |
|||
{ |
|||
using System; |
|||
using System.Diagnostics; |
|||
using System.Runtime.CompilerServices; |
|||
using System.Runtime.InteropServices; |
|||
|
|||
/// <summary>
|
|||
/// Represents a contiguous region of a pinned managed array.
|
|||
/// The array is usually owned by a <see cref="PinnedBuffer{T}"/> instance.
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// <see cref="BufferSpan{T}"/> is very similar to corefx System.Span<T>, and we try to maintain a compatible API.
|
|||
/// There are several differences though:
|
|||
/// - It's not possible to use it with stack objects or pointers to unmanaged memory, only with managed arrays.
|
|||
/// - It's possible to retrieve a reference to the array (<see cref="Array"/>) so we can pass it to API-s like <see cref="Marshal.Copy(byte[], int, IntPtr, int)"/>
|
|||
/// - It's possible to retrieve the pinned pointer. This enables optimized (unchecked) unsafe operations.
|
|||
/// - There is no bounds checking for performance reasons, only in debug mode. This makes <see cref="BufferSpan{T}"/> an unsafe type!
|
|||
/// </remarks>
|
|||
/// <typeparam name="T">The type of elements of the array</typeparam>
|
|||
internal unsafe struct BufferSpan<T> |
|||
where T : struct |
|||
{ |
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="BufferSpan{T}"/> struct from a pinned array and an start.
|
|||
/// </summary>
|
|||
/// <param name="array">The pinned array</param>
|
|||
/// <param name="pointerToArray">Pointer to the beginning of the array</param>
|
|||
/// <param name="start">The index at which to begin the span.</param>
|
|||
/// <param name="length">The length</param>
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|||
public BufferSpan(T[] array, void* pointerToArray, int start, int length) |
|||
{ |
|||
GuardArrayAndPointer(array, pointerToArray); |
|||
|
|||
DebugGuard.MustBeLessThanOrEqualTo(start, array.Length, nameof(start)); |
|||
DebugGuard.MustBeLessThanOrEqualTo(length, array.Length - start, nameof(length)); |
|||
|
|||
this.Array = array; |
|||
this.Length = length; |
|||
this.Start = start; |
|||
this.PointerAtOffset = (IntPtr)pointerToArray + (Unsafe.SizeOf<T>() * start); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="BufferSpan{T}"/> struct from a pinned array and an start.
|
|||
/// </summary>
|
|||
/// <param name="array">The pinned array</param>
|
|||
/// <param name="pointerToArray">Pointer to the beginning of the array</param>
|
|||
/// <param name="start">The index at which to begin the span.</param>
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|||
public BufferSpan(T[] array, void* pointerToArray, int start) |
|||
{ |
|||
GuardArrayAndPointer(array, pointerToArray); |
|||
DebugGuard.MustBeLessThanOrEqualTo(start, array.Length, nameof(start)); |
|||
|
|||
this.Array = array; |
|||
this.Length = array.Length - start; |
|||
this.Start = start; |
|||
this.PointerAtOffset = (IntPtr)pointerToArray + (Unsafe.SizeOf<T>() * start); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="BufferSpan{T}"/> struct from a pinned array.
|
|||
/// </summary>
|
|||
/// <param name="array">The pinned array</param>
|
|||
/// <param name="pointerToArray">Pointer to the start of 'array'</param>
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|||
public BufferSpan(T[] array, void* pointerToArray) |
|||
{ |
|||
GuardArrayAndPointer(array, pointerToArray); |
|||
|
|||
this.Array = array; |
|||
this.Start = 0; |
|||
this.Length = array.Length; |
|||
this.PointerAtOffset = (IntPtr)pointerToArray; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets the backing array
|
|||
/// </summary>
|
|||
public T[] Array { get; private set; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the length of the <see cref="BufferSpan{T}"/>
|
|||
/// </summary>
|
|||
public int Length { get; private set; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the start inside <see cref="Array"/>
|
|||
/// </summary>
|
|||
public int Start { get; private set; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the start inside <see cref="Array"/> in bytes.
|
|||
/// </summary>
|
|||
public int ByteOffset => this.Start * Unsafe.SizeOf<T>(); |
|||
|
|||
/// <summary>
|
|||
/// Gets the pointer to the offseted array position
|
|||
/// </summary>
|
|||
public IntPtr PointerAtOffset { get; private set; } |
|||
|
|||
/// <summary>
|
|||
/// Returns a reference to specified element of the span.
|
|||
/// </summary>
|
|||
/// <param name="index">The index</param>
|
|||
/// <returns>The reference to the specified element</returns>
|
|||
public ref T this[int index] |
|||
{ |
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|||
get |
|||
{ |
|||
DebugGuard.MustBeLessThan(index, this.Length, nameof(index)); |
|||
|
|||
byte* ptr = (byte*)this.PointerAtOffset + BufferSpan.SizeOf<T>(index); |
|||
return ref Unsafe.AsRef<T>(ptr); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Convertes <see cref="BufferSpan{T}"/> instance to a raw 'void*' pointer
|
|||
/// </summary>
|
|||
/// <param name="bufferSpan">The <see cref="BufferSpan{T}"/> to convert</param>
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|||
public static explicit operator void*(BufferSpan<T> bufferSpan) |
|||
{ |
|||
return (void*)bufferSpan.PointerAtOffset; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Converts <see cref="BufferSpan{T}"/> instance to a raw 'byte*' pointer
|
|||
/// </summary>
|
|||
/// <param name="bufferSpan">The <see cref="BufferSpan{T}"/> to convert</param>
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|||
public static explicit operator byte*(BufferSpan<T> bufferSpan) |
|||
{ |
|||
return (byte*)bufferSpan.PointerAtOffset; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Converts generic <see cref="BufferSpan{T}"/> to a <see cref="BufferSpan{T}"/> of bytes
|
|||
/// setting it's <see cref="Start"/> and <see cref="PointerAtOffset"/> to correct values.
|
|||
/// </summary>
|
|||
/// <param name="source">The <see cref="BufferSpan{T}"/> to convert</param>
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|||
public static explicit operator BufferSpan<byte>(BufferSpan<T> source) |
|||
{ |
|||
BufferSpan<byte> result = default(BufferSpan<byte>); |
|||
result.Array = Unsafe.As<byte[]>(source.Array); |
|||
result.Start = source.Start * Unsafe.SizeOf<T>(); |
|||
result.PointerAtOffset = source.PointerAtOffset; |
|||
return result; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Forms a slice out of the given BufferSpan, beginning at 'start'.
|
|||
/// </summary>
|
|||
/// <param name="start">TThe index at which to begin this slice.</param>
|
|||
/// <returns>The offseted (sliced) BufferSpan</returns>
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|||
public BufferSpan<T> Slice(int start) |
|||
{ |
|||
DebugGuard.MustBeLessThan(start, this.Length, nameof(start)); |
|||
|
|||
BufferSpan<T> result = default(BufferSpan<T>); |
|||
result.Array = this.Array; |
|||
result.Start = this.Start + start; |
|||
result.PointerAtOffset = this.PointerAtOffset + (Unsafe.SizeOf<T>() * start); |
|||
result.Length = this.Length - start; |
|||
return result; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Forms a slice out of the given BufferSpan, beginning at 'start'.
|
|||
/// </summary>
|
|||
/// <param name="start">The index at which to begin this slice.</param>
|
|||
/// <param name="length">The desired length for the slice (exclusive).</param>
|
|||
/// <returns>The sliced BufferSpan</returns>
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|||
public BufferSpan<T> Slice(int start, int length) |
|||
{ |
|||
DebugGuard.MustBeLessThanOrEqualTo(start, this.Length, nameof(start)); |
|||
DebugGuard.MustBeLessThanOrEqualTo(length, this.Length - start, nameof(length)); |
|||
|
|||
BufferSpan<T> result = default(BufferSpan<T>); |
|||
result.Array = this.Array; |
|||
result.Start = this.Start + start; |
|||
result.PointerAtOffset = this.PointerAtOffset + (Unsafe.SizeOf<T>() * start); |
|||
result.Length = length; |
|||
return result; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Clears `count` elements from the beginning of the span.
|
|||
/// </summary>
|
|||
/// <param name="count">The number of elements to clear</param>
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|||
public void Clear(int count) |
|||
{ |
|||
DebugGuard.MustBeLessThanOrEqualTo(count, this.Length, nameof(count)); |
|||
|
|||
if (count < 256) |
|||
{ |
|||
Unsafe.InitBlock((void*)this.PointerAtOffset, 0, BufferSpan.USizeOf<T>(count)); |
|||
} |
|||
else |
|||
{ |
|||
System.Array.Clear(this.Array, this.Start, count); |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Clears the the span
|
|||
/// </summary>
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|||
public void Clear() |
|||
{ |
|||
this.Clear(this.Length); |
|||
} |
|||
|
|||
[Conditional("DEBUG")] |
|||
private static void GuardArrayAndPointer(T[] array, void* pointerToArray) |
|||
{ |
|||
DebugGuard.NotNull(array, nameof(array)); |
|||
DebugGuard.IsFalse( |
|||
pointerToArray == (void*)0, |
|||
nameof(pointerToArray), |
|||
"pointerToArray should not be null pointer!"); |
|||
} |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -1,55 +0,0 @@ |
|||
// <copyright file="DecodedBlockArray.cs" company="James Jackson-South">
|
|||
// Copyright (c) James Jackson-South and contributors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
|
|||
namespace ImageSharp.Formats.Jpg |
|||
{ |
|||
using System; |
|||
using System.Buffers; |
|||
|
|||
/// <summary>
|
|||
/// Because <see cref="System.Array.Length"/> has no information for rented arrays,
|
|||
/// we need to store the count and the buffer separately when storing pooled <see cref="DecodedBlock"/> arrays.
|
|||
/// </summary>
|
|||
internal struct DecodedBlockArray : IDisposable |
|||
{ |
|||
/// <summary>
|
|||
/// The <see cref="ArrayPool{T}"/> used to pool data in <see cref="JpegDecoderCore.DecodedBlocks"/>.
|
|||
/// Should always clean arrays when returning!
|
|||
/// </summary>
|
|||
private static readonly ArrayPool<DecodedBlock> ArrayPool = ArrayPool<DecodedBlock>.Create(); |
|||
|
|||
/// <summary>
|
|||
/// Initializes a new instance of the <see cref="DecodedBlockArray"/> struct. Rents a buffer.
|
|||
/// </summary>
|
|||
/// <param name="count">The number of valid <see cref="DecodedBlock"/>-s</param>
|
|||
public DecodedBlockArray(int count) |
|||
{ |
|||
this.Count = count; |
|||
this.Buffer = ArrayPool.Rent(count); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// Gets the number of actual <see cref="DecodedBlock"/>-s inside <see cref="Buffer"/>
|
|||
/// </summary>
|
|||
public int Count { get; } |
|||
|
|||
/// <summary>
|
|||
/// Gets the rented buffer.
|
|||
/// </summary>
|
|||
public DecodedBlock[] Buffer { get; private set; } |
|||
|
|||
/// <summary>
|
|||
/// Returns the rented buffer to the pool.
|
|||
/// </summary>
|
|||
public void Dispose() |
|||
{ |
|||
if (this.Buffer != null) |
|||
{ |
|||
ArrayPool.Return(this.Buffer, true); |
|||
this.Buffer = null; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue