Hello,
TFPCanvasDrawer provides anti-alias support?
Thank you!

Mailing lists / fpc-pascal / 2013-01
12 messages · 4 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hello,
TFPCanvasDrawer provides anti-alias support?
Thank you!
silvioprog wroteHello, TFPCanvasDrawer provides anti-alias support?
Not for lines. For texts, it should be able to add it.
Michael.
2013/1/28 Michael Van Canneyt
Sniff. :'(
I'm trying to generate charts in my CGI apps:
http://silvioprog.com.br/cgi-bin/cgi1
And PDF with PowerPDF (I'll send a patch soon to remove some LCL dependences):
http://silvioprog.com.br/cgi-bin/cgi2 (Clique "aqui" = Click "here")
For texts, it should be able to add it.
Yes:
procedure TFPCanvasDrawer.EnsureFont;
begin
{$IFDEF USE_FTFONT}
if FFont nil then exit;
FFont := TFreeTypeFont.Create;
FFont.Resolution := 72;
FFont.AntiAliased := False; <<<< I'll set it for True. It would be
interesting if there was a property to handle it.:)
FCanvas.Font := FFont;
{$ENDIF}
end;Thanks for the fast reply man! :)
ps. I'm very, very happy with the Free Pascal. Now, I'm creating fine my PDFs and charts. I will make one layer to facilitate the use of some classes of PowerPDF and TAChart.
Not for lines.
Silvio, TAchart has a BGRABitmap backend mode, it creates great anti-aliased graphics (both lines and text). I didn't tested on CGI without linking against graphic libraries, I think it relies on TCanvas, so maybe it won't work, but it worth a try.
Leonardo M. Ramé
http://leonardorame.blogspot.com
2013/1/28 Michael Van Canneyt 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 -
Not for lines. Silvio, TAchart has a BGRABitmap backend mode, it creates great…
2013/1/28 Leonardo M. Ramé
I'll test it now, thank you Leo! :)
Is this the official link to download it?:
https://lazpaint.svn.sourceforge.net/svnroot/lazpaint
Use AggPas. That is exactly why I incorporated it into fpGUI. I needed anti-aliased line…
----- Original Message -----
Yes, that's a nice backend for TAchart.
Also you could generate your charts in the browser, using a JavaScript/Html5 library like this one: http://www.humblesoftware.com/flotr2/
Leonardo M. Ramé
http://leonardorame.blogspot.com
2013/1/28 Leonardo M. Ramé I'll test it now, thank you Leo! :) Is this the official link…
svn co svn://svn.code.sf.net/p/lazpaint/code/bgrabitmap
Leonardo M. Ramé
http://leonardorame.blogspot.com
Use AggPas. That is exactly why I incorporated it into fpGUI. I needed anti-aliased line…
2013/1/28 Graeme Geldenhuys
Installing it now (http://imagebin.org/244603). Thank you Graeme! :)
2013/1/28 silvioprog
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:
I may be using the wrong way, but I did not find documentation to help me with this. :/
Not for lines. Silvio, TAchart has a BGRABitmap backend mode, it creates great…
2013/1/28 Leonardo M. Ramé
It works fine (see result here: http://imagebin.org/244612) in Win32 with this code:
program noguidemo;
{$mode objfpc}{$H+}uses
Interfaces,
Classes,
FPCanvas,
FPImage,
FPImgCanv,
TATools,
TAGraph,
TASeries,
TADrawerCanvas,
TADrawUtils,
BGRABitmap,
TAChartUtils,
TADrawerBGRA;var
chart: TChart;
bs: TBarSeries;
img: TBGRABitmap;
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);
img := TBGRABitmap.Create(chart.Width, chart.Height);
d := TBGRABitmapDrawer.Create(img);
img.CanvasBGRA.Font.Antialiasing := true;
img.CanvasBGRA.Font.Name := 'Arial';
d.DoGetFontOrientation := @CanvasGetFontOrientationFunc;
chart.Draw(d, Rect(0, 0, chart.Width, chart.Height));
img.SaveToFile('test.png');
img.Free;
bs.Free;
chart.Free;
end.But, with NoGUI, the error is:
C:\Users\silvioprog\Desktop\nogui>noguidemo.exe
TRasterImage.BitmapHandleNeeded: Unable to create handles, using default [FORMS.PP] ExceptionOccurred
Sender=EInvalidOperation
Exception=Canvas does not allow drawing
Stack trace:
$004951D4 TCANVAS__REQUIREDSTATE, line 1672 of ./include/canvas.inc $004953F0 TCANVAS__TEXTEXTENT, line 1731 of ./include/canvas.inc $0060A29F GETFONTHEIGHTSIGN, line 236 of bgratext.pas $005BCEFA TBGRADEFAULTBITMAP__INIT, line 1684 of bgradefaultbitmap.pas $005B9DF6 TBGRADEFAULTBITMAP__CREATE, line 732 of bgradefaultbitmap.pas $00401B91 main, line 43 of noguidemo.lpr
TApplication.HandleException Canvas does not allow drawing Stack trace:
$004951D4 TCANVAS__REQUIREDSTATE, line 1672 of ./include/canvas.inc $004953F0 TCANVAS__TEXTEXTENT, line 1731 of ./include/canvas.inc $0060A29F GETFONTHEIGHTSIGN, line 236 of bgratext.pas $005BCEFA TBGRADEFAULTBITMAP__INIT, line 1684 of bgradefaultbitmap.pas $005B9DF6 TBGRADEFAULTBITMAP__CREATE, line 732 of bgradefaultbitmap.pas $00401B91 main, line 43 of noguidemo.lpr
Exception at 004951D4: EInvalidOperation:
Canvas does not allow drawing.
C:\Users\silvioprog\Desktop\nogui>
:(
2013/1/28 silvioprog Fail. :( program noguidemo; {$mode objfpc}{$H+} uses agg_fpimage; var
silvioprog wroteFail. :(
I don't use the AggPas from Lazarus though, so not sure what new dependencies it pulls in.
The result is: http://imagebin.org/244608
I believe I saw a LCL bug report about such "weird" bitmaps recently. I don't think the problem is AggPas, but rather one of LCL. Maybe it is worth asking in the Lazarus mailing list.
Regards,
- Graeme -