Implementing AggPas with PtcGraph

classic Classic list List threaded Threaded
103 messages Options
123456
Reply | Threaded
Open this post in threaded view
|

Re: Implementing AggPas with PtcGraph

Graeme Geldenhuys-6
On 2017-06-14 11:57, James Richters wrote:
> I've downloaded the zip file and extracted it to H:\FPC64.   But now
> I have a few questions to attempt to duplicate a successful 64bit
> compile.

Two steps are required - sorry, I forgot to mention that in my previous
post (though I did to the person i created this zip for originally).

1) I find it always useful to have the <fpc>\bin\ directory in my PATH
so that the fpc.exe executable can be run from anywhere.

2) You need to adjust the fpc.cfg file (located in the 'bin' directory)
to match your install path. My path was:

    c:\lazarus\fpc\3.0.2\x86_64-win64

Back in FPC 2.4.x I installed Lazarus which included FPC, which in turn
installed the FPC under the c:\lazarus\fpc\ directory. Ever since every
FPC update, I just stuck to that install location. So you don't need to
have it like this obviously.


> Maybe it isn't valid to use the IDE with Win64?  I sure wish it would
> work.   I like and prefer the FPC text IDE.

The FPC Text IDE (64-bit) runs just fine here under Windows 7 64-bit.
See attached screenshot. Even mouse support works inside the Text IDE.

I mostly use MSEide for all my console, web and fpGUI related
programming. I created some custom project templates and away I go.
Lazarus has some nice editor features, but is often buggy and the
Lazarus Package system just doesn't work for me. With MSEide I use
global (or per project) path macros instead. This gives much more
reliable compilations.

Here is the command line equivalent of what my MSEide project does for
the ptcgraph + aggpas demo.

C:\lazarus\fpc\3.0.2\x86_64-win64\bin\fpc.exe
-oaggpas_ptcgraph_output.exe -Fuc:\devel\fpgui\src\reportengine
-Fuc:\devel\fpgui\src\corelib\render\software
-Fic:\devel\fpgui\src\corelib\render\software -Fic:\devel\fpgui\src
-Fuc:\devel\fpgui\src\corelib\gdi -Fic:\devel\fpgui\src\corelib\gdi
-Fuc:\devel\fpgui\src\gui -Fuc:\devel\fpgui\src\corelib -l -Mobjfpc -Sh
-Sc -Si -gl -O- -FUunits -viewnh aggpas_ptcgraph_output.pas


As for AggPas. I use the version of AggPas that is included with fpGUI.
I simply make sure the path to AggPas is specified in the project
compiler settings, which in the above command line parameter is:

    c:\devel\fpgui\src\corelib\render\software

FPC then compiles all units as it needs them, and I always output the
compiled units into a project specific "units" directory (the -FUunits
command line parameter seen above). I don't like mixing *.pas and
*.o;*.ppu files in the same directories.


