Re: [fpc-pascal] Implementing AggPas with PtcGraph

2017-06-13 Thread Stefan V. Pantazi
Yes, it is puzzling. Different pointer sizes, compilers, OS, 32/64 bit 
library dependencies, can be potential causes.


Again, note that I compiled the example on a CentOS 7, 64bit Linux with 
Lazarus 1.5 + fpc 3.0.1


I can also confirm that the test program compiles and works fine on 
Ubuntu 16.04 64bit, with Lazarus 1.7 + fpc 3.1.1



On 06/13/2017 10:16 PM, James Richters wrote:

but I don't know what I can do about it and why you are able to cross 
compile for win64 and it works.


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

Re: [fpc-pascal] Implementing AggPas with PtcGraph

2017-06-13 Thread James Richters
>If you are already on a win64 machine then your default target CPU should 
>already be x86_64. why do you need fpc-3.0.2-cross-i386-win32-win64?
Correction:  
I start with fpc-3.0.2.i386-win32 because there is no precompiled version for 
win64 of freepascal I tried to compile it myself is it's just a confusing mess 
that I can't get to work.
So I then need to install fpc-3.0.2-cross-i386-win32-win64 to compile x64 with 
the above fpc-3.0.2.i386-win32 running on my x64 machine.

With Lazarus I am able to do it the other way around, I install
lazarus-1.6.4-fpc-3.0.2-win64.exe so from there I can compile x64 programs, 
then install 
lazarus-1.6.4-fpc-3.0.2-cross-i386-win32-win64.exe so I can also compile Win32 
programs with Lazarus.

James

