[fpc-pascal] Implementing AggPas with PtcGraph

James Richters james at productionautomation.net
Tue Jun 13 20:27:36 CEST 2017


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-bounces at lists.freepascal.org] On Behalf Of Stefan V. Pantazi
Sent: Tuesday, June 13, 2017 2:03 PM
To: FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
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 at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>

-- 
_______________________________________________________
_______________________________________________
fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal




More information about the fpc-pascal mailing list