From 2161f792f89b9faf22feb3f8d5e4af52766d8bd5 Mon Sep 17 00:00:00 2001 From: ask Date: Fri, 1 Apr 2011 09:59:46 +0000 Subject: [PATCH] TAChart: Add BGRABitmap demo git-svn-id: trunk@30116 - --- .gitattributes | 4 + components/tachart/demo/bgra/Main.lfm | 70 +++++++++++++++ components/tachart/demo/bgra/Main.pas | 57 ++++++++++++ components/tachart/demo/bgra/bgrademo.lpi | 105 ++++++++++++++++++++++ components/tachart/demo/bgra/bgrademo.lpr | 22 +++++ 5 files changed, 258 insertions(+) create mode 100644 components/tachart/demo/bgra/Main.lfm create mode 100644 components/tachart/demo/bgra/Main.pas create mode 100644 components/tachart/demo/bgra/bgrademo.lpi create mode 100644 components/tachart/demo/bgra/bgrademo.lpr diff --git a/.gitattributes b/.gitattributes index 1bb85db46d..325f27936c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2342,6 +2342,10 @@ components/tachart/demo/basic/demo.lpi svneol=native#text/plain components/tachart/demo/basic/demo.lpr svneol=native#text/plain components/tachart/demo/basic/unit1.lfm svneol=native#text/plain components/tachart/demo/basic/unit1.pas svneol=native#text/plain +components/tachart/demo/bgra/Main.lfm svneol=native#text/plain +components/tachart/demo/bgra/Main.pas svneol=native#text/pascal +components/tachart/demo/bgra/bgrademo.lpi svneol=native#text/plain +components/tachart/demo/bgra/bgrademo.lpr svneol=native#text/pascal components/tachart/demo/chartsource/chartsourcedemo.lpi svneol=native#text/plain components/tachart/demo/chartsource/chartsourcedemo.lpr svneol=native#text/plain components/tachart/demo/chartsource/main.lfm svneol=native#text/plain diff --git a/components/tachart/demo/bgra/Main.lfm b/components/tachart/demo/bgra/Main.lfm new file mode 100644 index 0000000000..c19186a1c4 --- /dev/null +++ b/components/tachart/demo/bgra/Main.lfm @@ -0,0 +1,70 @@ +object Form1: TForm1 + Left = 1221 + Height = 432 + Top = 154 + Width = 640 + Caption = 'Form1' + ClientHeight = 432 + ClientWidth = 640 + Position = poScreenCenter + LCLVersion = '0.9.31' + object Chart1: TChart + Left = 0 + Height = 432 + Top = 0 + Width = 300 + AxisList = < + item + Title.LabelFont.Orientation = 900 + end + item + Alignment = calBottom + end> + BackColor = clMoneyGreen + Foot.Brush.Color = clBtnFace + Foot.Font.Color = clBlue + Title.Brush.Color = clBtnFace + Title.Brush.Style = bsClear + Title.Font.Color = clBlue + Title.Font.Height = -16 + Title.Text.Strings = ( + 'Standard' + ) + Title.Visible = True + Align = alLeft + Color = clGreen + ParentColor = False + object Chart1LineSeries1: TLineSeries + LinePen.Width = 2 + Source = RandomChartSource1 + end + object Chart1BarSeries1: TBarSeries + BarBrush.Color = clRed + Source = RandomChartSource1 + end + end + object PaintBox1: TPaintBox + Left = 304 + Height = 432 + Top = 0 + Width = 336 + Align = alClient + OnPaint = PaintBox1Paint + end + object Splitter1: TSplitter + Left = 300 + Height = 432 + Top = 0 + Width = 4 + end + object RandomChartSource1: TRandomChartSource + PointsNumber = 10 + RandSeed = 1795920317 + XMax = 15 + XMin = 5 + YMax = 10 + YMin = -1 + left = 189 + top = 263 + end +end diff --git a/components/tachart/demo/bgra/Main.pas b/components/tachart/demo/bgra/Main.pas new file mode 100644 index 0000000000..46b67f1ac4 --- /dev/null +++ b/components/tachart/demo/bgra/Main.pas @@ -0,0 +1,57 @@ +unit Main; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, ExtCtrls, PairSplitter, SysUtils, FileUtil, Forms, Controls, + Graphics, Dialogs, TAGraph, TASeries, TASources; + +type + + { TForm1 } + + TForm1 = class(TForm) + Chart1: TChart; + Chart1BarSeries1: TBarSeries; + Chart1LineSeries1: TLineSeries; + PaintBox1: TPaintBox; + RandomChartSource1: TRandomChartSource; + Splitter1: TSplitter; + procedure PaintBox1Paint(Sender: TObject); + end; + +var + Form1: TForm1; + +implementation + +{$R *.lfm} + +uses + BGRABitmap, TADrawerBGRA; + +{ TForm1 } + +procedure TForm1.PaintBox1Paint(Sender: TObject); +var + bmp: TBGRABitmap; +begin + bmp := TBGRABitmap.Create(PaintBox1.Width, PaintBox1.Height); + Chart1.DisableRedrawing; + try + Chart1.Title.Text.Text := 'BGRABitmap'; + Chart1.Draw( + TBGRABitmapDrawer.Create(bmp), + Rect(0, 0, PaintBox1.Width, PaintBox1.Height)); + bmp.Draw(PaintBox1.Canvas, 0, 0); + Chart1.Title.Text.Text := 'Standard'; + finally + Chart1.EnableRedrawing; + bmp.Free; + end; +end; + +end. + diff --git a/components/tachart/demo/bgra/bgrademo.lpi b/components/tachart/demo/bgra/bgrademo.lpi new file mode 100644 index 0000000000..eab52bf77a --- /dev/null +++ b/components/tachart/demo/bgra/bgrademo.lpi @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/components/tachart/demo/bgra/bgrademo.lpr b/components/tachart/demo/bgra/bgrademo.lpr new file mode 100644 index 0000000000..e82f01d926 --- /dev/null +++ b/components/tachart/demo/bgra/bgrademo.lpr @@ -0,0 +1,22 @@ +program bgrademo; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Interfaces, // this includes the LCL widgetset + bgrabitmappack, tachartlazaruspkg, + Forms, Main, tadrawerbgra + { you can add units after this }; + +{$R *.res} + +begin + RequireDerivedFormResource := True; + Application.Initialize; + Application.CreateForm(TForm1, Form1); + Application.Run; +end. +