[fpc-pascal] TFPCanvasDrawer and anti-alias.

silvioprog silvioprog at gmail.com
Tue Jan 29 02:52:40 CET 2013


2013/1/28 silvioprog <silvioprog at gmail.com>

> 2013/1/28 Graeme Geldenhuys <graeme at geldenhuys.co.uk>
>
>> On 01/28/13 23:32, silvioprog wrote:
>> >> Not for lines.
>> >
>> >
>> > Sniff. :'(
>> >
>> > I'm trying to generate charts in my CGI apps:
>>
>> Use AggPas. That is exactly why I incorporated it into fpGUI. I needed
>> anti-aliased line drawing for graphs etc.
>>
>>
>> Regards,
>>   - Graeme -
>>
>
> Installing it now (http://imagebin.org/244603). Thank you Graeme! :)
>

Fail. :(

program noguidemo;

{$mode objfpc}{$H+}

uses
  Interfaces,
  Classes,
  FPCanvas,
  FPImage,
  TATools,
  TAGraph,
  TASeries,
  TADrawerFPCanvas,
  TADrawerCanvas,
  TADrawUtils,
  agg_fpimage;

var
  chart: TChart;
  bs: TBarSeries;
  c: TAggFPCanvas;
  d: IChartDrawer;
begin
  chart :=3D TChart.Create(nil);
  chart.LeftAxis.Marks.LabelFont.Name :=3D 'Arial';
  chart.LeftAxis.Marks.LabelFont.Size :=3D 10;
  chart.LeftAxis.Marks.LabelFont.Orientation :=3D 450;
  chart.LeftAxis.Marks.Frame.Visible :=3D True;
  chart.LeftAxis.Marks.Frame.Style :=3D psSolid;
  chart.LeftAxis.Marks.Frame.FPColor :=3D colBlack;
  chart.LeftAxis.Grid.FPColor :=3D colDkGray;
  chart.BottomAxis.Marks.Visible :=3D False;
  chart.BottomAxis.Grid.FPColor :=3D colDkGray;
  chart.Color :=3D $FFA0A0;
  chart.BackColor :=3D $FFFFFF;
  bs :=3D TBarSeries.Create(nil);
  chart.AddSeries(bs);
  bs.AddXY(1, 10);
  bs.AddXY(2, 7);
  bs.AddXY(3, 8);
  c :=3D TAggFPCanvas.Create;
  c.Width :=3D chart.Width;
  c.Height :=3D chart.Height;
  d :=3D TFPCanvasDrawer.Create(c);
  d.DoGetFontOrientation :=3D @CanvasGetFontOrientationFunc;
  chart.Draw(d, Rect(0, 0, chart.Width, chart.Height));
  c.Image.SaveToFile('test.png');
  c.Free;
  bs.Free;
  chart.Free;
end.

The result is:

http://imagebin.org/244608

I may be using the wrong way, but I did not find documentation to help me
with this. :/

-- =

Silvio Cl=E9cio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freepascal.org/lists/fpc-pascal/attachments/20130128/60df=
ce9a/attachment.htm


More information about the fpc-pascal mailing list