mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-20 17:40:40 +02:00
TAChart: Move DrawXorText to TADrawerCanvas unit
git-svn-id: trunk@38434 -
This commit is contained in:
parent
c5350721c8
commit
3192129e6e
@ -113,8 +113,8 @@ type
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
FPCanvas, Graphics, GraphMath, LCLIntf, LCLType, Math, SysUtils, Types,
|
FPCanvas, Graphics, GraphMath, Math, SysUtils, Types,
|
||||||
TAChartAxis, TACustomSeries, TAGeometry;
|
TAChartAxis, TACustomSeries, TADrawerCanvas, TAGeometry;
|
||||||
|
|
||||||
const
|
const
|
||||||
DEF_DISTANCE_FORMAT = '%0:.9g';
|
DEF_DISTANCE_FORMAT = '%0:.9g';
|
||||||
@ -136,7 +136,7 @@ constructor TDataPointDistanceToolMarks.Create(AOwner: TCustomChart);
|
|||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
FDistance := DEF_MARKS_DISTANCE;
|
FDistance := DEF_MARKS_DISTANCE;
|
||||||
FLabelBrush.Color := clYellow;
|
SetPropDefaults(FLabelBrush, ['Color']);
|
||||||
Format := DEF_DISTANCE_FORMAT;
|
Format := DEF_DISTANCE_FORMAT;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -195,29 +195,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDataPointDistanceTool.DoDraw;
|
procedure TDataPointDistanceTool.DoDraw;
|
||||||
|
|
||||||
procedure DrawXorText(ACanvas: TCanvas; APoint: TPoint; const AText: String);
|
|
||||||
var
|
|
||||||
bmp: TBitmap;
|
|
||||||
ext: TSize;
|
|
||||||
begin
|
|
||||||
ext := ACanvas.TextExtent(AText);
|
|
||||||
bmp := TBitmap.Create;
|
|
||||||
try
|
|
||||||
bmp.SetSize(ext.cx, ext.cy);
|
|
||||||
bmp.Canvas.Brush.Style := bsClear;
|
|
||||||
bmp.Canvas.Font := ACanvas.Font;
|
|
||||||
bmp.Canvas.Font.Color := clWhite;
|
|
||||||
bmp.Canvas.TextOut(0, 0, AText);
|
|
||||||
APoint -= ext div 2;
|
|
||||||
BitBlt(
|
|
||||||
ACanvas.Handle, APoint.X, APoint.Y, ext.cx, ext.cy,
|
|
||||||
bmp.Canvas.Handle, 0, 0, SRCINVERT);
|
|
||||||
finally
|
|
||||||
bmp.Free;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
var
|
var
|
||||||
a: Double;
|
a: Double;
|
||||||
|
|
||||||
@ -348,8 +325,10 @@ begin
|
|||||||
finally
|
finally
|
||||||
FreeAndNil(newEnd);
|
FreeAndNil(newEnd);
|
||||||
end;
|
end;
|
||||||
if EffectiveDrawingMode = tdmXor then
|
if EffectiveDrawingMode = tdmXor then begin
|
||||||
|
FChart.Drawer.SetXorPen(FPen);
|
||||||
DoDraw;
|
DoDraw;
|
||||||
|
end;
|
||||||
Handled;
|
Handled;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -76,10 +76,12 @@ type
|
|||||||
|
|
||||||
function CanvasGetFontOrientationFunc(AFont: TFPCustomFont): Integer;
|
function CanvasGetFontOrientationFunc(AFont: TFPCustomFont): Integer;
|
||||||
function ChartColorSysToFPColor(AChartColor: TChartColor): TFPColor;
|
function ChartColorSysToFPColor(AChartColor: TChartColor): TFPColor;
|
||||||
|
procedure DrawXorText(ACanvas: TCanvas; APoint: TPoint; const AText: String);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
|
LCLIntf, LCLType,
|
||||||
TAGeometry;
|
TAGeometry;
|
||||||
|
|
||||||
function CanvasGetFontOrientationFunc(AFont: TFPCustomFont): Integer;
|
function CanvasGetFontOrientationFunc(AFont: TFPCustomFont): Integer;
|
||||||
@ -95,6 +97,28 @@ begin
|
|||||||
Result := ChartColorToFPColor(ColorToRGB(AChartColor));
|
Result := ChartColorToFPColor(ColorToRGB(AChartColor));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure DrawXorText(ACanvas: TCanvas; APoint: TPoint; const AText: String);
|
||||||
|
var
|
||||||
|
bmp: TBitmap;
|
||||||
|
ext: TPoint;
|
||||||
|
begin
|
||||||
|
ext := ACanvas.TextExtent(AText);
|
||||||
|
bmp := TBitmap.Create;
|
||||||
|
try
|
||||||
|
bmp.SetSize(ext.X, ext.Y);
|
||||||
|
bmp.Canvas.Brush.Style := bsClear;
|
||||||
|
bmp.Canvas.Font := ACanvas.Font;
|
||||||
|
bmp.Canvas.Font.Color := clWhite;
|
||||||
|
bmp.Canvas.TextOut(0, 0, AText);
|
||||||
|
APoint -= ext div 2;
|
||||||
|
BitBlt(
|
||||||
|
ACanvas.Handle, APoint.X, APoint.Y, ext.X, ext.Y,
|
||||||
|
bmp.Canvas.Handle, 0, 0, SRCINVERT);
|
||||||
|
finally
|
||||||
|
bmp.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{ TCanvasDrawer }
|
{ TCanvasDrawer }
|
||||||
|
|
||||||
procedure TCanvasDrawer.AddToFontOrientation(ADelta: Integer);
|
procedure TCanvasDrawer.AddToFontOrientation(ADelta: Integer);
|
||||||
|
Loading…
Reference in New Issue
Block a user