[Lazarus] Get JPEG from TAChart in CGI app

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Mon Mar 21 13:04:34 CET 2011



On Mon, 21 Mar 2011, Mattias Gaertner wrote:

> On Mon, 21 Mar 2011 11:25:12 +0100 (CET)
> michael.vancanneyt at wisa.be wrote:
>
>> [...]
>>> Using widgetset is perhaps not the ideal solution, but the practical one,
>>> given the contraints of existing tools.
>>> Surely they may be improved, but that is not fast not easy to do.
>>
>> Correct. Unfortunately, no-one seems to be willing to take on the task :(
>
> Huh?
> AFAIK you can do quite a lot with fpcanvas. You
> can use fonts. But using fonts is not very comfortable because you have
> to search and load it yourself.
>
>
>>>> None of "theme,  screen color depths and sub pixel rendering parameters" are
>>>> necessary to create a bitmap. A bitmap is a matrix of pixels with a certain
>>>> color. No more, no less. Some of these parameters are needed when the bitmap
>>>> is being displayed, but definitely not when it is created.
>>>
>>> I am not sure how you could create a bitmap without (at least implicitly)
>>> specifying color depth.
>>
>> There is no need for 'color depth'. A color is 4 words; that's it.
>
> 48bit for each pixel costs a lot of mem and speed.
> But it is easy with fpimage to define a RGB 8bit image or RGBA or
> grayscale.
>
>
>> [...]
>>> I even suspect that in many cases widgetset drawing is faster than
>>> pure FPCanvas.
>
> Why?
> AFAIK in cgi you can not use the hardware acceleration.

You don't need it, either.

When generating a bitmap, I don't see how hardware accelleration 
of the graphics card comes into play ?
When generating a bitmap 'on screen', the double buffering mechanism 
means that
a) you somehow create it in memory
b) it is then moved 'accelerated' to screen.
and in 95% of cases, even without double buffering, this is the mechanism
used.

Since CGI only needs step a), the 'acceleration' is not needed.

>>> Now, the fact that a widgetset tries to access *screen* to create a bitmap
>>> is a problem, I would even call it a bug, although I do not know if it
>>> is in GTK or LCL.
>>
>> I suppose the LCL, because most likely it asks some system metrics (DPI etc).
>> The widgetset can only get them from the display...
>
> Since you are the second to blame the LCL, let's try the most simple
> gtk program:
>
> program test1;
> uses gtk2;
> begin
>  gtk_init(nil, nil);
> end.
>
> $ ./test1
>
> (test1:3683): Gtk-WARNING **: cannot open display:

Obviously, but AFAIK it is the LCL that calls gtk_init ? 
Simply linking to GTK doesn't open a display, I presume.

Michael.


More information about the Lazarus mailing list