Skip to content

Commit

Permalink
Export GetBestColor
Browse files Browse the repository at this point in the history
  • Loading branch information
ollydev committed Sep 30, 2023
1 parent 25ca7a3 commit 32a7553
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 10 deletions.
15 changes: 7 additions & 8 deletions Source/Simba.lpr
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@
simba.init,
Classes, SysUtils, Interfaces, Forms,
simba.mufasatypes, simba.main,
simba.aboutform, simba.debugimageform, simba.imagetostringform,
simba.functionlistform, simba.scripttabsform, simba.outputform,
simba.colorpickerhistoryform, simba.filebrowserform, simba.notesform,
simba.settingsform, simba.associate, simba.openexampleform,
simba.package_form, simba.shapeboxform, simba.backupsform,
simba.findinfilesform,
simba.aboutform, simba.debugimageform, simba.imagetostringform, simba.functionlistform,
simba.scripttabsform, simba.outputform, simba.colorpickerhistoryform, simba.filebrowserform,
simba.notesform, simba.settingsform, simba.associate, simba.openexampleform,
simba.package_form, simba.shapeboxform, simba.backupsform, simba.findinfilesform,
simba.compiler_dump, simba.plugin_dump,
simba.scriptthread, simba.ide_initialization, simba.threading,
simba.openssl, simba.ide_codetools_setup;
simba.scriptthread,
simba.ide_initialization, simba.ide_analytics, simba.ide_codetools_setup,
simba.openssl;

begin
{$IF DECLARED(SetHeapTraceOutput)}
Expand Down
23 changes: 22 additions & 1 deletion Source/script/imports/simba/simba.import_colormath.pas
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ implementation

uses
Graphics, lptypes,
simba.colormath_distance, simba.colormath;
simba.colormath_distance, simba.colormath, simba.colormath_aca;

(*
Color Math
Expand Down Expand Up @@ -402,6 +402,16 @@ procedure _LapeColorDistance2(const Params: PParamArray; const Result: Pointer);
PSingle(Result)^ := ColorDistance(PColor(Params^[0])^, PColor(Params^[1])^);
end;

(*
GetBestColor
~~~~~~~~~~~~
> function GetBestColor(ColorSpace: EColorSpace; Colors: TColorArray): TBestColor;
*)
procedure _LapeGetBestColor(const Params: PParamArray; const Result: Pointer); LAPE_WRAPPER_CALLING_CONV
begin
TBestColor(Result^) := GetBestColor(PColorSpace(Params^[0])^, PColorArray(Params^[1])^);
end;

(*
TColor.R
~~~~~~~~
Expand Down Expand Up @@ -708,6 +718,17 @@ procedure ImportColorMath(Compiler: TSimbaScript_Compiler);
addGlobalFunc('function ColorDistance(Color1, Color2: TColor; const ColorSpace: EColorSpace; const Multipliers: TChannelMultipliers): Single; overload', @_LapeColorDistance1);
addGlobalFunc('function ColorDistance(Color1, Color2: TColor): Single; overload', @_LapeColorDistance2);

addGlobalType([
'record',
' Color: TColor;',
' Mods: TChannelMultipliers;',
' Tolerance: Single;',
'end;'],
'TBestColor'
);

addGlobalFunc('function GetBestColor(Formula: EColorSpace; Colors: TColorArray): TBestColor;', @_LapeGetBestColor);

addGlobalType([
'record',
' const ALICEBLUE = TColor($FFF8F0);',
Expand Down
7 changes: 6 additions & 1 deletion Source/simba.ide_analytics.pas
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
{
Author: Raymond van Venetië and Merlijn Wajer
Project: Simba (https://github.com/MerlijnWajer/Simba)
License: GNU General Public License (https://www.gnu.org/licenses/gpl-3.0)
}
unit simba.ide_analytics;

{$i simba.inc}
Expand Down Expand Up @@ -28,7 +33,7 @@ procedure SendAnalytics;
end;

initialization
SimbaIDEInitialization.RegisterMethodOnAfterCreate(@SendAnalytics, 'Analytics');
SimbaIDEInitialization_AddBeforeShow(@SendAnalytics, 'Analytics', True);

end.

0 comments on commit 32a7553

Please sign in to comment.