> I also wonder if this is a windows 10 frootllooopy weirdness thing
> (it wouldn't be the first).  Can you just email me the exe file
> zipped and l'll just try to run it here?  Then I will know if it's a
> compiler issue or an OS issue

I assume you mean the executable of the ptcgraph+aggpas demo? I'll do so
in a private email.



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  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Screenshot at 2017-06-14 13:17:39.png (18K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Implementing AggPas with PtcGraph

Zaaphod
Thanks for all the info, I will try to get it working.

>I assume you mean the executable of the ptcgraph+aggpas demo? I'll do so in a private email.
Yes, please.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Implementing AggPas with PtcGraph

Zaaphod
In reply to this post by Graeme Geldenhuys-6
>> I also wonder if this is a windows 10 frootllooopy weirdness thing (it
>> wouldn't be the first).  Can you just email me the exe file zipped and
>> I'll just try to run it here?  Then I will know if it's a compiler
>> issue or an OS issue

>I assume you mean the executable of the ptcgraph+aggpas demo? I'll do so in a private email.

Thanks for mailing the demo executable.  I'm happy to report that it does run fine on my system as well (Windows 10 x64)
So there must be something different in the way I am compiling it that is causing the problem.

James


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Implementing AggPas with PtcGraph

Zaaphod
In reply to this post by Graeme Geldenhuys-6
I was able to finally compile and run the test program for Win64.   I wanted to change only one thing at a time so I could figure out what exactly the problem was.  The first thing I tried was to use the exact version of AggPas Graeme used.

>As for AggPas. I use the version of AggPas that is included with fpGUI.
>I simply make sure the path to AggPas is specified in the project compiler settings, which in the above command line parameter is:
>    c:\devel\fpgui\src\corelib\render\software

Previously I was using the only version of AggPas I could find by doing an internet search which I downloaded from here:
http://www.crossgl.com/aggpas/aggpas-download.htm then downloaded AggPas24-rm3.zip

So I removed that version and downloaded fpgui_src_1.4.1.zip from:
https://sourceforge.net/projects/fpgui/files/fpGUI/1.4.1/

I extracted it to my H: Drive and tested it out.
I did not change my path for this test so I just put in paths to everything and ran it from the H:\FPC64\3.0.2\x86_64-win64\bin directory then executed the following command line:
fpc -Fu..\units\$fpctarget\* -FuH:\fpgui-1.4.1\src\corelib\render\software J:\programming\Gcode\Graphics\aggpas_ptcgraph_output.pas

The compile was successful and the Win64 version of the program ran fine.

So just for fun, I replaced the aggpas units in my original setup with the ones from fpgui_src_1.4.1.zip and tried it the original way I was doing it with the cross compiler and the command:
fpc -FuJ:\Programming\FPC\3.0.2\units\$fpctarget\* -Px86_64 aggpas_ptcgraph_output.pas
This was also successful, so I tried a few other sample programs and they all seem to work as both Win32 and Win64

So I was wondering, why would this be?  So I looked at this:
>While in lazarus open agg_rasterizer_scanline_aa.pas, go ro line 611 press Ctr and click on ptrcomp. It should open agg_basics.pas, the comment may apply to your situation.

And did a compare between agg_basics from AggPas24-rm3.zip and agg_basics from fpgui_src_1.4.1.zip and noticed they are NOT the same.  They both indicate they are the same by the comments at the top
// Anti-Grain Geometry - Version 2.4 Release Milano 3 (AggPas 2.4 RM3)

But the version from AggPas24-rm3.zip has
// Pascal's pointer-in-an-array-access helper structures
 p32_ptr = ^p32;
 p32 = record
   case integer of
    1 : (ptr : pointer );

   {$IFDEF CPU64 }
    2 : (int : system.int64 );

   {$ELSE }
    2 : (int : integer );

   {$ENDIF }

  end;

while the version from fpgui_src_1.4.1.zip has
// Pascal's pointer-in-an-array-access helper structures
 p32_ptr = ^p32;
 p32 = record
   case integer of
    1 : (ptr : pointer );
    2 : (int : ptrcomp );
  end;

There are also several other differences in the 2 files.  

So it looks like AggPas24-rm3.zip from http://www.crossgl.com/aggpas/aggpas-download.htm was last updated in 2008, while
FPGUI was updated in 2015 and the version there has had some changes so it is now beyond 24-rm3.  Very confusing.  Maybe AggPas is not being maintained anymore at http://www.crossgl.com/aggpas ?

Anyway Thank you to everyone for helping get to the bottom of this!  


-----Original Message-----
From: fpc-pascal [mailto:[hidden email]] On Behalf Of Graeme Geldenhuys
Sent: Wednesday, June 14, 2017 8:29 AM
To: [hidden email]
Cc: James Richters <[hidden email]>
Subject: Re: [fpc-pascal] Implementing AggPas with PtcGraph

On 2017-06-14 11:57, James Richters wrote:
> I've downloaded the zip file and extracted it to H:\FPC64.   But now
> I have a few questions to attempt to duplicate a successful 64bit
> compile.

Two steps are required - sorry, I forgot to mention that in my previous post (though I did to the person i created this zip for originally).

1) I find it always useful to have the <fpc>\bin\ directory in my PATH so that the fpc.exe executable can be run from anywhere.

2) You need to adjust the fpc.cfg file (located in the 'bin' directory) to match your install path. My path was:

    c:\lazarus\fpc\3.0.2\x86_64-win64

Back in FPC 2.4.x I installed Lazarus which included FPC, which in turn installed the FPC under the c:\lazarus\fpc\ directory. Ever since every FPC update, I just stuck to that install location. So you don't need to have it like this obviously.


> Maybe it isn't valid to use the IDE with Win64?  I sure wish it would
> work.   I like and prefer the FPC text IDE.

The FPC Text IDE (64-bit) runs just fine here under Windows 7 64-bit.
See attached screenshot. Even mouse support works inside the Text IDE.

I mostly use MSEide for all my console, web and fpGUI related programming. I created some custom project templates and away I go.
Lazarus has some nice editor features, but is often buggy and the Lazarus Package system just doesn't work for me. With MSEide I use global (or per project) path macros instead. This gives much more reliable compilations.

Here is the command line equivalent of what my MSEide project does for the ptcgraph + aggpas demo.

C:\lazarus\fpc\3.0.2\x86_64-win64\bin\fpc.exe
-oaggpas_ptcgraph_output.exe -Fuc:\devel\fpgui\src\reportengine
-Fuc:\devel\fpgui\src\corelib\render\software
-Fic:\devel\fpgui\src\corelib\render\software -Fic:\devel\fpgui\src -Fuc:\devel\fpgui\src\corelib\gdi -Fic:\devel\fpgui\src\corelib\gdi -Fuc:\devel\fpgui\src\gui -Fuc:\devel\fpgui\src\corelib -l -Mobjfpc -Sh -Sc -Si -gl -O- -FUunits -viewnh aggpas_ptcgraph_output.pas


As for AggPas. I use the version of AggPas that is included with fpGUI.
I simply make sure the path to AggPas is specified in the project compiler settings, which in the above command line parameter is:

    c:\devel\fpgui\src\corelib\render\software

FPC then compiles all units as it needs them, and I always output the compiled units into a project specific "units" directory (the -FUunits command line parameter seen above). I don't like mixing *.pas and *.o;*.ppu files in the same directories.


> I also wonder if this is a windows 10 frootllooopy weirdness thing (it
> wouldn't be the first).  Can you just email me the exe file zipped and
> l'll just try to run it here?  Then I will know if it's a compiler
> issue or an OS issue

I assume you mean the executable of the ptcgraph+aggpas demo? I'll do so in a private email.



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  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Implementing AggPas with PtcGraph

Zaaphod
All this has me wondering about the freetype.dll version.  I've been using freetype.dll that I found in AggPas24-rm3.zip modified 9/17/2007
I notice there is another one in fpgui_src_1.4.1.zip in the fpgui-1.4.1\extras\freetype_windows directory modified 12/9/2012  Is this the best version to use?  

I was hoping to figure out a way to not have the dependency of msvcr71.dll
I tried going all over https://www.freetype.org and even downloaded ft28.zip from there and tried to make sense of it, but just got more confused
I haven't tried the version of freetype.dll included with fpgui yet, I thought I would just ask first

James

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Implementing AggPas with PtcGraph

Zaaphod
I finally got freetype to work with AggPas, but I had to make a few changes.  I am wondering if there is a way to submit a request for changes so they will be part of the next release?

Here is what I found out...
Freetype.dll included in fpgui_src_1.4.1.zip indeed does not have a dependency for msvcr71.dll... however,  it only works if I compile with Win32.

I did some searching and came up with something called libfreetype-6.dll listed as a 64bit Freetype library, so I copied that over and renamed it to freetype.lib, and now my Win64 program uses it and works... but as expected, the Win32 program no longer works.  

So I did some digging and fount 'freetype.dll' being assigned in agg_font_freetype_lib.pas on line 42 as follows:
-------------------------------------------------------------------------
const
{$IFDEF WINDOWS }
  ft_lib = 'freetype.dll';
{$ENDIF }

// Linux, FreeBSD etc.
{$if defined(UNIX) and not defined(darwin)}
  ft_lib = 'freetype';
{$ENDIF }

// Mac OS X
{$ifdef darwin}
  ft_lib = 'libfreetype';
{$ENDIF }
-------------------------------------------------------------------------
So I changed the Windows section to:
{$IFDEF WINDOWS }
{$IFDEF CPU64 }
  ft_lib = 'libfreetype-6.dll';
{$Else }
  ft_lib = 'freetype.dll';
{$ENDIF }
{$ENDIF }

Now if I compile it Win64 it uses the 64bit library and if I compile it Win32 it uses the 32bit library, this way I can just randomly create whatever type program I want and get the correct library.   I suppose something similar would be needed for other platforms but have no way to test it.

Also I had issues with using freetype at all.  I used
Writeln('FreeType: ',Agg2DUsesFreeType,'  Win32 True Type: ',Agg2DUsesWin32TrueType);
To show which font method was being used and found my program was using win32 true type fonts

So I went to Agg_2D.pas on line 25 and found this:

// With this define uncommented you can use FreeType font engine
{ $DEFINE AGG2D_USE_FREETYPE }

It took me a while to figure out that the space between ( and $ was making this into a comment,  it would have been more clear to comment it out like:
//{$DEFINE AGG2D_USE_FREETYPE}  

But in any case I did figure it out and uncommented it,  but then I could not compile it because of:
agg_2D.pas(142,15) Error: Duplicate identifier "FontEngine"

So Agg_2D.pas line 138 - 143 are:
{$IFDEF AGG2D_USE_FREETYPE }
 FontEngine = font_engine_freetype_int32;
{$ENDIF }
{$IFDEF AGG2D_USE_WINFONTS}
 FontEngine = font_engine_win32_tt_int32;
{$ENDIF }

The only way the FontEngine = font_engine_win32_tt_int32; on line 142 could cause this error is if both  AGG2D_USE_WINFONTS and  AGG2D_USE_FREETYPE were defined.  I looked around and could not find where AGG2D_USE_WINFONTS was defined, but it seems obvious that both cannot be defined at once so I changed from line 25 in Agg_2D.pas to this:
// With this define uncommented you can use FreeType font engine
//{$DEFINE AGG2D_USE_FREETYPE}

{$IFDEF AGG2D_USE_FREETYPE }
  {$UNDEF AGG2D_USE_WINFONTS}
{$ENDIF }

And now if I run it as above I get Win32 true type fonts and if I comment out the freetype define I get freetype fonts.

I noticed that with the freetype define comment out, adding it to my program could not make it work.  I would prefer a method that did not involve modifying the Agg_2D unit to change which font package to use.

Also,  I have copied Agg_2D.pas to Agg_2D_RBG565.pas and modified that one as needed for ptcgraph.  I wonder if it would be beneficial to add this modified version of the unit to the development system so eventually it will be included in the official release.  That way everyone working on it and / or testing it are using the same thing, and people can have programs that use either unit side by side without remembering how to modify / unmodify a unit to make it work.    I'm not sure where the proper place is to submit things like this, but I would be happy to contribute these changes if possible.

James



-----Original Message-----
From: fpc-pascal [mailto:[hidden email]] On Behalf Of James Richters
Sent: Wednesday, June 14, 2017 11:54 AM
To: 'FPC-Pascal users discussions' <[hidden email]>
Subject: Re: [fpc-pascal] Implementing AggPas with PtcGraph

All this has me wondering about the freetype.dll version.  I've been using freetype.dll that I found in AggPas24-rm3.zip modified 9/17/2007 I notice there is another one in fpgui_src_1.4.1.zip in the fpgui-1.4.1\extras\freetype_windows directory modified 12/9/2012  Is this the best version to use?  

I was hoping to figure out a way to not have the dependency of msvcr71.dll I tried going all over https://www.freetype.org and even downloaded ft28.zip from there and tried to make sense of it, but just got more confused I haven't tried the version of freetype.dll included with fpgui yet, I thought I would just ask first

James

_______________________________________________
fpc-pascal maillist  -  [hidden email] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Implementing AggPas with PtcGraph

Graeme Geldenhuys-6
In reply to this post by Zaaphod
On 2017-06-14 16:37, James Richters wrote:
> I was able to finally compile and run the test program for Win64.

Excellent news!


>> As for AggPas. I use the version of AggPas that is included with
>> fpGUI. I simply make sure the path to AggPas is specified in the

There are 3 forks of AggPas that I know of, and the one included with
fpGUI is the most maintained version (features and bug fixes).


> Previously I was using the only version of AggPas I could find by
> doing an internet search which I downloaded from here:
> http://www.crossgl.com/aggpas/aggpas-download.htm then downloaded
> AggPas24-rm3.zip

Ah, that would explain it. That is the original and FINAL release of
AggPas by Milano from many years ago. It doesn't support 64-bit, doesn't
support FreeBSD and had some bugs.

All those issues have been resolved in the AggPas included with fpGUI.


> So it looks like AggPas24-rm3.zip from
> http://www.crossgl.com/aggpas/aggpas-download.htm was last updated in
> 2008, while FPGUI was updated in 2015 and the version there has had
> some changes so it is now beyond 24-rm3.

And if you look in the "develop" branch of fpGUI, there is an even later
AggPas version - last updated a month ago.


> Very confusing.  Maybe
> AggPas is not being maintained anymore at
> http://www.crossgl.com/aggpas ?

Yes, it is a bit confusing. No, the original AgPass from the crossgl.com
website is not being maintained for many years.

I think you main a valid point in your other mail about the unit header
comments. I'll update the header comments in fpGUI repository and make
sure that it mentions that it is beyond the origin 2.4-rm3 release.

ps:
   And if you wondered why I don't have AggPas in its own repository?
   AggPas is/has been integrated into fpGUI and is becoming the default
   renderer for fpGUI's Canvas class. So it's a critical dependency
   (and at the time I didn't know about Git Submodules). At least
   I kept all the AggPas code in its own directory, but in hindsight,
   I should probably have named that directory "render/aggpas/" and not
   "render/software/". Umm, I might just change that before the
   next fpGUI release.


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  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Implementing AggPas with PtcGraph

Graeme Geldenhuys-6
In reply to this post by Zaaphod
On 2017-06-14 19:15, James Richters wrote:
> Here is what I found out... Freetype.dll included in
> fpgui_src_1.4.1.zip indeed does not have a dependency for
> msvcr71.dll...

Yup, that's what I thought. :)


> however,  it only works if I compile with Win32.

True. I'll include a 64-bit version too.


Speaking of the AggPas in fpGUI only:
   As for the $DEFINE and $IFDEF comments. When you toggle one font
renderer (or disable it completely), then the other defines should have
been undefined. That's how it used to work. Maybe somewhere that go
broken. I'll do some testing and fix anything that is needed. Thanks for
mentioning it.

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  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Implementing AggPas with PtcGraph

Graeme Geldenhuys-6
In reply to this post by Zaaphod
On 2017-06-14 19:15, James Richters wrote:
> testing it are using the same thing, and people can have programs
> that use either unit side by side without remembering how to modify /
> unmodify a unit to make it work.

The font rendering should all be controlled by compiler defines. You
don't need to modify the unit to make it work. Simply add the correct
define in your project's Compiler Settings and recompile the code. If
you know you are only every going to use one font render engine, then
you can obviously modify the unit to make the default more to your liking.


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  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Implementing AggPas with PtcGraph

Zaaphod
>The font rendering should all be controlled by compiler defines. You don't need to modify the unit to make it work.
>Simply add the correct define in your project's Compiler Settings and recompile the code.

That is what I thought should happen, but I put
{$DEFINE AGG2D_USE_FREETYPE}

In my program under
{$mode objfpc}{$H+}

I still get:
FreeType: FALSE  Win32 True Type: TRUE

But if I uncomment
{$DEFINE AGG2D_USE_FREETYPE}
In agg_2D.pas

It's the only way I can get
FreeType: TRUE  Win32 True Type: FALSE

I don't know why the define isn't making it to the unit.  Do I need to do something else?   It's as if it's being un-defined somewhere else but I don't know where.. maybe the same place that is {$DEFINE AGG2D_USE_WINFONTS} because that is defiantly being set somewhere before the agg_2D.Pas unit and the only way to not get an error is for me to have this at the top of agg_2D.pas

{$IFDEF AGG2D_USE_FREETYPE }
 {$UNDEF AGG2D_USE_WINFONTS}
{$ENDIF }

>And if you look in the "develop" branch of fpGUI, there is an even later
>AggPas version - last updated a month ago.

Maybe I should go get this.. maybe some of these things are fixed already

Thank you for the help with this.

James

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Implementing AggPas with PtcGraph

Stefan V. Pantazi
I think you need to use a global define passing a -d??? parameter
(-dAGG2D_USE_FREETYPE) to the compiler. Just adding it to a unit only
defines for that unit and to any file included in that one unit.

On 06/14/2017 09:40 PM, James Richters wrote:

>> The font rendering should all be controlled by compiler defines. You don't need to modify the unit to make it work.
>> Simply add the correct define in your project's Compiler Settings and recompile the code.
>
> That is what I thought should happen, but I put
> {$DEFINE AGG2D_USE_FREETYPE}
>
> In my program under
> {$mode objfpc}{$H+}
>
> I still get:
> FreeType: FALSE  Win32 True Type: TRUE
>
> But if I uncomment
> {$DEFINE AGG2D_USE_FREETYPE}
> In agg_2D.pas
>
> It's the only way I can get
> FreeType: TRUE  Win32 True Type: FALSE
>
> I don't know why the define isn't making it to the unit.  Do I need to do something else?   It's as if it's being un-defined somewhere else but I don't know where.. maybe the same place that is {$DEFINE AGG2D_USE_WINFONTS} because that is defiantly being set somewhere before the agg_2D.Pas unit and the only way to not get an error is for me to have this at the top of agg_2D.pas
>
> {$IFDEF AGG2D_USE_FREETYPE }
>  {$UNDEF AGG2D_USE_WINFONTS}
> {$ENDIF }
>
>> And if you look in the "develop" branch of fpGUI, there is an even later
>> AggPas version - last updated a month ago.
>
> Maybe I should go get this.. maybe some of these things are fixed already
>
> Thank you for the help with this.
>
> James
>
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>

--
_______________________________________________________
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Implementing AggPas with PtcGraph

Graeme Geldenhuys-6
In reply to this post by Zaaphod
On 2017-06-15 02:40, James Richters wrote:
> That is what I thought should happen, but I put {$DEFINE
> AGG2D_USE_FREETYPE}
>
> I don't know why the define isn't making it to the unit.  Do I need
> to do something else?

Compiler defines defined with the $DEFINE directive is per unit only.

That is why I said you must put it in your Project's Compiler Settings
instead using your IDE of choice (or via the command line when calling
fpc.exe binary). That way the define is active for all units of your
project.


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  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Implementing AggPas with PtcGraph

Graeme Geldenhuys-6
In reply to this post by Stefan V. Pantazi
On 2017-06-15 02:55, Stefan V. Pantazi wrote:
> I think you need to use a global define passing a -d??? parameter
> (-dAGG2D_USE_FREETYPE) to the compiler. Just adding it to a unit only
> defines for that unit


The above statement is 100% correct.


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  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Implementing AggPas with PtcGraph

Zaaphod
In reply to this post by Graeme Geldenhuys-6
>True. I'll include a 64-bit version too.

That would be great, because I don't have a clue where this 64bit version I found came from, what version it is, and things like that.  
Maybe include Freetype32.dll and Freetype64.dll to make it very clear.

>That is why I said you must put it in your Project's Compiler Settings instead using your IDE of choice
>(or via the command line when calling fpc.exe binary). That way the define is active for all units of your project.

I see, thanks for explaining.   For some reason, I was thinking it was optional to put it in the compiler, but I could also put it in the program.
Is there no way to set a global define in each program so I could have several programs defined differently and randomly compile them without changing any settings?  
It seems some method of doing that would be very useful... but maybe not easy to implement... I suppose it probably compiles all the units first then the main program, so putting anything in the main program wouldn't be seen until it was too late.

James


-----Original Message-----
From: fpc-pascal [mailto:[hidden email]] On Behalf Of Graeme Geldenhuys
Sent: Thursday, June 15, 2017 3:19 AM
To: [hidden email]
Subject: Re: [fpc-pascal] Implementing AggPas with PtcGraph

On 2017-06-15 02:40, James Richters wrote:
> That is what I thought should happen, but I put {$DEFINE
> AGG2D_USE_FREETYPE}
>
> I don't know why the define isn't making it to the unit.  Do I need to
> do something else?

Compiler defines defined with the $DEFINE directive is per unit only.

That is why I said you must put it in your Project's Compiler Settings instead using your IDE of choice (or via the command line when calling fpc.exe binary). That way the define is active for all units of your project.


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  -  [hidden email] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Implementing AggPas with PtcGraph

Mattias Gaertner
On Thu, 15 Jun 2017 06:37:41 -0400
"James Richters" <[hidden email]> wrote:

>[...]
> I see, thanks for explaining.   For some reason, I was thinking it was optional to put it in the compiler, but I could also put it in the program.
> Is there no way to set a global define in each program so I could have several programs defined differently and randomly compile them without changing any settings?  

The idea is that you have one project per program. You can compile them
randomly without changing anything.


> It seems some method of doing that would be very useful... but maybe not easy to implement... I suppose it probably compiles all the units first then the main program, so putting anything in the main program wouldn't be seen until it was too late.

There are already many ways to add defines. Adding another one would
make it harder for newbies.

Mattias
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Implementing AggPas with PtcGraph

Graeme Geldenhuys-6
In reply to this post by Zaaphod
On 2017-06-15 11:37, James Richters wrote:
>  Maybe include Freetype32.dll and Freetype64.dll to make it very
> clear.

That was exactly what I had in mind.

> the program. Is there no way to set a global define in each program
> so I could have several programs defined differently and randomly
> compile them without changing any settings?

If you want a compiler define for all projects, then simply add that
define in your fpc.cfg file. That is a "global options" file. I trust
those will take effect even if you use the FPC Text IDE, because it is
the fpc.exe binary that reads the fpc.cfg file and gets default settings
from there.


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  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Implementing AggPas with PtcGraph

Zaaphod
In reply to this post by Mattias Gaertner
>The idea is that you have one project per program. You can compile them randomly without changing anything.

I don't understand what you mean by 'one project per program' ?  I only have programs that I have sorted in sub directories.  I normally use the Freepascal text IDE to compile them, and sometimes the command line.   I might want to have ProgramA.pas have one define and ProgramB.pas have another, both using the same unit, is there some method to do that?

>There are already many ways to add defines. Adding another one would make it harder for newbies.
Is there some method to make a global define that is in the program itself?   I don't see how having options available makes anything harder for anyone, they can just not use such features.

>If you want a compiler define for all projects, then simply add that define in your fpc.cfg file. That is a "global options" file. I trust those will take effect even if you use the FPC Text IDE, because it is the fpc.exe binary that reads the fpc.cfg file and gets default settings from there.

Thanks for explaining that.  It looks like I can define where my units are with fpc.cfg as well and then I won't need to keep putting them on the command line.   If I put an fpc.cfg in a specific directory along with my program to be compiled, will the one in that directory override the one in \FPC\3.0.2\bin\i386-win32 ?

I'm wondering if I am missing something with reference to 'projects' is that a Lazarus thing?   How are 'projects' defined?

James

-----Original Message-----
From: fpc-pascal [mailto:[hidden email]] On Behalf Of Mattias Gaertner
Sent: Thursday, June 15, 2017 6:55 AM
To: [hidden email]
Subject: Re: [fpc-pascal] Implementing AggPas with PtcGraph

On Thu, 15 Jun 2017 06:37:41 -0400
"James Richters" <[hidden email]> wrote:

>[...]
> I see, thanks for explaining.   For some reason, I was thinking it was optional to put it in the compiler, but I could also put it in the program.
> Is there no way to set a global define in each program so I could have several programs defined differently and randomly compile them without changing any settings?  

The idea is that you have one project per program. You can compile them randomly without changing anything.


> It seems some method of doing that would be very useful... but maybe not easy to implement... I suppose it probably compiles all the units first then the main program, so putting anything in the main program wouldn't be seen until it was too late.

There are already many ways to add defines. Adding another one would make it harder for newbies.

Mattias
_______________________________________________
fpc-pascal maillist  -  [hidden email] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Implementing AggPas with PtcGraph

Tomas Hajny-2
On Thu, June 15, 2017 13:57, James Richters wrote:
>>The idea is that you have one project per program. You can compile them
>> randomly without changing anything.
>
> I don't understand what you mean by 'one project per program' ?  I only
> have programs that I have sorted in sub directories.  I normally use the
> Freepascal text IDE to compile them, and sometimes the command line.   I
> might want to have ProgramA.pas have one define and ProgramB.pas have
> another, both using the same unit, is there some method to do that?

Yes:

1) Have sources of the two programs in different folders (directories) and
start the text-mode IDE in the respective folder depending on the
"project" / program you intend to build.

2) Set the compiler defines as necessary for the respective "project"
(i.e. differently for ProgramA when started from directory of ProgramA and
for ProgramB when started from directory of ProgramB) - Options ->
Compiler -> Conditional defines. By default, the configuration is
automaticaly saved when exiting the IDE.

3) Make sure you always rebuild the unit depending on the program you want
to compile (Compile -> Build). Obviously, this requires the source file of
the unit to be available for the compiler (i.e. in one of paths in Options
-> Directories -> Unit directories).


>>There are already many ways to add defines. Adding another one would make
>> it harder for newbies.
> Is there some method to make a global define that is in the program
> itself?   I don't see how having options available makes anything harder
> for anyone, they can just not use such features.

The hard thing is for the user to understand differences among the
available options and their implications.

Defines have impact only when compiling the particular source code. Having
a 'global define' in a program could never have impact to a unit which
might be already compiled using different defines at the moment the
particular program is compiled. One of possible solutions for this is
having a 'global include file' which is included in all the relevant units
and the program, the other is outlined above (defines stored in the
compiler / IDE configuration file).


>>If you want a compiler define for all projects, then simply add that
>> define in your fpc.cfg file. That is a "global options" file. I trust
>> those will take effect even if you use the FPC Text IDE, because it is
>> the fpc.exe binary that reads the fpc.cfg file and gets default settings
>> from there.

Not quite - the text-mode IDE doesn't invoke fpc.exe binary (it has the
compiler built-in) and it passes the options as defined in the respective
IDE dialogs.


