[fpc-pascal] Implementing AggPas with PtcGraph

James Richters james at productionautomation.net
Fri Jun 2 13:40:39 CEST 2017


Thanks for the help. I was able to make a little progress.

>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.

I did as you suggest here and changed my buffer to be an array of words, and I am able to get a representation of the image to screen by reading elements of the array and using putpixel() to put them on the screen,  however the colors are all wrong.  I am wondering if this m_pixformat variable that shows up everywhere needs to be set also?   The pixfmt_custom_blend_rgba calls may also be the problem with the colors.  There are no corresponding custom blend procedures in agg_pixfmt_rgb_packed.

>Anyway, this will probably still not make
>ptcgraph.putimage(0,0,buf[0],0);
No this still does not work, I am able to use a nested loop and putpixel() but that is very slow.  I still think something is missing with putimage because I don't see how it knows the shape of the image, maybe I need to actually do a getimage() at some point to set the shape of before putimage will work.. I'll do some experiments with it.  

James

-----Original Message-----
From: fpc-pascal [mailto:fpc-pascal-bounces at lists.freepascal.org] On Behalf Of Stefan V. Pantazi
Sent: Thursday, June 01, 2017 9:47 AM
To: FPC-Pascal users discussions <fpc-pascal at lists.freepascal.org>
Subject: Re: [fpc-pascal] Implementing AggPas with PtcGraph

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
>
_______________________________________________
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