<div dir="ltr">2013/1/28 Leonardo M. Ramé <span dir="ltr"><<a href="mailto:martinrame@yahoo.com" target="_blank">martinrame@yahoo.com</a>></span><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
[...]<br>
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.<br>
<br>
Leonardo M. Ramé<br>
<a href="http://leonardorame.blogspot.com" target="_blank">http://leonardorame.blogspot.com<br></a></blockquote></div><div><br></div><div style>It works fine (see result here: <a href="http://imagebin.org/244612">http://imagebin.org/244612</a>) in Win32 with this code:</div>
<div style><br></div><div style><div>program noguidemo;</div><div><br></div><div>{$mode objfpc}{$H+}</div><div><br></div><div>uses</div><div> Interfaces,</div><div> Classes,</div><div> FPCanvas,</div><div> FPImage,</div>
<div> FPImgCanv,</div><div> TATools,</div><div> TAGraph,</div><div> TASeries,</div><div> TADrawerCanvas,</div><div> TADrawUtils,</div><div> BGRABitmap,</div><div> TAChartUtils,</div><div> TADrawerBGRA;</div><div>
<br></div><div>var</div><div> chart: TChart;</div><div> bs: TBarSeries;</div><div> img: TBGRABitmap;</div><div> d: IChartDrawer;</div><div>begin</div><div> chart := TChart.Create(nil);</div><div> <a href="http://chart.LeftAxis.Marks.LabelFont.Name">chart.LeftAxis.Marks.LabelFont.Name</a> := 'Arial';</div>
<div> chart.LeftAxis.Marks.LabelFont.Size := 10;</div><div> chart.LeftAxis.Marks.LabelFont.Orientation := 450;</div><div> chart.LeftAxis.Marks.Frame.Visible := True;</div><div> chart.LeftAxis.Marks.Frame.Style := psSolid;</div>
<div> chart.LeftAxis.Marks.Frame.FPColor := colBlack;</div><div> chart.LeftAxis.Grid.FPColor := colDkGray;</div><div> chart.BottomAxis.Marks.Visible := False;</div><div> chart.BottomAxis.Grid.FPColor := colDkGray;</div>
<div> chart.Color := $FFA0A0;</div><div> chart.BackColor := $FFFFFF;</div><div> bs := TBarSeries.Create(nil);</div><div> chart.AddSeries(bs);</div><div> bs.AddXY(1, 10);</div><div> bs.AddXY(2, 7);</div><div> bs.AddXY(3, 8);</div>
<div> img := TBGRABitmap.Create(chart.Width, chart.Height);</div><div> d := TBGRABitmapDrawer.Create(img);</div><div> img.CanvasBGRA.Font.Antialiasing := true;</div><div> <a href="http://img.CanvasBGRA.Font.Name">img.CanvasBGRA.Font.Name</a> := 'Arial';</div>
<div> d.DoGetFontOrientation := @CanvasGetFontOrientationFunc;</div><div> chart.Draw(d, Rect(0, 0, chart.Width, chart.Height));</div><div> img.SaveToFile('test.png');</div><div> img.Free;</div><div> bs.Free;</div>
<div> chart.Free;</div><div>end.</div><div><br></div><div style>But, with NoGUI, the error is:</div><div style><div><br></div><div>C:\Users\silvioprog\Desktop\nogui>noguidemo.exe</div><div>TRasterImage.BitmapHandleNeeded: Unable to create handles, using default</div>
<div>[FORMS.PP] ExceptionOccurred</div><div> Sender=EInvalidOperation</div><div> Exception=Canvas does not allow drawing</div><div> Stack trace:</div><div> $004951D4 TCANVAS__REQUIREDSTATE, line 1672 of ./include/canvas.inc</div>
<div> $004953F0 TCANVAS__TEXTEXTENT, line 1731 of ./include/canvas.inc</div><div> $0060A29F GETFONTHEIGHTSIGN, line 236 of bgratext.pas</div><div> $005BCEFA TBGRADEFAULTBITMAP__INIT, line 1684 of bgradefaultbitmap.pas</div>
<div> $005B9DF6 TBGRADEFAULTBITMAP__CREATE, line 732 of bgradefaultbitmap.pas</div><div> $00401B91 main, line 43 of noguidemo.lpr</div><div>TApplication.HandleException Canvas does not allow drawing</div><div> Stack trace:</div>
<div> $004951D4 TCANVAS__REQUIREDSTATE, line 1672 of ./include/canvas.inc</div><div> $004953F0 TCANVAS__TEXTEXTENT, line 1731 of ./include/canvas.inc</div><div> $0060A29F GETFONTHEIGHTSIGN, line 236 of bgratext.pas</div>
<div> $005BCEFA TBGRADEFAULTBITMAP__INIT, line 1684 of bgradefaultbitmap.pas</div><div> $005B9DF6 TBGRADEFAULTBITMAP__CREATE, line 732 of bgradefaultbitmap.pas</div><div> $00401B91 main, line 43 of noguidemo.lpr</div>
<div>Exception at 004951D4: EInvalidOperation:</div><div>Canvas does not allow drawing.</div><div><br></div><div>C:\Users\silvioprog\Desktop\nogui></div></div></div><div><br></div><div>:(</div><div><br></div>-- <br>Silvio Clécio<br>
My public projects - <a href="http://github.com/silvioprog" target="_blank">github.com/silvioprog</a>
</div></div>