-Original Message-
From: fpc-pascal [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of 
James Richters
Sent: Tuesday, June 13, 2017 10:16 PM
To: 'FPC-Pascal users discussions' 
Subject: Re: [fpc-pascal] Implementing AggPas with PtcGraph

>It is unclear to me whether you are on a win32 or win64 OS?
I am on Windows 10 x64 OS

>If you are already on a win64 machine then your default target CPU should 
>already be x86_64. why do you need fpc-3.0.2-cross-i386-win32-win64?
fpc-3.0.2-cross-i386-win32-win64 is to be able to compile as a win32 program on 
a win64 machine.   I installed that so I could compile as win32 for comparison. 
 The test program works if compiled with Lazarus  for win32 but not win64

>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.
I was able to follow this and get to the comment in agg_basics, I read the 
comment that indicates some difference and possible problem with pointers on 
win64 but I don't know what I can do about it and why you are able to cross 
compile for win64 and it works.   I wonder if this is an issue with Freepascal 
3.0.2, and aggpas hasn't been fixed for it yet and I need to use Freepascal 
3.0.1 to get it to work?

James

-Original Message-
From: fpc-pascal [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of 
Stefan V. Pantazi
Sent: Tuesday, June 13, 2017 9:25 PM
To: FPC-Pascal users discussions 
Subject: Re: [fpc-pascal] Implementing AggPas with PtcGraph

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.

It is unclear to me whether you are on a win32 or win64 OS? If you are already 
on a win64 machine then your default target CPU should already be x86_64. why 
do you need fpc-3.0.2-cross-i386-win32-win64?


On 06/13/2017 08:25 PM, James Richters wrote:
>> Noting your problems with compilation, you may want to consider using 
>> Lazarus IDE as well.
>
> I have just installed Lazarus but still can't get the 
> aggpas_ptcgraph_output.pas sample program to run when compiled for x64.
> Here is what I have done.
>
> Downloaded and installed lazarus-1.6.0-fpc-3.0.0-win64.exe and 
> accepted all defaults Downloaded and installed 
> lazarus-1.6.4-fpc-3.0.2-cross-i386-win32-win64.exe and accepted the default 
> install directory.
> Copied aggpas to C:\lazarus\fpc\3.0.2\units\i386-win32
> Copied aggpas to C:\lazarus\fpc\3.0.2\units\x86_64-win64
>
> Opened a sample program the uses just ptcgraph, when it asked to 
> create a project I said yes then selected 'Program' from the list I 
> was able to compile and run it with options for OS win32 CPU i386 as 
> well as OS  win64 CPU x86_64 and it ran fine with both versions I opened 
> aggpas_ptcgraph_output.pas the same way and selected program.  If I select OS 
> win32 CPU i386 it compiles and runs fine, no problems When I select OS  win64 
> CPU x86_64 and try to run it, it opens both the console window and graphics 
> window, then I get an error box reading:
>
> Project aggpas_ptcgraph_output raised exception class 'external: SIGSEGV'
> In file 'C:\lazarus\fpc\3.0.2\u..\agg_rasterizer_scanline_aa.pas' at 
> line 611 while cell_aa_ptr_prt(ptrcomp(j) + 1 * 4^^.x
> Any ideas why this is happening?
>
> James
>
>
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org 
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>

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

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

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org

Re: [fpc-pascal] Implementing AggPas with PtcGraph

2017-06-13 Thread James Richters
>It is unclear to me whether you are on a win32 or win64 OS?
I am on Windows 10 x64 OS

>If you are already on a win64 machine then your default target CPU should 
>already be x86_64. why do you need fpc-3.0.2-cross-i386-win32-win64?
fpc-3.0.2-cross-i386-win32-win64 is to be able to compile as a win32 program on 
a win64 machine.   I installed that so I could compile as win32 for comparison. 
 The test program works if compiled with Lazarus  for win32 but not win64

>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.
I was able to follow this and get to the comment in agg_basics, I read the 
comment that indicates some difference and possible problem with pointers on 
win64 but I don't know what I can do about it and why you are able to cross 
compile for win64 and it works.   I wonder if this is an issue with Freepascal 
3.0.2, and aggpas hasn't been fixed for it yet and I need to use Freepascal 
3.0.1 to get it to work?

James

-Original Message-
From: fpc-pascal [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of 
Stefan V. Pantazi
Sent: Tuesday, June 13, 2017 9:25 PM
To: FPC-Pascal users discussions 
Subject: Re: [fpc-pascal] Implementing AggPas with PtcGraph

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.

It is unclear to me whether you are on a win32 or win64 OS? If you are already 
on a win64 machine then your default target CPU should already be x86_64. why 
do you need fpc-3.0.2-cross-i386-win32-win64?


On 06/13/2017 08:25 PM, James Richters wrote:
>> Noting your problems with compilation, you may want to consider using 
>> Lazarus IDE as well.
>
> I have just installed Lazarus but still can't get the 
> aggpas_ptcgraph_output.pas sample program to run when compiled for x64.
> Here is what I have done.
>
> Downloaded and installed lazarus-1.6.0-fpc-3.0.0-win64.exe and 
> accepted all defaults Downloaded and installed 
> lazarus-1.6.4-fpc-3.0.2-cross-i386-win32-win64.exe and accepted the default 
> install directory.
> Copied aggpas to C:\lazarus\fpc\3.0.2\units\i386-win32
> Copied aggpas to C:\lazarus\fpc\3.0.2\units\x86_64-win64
>
> Opened a sample program the uses just ptcgraph, when it asked to 
> create a project I said yes then selected 'Program' from the list I 
> was able to compile and run it with options for OS win32 CPU i386 as 
> well as OS  win64 CPU x86_64 and it ran fine with both versions I opened 
> aggpas_ptcgraph_output.pas the same way and selected program.  If I select OS 
> win32 CPU i386 it compiles and runs fine, no problems When I select OS  win64 
> CPU x86_64 and try to run it, it opens both the console window and graphics 
> window, then I get an error box reading:
>
> Project aggpas_ptcgraph_output raised exception class 'external: SIGSEGV'
> In file 'C:\lazarus\fpc\3.0.2\u..\agg_rasterizer_scanline_aa.pas' at 
> line 611 while cell_aa_ptr_prt(ptrcomp(j) + 1 * 4^^.x
> Any ideas why this is happening?
>
> James
>
>
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org 
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>

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

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

Re: [fpc-pascal] Implementing AggPas with PtcGraph

2017-06-13 Thread Stefan V. Pantazi
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.


It is unclear to me whether you are on a win32 or win64 OS? If you are 
already on a win64 machine then your default target CPU should already 
be x86_64. why do you need fpc-3.0.2-cross-i386-win32-win64?



On 06/13/2017 08:25 PM, James Richters wrote:

Noting your problems with compilation, you may want to consider using Lazarus 
IDE as well.


I have just installed Lazarus but still can't get the 
aggpas_ptcgraph_output.pas sample program to run when compiled for x64.
Here is what I have done.

Downloaded and installed lazarus-1.6.0-fpc-3.0.0-win64.exe and accepted all 
defaults
Downloaded and installed lazarus-1.6.4-fpc-3.0.2-cross-i386-win32-win64.exe and 
accepted the default install directory.
Copied aggpas to C:\lazarus\fpc\3.0.2\units\i386-win32
Copied aggpas to C:\lazarus\fpc\3.0.2\units\x86_64-win64

Opened a sample program the uses just ptcgraph, when it asked to create a 
project I said yes then selected 'Program' from the list
I was able to compile and run it with options for OS win32 CPU i386 as well as 
OS  win64 CPU x86_64 and it ran fine with both versions
I opened aggpas_ptcgraph_output.pas the same way and selected program.  If I 
select OS win32 CPU i386 it compiles and runs fine, no problems
When I select OS  win64 CPU x86_64 and try to run it, it opens both the console 
window and graphics window, then I get an error box reading:

Project aggpas_ptcgraph_output raised exception class 'external: SIGSEGV'
In file 'C:\lazarus\fpc\3.0.2\u..\agg_rasterizer_scanline_aa.pas' at line 611 
while cell_aa_ptr_prt(ptrcomp(j) + 1 * 4^^.x

Re: [fpc-pascal] Implementing AggPas with PtcGraph

2017-06-13 Thread Stefan V. Pantazi
Looks like it may be something specific to your setup. In my tests I 
used Lazarus 1.5 as IDE and fpc 3.0.1 on Linux. Crosscompiled example 
ran on Win7 64 bit. So there are already differences with your 
environment. Noting your problems with compilation, you may want to 
consider using Lazarus IDE as well. You get a debugger too.


One other thing that comes to mind is to be mindful of calls like this

  agg^.rectangle(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT);

If the default fill color is black, then the result will be a black 
window, albeit not unresponsive. Again, if your program hangs for some 
reason, a debugger may come in handy.


Stefan

On 06/13/2017 04:44 PM, James Richters wrote:

I've tested the example on 64 bit linux as a native application as well cross 
compiled for a x86_64 windows target. Worked fine in both Wine and on a Win64 
machine.



In my experience, the one dependency that AggPas has potential to fail may be 
related to the freetype library. If you plan to run your app on windows only, 
then you can turn freetype off and
AggPas will happily use windows font libraries. Search for the 
AGG2D_USE_FREETYPE define and comment it out.


I thought I would try to compile the example for x86_64, because I would 
eventually like to make my final program an x86_64 program.

When I compile it with the command:
fpc -Fu'J:\programming\fpc\3.0.2\units\$fpctarget\*' aggpas_ptcgraph_output.pas
it works fine.

When I try
fpc -Fu'J:\programming\fpc\3.0.2\units\$fpctarget\*' -Px86_64 
aggpas_ptcgraph_output.pas
it compiles fine with no errors, and it executes with no errors, however I do 
not get any output in either window at all, they are both just black, and 
unresponsive.

I've commented out the AGG2D_USE_FREETYPE for now, because I'm not sure if the 
freetype.dll I have will work on 64bit programs, and thought I would eliminate 
that as a possible issue.

I am using FPC v3.0.2 on a windows 10 x64 machine
I normally use the freepascal IDE to compile my programs, so I'm not too 
familiar with compiling from the command line.  I'm wondering if I am doing 
something wrong.

Also, is there some way to set a default for my units so I don't have to use 
Fu'J:\programming\fpc\3.0.2\units\$fpctarget\*' all the time?  If I don't use 
that, then it can't find any units, even though it's set in the directories 
with the IDE

I have some other sample programs that use ptcgraph (without AggPas) that do 
not have this issue, they compile as 64bit programs and run fine.  This seems 
to be something with using AggPas that appears to be causing the problem. I  
put in a writeln('test'); at the beginning of the program and it does do that, 
and I move ptcgraph.Rectangle(10,10,100,100); to before drawstuff(agg); I will 
get the rectangle on the graph screen.   So I thought I would try to narrow 
down what was happening by drawing different rectangles in the middle of the 
code like this:
  ptcgraph.Rectangle(30,30,200,200);
  agg^.clearAll(0, 0, 0);
  agg^.lineColor(0, 0, 0, 255);
  agg^.lineWidth(3);
  agg^.rectangle(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT);
  ptcgraph.Rectangle(30,30,200,300);
  agg^.lineWidth(1);
  agg^.lineColor(0, 155, 0, 255);
  agg^.rectangle(10, 10, 50, 50);
  ptcgraph.Rectangle(30,30,300,300);

I get the first rectangle right away, the second rectangle after 6 seconds, and 
the third after 6 more seconds.
I tried commenting out everything else, but I still never get the image from 
putimage();

I'm very confused by this and don't have a clue what could be wrong.  If I take 
out the -Px86_64 in the compile command line, the program runs as expected.  
Since Stefan said he compiled 64bit versions of the example program and it 
worked, I wonder why I am having this issue.

James

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



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

Re: [fpc-pascal] Implementing AggPas with PtcGraph

2017-06-13 Thread James Richters
>I've tested the example on 64 bit linux as a native application as well cross 
>compiled for a x86_64 windows target. Worked fine in both Wine and on a Win64 
>machine.

>In my experience, the one dependency that AggPas has potential to fail may be 
>related to the freetype library. If you plan to run your app on windows only, 
>then you can turn freetype off and
>AggPas will happily use windows font libraries. Search for the 
>AGG2D_USE_FREETYPE define and comment it out.

I thought I would try to compile the example for x86_64, because I would 
eventually like to make my final program an x86_64 program. 

When I compile it with the command:
fpc -Fu'J:\programming\fpc\3.0.2\units\$fpctarget\*' aggpas_ptcgraph_output.pas
it works fine.

When I try
fpc -Fu'J:\programming\fpc\3.0.2\units\$fpctarget\*' -Px86_64 
aggpas_ptcgraph_output.pas
it compiles fine with no errors, and it executes with no errors, however I do 
not get any output in either window at all, they are both just black, and 
unresponsive.

I've commented out the AGG2D_USE_FREETYPE for now, because I'm not sure if the 
freetype.dll I have will work on 64bit programs, and thought I would eliminate 
that as a possible issue.

I am using FPC v3.0.2 on a windows 10 x64 machine
I normally use the freepascal IDE to compile my programs, so I'm not too 
familiar with compiling from the command line.  I'm wondering if I am doing 
something wrong.

Also, is there some way to set a default for my units so I don't have to use 
Fu'J:\programming\fpc\3.0.2\units\$fpctarget\*' all the time?  If I don't use 
that, then it can't find any units, even though it's set in the directories 
with the IDE

I have some other sample programs that use ptcgraph (without AggPas) that do 
not have this issue, they compile as 64bit programs and run fine.  This seems 
to be something with using AggPas that appears to be causing the problem. I  
put in a writeln('test'); at the beginning of the program and it does do that, 
and I move ptcgraph.Rectangle(10,10,100,100); to before drawstuff(agg); I will 
get the rectangle on the graph screen.   So I thought I would try to narrow 
down what was happening by drawing different rectangles in the middle of the 
code like this:
  ptcgraph.Rectangle(30,30,200,200);
  agg^.clearAll(0, 0, 0);
  agg^.lineColor(0, 0, 0, 255);
  agg^.lineWidth(3);
  agg^.rectangle(0, 0, IMAGE_WIDTH, IMAGE_HEIGHT);
  ptcgraph.Rectangle(30,30,200,300);
  agg^.lineWidth(1);
  agg^.lineColor(0, 155, 0, 255);
  agg^.rectangle(10, 10, 50, 50);
  ptcgraph.Rectangle(30,30,300,300);

I get the first rectangle right away, the second rectangle after 6 seconds, and 
the third after 6 more seconds.  
I tried commenting out everything else, but I still never get the image from 
putimage(); 

I'm very confused by this and don't have a clue what could be wrong.  If I take 
out the -Px86_64 in the compile command line, the program runs as expected.  
Since Stefan said he compiled 64bit versions of the example program and it 
worked, I wonder why I am having this issue.

James

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

Re: [fpc-pascal] Implementing AggPas with PtcGraph

2017-06-13 Thread James Richters
Thanks for the help with this
> 1) the ideal way would be to specify the rgb order of a pixel format in the 
> Agg_2D constructor. The m_pixFormat 
> has a m_order field with the type order_type defined in agg_color.pas; have 
> not figured it yet

>2) knowing the R and B channels are swapped, you can do all your drawing with 
>colors there R and B are switched.
It sounds like it would be easier to figure out option 1.   That may also be 
better for compatibility if aggpas is updated in the future to be more 
compatible with ptcgraph.

James

-Original Message-
From: fpc-pascal [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of 
Stefan V. Pantazi
Sent: Tuesday, June 13, 2017 2:03 PM
To: FPC-Pascal users discussions 
Subject: Re: [fpc-pascal] Implementing AggPas with PtcGraph

There is a minus sign in the call:

  agg^.attach(@graph_buffer.data, IMAGE_WIDTH, IMAGE_HEIGHT, -(IMAGE_WIDTH * 
RGB_WIDTH))

Removing it will flip the Y axis.

With regard to color, there may be two options:

1) the ideal way would be to specify the rgb order of a pixel format in the 
Agg_2D constructor. The m_pixFormat has a m_order field with the type 
order_type defined in agg_color.pas; have not figured it yet

2) knowing the R and B channels are swapped, you can do all your drawing with 
colors there R and B are switched.


Stefan


On 06/13/2017 12:42 PM, James Richters wrote:
> I've just realized that the red and blue channels are reversed.  The sample
> program aggpas_ptcgraph_output.pas has the star filled in with a red fade
> and a blue series of random lines while the original test.png file had a
> blue fade in the star with red random lines.   Also, the image is flipped on
> the Y axis compared to the original example. The small green square is in
> the upper left corner of test.png, but it is in the lower left corner of
> aggpas_ptcgraph_output.pas
>
> I've been able to duplicate the results of test.png by shifting the left 5
> bits 11 positions to the right and the right 5 bits 11 positions to the left
> and flipping the Y axis,  but I can only do that with putpixel and a nested
> loop, which is quite a bit slower than putimage.
>
> Any ideas how I can build the data correctly so putimage will work?
>
> James
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>

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

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

Re: [fpc-pascal] Implementing AggPas with PtcGraph

2017-06-13 Thread James Richters
>   Also, the image is flipped on
>the Y axis compared to the original example. The small green square is in the 
>upper left corner of test.png, but it is in the lower left corner of 
>aggpas_ptcgraph_output.pas

It appears there is some ambiguity on whether 0,0 should be the lower left of 
upper left, but 
I figured out how to flip the image on the Y axis:

agg^.attach(@graph_buffer.data, IMAGE_WIDTH, IMAGE_HEIGHT, -(IMAGE_WIDTH * 
RGB_WIDTH)); 
makes the image what I would consider upside down because
agg^.rectangle(10, 10, 50, 50); 
ends up in the lower left corner but
ptcgraph.Rectangle(10,10,100,100);
ends up in the upper right corner.

If I use 
agg^.attach(@graph_buffer.data, IMAGE_WIDTH, IMAGE_HEIGHT, IMAGE_WIDTH * 
RGB_WIDTH);
now both 
agg^.rectangle(10, 10, 50, 50); 
and
ptcgraph.Rectangle(10,10,100,100);
end up in the upper left corner with the 10,10 coordinates matching up

I still have not figured out how to switch red and blue bits around so 
putimage() will work.

James


-Original Message-
From: fpc-pascal [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of 
James Richters
Sent: Tuesday, June 13, 2017 12:43 PM
To: 'FPC-Pascal users discussions' 
Subject: Re: [fpc-pascal] Implementing AggPas with PtcGraph

I've just realized that the red and blue channels are reversed.  The sample 
program aggpas_ptcgraph_output.pas has the star filled in with a red fade and a 
blue series of random lines while the original test.png file had a
blue fade in the star with red random lines.   Also, the image is flipped on
the Y axis compared to the original example. The small green square is in the 
upper left corner of test.png, but it is in the lower left corner of 
aggpas_ptcgraph_output.pas

I've been able to duplicate the results of test.png by shifting the left 5 bits 
11 positions to the right and the right 5 bits 11 positions to the left and 
flipping the Y axis,  but I can only do that with putpixel and a nested
loop, which is quite a bit slower than putimage.   

Any ideas how I can build the data correctly so putimage will work?

James

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

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

Re: [fpc-pascal] Implementing AggPas with PtcGraph

2017-06-13 Thread Stefan V. Pantazi

There is a minus sign in the call:

 agg^.attach(@graph_buffer.data, IMAGE_WIDTH, IMAGE_HEIGHT, 
-(IMAGE_WIDTH * RGB_WIDTH))


Removing it will flip the Y axis.

With regard to color, there may be two options:

1) the ideal way would be to specify the rgb order of a pixel format in 
the Agg_2D constructor. The m_pixFormat has a m_order field with the 
type order_type defined in agg_color.pas; have not figured it yet


2) knowing the R and B channels are swapped, you can do all your drawing 
with colors there R and B are switched.



Stefan


On 06/13/2017 12:42 PM, James Richters wrote:

I've just realized that the red and blue channels are reversed.  The sample
program aggpas_ptcgraph_output.pas has the star filled in with a red fade
and a blue series of random lines while the original test.png file had a
blue fade in the star with red random lines.   Also, the image is flipped on
the Y axis compared to the original example. The small green square is in
the upper left corner of test.png, but it is in the lower left corner of
aggpas_ptcgraph_output.pas

I've been able to duplicate the results of test.png by shifting the left 5
bits 11 positions to the right and the right 5 bits 11 positions to the left
and flipping the Y axis,  but I can only do that with putpixel and a nested
loop, which is quite a bit slower than putimage.

Any ideas how I can build the data correctly so putimage will work?

James

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



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

Re: [fpc-pascal] Implementing AggPas with PtcGraph

2017-06-13 Thread James Richters
I've just realized that the red and blue channels are reversed.  The sample
program aggpas_ptcgraph_output.pas has the star filled in with a red fade
and a blue series of random lines while the original test.png file had a
blue fade in the star with red random lines.   Also, the image is flipped on
the Y axis compared to the original example. The small green square is in
the upper left corner of test.png, but it is in the lower left corner of
aggpas_ptcgraph_output.pas

I've been able to duplicate the results of test.png by shifting the left 5
bits 11 positions to the right and the right 5 bits 11 positions to the left
and flipping the Y axis,  but I can only do that with putpixel and a nested
loop, which is quite a bit slower than putimage.   

Any ideas how I can build the data correctly so putimage will work?

James

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

Re: [fpc-pascal] Usage of TFPCustomImage

2017-06-13 Thread Juha Manninen
On Tue, Jun 13, 2017 at 5:20 PM, Michael Van Canneyt
 wrote:
> However, this method of loading an image depends on the order of the uses
> statements: each registered reader is asked in turn whether it recognizes
> the stream.

The unit IntfGraphics in LCL does not have unit FPReadPNM in its uses clause.
It has: FPReadBMP,  FPReadPNG, FPReadTiff


> The first to answer 'yes' will be used to read the stream. If PNM 'falsely'
> recognizes a PNG stream as PNM, there is nothing you can do except tell the
> reader which format to use...

Ok, I don't know how to do that. I don't even know how TFPCustomImage
should be used without LCL + TLazIntfImage.
"Custom" in its name hints that a derived class should be used.
Somebody else can study what happens in the code.

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

Re: [fpc-pascal] Usage of TFPCustomImage

2017-06-13 Thread Michael Van Canneyt



On Tue, 13 Jun 2017, Juha Manninen wrote:


The class TFPCustomImage and its usage has apparently changed in FPC
3.0.2 (and trunk) compared to FPC 3.0.

This issue:
 https://bugs.freepascal.org/view.php?id=32005
is marked for TLazIntfImage (in LCL) but actually the problematic
procedure LoadFromStream is in TFPCustomImage.
Please read my note in the issue.

Question: how should TFPCustomImage be used now?
I guess TLazIntfImage must be changed accordingly.


As far as I know, nothing has changed in this regard in TFPCustomImage.

However, this method of loading an image depends on the order of the uses
statements: each registered reader is asked in turn whether it recognizes 
the stream.


The first to answer 'yes' will be used to read the stream. If PNM 'falsely'
recognizes a PNG stream as PNM, there is nothing you can do except tell the
reader which format to use...

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

[fpc-pascal] Usage of TFPCustomImage

2017-06-13 Thread Juha Manninen
The class TFPCustomImage and its usage has apparently changed in FPC
3.0.2 (and trunk) compared to FPC 3.0.

This issue:
  https://bugs.freepascal.org/view.php?id=32005
is marked for TLazIntfImage (in LCL) but actually the problematic
procedure LoadFromStream is in TFPCustomImage.
Please read my note in the issue.

Question: how should TFPCustomImage be used now?
I guess TLazIntfImage must be changed accordingly.

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