Re: [fpc-pascal] I'm working on automated Help Output for console apps

2020-11-19 Thread Michael Van Canneyt via fpc-pascal



On Fri, 20 Nov 2020, Sven Barth via fpc-pascal wrote:


Graeme Geldenhuys via fpc-pascal  schrieb
am Fr., 20. Nov. 2020, 01:33:


For those console programmers out there... Is there anything in console
help
output that you like or wish you had. That way I could possibly add it and
make this even more useful to a wider audience.



Two things come to mind.

The first I don't know whether you have that on your list already: the
ability to change the prefixes ('-', '--') and the long argument separator
('='). Of course not specific to a single argument, but for all.

The second part is less output specific, but more DRY: a way to convert the
option list to TConsoleApplication's argument handling so that one doesn't
have to declare that twice.


Basically that should be a string for the short options
  abc:e:f:g:: 
and an array of strings

  ['alert','bonus','config:','export:','file:','generate::']

where : means value required and :: means optional value.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] I'm working on automated Help Output for console apps

2020-11-19 Thread Sven Barth via fpc-pascal
Graeme Geldenhuys via fpc-pascal  schrieb
am Fr., 20. Nov. 2020, 01:33:

> For those console programmers out there... Is there anything in console
> help
> output that you like or wish you had. That way I could possibly add it and
> make this even more useful to a wider audience.
>

Two things come to mind.

The first I don't know whether you have that on your list already: the
ability to change the prefixes ('-', '--') and the long argument separator
('='). Of course not specific to a single argument, but for all.

The second part is less output specific, but more DRY: a way to convert the
option list to TConsoleApplication's argument handling so that one doesn't
have to declare that twice.

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] I'm working on automated Help Output for console apps

2020-11-19 Thread Graeme Geldenhuys via fpc-pascal
Hi,

I'm working on a automated help output writer(s) for console apps.
Thus no more tedious and ugly output when you do: myapp -h

My aims:
 * I write a lot of console apps, so this would be very useful to me.
 * Ability to swap out the help formatter. It's interface based, so
   custom implementations can easily be created.
 * Auto align help options and descriptions - the most annoying thing to
   do manually. ;-)
 * Ability to define console width in which to format and wrap the help
   output, but has a default value.
 * The idea is loosely base on the Java version found in Apache Commons.

When it's done I'll obviously shared it as open source somewhere.

With that said, below is how I currently use it. It uses the Builder design
pattern so gives it the Chain Invocations syntax. I know it's not something
often seen in Pascal programs, but it makes it very easy to read and easy
to use/type, especially with code completion editors like Lazarus IDE.

For those console programmers out there... Is there anything in console help
output that you like or wish you had. That way I could possibly add it and
make this even more useful to a wider audience.

I'm still working on AppName, Version and Usage output.

Example code:
==
var
  optionlist: TOptions;
  helpFormatter: IHelpFormatter;
  header: string;
  footer: string;
begin
  optionlist := TOptions.Create;

  optionlist.add(TOption.Builder
.isRequired
.withDescription('The file to be processed')
.hasArg
.withArgName('file')
.withLongOpt('file')
.build('f'));// build() always takes the mandatory short option.

  optionlist.add(TOption.Builder
.withLongOpt('help')
.withArgName('test')  // this is ignored because .hasArg was not 
specified
.build('h'));

  optionlist.add(TOption.Builder
.withDescription('Print the version of the application')
.withLongOpt('version')
.build('v'));

  header := 'Do something useful with an input file' + LineEnding;
  footer := LineEnding + 'Please report issues at http://example.com/issues';

  helpFormatter := TBasicHelpFormatter.Create();

  // sample outputs with increasing verbosity

  writeln('===   (1)');
  helpFormatter.printHelp(optionlist);

  writeln('===   (2)');
  helpFormatter.printHelp('DocView v1.0', optionlist);

  writeln('===   (3)');
  helpFormatter.printHelp('DocView v1.0', header, optionlist, footer);

  writeln('== the end =');
  optionlist.Free;
