You've already forked lazarus-ccr
mbColorLib: Restore loading of color palettes.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5678 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -4,7 +4,8 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
LCLType, LCLIntf, SysUtils, Classes, Graphics,
|
LCLType, LCLIntf, SysUtils, Classes, Graphics,
|
||||||
RGBHSVUtils, RGBHSLUtils, RGBCIEUtils, RGBCMYKUtils,
|
//RGBHSVUtils, RGBHSLUtils,
|
||||||
|
RGBCIEUtils, RGBCMYKUtils,
|
||||||
HTMLColors;
|
HTMLColors;
|
||||||
|
|
||||||
const
|
const
|
||||||
@ -53,18 +54,18 @@ function ReadJASCPal(PalFile: TFileName): string;
|
|||||||
|
|
||||||
//saves a string list to a JASC .pal file
|
//saves a string list to a JASC .pal file
|
||||||
procedure SaveJASCPal(pal: TStrings; FileName: TFileName);
|
procedure SaveJASCPal(pal: TStrings; FileName: TFileName);
|
||||||
(*
|
|
||||||
//reads Photoshop .aco file into an Aco record
|
//reads Photoshop .aco file into an Aco record
|
||||||
function ReadPhotoshopAco(PalFile: TFileName): AcoColors;
|
function ReadPhotoshopAco(PalFile: TFileName): AcoColors;
|
||||||
|
|
||||||
//reads Photoshop .act file
|
//reads Photoshop .act file
|
||||||
function ReadPhotoshopAct(PalFile: TFileName): string;
|
function ReadPhotoshopAct(PalFile: TFileName): string;
|
||||||
*)
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Math;
|
Math, mbColorConv;
|
||||||
|
|
||||||
function ReplaceFlags(s: string; flags: array of string; value: integer): string;
|
function ReplaceFlags(s: string; flags: array of string; value: integer): string;
|
||||||
var
|
var
|
||||||
@ -92,7 +93,12 @@ end;
|
|||||||
function FormatHint(fmt: string; c: TColor): string;
|
function FormatHint(fmt: string; c: TColor): string;
|
||||||
var
|
var
|
||||||
h: string;
|
h: string;
|
||||||
|
hslH, hslS, hslL: Double;
|
||||||
|
hsvH, hsvS, hsvV: Double;
|
||||||
begin
|
begin
|
||||||
|
ColorToHSL(c, hslH, hslS, hslL);
|
||||||
|
ColorToHSV(c, hsvH, hsvS, hsvV);
|
||||||
|
|
||||||
h := AnsiReplaceText(fmt, '%hex', '#' + ColorToHex(c));
|
h := AnsiReplaceText(fmt, '%hex', '#' + ColorToHex(c));
|
||||||
h := AnsiReplaceText(h, '%cieL', IntToStr(Round(GetCIElValue(c))));
|
h := AnsiReplaceText(h, '%cieL', IntToStr(Round(GetCIElValue(c))));
|
||||||
h := AnsiReplaceText(h, '%cieA', IntToStr(Round(GetCIEaValue(c))));
|
h := AnsiReplaceText(h, '%cieA', IntToStr(Round(GetCIEaValue(c))));
|
||||||
@ -102,12 +108,12 @@ begin
|
|||||||
h := AnsiReplaceText(h, '%cieZ', IntToStr(Round(GetCIEzValue(c))));
|
h := AnsiReplaceText(h, '%cieZ', IntToStr(Round(GetCIEzValue(c))));
|
||||||
h := AnsiReplaceText(h, '%cieC', IntToStr(Round(GetCIEcValue(c))));
|
h := AnsiReplaceText(h, '%cieC', IntToStr(Round(GetCIEcValue(c))));
|
||||||
h := AnsiReplaceText(h, '%cieH', IntToStr(Round(GetCIEhValue(c))));
|
h := AnsiReplaceText(h, '%cieH', IntToStr(Round(GetCIEhValue(c))));
|
||||||
h := AnsiReplaceText(h, '%hslH', IntToStr(RGBHSLUtils.GetHValue(c)));
|
h := AnsiReplaceText(h, '%hslH', IntToStr(Round(hslH * 360))); //RGBHSLUtils.GetHValue(c)));
|
||||||
h := AnsiReplaceText(h, '%hslS', IntToStr(RGBHSLUtils.GetSValue(c)));
|
h := AnsiReplaceText(h, '%hslS', IntToStr(Round(hslS * 255))); //RGBHSLUtils.GetSValue(c)));
|
||||||
h := AnsiReplaceText(h, '%hslL', IntToStr(RGBHSLUtils.GetLValue(c)));
|
h := AnsiReplaceText(h, '%hslL', IntToStr(Round(hslL * 255))); //RGBHSLUtils.GetLValue(c)));
|
||||||
h := AnsiReplaceText(h, '%hsvH', IntToStr(RGBHSVUtils.GetHValue(c)));
|
h := AnsiReplaceText(h, '%hsvH', IntToStr(round(hsvH * 360))); //RGBHSVUtils.GetHValue(c)));
|
||||||
h := AnsiReplaceText(h, '%hsvS', IntToStr(RGBHSVUtils.GetSValue(c)));
|
h := AnsiReplaceText(h, '%hsvS', IntToStr(round(hsvS * 255))); //RGBHSVUtils.GetSValue(c)));
|
||||||
h := AnsiReplaceText(h, '%hsvV', IntToStr(RGBHSVUtils.GetVValue(c)));
|
h := AnsiReplaceText(h, '%hsvV', IntToStr(round(hsvV * 255))); //RGBHSVUtils.GetVValue(c)));
|
||||||
h := AnsiReplaceText(h, '%r', IntToStr(GetRValue(c)));
|
h := AnsiReplaceText(h, '%r', IntToStr(GetRValue(c)));
|
||||||
h := AnsiReplaceText(h, '%g', IntToStr(GetGValue(c)));
|
h := AnsiReplaceText(h, '%g', IntToStr(GetGValue(c)));
|
||||||
h := AnsiReplaceText(h, '%b', IntToStr(GetBValue(c)));
|
h := AnsiReplaceText(h, '%b', IntToStr(GetBValue(c)));
|
||||||
@ -115,10 +121,10 @@ begin
|
|||||||
h := AnsiReplaceText(h, '%m', IntToStr(GetMValue(c)));
|
h := AnsiReplaceText(h, '%m', IntToStr(GetMValue(c)));
|
||||||
h := AnsiReplaceText(h, '%y', IntToStr(GetYValue(c)));
|
h := AnsiReplaceText(h, '%y', IntToStr(GetYValue(c)));
|
||||||
h := AnsiReplaceText(h, '%k', IntToStr(GetKValue(c)));
|
h := AnsiReplaceText(h, '%k', IntToStr(GetKValue(c)));
|
||||||
h := AnsiReplaceText(h, '%h', IntToStr(RGBHSLUtils.GetHValue(c)));
|
h := AnsiReplaceText(h, '%h', IntToStr(round(hslH * 360))); //RGBHSLUtils.GetHValue(c)));
|
||||||
h := AnsiReplaceText(h, '%s', IntToStr(RGBHSLUtils.GetSValue(c)));
|
h := AnsiReplaceText(h, '%s', IntToStr(round(hslS * 255))); //RGBHSLUtils.GetSValue(c)));
|
||||||
h := AnsiReplaceText(h, '%l', IntToStr(RGBHSLUtils.GetLValue(c)));
|
h := AnsiReplaceText(h, '%l', IntToStr(round(hslL * 255))); //RGBHSLUtils.GetLValue(c)));
|
||||||
h := AnsiReplaceText(h, '%v', IntToStr(RGBHSVUtils.GetVValue(c)));
|
h := AnsiReplaceText(h, '%v', IntToStr(round(hsvV * 255))); //RGBHSVUtils.GetVValue(c)));
|
||||||
Result := h;
|
Result := h;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -195,20 +201,28 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function MakePalette(BaseColor: TColor; SortOrder: TSortOrder): string;
|
function MakePalette(BaseColor: TColor; SortOrder: TSortOrder): string;
|
||||||
|
const
|
||||||
|
maxL = 240;
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
s: TStrings;
|
s: TStrings;
|
||||||
|
hslH, hslS, hslL: Double;
|
||||||
begin
|
begin
|
||||||
Result := '';
|
Result := '';
|
||||||
s := TStringList.Create;
|
s := TStringList.Create;
|
||||||
try
|
try
|
||||||
|
ColorToHSL(BaseColor, hslH, hslS, hslL);
|
||||||
case SortOrder of
|
case SortOrder of
|
||||||
soAscending:
|
soAscending:
|
||||||
for i := 239 downto 0 do
|
for i := maxL downto 0 do
|
||||||
s.Add(ColorToString(HSLRangeToRGB(GetHValue(BaseColor), GetSValue(BaseColor), 240 - i)));
|
s.Add(ColorToString(HSLToColor(hslH, hslS, 1 - i/maxL)));
|
||||||
|
// for i := 239 downto 0 do
|
||||||
|
// s.Add(ColorToString(HSLRangeToRGB(GetHValue(BaseColor), GetSValue(BaseColor), 240 - i)));
|
||||||
soDescending:
|
soDescending:
|
||||||
for i := 0 to 239 do
|
for i := 0 to maxL do
|
||||||
s.Add(ColorToString(HSLRangeToRGB(GetHValue(BaseColor), GetSValue(BaseColor), 240 - i)));
|
s.Add(ColorToString(HSLToColor(hslH, hslS, i/maxL)));
|
||||||
|
// for i := 0 to 239 do
|
||||||
|
// s.Add(ColorToString(HSLRangeToRGB(GetHValue(BaseColor), GetSValue(BaseColor), 240 - i)));
|
||||||
end;
|
end;
|
||||||
Result := s.Text;
|
Result := s.Text;
|
||||||
finally
|
finally
|
||||||
@ -261,228 +275,270 @@ procedure SortPalColors(Colors: TStrings; SortMode: TSortMode; SortOrder: TSortO
|
|||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
first: TColor;
|
first: TColor;
|
||||||
|
c: TColor;
|
||||||
|
hc, sc, lc, vc: Double;
|
||||||
|
hf, sf, lf, vf: Double;
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
first := clBlack;
|
first := clBlack;
|
||||||
for i := 0 to s.Count - 1 do
|
for i := 0 to s.Count - 1 do
|
||||||
|
begin
|
||||||
|
c := mbStringToColor(s.Strings[i]);
|
||||||
case sm of
|
case sm of
|
||||||
smRed:
|
smRed:
|
||||||
if GetRValue(first) < GetRValue(mbStringToColor(s.Strings[i])) then
|
if GetRValue(first) < GetRValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smGreen:
|
smGreen:
|
||||||
if GetGValue(first) < GetGValue(mbStringToColor(s.Strings[i])) then
|
if GetGValue(first) < GetGValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smBlue:
|
smBlue:
|
||||||
if GetBValue(first) < GetBValue(mbStringToColor(s.Strings[i])) then
|
if GetBValue(first) < GetBValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smHue:
|
smHue:
|
||||||
if GetHValue(first) < GetHValue(mbStringToColor(s.Strings[i])) then
|
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
ColorToHSL(c, hc, sc, lc);
|
||||||
Result := i;
|
ColorToHSL(first, hf, sf, lf);
|
||||||
|
if hf < hc then begin
|
||||||
|
first := c;
|
||||||
|
Result := i;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
smSaturation:
|
smSaturation:
|
||||||
if GetSValue(first) < GetSValue(mbStringToColor(s.Strings[i])) then
|
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
ColorToHSL(c, hc, sc, lc);
|
||||||
Result := i;
|
ColorToHSL(first, hf, sf, lf);
|
||||||
|
if sf < sc then begin
|
||||||
|
first := c;
|
||||||
|
Result := i;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
smLuminance:
|
smLuminance:
|
||||||
if GetLValue(first) < GetLValue(mbStringToColor(s.Strings[i])) then
|
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
ColorToHSL(c, hc, sc, lc);
|
||||||
Result := i;
|
ColorToHSL(first, hf, sc, lf);
|
||||||
|
if lf < lc then
|
||||||
|
begin
|
||||||
|
first := c;
|
||||||
|
Result := i;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
smValue:
|
smValue:
|
||||||
if GetVValue(first) < GetVValue(mbStringToColor(s.Strings[i])) then
|
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
ColorToHSV(c, hc, sc, vc);
|
||||||
Result := i;
|
ColorToHSV(first, hf, sc, vf);
|
||||||
|
if vf < vc then
|
||||||
|
begin
|
||||||
|
first := c;
|
||||||
|
Result := i;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
smCyan:
|
smCyan:
|
||||||
if GetCValue(first) < GetCValue(mbStringToColor(s.Strings[i])) then
|
if GetCValue(first) < GetCValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smMagenta:
|
smMagenta:
|
||||||
if GetMValue(first) < GetMValue(mbStringToColor(s.Strings[i])) then
|
if GetMValue(first) < GetMValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smYellow:
|
smYellow:
|
||||||
if GetYValue(first) < GetYValue(mbStringToColor(s.Strings[i])) then
|
if GetYValue(first) < GetYValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smBlacK:
|
smBlacK:
|
||||||
if GetKValue(first) < GetKValue(mbStringToColor(s.Strings[i])) then
|
if GetKValue(first) < GetKValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smCIEx:
|
smCIEx:
|
||||||
if GetCIEXValue(first) < GetCIEXValue(mbStringToColor(s.Strings[i])) then
|
if GetCIEXValue(first) < GetCIEXValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smCIEy:
|
smCIEy:
|
||||||
if GetCIEYValue(first) < GetCIEYValue(mbStringToColor(s.Strings[i])) then
|
if GetCIEYValue(first) < GetCIEYValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smCIEz:
|
smCIEz:
|
||||||
if GetCIEZValue(first) < GetCIEZValue(mbStringToColor(s.Strings[i])) then
|
if GetCIEZValue(first) < GetCIEZValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smCIEl:
|
smCIEl:
|
||||||
if GetCIELValue(first) < GetCIELValue(mbStringToColor(s.Strings[i])) then
|
if GetCIELValue(first) < GetCIELValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smCIEa:
|
smCIEa:
|
||||||
if GetCIEAValue(first) < GetCIEAValue(mbStringToColor(s.Strings[i])) then
|
if GetCIEAValue(first) < GetCIEAValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smCIEb:
|
smCIEb:
|
||||||
if GetCIEBValue(first) < GetCIEBValue(mbStringToColor(s.Strings[i])) then
|
if GetCIEBValue(first) < GetCIEBValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function MinPos(s: TStrings; sm: TSortMode): integer;
|
function MinPos(s: TStrings; sm: TSortMode): integer;
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
first: TColor;
|
first: TColor;
|
||||||
|
c: TColor;
|
||||||
|
hc, sc, lc, vc: Double;
|
||||||
|
hf, sf, lf, vf: Double;
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
first := clWhite;
|
first := clWhite;
|
||||||
for i := 0 to s.Count - 1 do
|
for i := 0 to s.Count - 1 do
|
||||||
|
begin
|
||||||
|
c := mbStringToColor(s.Strings[i]);
|
||||||
case sm of
|
case sm of
|
||||||
smRed:
|
smRed:
|
||||||
if GetRValue(first) > GetRValue(mbStringToColor(s.Strings[i])) then
|
if GetRValue(first) > GetRValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smGreen:
|
smGreen:
|
||||||
if GetGValue(first) > GetGValue(mbStringToColor(s.Strings[i])) then
|
if GetGValue(first) > GetGValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smBlue:
|
smBlue:
|
||||||
if GetBValue(first) > GetBValue(mbStringToColor(s.Strings[i])) then
|
if GetBValue(first) > GetBValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smHue:
|
smHue:
|
||||||
if GetHValue(first) > GetHValue(mbStringToColor(s.Strings[i])) then
|
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
ColorToHSL(c, hc, sc, lc);
|
||||||
Result := i;
|
ColorToHSL(first, hf, sf, lf);
|
||||||
|
if hf > hc then
|
||||||
|
begin
|
||||||
|
first := c;
|
||||||
|
Result := i;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
smSaturation:
|
smSaturation:
|
||||||
if GetSValue(first) > GetSValue(mbStringToColor(s.Strings[i])) then
|
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
ColorToHSL(c, hc, sc, lc);
|
||||||
Result := i;
|
ColorToHSV(first, hf, sf, vf);
|
||||||
|
if sf > sc then
|
||||||
|
begin
|
||||||
|
first := c;
|
||||||
|
Result := i;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
smLuminance:
|
smLuminance:
|
||||||
if GetLValue(first) > GetLValue(mbStringToColor(s.Strings[i])) then
|
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
ColorToHSL(c, hc, sc, lc);
|
||||||
Result := i;
|
ColorToHSV(first, hf, sf, vf);
|
||||||
|
if lf > lc then
|
||||||
|
begin
|
||||||
|
first := c;
|
||||||
|
Result := i;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
smValue:
|
smValue:
|
||||||
if GetVValue(first) > GetVValue(mbStringToColor(s.Strings[i])) then
|
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
ColorToHSV(c, hc, sc, vc);
|
||||||
Result := i;
|
ColorToHSV(first, hf, sf, vf);
|
||||||
|
if vf > vc then
|
||||||
|
begin
|
||||||
|
first := c;
|
||||||
|
Result := i;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
smCyan:
|
smCyan:
|
||||||
if GetCValue(first) > GetCValue(mbStringToColor(s.Strings[i])) then
|
if GetCValue(first) > GetCValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smMagenta:
|
smMagenta:
|
||||||
if GetMValue(first) > GetMValue(mbStringToColor(s.Strings[i])) then
|
if GetMValue(first) > GetMValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smYellow:
|
smYellow:
|
||||||
if GetYValue(first) > GetYValue(mbStringToColor(s.Strings[i])) then
|
if GetYValue(first) > GetYValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smBlacK:
|
smBlacK:
|
||||||
if GetKValue(first) > GetKValue(mbStringToColor(s.Strings[i])) then
|
if GetKValue(first) > GetKValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smCIEx:
|
smCIEx:
|
||||||
if GetCIEXValue(first) > GetCIEXValue(mbStringToColor(s.Strings[i])) then
|
if GetCIEXValue(first) > GetCIEXValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smCIEy:
|
smCIEy:
|
||||||
if GetCIEYValue(first) > GetCIEYValue(mbStringToColor(s.Strings[i])) then
|
if GetCIEYValue(first) > GetCIEYValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smCIEz:
|
smCIEz:
|
||||||
if GetCIEZValue(first) > GetCIEZValue(mbStringToColor(s.Strings[i])) then
|
if GetCIEZValue(first) > GetCIEZValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smCIEl:
|
smCIEl:
|
||||||
if GetCIELValue(first) > GetCIELValue(mbStringToColor(s.Strings[i])) then
|
if GetCIELValue(first) > GetCIELValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smCIEa:
|
smCIEa:
|
||||||
if GetCIEAValue(first) > GetCIEAValue(mbStringToColor(s.Strings[i])) then
|
if GetCIEAValue(first) > GetCIEAValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
smCIEb:
|
smCIEb:
|
||||||
if GetCIEBValue(first) > GetCIEBValue(mbStringToColor(s.Strings[i])) then
|
if GetCIEBValue(first) > GetCIEBValue(c) then
|
||||||
begin
|
begin
|
||||||
first := mbStringToColor(s.Strings[i]);
|
first := c;
|
||||||
Result := i;
|
Result := i;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -568,8 +624,21 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ExchangeBytes(var w: Word);
|
procedure ExchangeBytes(var w: Word);
|
||||||
|
type
|
||||||
|
TWordRec = packed record
|
||||||
|
a, b: byte;
|
||||||
|
end;
|
||||||
|
var
|
||||||
|
brec: TWordRec;
|
||||||
|
tmp: Byte;
|
||||||
begin
|
begin
|
||||||
Swap(w);
|
brec := TWordRec(w);
|
||||||
|
tmp := brec.a;
|
||||||
|
brec.a := brec.b;
|
||||||
|
brec.b := tmp;
|
||||||
|
w := word(brec);
|
||||||
|
|
||||||
|
// Swap(w);
|
||||||
{
|
{
|
||||||
asm
|
asm
|
||||||
MOV DX,[w] //assign the word to the data register
|
MOV DX,[w] //assign the word to the data register
|
||||||
@ -590,7 +659,7 @@ begin
|
|||||||
s[i] := WideChar(w);
|
s[i] := WideChar(w);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
(*
|
|
||||||
function GetAcoColor(space,w,x,y,z: word): TColor;
|
function GetAcoColor(space,w,x,y,z: word): TColor;
|
||||||
begin
|
begin
|
||||||
case space of
|
case space of
|
||||||
@ -722,5 +791,5 @@ begin
|
|||||||
end;
|
end;
|
||||||
CloseFile(f);
|
CloseFile(f);
|
||||||
end;
|
end;
|
||||||
*)
|
|
||||||
end.
|
end.
|
||||||
|
@ -682,7 +682,6 @@ begin
|
|||||||
FNames.Clear;
|
FNames.Clear;
|
||||||
FColors.Text := ReadJASCPal(FileName);
|
FColors.Text := ReadJASCPal(FileName);
|
||||||
end
|
end
|
||||||
(*
|
|
||||||
else if SameText(ExtractFileExt(FileName), '.aco') then
|
else if SameText(ExtractFileExt(FileName), '.aco') then
|
||||||
begin
|
begin
|
||||||
supported := true;
|
supported := true;
|
||||||
@ -701,7 +700,6 @@ begin
|
|||||||
FNames.Clear;
|
FNames.Clear;
|
||||||
FColors.Text := ReadPhotoshopAct(FileName);
|
FColors.Text := ReadPhotoshopAct(FileName);
|
||||||
end
|
end
|
||||||
*)
|
|
||||||
else
|
else
|
||||||
raise Exception.Create('The file format you are trying to load is not supported in this version of the palette'#13'Please send a request to MXS along with the files of this format so'#13'loading support for this file can be added too');
|
raise Exception.Create('The file format you are trying to load is not supported in this version of the palette'#13'Please send a request to MXS along with the files of this format so'#13'loading support for this file can be added too');
|
||||||
if supported then
|
if supported then
|
||||||
|
@ -521,17 +521,6 @@ LazarusResources.Add('TRColorPicker','PNG',[
|
|||||||
+#162'b'#192#11#187#209' '#26#186'U&'#205#1#0'C'#2'<{?'#184#187'_'#0#0#0#0'IE'
|
+#162'b'#192#11#187#209' '#26#186'U&'#205#1#0'C'#2'<{?'#184#187'_'#0#0#0#0'IE'
|
||||||
+'ND'#174'B`'#130
|
+'ND'#174'B`'#130
|
||||||
]);
|
]);
|
||||||
LazarusResources.Add('TSColorPicker','PNG',[
|
|
||||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
|
|
||||||
+#0#0#9'pHYs'#0#0#11#19#0#0#11#19#1#0#154#156#24#0#0#0#140'IDATH'#199#237#146
|
|
||||||
+'1'#10#3'!'#16'E'#159#144'-'#236#4'At'#147#173#189#136'7'#245#26#150'^'#198
|
|
||||||
+#206'e'#3#150#166'X'#2#233#146#144'l'#147#248#154#153#15#195'|'#254'00'#248
|
|
||||||
+'y'#196#179#1#239'}/'#165'PkE)'#133'1'#134#249'<'#179'\'#22'b'#140#226'c'#3#0
|
|
||||||
+#231'\o'#173'!'#165'Dk'#141#181#150#148#146#248'J'#130#199'$'#211'4'#161#148
|
|
||||||
+'"'#231','#14#185'g'#8#161#255#241#23#245#190'v'#216#128'+{'#189#247#239#234
|
|
||||||
+'m_,V'#1'p::'#193'0'#24#6#131#193#11#220#0']'#214','#236#161'*'#153#199#0#0#0
|
|
||||||
+#0'IEND'#174'B`'#130
|
|
||||||
]);
|
|
||||||
LazarusResources.Add('TSLColorPicker','PNG',[
|
LazarusResources.Add('TSLColorPicker','PNG',[
|
||||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
|
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
|
||||||
+#0#0#9'pHYs'#0#0#11#19#0#0#11#19#1#0#154#156#24#0#0#1#143'IDATH'#199#221#148
|
+#0#0#9'pHYs'#0#0#11#19#0#0#11#19#1#0#154#156#24#0#0#1#143'IDATH'#199#221#148
|
||||||
@ -634,3 +623,15 @@ LazarusResources.Add('THSCirclePicker','PNG',[
|
|||||||
+#30#132'p'#229'b'#140#147#222#250#128#167#24#160'W'#145#205'y'#245#247#16#252
|
+#30#132'p'#229'b'#140#147#222#250#128#167#24#160'W'#145#205'y'#245#247#16#252
|
||||||
+'_'#255#182#254#4'leR'#175#234#10''''#210#0#0#0#0'IEND'#174'B`'#130
|
+'_'#255#182#254#4'leR'#175#234#10''''#210#0#0#0#0'IEND'#174'B`'#130
|
||||||
]);
|
]);
|
||||||
|
LazarusResources.Add('TSColorPicker','PNG',[
|
||||||
|
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
|
||||||
|
+#0#0#9'pHYs'#0#0#11#19#0#0#11#19#1#0#154#156#24#0#0#0#176'IDATH'#199#237#149
|
||||||
|
+'A'#10#131'0'#16'E'#255'@5'#184#11#4'D'#210#186#207'A'#188#152'W'#241#26'.='
|
||||||
|
+#141';w'#146'Y'#244'wQAp'#211#148'"'#180'%'#3#3#147'0'#195#227#135#31'FH'#226
|
||||||
|
+#204#184#224#228#200#128#207#1'!'#4#206#243#140'eY`'#173'E]'#215#240'W'#143
|
||||||
|
+#246#214'b'#24#6'y5/).'#242#222's]WTU'#5#231#28#154#166#193'8'#142#146#162'@'
|
||||||
|
+'Rm'#26'B`Q'#20#176#214'b'#154'&I~#'#146#201#217'u'#29#223#233''''#153#174
|
||||||
|
+#224#251']'#212#247'=K'#141'0'#241#153#165#234'^'#199#8#179#157#203#237#206
|
||||||
|
+#168#238#245#161#223#168#2'wJ'#254#201#25#240'#'#0#201'+'#243#255#1#15#140
|
||||||
|
+#197#148#197#26'E'#187's'#0#0#0#0'IEND'#174'B`'#130
|
||||||
|
]);
|
||||||
|
Reference in New Issue
Block a user