Re: [fpc-pascal] Implementing AggPas with PtcGraph

2017-05-31 Thread James Richters
>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-boun...@lists.freepascal.org] On Behalf Of 
Graeme Geldenhuys
Sent: Wednesday, May 31, 2017 1:17 PM
To: fpc-pascal@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@lists.freepascal.org 
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Graphtest2.pas
Description: Binary data
___
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-05-31 Thread Graeme Geldenhuys

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@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Implementing AggPas with PtcGraph

2017-05-31 Thread Reimar Grabowski
On Wed, 31 May 2017 10:47:40 -0400
"James Richters"  wrote:

> It's a word with:
> 5bits red, 6bits green, and 5bits blue like this:
> 
> RGGB
> 
> I'm not sure what that's called
RGB565, maybe?

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

[fpc-pascal] Mantis/Bugtracker registrations fixed

2017-05-31 Thread Karoly Balogh (Charlie/SGR)
Hi,

We had numerous reports over the past few weeks, that the FPC/Lazarus
Bugtracker registration verification was broken. Thanks to the work of
Michael van Canneyt, it should be fixed now.

If you had trouble creating a bugtracker account in the last few weeks,
please try again now.

Charlie
___
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-05-31 Thread James Richters
>seems to be a word in the format of RGBA with 4 bits each

Well, it seemed to be RGBA, but it's not...  

It's a word with:
5bits red, 6bits green, and 5bits blue like this:

RGGB

I'm not sure what that's called or how to set up aggpas to use that, but that's 
what it seems to be if ptcgraph is put in a 16bit color mode.  It doesn't seem 
to be able to go any higher than that, but that's fine for my purposes.

James




-Original Message-
From: fpc-pascal [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of 
James Richters
Sent: Wednesday, May 31, 2017 7:52 AM
To: 'FPC-Pascal users discussions' 
Subject: Re: [fpc-pascal] Implementing AggPas with PtcGraph

I was doing some tests with Putpixel and that seems to be a word in the format 
of RGBA with 4 bits each.I would think putimage would use the same format, 
but I haven't tested that yet.

I'm still a bit confused by putimage, since it only has an X and Y startpoint, 
how do you define the height and width of the bitmap? Getimage() specifies a 
rectangle, and imagesize() figures out how much memory you need, but I just 
don't what defines the size and shape of the image to putimage.

I managed to get the test out of the buffer and onto the screen with :

  function getBufItemAsByte(aDelta: Word): Byte;
  var
actualY: Integer;
thing:Byte;
  begin
actualY := ImageHeight - y - 1;
thing :=
  byte(buf[x * RGBA_Width + actualY * ImageWidth * RGBA_Width + aDelta]);
result:=thing shr 4;  //colors channels are reduced to 4 bits each, they 
are not correct
  end;

for x := 0 to ImageWidth - 1 do
   for y := 0 to ImageHeight - 1 do
   begin
  pixelcolor:=(getBufItemAsbyte(2) shl 12)+(getBufItemAsbyte(1) shl 8) 
+(getBufItemAsbyte(0) shl 4)+getBufItemAsbyte(3);
  putpixel(x,y,pixelcolor);
  end;


James

-Original Message-
From: fpc-pascal [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of 
Graeme Geldenhuys
Sent: Tuesday, May 30, 2017 8:19 PM
To: fpc-pascal@lists.freepascal.org
Subject: Re: [fpc-pascal] Implementing AggPas with PtcGraph

On 2017-05-30 22:37, James Richters wrote:

> Putimage() takes
> Initial X position
> Initial Y position
> Pointer to beginning of memory bitmap

In that case the AggPas code should be even faster, because PutImage() only 
want a pointer to the bitmap data - thus no need to go through the slow FPImage 
code to generate a PNG or BMP image. The pixel-by-pixel conversions for FPImage 
is very slow.

>Size := ImageSize(10, 20, 30, 40);
>GetMem(Q, Size);   { Allocate memory on heap }

So you can do pretty much the same with AggPas then. Allocate the memory you 
need, and attach that as the rendering buffer or AggPas. As I mentioned before, 
AggPas just needs to know what memory it can write too, and in what format you 
want that rendered data to be. AggPas supports many render buffer formats. BGR, 
BGRA, RGB, RGBA, Gray8, rgb555, rgb565 etc etc. And if an existing render 
buffer format doesn't exist, it is really easy and quick to add a new one - 
just a few really simple procedures to implement.

See the pf_*.inc files for plenty of examples. The "pf_" prefix stands for 
"pixel format definition".


> I'm looking at it and I think getimage / putimage are just one byte per 
> pixel... maybe?

I'll see if I can get graph or ptcgraph working working here under FreeBSD, 
then I'll take a look at what pixel format they use.


Regards,
   Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
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-05-31 Thread James Richters
I was doing some tests with Putpixel and that seems to be a word in the format 
of RGBA with 4 bits each.I would think putimage would use the same format, 
but I haven't tested that yet.

I'm still a bit confused by putimage, since it only has an X and Y startpoint, 
how do you define the height and width of the bitmap? Getimage() specifies a 
rectangle, and imagesize() figures out how much memory you need, but I just 
don't what defines the size and shape of the image to putimage.

I managed to get the test out of the buffer and onto the screen with :

  function getBufItemAsByte(aDelta: Word): Byte;
  var
actualY: Integer;
thing:Byte;
  begin
actualY := ImageHeight - y - 1;
thing :=
  byte(buf[x * RGBA_Width + actualY * ImageWidth * RGBA_Width + aDelta]);
result:=thing shr 4;  //colors channels are reduced to 4 bits each, they 
are not correct
  end;

for x := 0 to ImageWidth - 1 do
   for y := 0 to ImageHeight - 1 do
   begin
  pixelcolor:=(getBufItemAsbyte(2) shl 12)+(getBufItemAsbyte(1) shl 8) 
+(getBufItemAsbyte(0) shl 4)+getBufItemAsbyte(3);
  putpixel(x,y,pixelcolor);
  end;


James

-Original Message-
From: fpc-pascal [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of 
Graeme Geldenhuys
Sent: Tuesday, May 30, 2017 8:19 PM
To: fpc-pascal@lists.freepascal.org
Subject: Re: [fpc-pascal] Implementing AggPas with PtcGraph

On 2017-05-30 22:37, James Richters wrote:

> Putimage() takes
> Initial X position
> Initial Y position
> Pointer to beginning of memory bitmap

In that case the AggPas code should be even faster, because PutImage() only 
want a pointer to the bitmap data - thus no need to go through the slow FPImage 
code to generate a PNG or BMP image. The pixel-by-pixel conversions for FPImage 
is very slow.

>Size := ImageSize(10, 20, 30, 40);
>GetMem(Q, Size);   { Allocate memory on heap }

So you can do pretty much the same with AggPas then. Allocate the memory you 
need, and attach that as the rendering buffer or AggPas. As I mentioned before, 
AggPas just needs to know what memory it can write too, and in what format you 
want that rendered data to be. AggPas supports many render buffer formats. BGR, 
BGRA, RGB, RGBA, Gray8, rgb555, rgb565 etc etc. And if an existing render 
buffer format doesn't exist, it is really easy and quick to add a new one - 
just a few really simple procedures to implement.

See the pf_*.inc files for plenty of examples. The "pf_" prefix stands for 
"pixel format definition".


> I'm looking at it and I think getimage / putimage are just one byte per 
> pixel... maybe?

I'll see if I can get graph or ptcgraph working working here under 
FreeBSD, then I'll take a look at what pixel format they use.


Regards,
   Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
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