[Lazarus] Get JPEG from TAChart in CGI app

classic Classic list List threaded Threaded
56 messages Options
123
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Marco van de Voort
On Sun, Mar 20, 2011 at 07:30:27PM +0100, Michael Van Canneyt wrote:
> >
> > I get an Access Violation.
>
> Simply said: you can't.
>
> The current TAChart is not suitable for a CGI application. It expects a
> GUI.

(If people know how to fix/abstract that, I'd be interested due to a
possible application in an OpenGL gui)

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Alexander Klenin
On Tue, Mar 22, 2011 at 06:32, Marco van de Voort <[hidden email]> wrote:

> On Sun, Mar 20, 2011 at 07:30:27PM +0100, Michael Van Canneyt wrote:
>> >
>> > I get an Access Violation.
>>
>> Simply said: you can't.
>>
>> The current TAChart is not suitable for a CGI application. It expects a
>> GUI.
>
> (If people know how to fix/abstract that, I'd be interested due to a
> possible application in an OpenGL gui)

As you can see further in the thread, it is already half-fixed ;-)
TAChart still can not work without any widgetset,
but already works with nogui.
BTW, TAChart can draw to OpenGL.

--
Alexander S. Klenin

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Graeme Geldenhuys
In reply to this post by Alexander Klenin
On Mon, 21 Mar 2011 05:27:49 +1000
Alexander Klenin <klenin@****.com> wrote:
> You have to link you CGI app with some graphic widgetset,
> which will unfortunately bloat an executable, but should otherwise
> work.


Not 100% true. If you run that CGI app under a Linux server that
doesn't have X11 installed, it WILL fail.


--

Regards,
  - Graeme -

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Marco van de Voort
In reply to this post by Alexander Klenin
On Tue, Mar 22, 2011 at 06:47:11AM +1000, Alexander Klenin wrote:
> > (If people know how to fix/abstract that, I'd be interested due to a
> > possible application in an OpenGL gui)
>
> As you can see further in the thread, it is already half-fixed ;-)
> TAChart still can not work without any widgetset,
> but already works with nogui.
> BTW, TAChart can draw to OpenGL.

It's just a wild idea, and maybe TAChart is not feasable. But we to display
a whole bunch of trend meters in our app.

Fast, and predictable update times, scaling possibilities (the nearly free
pan and zoom are the main reason for opengl).

I'm planning to review our opengl routines this summer, and a HUD based
trendmeter is high on the agenda.


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Leonardo M. Ramé
In reply to this post by Leonardo M. Ramé
On 2011-03-21 15:07:46 -0300, Leonardo M. Ramé wrote:

> On 2011-03-21 23:49:36 +1000, Alexander Klenin wrote:
> > On Mon, Mar 21, 2011 at 23:19, Leonardo M. Ramé <[hidden email]> wrote:
> > > On 2011-03-21 09:43:23 -0300, Marcos Douglas wrote:
> > >> So, create a GUI app (always on) with HTTP support. The CGI request
> > >> charts to this app.
> > >>
> > >> Marcos Douglas
> > >
> > > Hi Marcos. In my case I cannot do that, because the app will run on a
> > > headless, no X, server.
> >
> > I have implemented initial FPCanvas backend.
> > Since r29962, nogui demo uses nogui widgetset -- thus, it should not
> > need GTK anymore.
> > Please test.
> >
>
> It seems to work, at least from command line, no fonts of course, but
> graphics and colors works ok.
>
> I'll test the CGI app from home when I'll go back from work.
>

I tested it in a CGI sample last night, but no luck. I keep getting the
"Canvas does not allow drawing error.".

--
Leonardo M. Ramé
http://leonardorame.blogspot.com

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Alexander Klenin
On Tue, Mar 22, 2011 at 21:57, Leonardo M. Ramé <[hidden email]> wrote:

>> > Since r29962, nogui demo uses nogui widgetset -- thus, it should not
>> > need GTK anymore.
>> > Please test.
>> >
>>
>> It seems to work, at least from command line, no fonts of course, but
>> graphics and colors works ok.
>>
>> I'll test the CGI app from home when I'll go back from work.
>>
>
> I tested it in a CGI sample last night, but no luck. I keep getting the
> "Canvas does not allow drawing error.".

