Skip to content

Commit

Permalink
Implement finder multithreading
Browse files Browse the repository at this point in the history
  • Loading branch information
ollydev committed Jun 27, 2023
1 parent f77218e commit 7f02834
Show file tree
Hide file tree
Showing 10 changed files with 342 additions and 354 deletions.
28 changes: 19 additions & 9 deletions Source/colormath/simba.colormath.pas
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,17 @@ interface
simba.mufasatypes;

type
TColorHelper = type Helper for TColor
{$PUSH}
{$SCOPEDENUMS ON}
EColorSpace = (RGB, HSV, HSL, XYZ, LAB, LCH, DELTAE);
PColorSpace = ^EColorSpace;
{$POP}

EColorSpaceHelper = type helper for EColorSpace
function AsString: String;
end;

TColorHelper = type helper for TColor
function ToBGRA: TColorBGRA;
function ToRGB: TColorRGB;
function ToXYZ: TColorXYZ;
Expand All @@ -41,8 +51,8 @@ TColorRGB_Helper = record helper for TColorRGB
end;

TColorBGRA_Helper = record helper for TColorBGRA
function Equals(const Other: TColorBGRA): Boolean;
function EqualsIgnoreAlpha(const Other: TColorBGRA): Boolean;
function Equals(const Other: TColorBGRA): Boolean; inline;
function EqualsIgnoreAlpha(const Other: TColorBGRA): Boolean; inline;

function ToRGB: TColorRGB;
function ToXYZ: TColorXYZ;
Expand Down Expand Up @@ -79,12 +89,6 @@ TColorLCH_Helper = record helper for TColorLCH
function ToColor: TColor;
end;

{$PUSH}
{$SCOPEDENUMS ON}
EColorSpace = (RGB, HSV, HSL, XYZ, LAB, LCH, DELTAE);
PColorSpace = ^EColorSpace;
{$POP}

function ColorIntensity(const Color: TColor): Byte;
function ColorToGray(const Color: TColor): Byte;
function ColorToRGB(const Color: TColor): TColorRGB;
Expand All @@ -98,8 +102,14 @@ function ColorToLCH(const Color: TColor): TColorLCH;
implementation

uses
TypInfo,
simba.colormath_conversion;

function EColorSpaceHelper.AsString: String;
begin
Result := GetEnumName(TypeInfo(Self), Ord(Self));
end;

function ColorToRGB(const Color: TColor): TColorRGB;
begin
Result := TSimbaColorConversion.ColorToRGB(Color);
Expand Down
4 changes: 4 additions & 0 deletions Source/colormath/simba.colormath_distance_unrolled.pas
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ interface
Classes, SysUtils, Math,
simba.mufasatypes, simba.colormath_distance;

type
TColorDistanceFunc = function(const Color1: Pointer; const Color2: TColorBGRA; const mul: TChannelMultipliers): Single;

function DistanceRGB_UnRolled(const C1: PColorRGB; const C2: TColorBGRA; const mul: TChannelMultipliers): Single;
function DistanceHSL_UnRolled(const C1: PColorHSL; const C2: TColorBGRA; const mul: TChannelMultipliers): Single;
function DistanceHSV_UnRolled(const C1: PColorHSV; const C2: TColorBGRA; const mul: TChannelMultipliers): Single;
Expand Down Expand Up @@ -320,3 +323,4 @@ function DistanceDeltaE_UnRolled(const C1: PColorLAB; const C2: TColorBGRA; cons

end.


0 comments on commit 7f02834

Please sign in to comment.