end;
==


And here is the example output for the 3 options so far:

===   (1)
* -f,--file The file to be processed
  -h,--help
  -v,--versionPrint the version of the application

* indicates required parameters
===   (2)
DocView v1.0
* -f,--file The file to be processed
  -h,--help
  -v,--versionPrint the version of the application

* indicates required parameters
===   (3)
DocView v1.0
Do something useful with an input file

* -f,--file The file to be processed
  -h,--help
  -v,--versionPrint the version of the application

* indicates required parameters

Please report issues at http://example.com/issues
== the end =



Regards,
  Graeme

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

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Graphing library

2020-11-19 Thread Graeme Geldenhuys via fpc-pascal
On 19/11/2020 1:29 pm, James Richters via fpc-pascal wrote:
> Exporting PDF files from my AGG-Pas buffer would be really nice.

Indeed an interesting idea, but unfortunately that ability has not been
implemented yet. In my earlier message I was more referring to using
either fpPDF or AggPas.

Saying that I'm not saying it's impossible for AggPas to generate
PDF's - I've just not looked into it. ;-)


> Would you happen to have a sample program of how to generate a PDF
> from my Agg-Pas buffer

As I mentioned, that functionality does not exist yet. If you want
examples of how to generate PDFs using fpPDF however, the FPC code
includes examples, and you can also take a look at the fpReport code
too, as it can use fpPDF as report output renderer too.

 On a side note:
   I also wrote an AggPas report output renderer for fpReport, but
   not sure if that was included with FPC at the time. If not, it
   is available in the fpGUI's code repository.

Regards,
  Graeme

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

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] PTC Graph - Custom window sizes

2020-11-19 Thread James Richters via fpc-pascal
Thanks for the explanation
I don't really need to have multiple windows.. just an idea I was tinkering 
with while I was testing some things.This already solves the main issues I 
was having.

I had another thought..  I can imagine a use for wanting to make the PTCGraph 
window larger than my screen.. then move the window to see parts of it that 
don't fit.  Just for fun I tried to define a PTCGraph window larger than my 
screen but it seemed to be truncated to the size of my screen.   Is there an 
easy fix to allow the PTCGraph window to be larger than the screen?  I know I 
can keep re-drawing things.. but sometimes the redraw can be really slow, so if 
I drew it slow once on a window larger than my screen then just move the whole 
window around it would get around the slow re-draw.

James

-Original Message-
From: fpc-pascal  On Behalf Of Nikolay 
Nikolov via fpc-pascal
Sent: Thursday, November 19, 2020 5:06 PM
To: 'FPC-Pascal users discussions' 
Cc: Nikolay Nikolov 
Subject: Re: [fpc-pascal] PTC Graph - Custom window sizes


On 11/19/20 11:40 PM, James Richters wrote:
> So far it's working great!But now I have another question... Since I can 
> now have a small little PTCGraph window... is there any possibility of having 
> more than one in the same program?  Perhaps running each window in a 
> different thread? Or is there something fundamental that prevents this?

That would require rewriting the entire graph unit interface, which is a legacy 
from Turbo Pascal and is designed with full screen graphics on a single display 
in mind. In other words, it would be a new library, and not ptcgraph anymore. 
The problem is, there is currently no concept for a graphics or window context. 
When you call a graphics function, it draws to the screen. If you have multiple 
windows, then each window is like a separate screen, and then how can each 
function know which window it should draw into? This means a major API change 
is required (adding extra parameters, or redesigning the API entirely, using 
classes), which would break backward compatibility. And at this point, if you 
need multiple windows, you can probably switch to using the Lazarus LCL and 
create a proper GUI app, since your app will need to be rewritten anyway as a 
multi-window app.

Nikolay

