TAChart: Move PrepareXorPen procedure to TAChartUtils unit

git-svn-id: trunk@24276 -
This commit is contained in:
ask 2010-03-29 10:32:36 +00:00
parent fa6eba8104
commit 130b0d9d2d
2 changed files with 16 additions and 13 deletions

View File

@ -172,6 +172,8 @@ function PointDist(const A, B: TPoint): Integer; inline;
function PointDistX(const A, B: TPoint): Integer; inline;
function PointDistY(const A, B: TPoint): Integer; inline;
procedure PrepareXorPen(ACanvas: TCanvas);
function RectIntersectsRect(
var ARect: TDoubleRect; const AFixed: TDoubleRect): Boolean;
@ -432,6 +434,17 @@ begin
Result := Abs(A.Y - B.Y);
end;
procedure PrepareXorPen(ACanvas: TCanvas);
begin
with ACanvas do begin
Brush.Style := bsClear;
Pen.Style := psSolid;
Pen.Mode := pmXor;
Pen.Color := clWhite;
Pen.Width := 1;
end;
end;
{$HINTS OFF}
function RectIntersectsRect(

View File

@ -260,7 +260,6 @@ type
procedure DrawLineVert(ACanvas: TCanvas; AX: Integer);
procedure DrawOnCanvas(Rect: TRect; ACanvas: TCanvas); deprecated;
function IsPointInViewPort(const AP: TDoublePoint): Boolean;
procedure PrepareXorPen;
public
procedure AddSeries(ASeries: TBasicChartSeries);
@ -536,15 +535,6 @@ begin
end;
end;
procedure TChart.PrepareXorPen;
begin
Canvas.Brush.Style := bsClear;
Canvas.Pen.Style := psSolid;
Canvas.Pen.Mode := pmXor;
Canvas.Pen.Color := clWhite;
Canvas.Pen.Width := 1;
end;
procedure TChart.CalculateTransformationCoeffs(const AMargin: TRect);
type
TConvFunc = function (AX: Integer): Double of object;
@ -901,7 +891,7 @@ end;
procedure TChart.DrawReticule(ACanvas: TCanvas);
begin
PrepareXorPen;
PrepareXorPen(ACanvas);
if ReticuleMode in [rmVertical, rmCross] then
DrawLineVert(ACanvas, FReticulePos.X);
if ReticuleMode in [rmHorizontal, rmCross] then
@ -1379,7 +1369,7 @@ end;
procedure TChartZoomDragTool.MouseMove(APoint: TPoint);
begin
if not IsActive then exit;
Chart.PrepareXorPen;
PrepareXorPen(Chart.Canvas);
Chart.Canvas.Rectangle(FSelectionRect);
FSelectionRect.BottomRight := APoint;
Chart.Canvas.Rectangle(FSelectionRect);
@ -1390,7 +1380,7 @@ begin
Unused(APoint);
Deactivate;
with Chart do begin
PrepareXorPen;
PrepareXorPen(Canvas);
Canvas.Rectangle(FSelectionRect);
ZoomToRect(FSelectionRect);
end;