LCL Carbon: exclude last pixel when rasterizating line

git-svn-id: trunk@14445 -
This commit is contained in:
tombo 2008-03-06 10:59:05 +00:00
parent 8aedb53f6c
commit 8dde11e9ab
2 changed files with 18 additions and 5 deletions

View File

@ -1042,11 +1042,21 @@ end;
------------------------------------------------------------------------------}
procedure TCarbonDeviceContext.LineTo(X, Y: Integer);
begin
CGContextBeginPath(CGContext);
// add 0.5 to both coordinates for better rasterization
CGContextMoveToPoint(CGContext, PenPos.x + 0.5, PenPos.y + 0.5);
CGContextAddLineToPoint(CGContext, X + 0.5, Y + 0.5);
CGContextStrokePath(CGContext);
if CurrentPen.Width = 1 then
begin
CGContextSaveGState(CGContext);
ExcludeClipRect(X, Y, X + 1, Y + 1);
end;
try
CGContextBeginPath(CGContext);
// add 0.5 to both coordinates for better rasterization
CGContextMoveToPoint(CGContext, PenPos.x + 0.5, PenPos.y + 0.5);
CGContextAddLineToPoint(CGContext, X + 0.5, Y + 0.5);
CGContextStrokePath(CGContext);
finally
if CurrentPen.Width = 1 then CGContextRestoreGState(CGContext);
end;
FPenPos.x := X;
FPenPos.y := Y;

View File

@ -198,6 +198,9 @@ type
constructor Create(AGlobal: Boolean); // create default pen
constructor Create(ALogPen: TLogPen);
procedure Apply(ADC: TCarbonContext; UseROP2: Boolean = True);
property Width: Integer read FWidth;
property Style: LongWord read FStyle;
end;
{ TCarbonBitmap }