>
> James
>
> -Original Message-
> From: fpc-pascal  On Behalf 
> Of James Richters via fpc-pascal
> Sent: Thursday, November 19, 2020 1:49 PM
> To: 'FPC-Pascal users discussions' 
> Cc: James Richters ; 'Nikolay 
> Nikolov' 
> Subject: Re: [fpc-pascal] PTC Graph - Custom window sizes
>
> Thank you very much Nikolay!  I will test it and let you know the results.
>
> James
>
>
> -Original Message-
> From: fpc-pascal  On Behalf 
> Of Nikolay Nikolov via fpc-pascal
> Sent: Thursday, November 19, 2020 1:07 PM
> To: fpc-pascal@lists.freepascal.org
> Cc: Nikolay Nikolov 
> Subject: Re: [fpc-pascal] PTC Graph - Custom window sizes
>
>
> On 11/19/20 7:37 PM, Nikolay Nikolov wrote:
>> On 11/19/20 3:44 PM, James Richters via fpc-pascal wrote:
>>> I've been using PTCGraph from PTCPas and so far I can only use 
>>> windows sizes that there happens to be a display driver for,  even 
>>> if they are in a window.. so I can make a 640x480 or 1024x768 
>>> window, but if I have a screen in a vertical configuration now I 
>>> can't get a
>>> 640x480 window, I can only get a 480x640 window because with the 
>>> screen vertical, only vertical orientation graphics drivers are
>>> available.There are times I want a totally custom size window as
>>> well,  like a 100x50.  I see a lot of procedure like 
>>> ptc_Init640x480x32bpp with all kinds of configurations of screen 
>>> resolutions and color densities, but there is also some named 
>>> ptc_InitNonStandard32k.. with other color densities.. but I don't 
>>> know how to initialize PTCGraph into my own custom window size.
>>> Does anyone know how I could make my PTCGraph windows a custom weird 
>>> size that doesn't necessarily match the available video drivers?
>> It's not possible with the current implementation, but right now I'm 
>> working on a patch that would make this possible. I'll post here when 
>> it's ready for testing.
> Implemented and committed in ptcpas and fpc trunk. The new function is called 
> InstallUserMode:
>
> function InstallUserMode(Width, Height: SmallInt; Colors: LongInt;
> HardwarePages: SmallInt; XAspect, YAspect: Word): smallint;
>
> Example use:
>
> uses
> {$ifdef UNIX}cthreads,{$endif} ptcgraph, ptccrt; var
> gd, gm: SmallInt;
> begin
> gd := VESA;
> gm := InstallUserMode(100, 160, 16, 1, 1, 1);
> if gm < 0 then
> begin
>   Writeln(ErrOutput, 'Error installing user mode: ', GraphErrorMsg(gm));
>   Halt(1);
> end;
> InitGraph(gd, gm, '');
> OutText('Hello!');
> ReadKey;
> CloseGraph;
> end.
>
> It supports adding modes with 16, 256, 32768, 65536 and 16777216 colors with 
> a custom X and Y resolution, 

Re: [fpc-pascal] PTC Graph - Custom window sizes

2020-11-19 Thread Nikolay Nikolov via fpc-pascal


On 11/19/20 11:40 PM, James Richters wrote:

So far it's working great!But now I have another question... Since I can 
now have a small little PTCGraph window... is there any possibility of having 
more than one in the same program?  Perhaps running each window in a different 
thread? Or is there something fundamental that prevents this?


That would require rewriting the entire graph unit interface, which is a 
legacy from Turbo Pascal and is designed with full screen graphics on a 
single display in mind. In other words, it would be a new library, and 
not ptcgraph anymore. The problem is, there is currently no concept for 
a graphics or window context. When you call a graphics function, it 
draws to the screen. If you have multiple windows, then each window is 
like a separate screen, and then how can each function know which window 
it should draw into? This means a major API change is required (adding 
extra parameters, or redesigning the API entirely, using classes), which 
would break backward compatibility. And at this point, if you need 
multiple windows, you can probably switch to using the Lazarus LCL and 
create a proper GUI app, since your app will need to be rewritten anyway 
as a multi-window app.


