[fpc-pascal] Implementing AggPas with PtcGraph

Stefan V. Pantazi svpantazi at gmail.com
Thu Jun 1 15:46:34 CEST 2017


Have a look at the agg_2D unit. The agg_2D uses
..
  agg_pixfmt ,
  agg_pixfmt_rgba ,
..

Therefore, the rgba format is pretty much baked in. That is to say that 
the constructor of the main object Agg2D uses the pixfmt_rgba32 to set 
the pixel format.

...
{ CONSTRUCT }
constructor Agg2D.Construct;
begin
  m_rbuf.Construct;

  pixfmt_rgba32           (m_pixFormat , at m_rbuf );
  pixfmt_custom_blend_rgba(m_pixFormatComp , at m_rbuf 
, at comp_op_adaptor_rgba ,rgba_order );
  pixfmt_rgba32           (m_pixFormatPre , at m_rbuf );
  pixfmt_custom_blend_rgba(m_pixFormatCompPre , at m_rbuf 
, at comp_op_adaptor_rgba ,rgba_order );
...

There is another agg unit agg_pixfmt_rgb_packed that seem to have the 
565 format that you need. Add it to the uses list and try to replace the 
pixfmt_rgba32 calls with pixfmt_rgb565. That will make agg use that format.

The pixfmt_custom_blend_rgba calls may need further hacking too to make 
things work, however, Agg2D should use a 16 bit format if you use 
pixfmt_rgb565 callse instead of pixfmt_rgba32. You should also set 
RGBA_Width =2; in your program to reflect the change.

Anyway, this will probably still not make

ptcgraph.putimage(0,0,buf[0],0);

work, but that may be a ptcgraph problem.


Hope this helps,

Stefan

On 05/31/2017 02:57 PM, James Richters wrote:
>> And AggPas already has support for that pixel format
>
> How do I define that as the format I want?  I've been looking all through the example and do not see how this is defined.  I've attached a test program, it's basically Graeme's sample but going to screen instead of a file.  I just don't see where the pixel format is defined.  I have it kind of working in a funny way by just forcing the existing pixels to conform to the required format.
>
> -----Original Message-----
> From: fpc-pascal [mailto:fpc-pascal-bounces at lists.freepascal.org] On Behalf Of Graeme Geldenhuys
> Sent: Wednesday, May 31, 2017 1:17 PM
> To: fpc-pascal at lists.freepascal.org
> Subject: Re: [fpc-pascal] Implementing AggPas with PtcGraph
>
> On 2017-05-31 18:03, Reimar Grabowski wrote:
>>> I'm not sure what that's called
>> RGB565, maybe?
>
> And AggPas already has support for that pixel format.
>
> Regards,
>    Graeme
>
> _______________________________________________
> 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