added skipping non-hex characters in color-data - allows users to paste parameters with line breaks (from emails, etc)
This commit is contained in:
parent
da82735e8a
commit
023b72b70f
@ -3942,7 +3942,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure ParseCompactcolors(cp: TControlPoint; count: integer; data: string);
|
procedure ParseCompactcolors(cp: TControlPoint; count: integer; in_data: string);
|
||||||
function HexChar(c: Char): Byte;
|
function HexChar(c: Char): Byte;
|
||||||
begin
|
begin
|
||||||
case c of
|
case c of
|
||||||
@ -3955,13 +3955,21 @@ procedure ParseCompactcolors(cp: TControlPoint; count: integer; data: string);
|
|||||||
end;
|
end;
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
|
c: char;
|
||||||
|
data: string;
|
||||||
begin
|
begin
|
||||||
// diable generating pallete
|
// diable generating pallete
|
||||||
if Parsecp.cmapindex = -2 then
|
if Parsecp.cmapindex = -2 then
|
||||||
Parsecp.cmapindex := -1;
|
Parsecp.cmapindex := -1;
|
||||||
|
|
||||||
Assert(Count = 256,'only 256 color Colormaps are supported at the moment');
|
Assert(Count = 256, 'only 256 color Colormaps are supported at the moment');
|
||||||
Assert((Count * 8) = Length(data),'Data size MisMatch');
|
data := '';
|
||||||
|
for i := 0 to Length(in_data) do
|
||||||
|
begin
|
||||||
|
c := in_data[i];
|
||||||
|
if c in ['0'..'9']+['A'..'F']+['a'..'f'] then data := data + c;
|
||||||
|
end;
|
||||||
|
Assert((Count * 8) = Length(data), 'Color-data size mismatch');
|
||||||
for i := 0 to Count -1 do begin
|
for i := 0 to Count -1 do begin
|
||||||
Parsecp.cmap[i][0] := 16 * HexChar(Data[i*8 + 3]) + HexChar(Data[i*8 + 4]);
|
Parsecp.cmap[i][0] := 16 * HexChar(Data[i*8 + 3]) + HexChar(Data[i*8 + 4]);
|
||||||
Parsecp.cmap[i][1] := 16 * HexChar(Data[i*8 + 5]) + HexChar(Data[i*8 + 6]);
|
Parsecp.cmap[i][1] := 16 * HexChar(Data[i*8 + 5]) + HexChar(Data[i*8 + 6]);
|
||||||
|
Loading…
Reference in New Issue
Block a user