That is very strange -- please make sure you are using the right version
using nogui widgetset (you can check it in Project Options -> Build
modes -> LCLWidgetType).
Otherwise, it sounds like nogui widgetset actually requires a GUI --
pretty serious bug, I'd say.

Can anybody else tell what's going on here?

--
Alexander S. Klenin

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Alexander Klenin
In reply to this post by Marco van de Voort
On Tue, Mar 22, 2011 at 18:02, Marco van de Voort <[hidden email]> wrote:
>> BTW, TAChart can draw to OpenGL.
>
> It's just a wild idea, and maybe TAChart is not feasable. But we to display
> a whole bunch of trend meters in our app.
>
> Fast, and predictable update times, scaling possibilities (the nearly free
> pan and zoom are the main reason for opengl).

Currently, TAChart back-ends are very simple and are only concerned
with actual drawing (in fact, they are called "drawers" in code).
So, zoom and panning in OpenGL mode are still performed by CPU.
My overall vision does include higher-level back-ends
(I currently plan to call them "renderers"), which will handle view
transformation
themselves -- but that requires yet another extensive refactoring,
so I do not think I will be able to do it soon.

> I'm planning to review our opengl routines this summer, and a HUD based
> trendmeter is high on the agenda.

Please send a message when you will start this --
maybe it will motivate me enough to push through with renderers ;-)

--
Alexander S. Klenin

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Leonardo M. Ramé
In reply to this post by Alexander Klenin
On 2011-03-23 05:23:26 +1000, Alexander Klenin wrote:

> On Tue, Mar 22, 2011 at 21:57, Leonardo M. Ramé <[hidden email]> wrote:
> >> > Since r29962, nogui demo uses nogui widgetset -- thus, it should not
> >> > need GTK anymore.
> >> > Please test.
> >> >
> >>
> >> It seems to work, at least from command line, no fonts of course, but
> >> graphics and colors works ok.
> >>
> >> I'll test the CGI app from home when I'll go back from work.
> >>
> >
> > I tested it in a CGI sample last night, but no luck. I keep getting the
> > "Canvas does not allow drawing error.".
>
> That is very strange -- please make sure you are using the right version
> using nogui widgetset (you can check it in Project Options -> Build
> modes -> LCLWidgetType).
> Otherwise, it sounds like nogui widgetset actually requires a GUI --
> pretty serious bug, I'd say.
>
> Can anybody else tell what's going on here?
>
Nevermind, it worked wonderfully.

I attached your nogui example compiled as a CGI.

--
Leonardo M. Ramé
http://leonardorame.blogspot.com

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

cgicharts.tar.gz (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Alexander Klenin
2011/3/23 Leonardo M. Ramé <[hidden email]>:
> Nevermind, it worked wonderfully.
>
> I attached your nogui example compiled as a CGI.

Excellent.
Now I just have to figure out how to draw text on FPCanvas...

--
Alexander S. Klenin

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Michael Van Canneyt


On Wed, 23 Mar 2011, Alexander Klenin wrote:

> 2011/3/23 Leonardo M. Ramé <[hidden email]>:
>> Nevermind, it worked wonderfully.
>>
>> I attached your nogui example compiled as a CGI.
>
> Excellent.
> Now I just have to figure out how to draw text on FPCanvas...

You need the ftfont, freetype, freetypeh units.
Then create a TFreetypeFont instance, assign to canvas.font,
and call TextRect() or whatever you would call normally.

in the SVN of FPC, check directory tests/utils/testsuite, unit utests.

It is a CGI  webprogram that e.g. draws a pie chart and puts a legend on it using FPimagecanvas.


Michael.
--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Alexander Klenin
2011/3/23 Michael Van Canneyt <[hidden email]>:
>> Now I just have to figure out how to draw text on FPCanvas...
>
> You need the ftfont, freetype, freetypeh units. Then create a TFreetypeFont
> instance, assign to canvas.font, and call TextRect() or whatever you would
> call normally.
>

Thanks for the pointer. I have added TFreetypeFont to the FPCanvas drawer.
See nogui demo since r29999.

However, I have encountered many problems:
1) FPCanvas drawer no requires freetype library even if no text is
actually drawn.
I can work around it by creating separate descendant drawer, but it is
frustrating.
2) FreeType library from gtk-windows is called 'freetype6.dll',
but freetypeh unit wants ''freetype-6.dll'.
I have no idea which is correct, but no the dll must be copied twice
(or symlinked, of course, but Windows symlink support is poor).
3) Kerning is totally broken. Maybe it is windows-specific problem,
but look at the attached code and screenshot to see what I mean.