> Thanks for explaining that.  It looks like I can define where my units are
> with fpc.cfg as well and then I won't need to keep putting them on the
> command line.   If I put an fpc.cfg in a specific directory along with my
> program to be compiled, will the one in that directory override the one in
> \FPC\3.0.2\bin\i386-win32 ?

Yes (if starting the _compiler_ in that directory). If using the IDE, you
can do the same with the fp.cfg file.


> I'm wondering if I am missing something with reference to 'projects' is
> that a Lazarus thing?   How are 'projects' defined?

Yes, projects are 'a Lazarus thing'. However, you can achieve a similar
effect with local options and configuration files for the text-mode IDE
(you just need to use different directories for different 'projects').

Hope this helps

Tomas


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Implementing AggPas with PtcGraph

Mattias Gaertner
In reply to this post by Zaaphod
On Thu, 15 Jun 2017 07:57:14 -0400
"James Richters" <[hidden email]> wrote:

> >The idea is that you have one project per program. You can compile them randomly without changing anything.  
>
> I don't understand what you mean by 'one project per program' ?

Project is a Lazarus/msegui thing.

> I only have programs that I have sorted in sub directories.  I normally use the Freepascal text IDE to compile them, and sometimes the command line.   I might want to have ProgramA.pas have one define and ProgramB.pas have another, both using the same unit, is there some method to do that?