Nikolay



James

-Original Message-
From: fpc-pascal  On Behalf Of James 
Richters via fpc-pascal
Sent: Thursday, November 19, 2020 1:49 PM
To: 'FPC-Pascal users discussions' 
Cc: James Richters ; 'Nikolay Nikolov' 

Subject: Re: [fpc-pascal] PTC Graph - Custom window sizes

Thank you very much Nikolay!  I will test it and let you know the results.

James


-Original Message-
From: fpc-pascal  On Behalf Of Nikolay 
Nikolov via fpc-pascal
Sent: Thursday, November 19, 2020 1:07 PM
To: fpc-pascal@lists.freepascal.org
Cc: Nikolay Nikolov 
Subject: Re: [fpc-pascal] PTC Graph - Custom window sizes


On 11/19/20 7:37 PM, Nikolay Nikolov wrote:

On 11/19/20 3:44 PM, James Richters via fpc-pascal wrote:

I've been using PTCGraph from PTCPas and so far I can only use
windows sizes that there happens to be a display driver for,  even if
they are in a window.. so I can make a 640x480 or 1024x768 window,
but if I have a screen in a vertical configuration now I can't get a
640x480 window, I can only get a 480x640 window because with the
screen vertical, only vertical orientation graphics drivers are
available.There are times I want a totally custom size window as
well,  like a 100x50.  I see a lot of procedure like
ptc_Init640x480x32bpp with all kinds of configurations of screen
resolutions and color densities, but there is also some named
ptc_InitNonStandard32k.. with other color densities.. but I don't
know how to initialize PTCGraph into my own custom window size.
Does anyone know how I could make my PTCGraph windows a custom weird
size that doesn't necessarily match the available video drivers?

It's not possible with the current implementation, but right now I'm
working on a patch that would make this possible. I'll post here when
it's ready for testing.

Implemented and committed in ptcpas and fpc trunk. The new function is called 
InstallUserMode:

function InstallUserMode(Width, Height: SmallInt; Colors: LongInt;
HardwarePages: SmallInt; XAspect, YAspect: Word): smallint;

Example use:

uses
{$ifdef UNIX}cthreads,{$endif} ptcgraph, ptccrt; var
gd, gm: SmallInt;
begin
gd := VESA;
gm := InstallUserMode(100, 160, 16, 1, 1, 1);
if gm < 0 then
begin
  Writeln(ErrOutput, 'Error installing user mode: ', GraphErrorMsg(gm));
  Halt(1);
end;
InitGraph(gd, gm, '');
OutText('Hello!');
ReadKey;
CloseGraph;
end.

It supports adding modes with 16, 256, 32768, 65536 and 16777216 colors with a custom X 
and Y resolution, custom number of hardware pages (for use with SetActivePage and 
SetVisualPage) and a custom pixel aspect ratio (used for drawing circles instead of 
ellipses on displays without square pixels - for square pixels, use "1, 
1").

Please test. :)

Best regards,

Nikolay

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org 
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org 
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] PTC Graph - Custom window sizes

2020-11-19 Thread James Richters via fpc-pascal
So far it's working great!But now I have another question... Since I can 
now have a small little PTCGraph window... is there any possibility of having 
more than one in the same program?  Perhaps running each window in a different 
thread? Or is there something fundamental that prevents this?

James

-Original Message-
From: fpc-pascal  On Behalf Of James 
Richters via fpc-pascal
Sent: Thursday, November 19, 2020 1:49 PM
To: 'FPC-Pascal users discussions' 
Cc: James Richters ; 'Nikolay Nikolov' 

Subject: Re: [fpc-pascal] PTC Graph - Custom window sizes

Thank you very much Nikolay!  I will test it and let you know the results.

James


-Original Message-
From: fpc-pascal  On Behalf Of Nikolay 
Nikolov via fpc-pascal
Sent: Thursday, November 19, 2020 1:07 PM
To: fpc-pascal@lists.freepascal.org
Cc: Nikolay Nikolov 
Subject: Re: [fpc-pascal] PTC Graph - Custom window sizes