--
Alexander S. Klenin

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

test.png (2K) Download Attachment
t.pp (696 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Vincent Snijders
2011/3/23 Alexander Klenin <[hidden email]>:

> 2011/3/23 Michael Van Canneyt <[hidden email]>:
>>> Now I just have to figure out how to draw text on FPCanvas...
>>
>> You need the ftfont, freetype, freetypeh units. Then create a TFreetypeFont
>> instance, assign to canvas.font, and call TextRect() or whatever you would
>> call normally.
>>
>
> Thanks for the pointer. I have added TFreetypeFont to the FPCanvas drawer.
> See nogui demo since r29999.
>

Does this mean that TAChart now always depends on TFreeTypeFont? And
that therefore Lazarus now requires the freefont libraries to be built
(and run) on *nix and to be run on windows?

Vincent

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Vincent Snijders
2011/4/4 Vincent Snijders <[hidden email]>:
> 2011/3/23 Alexander Klenin <[hidden email]>:
>> Thanks for the pointer. I have added TFreetypeFont to the FPCanvas drawer.
>> See nogui demo since r29999.
>>
>
> Does this mean that TAChart now always depends on TFreeTypeFont? And
> that therefore Lazarus now requires the freefont libraries to be built
> (and run) on *nix and to be run on windows?

The reason I ask, on powerpc-darwin (Mac OS X), I get the following errors:
Linking ../lazarus
/usr/bin/ld: Undefined symbols:
_FT_Done_FreeType
_FT_Done_Glyph
_FT_Get_Char_Index
_FT_Get_Glyph
_FT_Get_Kerning
_FT_Glyph_Copy
_FT_Glyph_To_Bitmap
_FT_Glyph_Transform
_FT_Init_FreeType
_FT_Load_Glyph
_FT_New_Face
_FT_Set_Char_Size
_FT_Set_Pixel_Sizes
An error occurred while linking
Error: Error while linking
Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted

Vincent

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Alexander Klenin
On Mon, Apr 4, 2011 at 22:32, Vincent Snijders
<[hidden email]> wrote:

> 2011/4/4 Vincent Snijders <[hidden email]>:
>> 2011/3/23 Alexander Klenin <[hidden email]>:
>>> Thanks for the pointer. I have added TFreetypeFont to the FPCanvas drawer.
>>> See nogui demo since r29999.
>>>
>>
>> Does this mean that TAChart now always depends on TFreeTypeFont? And
>> that therefore Lazarus now requires the freefont libraries to be built
>> (and run) on *nix and to be run on windows?
>
> The reason I ask, on powerpc-darwin (Mac OS X), I get the following errors:
> Linking ../lazarus
> /usr/bin/ld: Undefined symbols:
> _FT_Done_FreeType

If so, then it is a bug in FTFont.
BTW, I have found similar bug in GLUT -- see r29994.
I can remove font support for MacOS as I have done for Win64 --
just tell me the correct define to check.

--
Alexander S. Klenin

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Alexander Klenin
On Tue, Apr 5, 2011 at 01:09, Alexander Klenin <[hidden email]> wrote:
> I can remove font support for MacOS as I have done for Win64 --
> just tell me the correct define to check.

Alternatively, I can create a separate packages for FPCanvas and OpenGL,
as I have already done for AggPas and BGRABitmap.
I hoped to aviod that, since it would bring the TAChart to a total of
five packages.

--
Alexander S. Klenin

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Get JPEG from TAChart in CGI app

Darius Blaszyk
In reply to this post by Alexander Klenin

On Mar 23, 2011, at 12:05 PM, Alexander Klenin wrote:
> 3) Kerning is totally broken. Maybe it is windows-specific problem,
> but look at the attached code and screenshot to see what I mean.
This has been already fixed in trunk. I even think it has been merged in 2.4.3.

Darius
--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
123