mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-11 10:39:20 +02:00
TAChart: Add font orientation to the BGRA drawer. Update demo.
git-svn-id: trunk@30183 -
This commit is contained in:
parent
3a1863981e
commit
0a5e0fb00c
@ -15,6 +15,7 @@ object Form1: TForm1
|
|||||||
Width = 300
|
Width = 300
|
||||||
AxisList = <
|
AxisList = <
|
||||||
item
|
item
|
||||||
|
Marks.LabelFont.Orientation = 400
|
||||||
Title.LabelFont.Orientation = 900
|
Title.LabelFont.Orientation = 900
|
||||||
end
|
end
|
||||||
item
|
item
|
||||||
|
@ -30,21 +30,22 @@ implementation
|
|||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
BGRABitmap, TADrawerBGRA;
|
BGRABitmap, TADrawerBGRA, TADrawerCanvas, TADrawUtils;
|
||||||
|
|
||||||
{ TForm1 }
|
{ TForm1 }
|
||||||
|
|
||||||
procedure TForm1.PaintBox1Paint(Sender: TObject);
|
procedure TForm1.PaintBox1Paint(Sender: TObject);
|
||||||
var
|
var
|
||||||
bmp: TBGRABitmap;
|
bmp: TBGRABitmap;
|
||||||
|
id: IChartDrawer;
|
||||||
begin
|
begin
|
||||||
bmp := TBGRABitmap.Create(PaintBox1.Width, PaintBox1.Height);
|
bmp := TBGRABitmap.Create(PaintBox1.Width, PaintBox1.Height);
|
||||||
Chart1.DisableRedrawing;
|
Chart1.DisableRedrawing;
|
||||||
try
|
try
|
||||||
Chart1.Title.Text.Text := 'BGRABitmap';
|
Chart1.Title.Text.Text := 'BGRABitmap';
|
||||||
Chart1.Draw(
|
id := TBGRABitmapDrawer.Create(bmp);
|
||||||
TBGRABitmapDrawer.Create(bmp),
|
id.DoGetFontOrientation := @CanvasGetFontOrientationFunc;
|
||||||
Rect(0, 0, PaintBox1.Width, PaintBox1.Height));
|
Chart1.Draw(id, Rect(0, 0, PaintBox1.Width, PaintBox1.Height));
|
||||||
bmp.Draw(PaintBox1.Canvas, 0, 0);
|
bmp.Draw(PaintBox1.Canvas, 0, 0);
|
||||||
Chart1.Title.Text.Text := 'Standard';
|
Chart1.Title.Text.Text := 'Standard';
|
||||||
finally
|
finally
|
||||||
|
@ -30,6 +30,7 @@ type
|
|||||||
FBrushColor: TBGRAPixel;
|
FBrushColor: TBGRAPixel;
|
||||||
FCanvas: TBGRABitmap;
|
FCanvas: TBGRABitmap;
|
||||||
FFontColor: TBGRAPixel;
|
FFontColor: TBGRAPixel;
|
||||||
|
FFontOrientation: Integer;
|
||||||
FPenColor: TBGRAPixel;
|
FPenColor: TBGRAPixel;
|
||||||
FPenWidth: Integer;
|
FPenWidth: Integer;
|
||||||
FPrevPoint: TPoint;
|
FPrevPoint: TPoint;
|
||||||
@ -104,7 +105,7 @@ end;
|
|||||||
|
|
||||||
procedure TBGRABitmapDrawer.AddToFontOrientation(ADelta: Integer);
|
procedure TBGRABitmapDrawer.AddToFontOrientation(ADelta: Integer);
|
||||||
begin
|
begin
|
||||||
// NA
|
FFontOrientation += ADelta;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TBGRABitmapDrawer.ClippingStart(const AClipRect: TRect);
|
procedure TBGRABitmapDrawer.ClippingStart(const AClipRect: TRect);
|
||||||
@ -234,6 +235,7 @@ procedure TBGRABitmapDrawer.SetFont(AFont: TFPCustomFont);
|
|||||||
begin
|
begin
|
||||||
FCanvas.FontName := AFont.Name;
|
FCanvas.FontName := AFont.Name;
|
||||||
FCanvas.FontHeight := AFont.Size * 96 div 72;
|
FCanvas.FontHeight := AFont.Size * 96 div 72;
|
||||||
|
FFontOrientation := FGetFontOrientationFunc(AFont);
|
||||||
with AFont.FPColor do
|
with AFont.FPColor do
|
||||||
FFontColor := BGRA(red shr 8, green shr 8, blue shr 8, alpha shr 8);
|
FFontColor := BGRA(red shr 8, green shr 8, blue shr 8, alpha shr 8);
|
||||||
// TODO: FontStyle
|
// TODO: FontStyle
|
||||||
@ -262,7 +264,8 @@ end;
|
|||||||
|
|
||||||
procedure TBGRABitmapDrawer.SimpleTextOut(AX, AY: Integer; const AText: String);
|
procedure TBGRABitmapDrawer.SimpleTextOut(AX, AY: Integer; const AText: String);
|
||||||
begin
|
begin
|
||||||
FCanvas.TextOut(AX, AY, AText, FFontColor);
|
FCanvas.TextOutAngle(
|
||||||
|
AX, AY, FFontOrientation, AText, FFontColor, taLeftJustify);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Loading…
Reference in New Issue
Block a user