Yes, via the fpc.cfg, via @your.cfg, via include files, via FPC IDE
config or by tools like Lazarus, msegui, make, etc.

 
> >There are already many ways to add defines. Adding another one would make it harder for newbies.  
> Is there some method to make a global define that is in the program itself?   I don't see how having options available makes anything harder for anyone, they can just not use such features.

If someone else tries to understand your program he has to learn
your way. Too many options for the same thing can be a burden.
Especially when trying to find out why a macro was not defined.

 
>[...]
> Thanks for explaining that.  It looks like I can define where my units are with fpc.cfg as well and then I won't need to keep putting them on the command line.   If I put an fpc.cfg in a specific directory along with my program to be compiled, will the one in that directory override the one in \FPC\3.0.2\bin\i386-win32 ?

fpc takes the first it finds. You can see where fpc searches for configs using the -vt flag.
Alternatively you can pass @your.cfg to add a config.

 
> I'm wondering if I am missing something with reference to 'projects' is that a Lazarus thing?   How are 'projects' defined?

Many IDEs have "projects". Lazarus too. They contain build options and
other stuff. The FPC IDE does not call it "project", but its
local fpc.cfg, fp.ini and fp.dsk files have a similar purpose.

Mattias
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Implementing AggPas with PtcGraph

Zaaphod
In reply to this post by Tomas Hajny-2
Thanks everyone for explaining this,  and thanks for the various solutions.  I don't like modifying units that are part of a package because then I would need to remember how I modified them when a new version is released or have to figure out what's going on all over again.  

> 3) Make sure you always rebuild the unit depending on the program you want to compile (Compile -> Build).

Is there a way to force this with the command line? (same as Compile > build from the IDE) ?

>Defines have impact only when compiling the particular source code. Having a 'global define' in a program could never have impact to a unit which might be already compiled using different defines at the moment the particular program is compiled.

Oh, I see the issue here.   So If I were to write a unit that I wanted Programs to share, but have various options, I may be better off to define a variable in the unit and let the programs change the variable depending on what they want.... with the compiler directives, it's actually leaving out parts altogether, so you need to re-compile the unit if you want to change it... makes smaller files than always including things you don't want to use.

>Yes, projects are 'a Lazarus thing'. However, you can achieve a similar effect with local options and configuration files for the text-mode IDE (you just need to use different directories for different 'projects').
Using directories sounds easy enough.  

>Alternatively you can pass @your.cfg to add a config.
That's good to know, and could be useful!   Since fp gets constantly re-saved when the IDE closes, it's possible that custom settings could be forgotten about and overwritten to not be there anymore.  Using a custom cfg with this method would allow the changes to be kept separate and be a more obvious reminder that they need to happen.  Can I add the custom config into the IDE someplace?

James

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
123456