You've already forked lazarus-ccr
fpvectorial: Finishes fixing the colors in the PostScript reader
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1744 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -56,6 +56,7 @@ type
|
|||||||
{ TExpressionToken }
|
{ TExpressionToken }
|
||||||
|
|
||||||
TExpressionToken = class(TPSToken)
|
TExpressionToken = class(TPSToken)
|
||||||
|
public
|
||||||
ETType: TETType;
|
ETType: TETType;
|
||||||
function IsExpressionOperand: Boolean;
|
function IsExpressionOperand: Boolean;
|
||||||
procedure PrepareFloatValue;
|
procedure PrepareFloatValue;
|
||||||
@ -455,8 +456,11 @@ begin
|
|||||||
begin
|
begin
|
||||||
CurToken := TPSToken(ATokens.Items[i]);
|
CurToken := TPSToken(ATokens.Items[i]);
|
||||||
|
|
||||||
{ if CurToken.StrValue = 'J' then
|
{ if CurToken.StrValue = 'setrgbcolor' then
|
||||||
begin
|
begin
|
||||||
|
WriteLn('===================');
|
||||||
|
WriteLn('CMYK__');
|
||||||
|
WriteLn('===================');
|
||||||
DebugStack();
|
DebugStack();
|
||||||
end;}
|
end;}
|
||||||
|
|
||||||
@ -753,8 +757,8 @@ begin
|
|||||||
begin
|
begin
|
||||||
Param1 := TPSToken(Stack.Pop);
|
Param1 := TPSToken(Stack.Pop);
|
||||||
Param2 := TPSToken(Stack.Pop);
|
Param2 := TPSToken(Stack.Pop);
|
||||||
Stack.Push(Param2);
|
|
||||||
Stack.Push(Param1);
|
Stack.Push(Param1);
|
||||||
|
Stack.Push(Param2);
|
||||||
Exit(True);
|
Exit(True);
|
||||||
end;
|
end;
|
||||||
// Duplicate top element
|
// Duplicate top element
|
||||||
@ -1109,11 +1113,17 @@ begin
|
|||||||
|
|
||||||
if AToken.StrValue = 'stroke' then
|
if AToken.StrValue = 'stroke' then
|
||||||
begin
|
begin
|
||||||
|
{$ifdef FPVECTORIALDEBUG_PATHS}
|
||||||
|
WriteLn('[TvEPSVectorialReader.ExecutePaintingOperator] stroke');
|
||||||
|
{$endif}
|
||||||
Exit(True);
|
Exit(True);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if AToken.StrValue = 'eofill' then
|
if AToken.StrValue = 'eofill' then
|
||||||
begin
|
begin
|
||||||
|
{$ifdef FPVECTORIALDEBUG_PATHS}
|
||||||
|
WriteLn('[TvEPSVectorialReader.ExecutePaintingOperator] eofill');
|
||||||
|
{$endif}
|
||||||
AData.SetBrushStyle(bsSolid);
|
AData.SetBrushStyle(bsSolid);
|
||||||
|
|
||||||
Exit(True);
|
Exit(True);
|
||||||
@ -1360,6 +1370,7 @@ function TvEPSVectorialReader.ExecuteArithmeticAndMathOperator(
|
|||||||
AToken: TExpressionToken; AData: TvVectorialDocument): Boolean;
|
AToken: TExpressionToken; AData: TvVectorialDocument): Boolean;
|
||||||
var
|
var
|
||||||
Param1, Param2: TPSToken;
|
Param1, Param2: TPSToken;
|
||||||
|
NewToken: TExpressionToken;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
|
|
||||||
@ -1369,9 +1380,11 @@ begin
|
|||||||
begin
|
begin
|
||||||
Param1 := TPSToken(Stack.Pop);
|
Param1 := TPSToken(Stack.Pop);
|
||||||
Param2 := TPSToken(Stack.Pop);
|
Param2 := TPSToken(Stack.Pop);
|
||||||
Param1.FloatValue := Param2.FloatValue / Param1.FloatValue;
|
NewToken := TExpressionToken.Create;
|
||||||
Param1.StrValue := '00'; // Just to mark it as a number
|
NewToken.ETType := ettOperand;
|
||||||
Stack.Push(Param1);
|
NewToken.FloatValue := Param2.FloatValue / Param1.FloatValue;
|
||||||
|
NewToken.StrValue := FloatToStr(Param1.FloatValue);
|
||||||
|
Stack.Push(NewToken);
|
||||||
Exit(True);
|
Exit(True);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1380,19 +1393,23 @@ begin
|
|||||||
begin
|
begin
|
||||||
Param1 := TPSToken(Stack.Pop);
|
Param1 := TPSToken(Stack.Pop);
|
||||||
Param2 := TPSToken(Stack.Pop);
|
Param2 := TPSToken(Stack.Pop);
|
||||||
Param1.FloatValue := Param2.FloatValue * Param1.FloatValue;
|
NewToken := TExpressionToken.Create;
|
||||||
Param1.StrValue := '00'; // Just to mark it as a number
|
NewToken.ETType := ettOperand;
|
||||||
Stack.Push(Param1);
|
NewToken.FloatValue := Param2.FloatValue * Param1.FloatValue;
|
||||||
|
NewToken.StrValue := FloatToStr(Param1.FloatValue);
|
||||||
|
Stack.Push(NewToken);
|
||||||
Exit(True);
|
Exit(True);
|
||||||
end;
|
end;
|
||||||
// num1 num2 sub difference Return num1 minus num2
|
// num1 num2 sub difference Return num1 minus num2
|
||||||
if AToken.StrValue = 'sub' then
|
if AToken.StrValue = 'sub' then
|
||||||
begin
|
begin
|
||||||
|
NewToken := TExpressionToken.Create;
|
||||||
|
NewToken.ETType := ettOperand;
|
||||||
Param1 := TPSToken(Stack.Pop); // num2
|
Param1 := TPSToken(Stack.Pop); // num2
|
||||||
Param2 := TPSToken(Stack.Pop); // num1
|
Param2 := TPSToken(Stack.Pop); // num1
|
||||||
Param1.FloatValue := Param2.FloatValue - Param1.FloatValue;
|
NewToken.FloatValue := Param2.FloatValue - Param1.FloatValue;
|
||||||
Param1.StrValue := '00'; // Just to mark it as a number
|
NewToken.StrValue := FloatToStr(Param1.FloatValue);
|
||||||
Stack.Push(Param1);
|
Stack.Push(NewToken);
|
||||||
Exit(True);
|
Exit(True);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1451,6 +1468,7 @@ begin
|
|||||||
AData.StartPath();
|
AData.StartPath();
|
||||||
|
|
||||||
AData.SetPenColor(CurrentGraphicState.Color);
|
AData.SetPenColor(CurrentGraphicState.Color);
|
||||||
|
AData.SetBrushColor(CurrentGraphicState.Color);
|
||||||
|
|
||||||
Exit(True);
|
Exit(True);
|
||||||
end;
|
end;
|
||||||
@ -1529,15 +1547,14 @@ begin
|
|||||||
Exit(True);
|
Exit(True);
|
||||||
end;
|
end;
|
||||||
//
|
//
|
||||||
|
// Don't do anything, because a stroke or fill might come after closepath
|
||||||
|
// and newpath will be called after stroke and fill anyway
|
||||||
|
//
|
||||||
if AToken.StrValue = 'closepath' then
|
if AToken.StrValue = 'closepath' then
|
||||||
begin
|
begin
|
||||||
{$ifdef FPVECTORIALDEBUG_PATHS}
|
{$ifdef FPVECTORIALDEBUG_PATHS}
|
||||||
WriteLn('[TvEPSVectorialReader.ExecutePathConstructionOperator] closepath');
|
WriteLn('[TvEPSVectorialReader.ExecutePathConstructionOperator] closepath');
|
||||||
{$endif}
|
{$endif}
|
||||||
AData.EndPath();
|
|
||||||
AData.StartPath();
|
|
||||||
|
|
||||||
AData.SetPenColor(CurrentGraphicState.Color);
|
|
||||||
|
|
||||||
Exit(True);
|
Exit(True);
|
||||||
end;
|
end;
|
||||||
|
Reference in New Issue
Block a user