gpt4 book ai didi

delphi - 使用 delphi 按 Hue 和 Luminosity 对颜色(调色板)列表进行排序

转载 作者:行者123 更新时间:2023-12-03 15:47:13 24 4
gpt4 key购买 nike

我有几个颜色列表(TColor)存储在数组中,我喜欢使用 HUE o 亮度进行排序,是否存在任何具有此类函数或算法的 delphi 库或组件?

最佳答案

Delphi 包含一个名为 GraphUtil 的单元,它有一个名为 SortColorArray 的函数。

procedure SortColorArray(ColorArray: TColorArray; L, R: Integer;
SortType: TColorArraySortType; Reverse: Boolean = False);

此函数可以按色相、饱和度、亮度、红、绿、蓝对颜色列表进行排序。

你可以这样使用它

var
ColorList : TColorArray;
i : Integer;
begin

SetLength(ColorList,WebNamedColorsCount);
//fill the list the colors in this case using webcolors
for i := 0 to WebNamedColorsCount - 1 do
begin
ColorList[i].Value:=WebNamedColors[i].Value;
ColorList[i].Name :='';
end;
//sort the colors by HUE
SortColorArray(ColorList,0,WebNamedColorsCount-1,stHue,False);

//do your stuff here

end;

关于delphi - 使用 delphi 按 Hue 和 Luminosity 对颜色(调色板)列表进行排序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5738174/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com