On 11/19/20 7:37 PM, Nikolay Nikolov wrote:
>
> On 11/19/20 3:44 PM, James Richters via fpc-pascal wrote:
>> I've been using PTCGraph from PTCPas and so far I can only use 
>> windows sizes that there happens to be a display driver for,  even if 
>> they are in a window.. so I can make a 640x480 or 1024x768 window, 
>> but if I have a screen in a vertical configuration now I can't get a
>> 640x480 window, I can only get a 480x640 window because with the 
>> screen vertical, only vertical orientation graphics drivers are
>> available.There are times I want a totally custom size window as 
>> well,  like a 100x50.  I see a lot of procedure like 
>> ptc_Init640x480x32bpp with all kinds of configurations of screen 
>> resolutions and color densities, but there is also some named 
>> ptc_InitNonStandard32k.. with other color densities.. but I don't 
>> know how to initialize PTCGraph into my own custom window size.
>> Does anyone know how I could make my PTCGraph windows a custom weird 
>> size that doesn't necessarily match the available video drivers?
>
> It's not possible with the current implementation, but right now I'm 
> working on a patch that would make this possible. I'll post here when 
> it's ready for testing.

Implemented and committed in ptcpas and fpc trunk. The new function is called 
InstallUserMode:

function InstallUserMode(Width, Height: SmallInt; Colors: LongInt;
HardwarePages: SmallInt; XAspect, YAspect: Word): smallint;

Example use:

uses
   {$ifdef UNIX}cthreads,{$endif} ptcgraph, ptccrt; var
   gd, gm: SmallInt;
begin
   gd := VESA;
   gm := InstallUserMode(100, 160, 16, 1, 1, 1);
   if gm < 0 then
   begin
 Writeln(ErrOutput, 'Error installing user mode: ', GraphErrorMsg(gm));
 Halt(1);
   end;
   InitGraph(gd, gm, '');
   OutText('Hello!');
   ReadKey;
   CloseGraph;
end.

It supports adding modes with 16, 256, 32768, 65536 and 16777216 colors with a 
custom X and Y resolution, custom number of hardware pages (for use with 
SetActivePage and SetVisualPage) and a custom pixel aspect ratio (used for 
drawing circles instead of ellipses on displays without square pixels - for 
square pixels, use "1, 1").

Please test. :)

Best regards,

Nikolay

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org 
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org 
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] PTC Graph - Custom window sizes

2020-11-19 Thread James Richters via fpc-pascal
Thank you very much Nikolay!  I will test it and let you know the results.

James


-Original Message-
From: fpc-pascal  On Behalf Of Nikolay 
Nikolov via fpc-pascal
Sent: Thursday, November 19, 2020 1:07 PM
To: fpc-pascal@lists.freepascal.org
Cc: Nikolay Nikolov 
Subject: Re: [fpc-pascal] PTC Graph - Custom window sizes


On 11/19/20 7:37 PM, Nikolay Nikolov wrote:
>
> On 11/19/20 3:44 PM, James Richters via fpc-pascal wrote:
>> I've been using PTCGraph from PTCPas and so far I can only use 
>> windows sizes that there happens to be a display driver for,  even if 
>> they are in a window.. so I can make a 640x480 or 1024x768 window, 
>> but if I have a screen in a vertical configuration now I can't get a
>> 640x480 window, I can only get a 480x640 window because with the 
>> screen vertical, only vertical orientation graphics drivers are 
>> available.There are times I want a totally custom size window as 
>> well,  like a 100x50.  I see a lot of procedure like 
>> ptc_Init640x480x32bpp with all kinds of configurations of screen 
>> resolutions and color densities, but there is also some named 
>> ptc_InitNonStandard32k.. with other color densities.. but I don't 
>> know how to initialize PTCGraph into my own custom window size.
>> Does anyone know how I could make my PTCGraph windows a custom weird 
>> size that doesn't necessarily match the available video drivers?
>
> It's not possible with the current implementation, but right now I'm 
> working on a patch that would make this possible. I'll post here when 
> it's ready for testing.

