[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 := TChart.Create(nil);
chart.LeftAxis.Marks.LabelFont.Name := 'Arial';
chart.LeftAxis.Marks.LabelFont.Size := 10;
chart.LeftAxis.Marks.LabelFont.Orientation := 450;
chart.LeftAxis.Marks.Frame.Visible := True;
chart.LeftAxis.Marks.Frame.Style := psSolid;
chart.LeftAxis.Marks.Frame.FPColor := colBlack;
chart.LeftAxis.Grid.FPColor := colDkGray;
chart.BottomAxis.Marks.Visible := False;
chart.BottomAxis.Grid.FPColor := colDkGray;
chart.Color := $FFA0A0;
chart.BackColor := $FFFFFF;
bs := TBarSeries.Create(nil);
chart.AddSeries(bs);
bs.AddXY(1, 10);
bs.AddXY(2, 7);
bs.AddXY(3, 8);
c := TAggFPCanvas.Create;
c.Width := chart.Width;
c.Height := chart.Height;
d := TFPCanvasDrawer.Create(c);
d.DoGetFontOrientation := @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écio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130128/60dfce9a/attachment.html>
More information about the fpc-pascal
mailing list