[fpc-pascal] Implementing AggPas with PtcGraph

Stefan V. Pantazi svpantazi at gmail.com
Tue Jun 13 20:02:58 CEST 2017


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
>

-- 
_______________________________________________________



More information about the fpc-pascal mailing list