Implemented and committed in ptcpas and fpc trunk. The new function is called 
InstallUserMode:

function InstallUserMode(Width, Height: SmallInt; Colors: LongInt;
HardwarePages: SmallInt; XAspect, YAspect: Word): smallint;

Example use:

uses
   {$ifdef UNIX}cthreads,{$endif} ptcgraph, ptccrt; var
   gd, gm: SmallInt;
begin
   gd := VESA;
   gm := InstallUserMode(100, 160, 16, 1, 1, 1);
   if gm < 0 then
   begin
 Writeln(ErrOutput, 'Error installing user mode: ', GraphErrorMsg(gm));
 Halt(1);
   end;
   InitGraph(gd, gm, '');
   OutText('Hello!');
   ReadKey;
   CloseGraph;
end.

It supports adding modes with 16, 256, 32768, 65536 and 16777216 colors with a 
custom X and Y resolution, custom number of hardware pages (for use with 
SetActivePage and SetVisualPage) and a custom pixel aspect ratio (used for 
drawing circles instead of ellipses on displays without square pixels - for 
square pixels, use "1, 1").

Please test. :)

Best regards,

Nikolay

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org 
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] PTC Graph - Custom window sizes

2020-11-19 Thread Nikolay Nikolov via fpc-pascal


On 11/19/20 7:37 PM, Nikolay Nikolov wrote:


On 11/19/20 3:44 PM, James Richters via fpc-pascal wrote:
I've been using PTCGraph from PTCPas and so far I can only use 
windows sizes that there happens to be a display driver for,  even if 
they are in a window.. so I can make a 640x480 or 1024x768 window,  
but if I have a screen in a vertical configuration now I can't get a 
640x480 window, I can only get a 480x640 window because with the 
screen vertical, only vertical orientation graphics drivers are 
available.    There are times I want a totally custom size window as 
well,  like a 100x50.  I see a lot of procedure like 
ptc_Init640x480x32bpp with all kinds of configurations of screen 
resolutions and color densities, but there is also some named 
ptc_InitNonStandard32k.. with other color densities.. but I don't 
know how to initialize PTCGraph into my own custom window size.   
Does anyone know how I could make my PTCGraph windows a custom weird 
size that doesn't necessarily match the available video drivers?


It's not possible with the current implementation, but right now I'm 
working on a patch that would make this possible. I'll post here when 
it's ready for testing.


Implemented and committed in ptcpas and fpc trunk. The new function is 
called InstallUserMode:


function InstallUserMode(Width, Height: SmallInt; Colors: LongInt; 
HardwarePages: SmallInt; XAspect, YAspect: Word): smallint;


Example use:

uses
  {$ifdef UNIX}cthreads,{$endif} ptcgraph, ptccrt;
var
  gd, gm: SmallInt;
begin
  gd := VESA;
  gm := InstallUserMode(100, 160, 16, 1, 1, 1);
  if gm < 0 then
  begin
    Writeln(ErrOutput, 'Error installing user mode: ', GraphErrorMsg(gm));
    Halt(1);
  end;
  InitGraph(gd, gm, '');
  OutText('Hello!');
  ReadKey;
  CloseGraph;
end.

It supports adding modes with 16, 256, 32768, 65536 and 16777216 colors 
with a custom X and Y resolution, custom number of hardware pages (for 
use with SetActivePage and SetVisualPage) and a custom pixel aspect 
ratio (used for drawing circles instead of ellipses on displays without 
square pixels - for square pixels, use "1, 1").


Please test. :)

Best regards,

Nikolay

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] PTC Graph - Custom window sizes

2020-11-19 Thread Nikolay Nikolov via fpc-pascal


On 11/19/20 3:44 PM, James Richters via fpc-pascal wrote:

I've been using PTCGraph from PTCPas and so far I can only use windows sizes 
that there happens to be a display driver for,  even if they are in a window.. 
so I can make a 640x480 or 1024x768 window,  but if I have a screen in a 
vertical configuration now I can't get a 640x480 window, I can only get a 
480x640 window because with the screen vertical, only vertical orientation 
graphics drivers are available.There are times I want a totally custom size 
window as well,  like a 100x50.  I see a lot of procedure like 
ptc_Init640x480x32bpp with all kinds of configurations of screen resolutions 
and color densities, but there is also some named ptc_InitNonStandard32k.. with 
other color densities.. but I don't know how to initialize PTCGraph into my own 
custom window size.   Does anyone know how I could make my PTCGraph windows a 
custom weird size that doesn't necessarily match the available video drivers?


It's not possible with the current implementation, but right now I'm 
working on a patch that would make this possible. I'll post here when 
it's ready for testing.


Nikolay

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] PTC Graph - Custom window sizes

2020-11-19 Thread James Richters via fpc-pascal
I've been using PTCGraph from PTCPas and so far I can only use windows sizes 
that there happens to be a display driver for,  even if they are in a window.. 
so I can make a 640x480 or 1024x768 window,  but if I have a screen in a 
vertical configuration now I can't get a 640x480 window, I can only get a 
480x640 window because with the screen vertical, only vertical orientation 
graphics drivers are available.There are times I want a totally custom size 
window as well,  like a 100x50.  I see a lot of procedure like 
ptc_Init640x480x32bpp with all kinds of configurations of screen resolutions 
and color densities, but there is also some named ptc_InitNonStandard32k.. with 
other color densities.. but I don't know how to initialize PTCGraph into my own 
custom window size.   Does anyone know how I could make my PTCGraph windows a 
custom weird size that doesn't necessarily match the available video drivers?

James

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Graphing library

2020-11-19 Thread James Richters via fpc-pascal
Fppdf sounds interesting.  I'm already using AGG-Pas in my project, and I am 
quite happy with it.  Exporting PDF files from my AGG-Pas buffer would be 
really nice.   I did a quick search and didn't find any documentation for it, 
is there a link for this?  Would you happen to have a sample program of how to 
generate a PDF from my AGG-Pas buffer?

James

-Original Message-
From: fpc-pascal  On Behalf Of Graeme 
Geldenhuys via fpc-pascal
Sent: Wednesday, November 18, 2020 4:31 PM
To: fpc-pascal@lists.freepascal.org
Cc: Graeme Geldenhuys 
Subject: Re: [fpc-pascal] Graphing library

On 15/11/2020 8:33 am, Darius Blaszyk via fpc-pascal wrote:
> I am looking for a simple to use non-visual graphing library to 
> produce x-y plots in a  raster file format (similar to how pyplot works).


You could also use the fppdf code included with FPC and generate PDFs of any 
size (you don't have to stick to standard paper sizes). Not sure if PDF will 
suit your needs, but you will end up with a very portable format that scales.

Secondly, you could also use AGG-Pas. It's fully implemented in Object Pascal 
so is very portable (I've used it on RPi, Windows, Linux, FreeBSD and OSX). It 
is a anti-alias sub-pixel framework with configurable rendering pipelines. You 
can use the "raw" API to get the most flexibility, or use the easier 2D unit 
but reduces functionality and flexibility. The latest code is included with the 
fpGUI project, but still 100% stand-alone - no dependencies on fpGUI at all. It 
also comes with a huge about of demos so show off the features.

Original AGG-Pas website. But as I said, the code in fpGUI's repo is newer with 
multiple bug fixes and improvements.

  http://crossgl.com/aggpas/documentation/index.html


Both options have no dependencies on graphics libraries or GUI systems, so is 
perfect for console of server side rendering.

Regards,
  Graeme

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

My public PGP key:  http://tinyurl.com/graeme-pgp 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org 
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal